npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cz-table

v1.2.50

Published

业务组件表格

Downloads

308

Readme

[TOC]

简要描述
  • 财资业务表格组件
安装
  • npm install cz-table -S --registry=http://10.250.4.121:8088/
使用

src/views/cztable/demo.vue

<template>
  <cz-table
    ref="czTable"
    :view-id="viewId"
    @table-define-loaded="tableDefineLoaded"
  >
    <!--表格上方按钮-->
    <div slot="extra_top" class="extra_top">
      <el-button type="primary" icon="el-icon-check" class="extra_top_buttom_right" @click="saveData">保存</el-button>
      <el-button type="primary" icon="el-icon-circle-plus-outline" class="extra_top_buttom_right" @click="addNewRow">新增</el-button>
    </div>
    <!--通过插槽自定义列的展示方式   colId+''Column-->
    <template slot="_optColumn" slot-scope="scope">
      <el-button v-if="!scope.row._editing" type="text" size="small" @click="editRow(scope)">编辑</el-button>
      <el-button v-if="scope.row._editing" type="text" size="small" @click="confirmRow(scope)">确认</el-button>
      <el-button v-if="scope.row._editing" type="text" size="small" @click="cancelEdit(scope)">取消</el-button>
      <el-popconfirm
        v-if="!scope.row._editing"
        title="确认删除?"
        style="margin-left: 10px;"
        @confirm="deleteRow"
      >
        <el-button slot="reference" type="text" size="small">删除</el-button>
      </el-popconfirm>
    </template>
  </cz-table>
</template>

<script>
import {CzTable} from 'cz-table'

export default {
  name: 'Index',
  components: { CzTable },
  data() {
    return {
      viewId: this.$route.query.viewId,
      urlObj: {}
    }
  },
  watch: {
  },
  created() {
    for (var key in this.$route.query) {
      console.log(key)
      if (key !== 'viewId') {
        this.urlObj[this.formatToHump(key)] = this.$route.query[key]
      }
    }
  },
  mounted() {
  },
  beforeDestroy() {
  },
  methods: {
    addNewRow() {
      console.log(this.urlObj)
      this.$refs.czTable.addNewRow(this.urlObj)
    },
    deleteRow() {
      this.$refs.czTable.deleteRow()
    },
    saveData() {
      this.$refs.czTable.saveData()
    },
    editRow(scope) {
      this.$refs.czTable.editRow(scope)
    },
    confirmRow(scope) {
      this.$refs.czTable.confirmRow(scope)
    },
    cancelEdit(scope) {
      this.$refs.czTable.cancelEdit(scope)
    },
    formatToHump(value) {
      return value.replace(/\_(\w)/g, (_, letter) => letter.toUpperCase())
    },
    // 模型数据加载完,可以由业务层修改
    tableDefineLoaded(tableModel, colModels, searchModels) {
      colModels.push({
        align: 'center',
        colId: '_opt',
        colName: '操作',
        fixed: 'right',
        hasSlot: true,
        isEditable: false,
        isVisible: true,
        isNullable: true,
        showSize: 150
      })
    }
  }
}
</script>

<style lang="scss" >
.extra_top{
  height: 40px;
  padding-top: 9px;
}
.extra_top_buttom_right{
  float:right;
  margin-left:8px;
}

</style>

说明:在页面上直接使用cz-table,只需传viewId:视图ID参数即可 通过slot插槽,可以在表格上方、列、下方,插入自定义按钮,按钮事件调用组件内部的方法实现个性化处理

Methods

| 方法名 | 说明 | 参数 | 返回值 | | :------- | :--- | :----- | :----- | | addNewRow | 新增一行 | defaultData:新增行的默认值,可选 || | deleteRow | 删除行 | || | saveData | 保存编辑数据 | || | editRow | 编辑当前行 | scope || | confirmRow | 编辑后确认 | scope || | cancelEdit | 取消编辑当前行 | scope || | getSelectedData | 获取选中行数据 | |{id:'1',name:'abc'}|

Events

| 事件名 | 说明 | 参数 | | :------ | :--- | ------------------------------------ | | table-define-loaded | 表格定义加载完成 :可以修改表格元数据定义,比如增加自定义操作列、修改某一列的显示样式 | tableModel, colModels, searchModels |

备注
  • 更多返回错误代码请看首页的错误代码描述