zenglf
2023-10-18 73250e481e966dd8e3372c518530203ac047da14
src/components/jeecg/JVxeTable/components/JVxeTable.js
@@ -23,7 +23,7 @@
    }
  },
  mixins: [VxeWebSocketMixins],
  components: {JVxeToolbar, JVxeSubPopover, JVxeDetailsModal, JVxePagination},
  components: { JVxeToolbar, JVxeSubPopover, JVxeDetailsModal, JVxePagination },
  props: {
    rowKey: PropTypes.string.def('id'),
    // 列信息
@@ -48,7 +48,7 @@
      // prefix 前缀;suffix 后缀;
      slots: ['prefix', 'suffix'],
      // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮;collapse 展开收起
      btns: ['add', 'remove', 'clearSelection'],
      btns: ['add', 'remove', 'clearSelection']
    })),
    // 是否显示行号
    rowNumber: PropTypes.bool.def(false),
@@ -66,7 +66,7 @@
    // 最大高度
    maxHeight: {
      type: Number,
      default: () => null,
      default: () => null
    },
    // 要禁用的行 TODO 未实现
    disabledRows: PropTypes.object.def(() => ({})),
@@ -99,7 +99,7 @@
    // 注:该参数不能动态修改;如果行、列字段多的情况下,会根据机器性能造成不同程度的卡顿。
    alwaysEdit: PropTypes.bool.def(false),
    // 联动配置,数组,详情配置见文档
    linkageConfig: PropTypes.array.def(() => []),
    linkageConfig: PropTypes.array.def(() => [])
  },
  data() {
    return {
@@ -111,7 +111,7 @@
      // 内置 EditRules
      innerEditRules: [],
      // 记录滚动条位置
      scroll: {top: 0, left: 0},
      scroll: { top: 0, left: 0 },
      // 当前是否正在滚动
      scrolling: false,
      // vxe 默认配置
@@ -125,7 +125,7 @@
        'show-header-overflow': true,
        'show-footer-overflow': true,
        // 可编辑配置
        'edit-config': {trigger: 'click', mode: 'cell', showStatus: true},
        'edit-config': { trigger: 'click', mode: 'cell', showStatus: true },
        'expand-config': {
          iconClose: 'ant-table-row-expand-icon ant-table-row-collapsed',
          iconOpen: 'ant-table-row-expand-icon ant-table-row-expanded'
@@ -137,8 +137,8 @@
        // 'scroll-x': {
        //   gt: 15
        // },
        'radio-config': {highlight: true},
        'checkbox-config': {highlight: true},
        'radio-config': { highlight: true },
        'checkbox-config': { highlight: true }
      },
      // 绑定左侧选择框
      selectedRows: [],
@@ -148,15 +148,15 @@
      statistics: {
        has: false,
        sum: [],
        average: [],
        average: []
      },
      // 允许执行刷新特效的行ID
      reloadEffectRowKeysMap: {},
      //配置了但是没有授权的按钮和列 集合
      excludeCode:[],
      excludeCode: [],
      // 联动下拉选项(用于隔离不同的下拉选项)
      // 内部联动配置,map
      innerLinkageConfig: null,
      innerLinkageConfig: null
    }
  },
  computed: {
@@ -171,7 +171,7 @@
          scrolling: this.scrolling,
          reloadEffect: this.reloadEffect,
          reloadEffectRowKeysMap: this.reloadEffectRowKeysMap,
          listeners: this.cellListeners,
          listeners: this.cellListeners
        }
        if (column.$type === JVXETypes.rowDragSort) {
          renderOptions.dragSortKey = this.dragSortKey
@@ -191,7 +191,7 @@
              config: this.innerLinkageConfig.get(column.key),
              getLinkageOptionsSibling: this.getLinkageOptionsSibling,
              getLinkageOptionsAsync: this.getLinkageOptionsAsync,
              linkageSelectChange: this.linkageSelectChange,
              linkageSelectChange: this.linkageSelectChange
            }
          }
        }
@@ -204,21 +204,21 @@
        // update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 【新行编辑】列表上带按钮的遮挡问题
        if (column.$type === JVXETypes.file || column.$type === JVXETypes.image) {
          if (column.width && column.width.endsWith('px')) {
            column.width = Number.parseInt(column.width.substr(0,column.width.length-2))+Number.parseInt(1)+'px';
            column.width = Number.parseInt(column.width.substr(0, column.width.length - 2)) + Number.parseInt(1) + 'px'
          }
        }
        // update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 【新行编辑】列表上带按钮的遮挡问题
        // update--begin--autor:lvdandan-----date:20201211------for:JT-118 【online】 日期、时间控件长度较小
        if (column.$type === JVXETypes.datetime || column.$type === JVXETypes.userSelect || column.$type === JVXETypes.departSelect) {
          let width = column.width && column.width.endsWith('px')?Number.parseInt(column.width.substr(0,column.width.length-2)):0;
          if(width <= 190){
          let width = column.width && column.width.endsWith('px') ? Number.parseInt(column.width.substr(0, column.width.length - 2)) : 0
          if (width <= 190) {
            column.width = '190px'
          }
        }
        if (column.$type === JVXETypes.date) {
          let width = column.width && column.width.endsWith('px')?Number.parseInt(column.width.substr(0,column.width.length-2)):0;
          if(width <= 135){
          let width = column.width && column.width.endsWith('px') ? Number.parseInt(column.width.substr(0, column.width.length - 2)) : 0
          if (width <= 135) {
            column.width = '135px'
          }
        }
@@ -235,7 +235,7 @@
      let expandConfig = Object.assign({}, this.defaultVxeProps['expand-config'], this.expandConfig)
      return Object.assign({}, this.defaultVxeProps, {
        showFooter: this.statistics.has,
        showFooter: this.statistics.has
      }, this.$attrs, {
        loading: this.loading,
        columns: this.vxeColumns,
@@ -245,7 +245,7 @@
        maxHeight: this.maxHeight,
        border: this.bordered,
        expandConfig: expandConfig,
        footerMethod: this.handleFooterMethod,
        footerMethod: this.handleFooterMethod
        // footerSpanMethod: this.handleFooterSpanMethod,
      })
    },
@@ -259,7 +259,7 @@
        'edit-actived': this.handleEditActived,
        'radio-change': this.handleVxeRadioChange,
        'checkbox-all': this.handleVxeCheckboxAll,
        'checkbox-change': this.handleVxeCheckboxChange,
        'checkbox-change': this.handleVxeCheckboxChange
      }
      // 用户传递的事件,进行合并操作
      Object.keys(this.$listeners).forEach(key => {
@@ -285,9 +285,9 @@
        /** 当前行向下移一位 */
        rowMoveDown: rowIndex => this.rowResort(rowIndex, rowIndex + 1),
        /** 在当前行下面插入一行 */
        rowInsertDown: rowIndex => this.insertRows({}, rowIndex + 1),
        rowInsertDown: rowIndex => this.insertRows({}, rowIndex + 1)
      }
    },
    }
  },
  watch: {
    dataSource: {
@@ -334,7 +334,7 @@
        //     }
        //   }
        // })
      },
      }
    },
    columns: {
      immediate: true,
@@ -343,7 +343,7 @@
        this.loadExcludeCode()
        let innerColumns = []
        let innerEditRules = {}
        let {rowNumber, rowSelection, rowExpand, dragSort} = this
        let { rowNumber, rowSelection, rowExpand, dragSort } = this
        let expandColumn, seqColumn, checkboxColumn, radioColumn, dragSortColumn
        if (Array.isArray(columns)) {
          this.statistics.has = false
@@ -352,11 +352,11 @@
          // 处理成vxe可识别的columns
          columns.forEach(column => {
            if(this.excludeCode.indexOf(column.key)>=0){
            if (this.excludeCode.indexOf(column.key) >= 0) {
              return false
            }
            let col = {...column}
            let {type} = col
            let col = { ...column }
            let { type } = col
            const enhanced = getEnhancedMixins(type)
            if (type === JVXETypes.rowNumber) {
              seqColumn = col
@@ -373,7 +373,7 @@
              // 防止和vxeTable自带的type起冲突
              col.$type = col.type
              delete col.type
              let renderName = 'cellRender', renderOptions = {name: JVXETypes._prefix + type}
              let renderName = 'cellRender', renderOptions = { name: JVXETypes._prefix + type }
              if (type) {
                // hidden 是特殊的组件
                if (type === JVXETypes.hidden) {
@@ -441,9 +441,9 @@
        }
        // 判断是否开启了序号
        if (rowNumber) {
          let col = {type: 'seq', title: '#', width: 60, fixed: 'left', align: 'center'}
          let col = { type: 'seq', title: '#', width: 60, fixed: 'left', align: 'center' }
          if (seqColumn) {
            col = Object.assign(col, seqColumn, {type: 'seq'})
            col = Object.assign(col, seqColumn, { type: 'seq' })
          }
          innerColumns.unshift(col)
        }
@@ -453,14 +453,14 @@
          if (this.statistics.has && !rowExpand && !dragSort) {
            width = 60
          }
          let col = {type: this.rowSelectionType, width, fixed: 'left', align: 'center'}
          let col = { type: this.rowSelectionType, width, fixed: 'left', align: 'center' }
          // radio
          if (this.rowSelectionType === 'radio' && radioColumn) {
            col = Object.assign(col, radioColumn, {type: 'radio'})
            col = Object.assign(col, radioColumn, { type: 'radio' })
          }
          // checkbox
          if (this.rowSelectionType === 'checkbox' && checkboxColumn) {
            col = Object.assign(col, checkboxColumn, {type: 'checkbox'})
            col = Object.assign(col, checkboxColumn, { type: 'checkbox' })
          }
          innerColumns.unshift(col)
        }
@@ -470,9 +470,16 @@
          if (this.statistics.has && !dragSort) {
            width = 60
          }
          let col = {type: 'expand', title: '', width, fixed: 'left', align: 'center', slots: {content: 'expandContent'}}
          let col = {
            type: 'expand',
            title: '',
            width,
            fixed: 'left',
            align: 'center',
            slots: { content: 'expandContent' }
          }
          if (expandColumn) {
            col = Object.assign(col, expandColumn, {type: 'expand'})
            col = Object.assign(col, expandColumn, { type: 'expand' })
          }
          innerColumns.unshift(col)
        }
@@ -482,9 +489,16 @@
          if (this.statistics.has) {
            width = 60
          }
          let col = {type: JVXETypes.rowDragSort, title: '', width, fixed: 'left', align: 'center', cellRender: {name: JVXETypes._prefix + JVXETypes.rowDragSort}}
          let col = {
            type: JVXETypes.rowDragSort,
            title: '',
            width,
            fixed: 'left',
            align: 'center',
            cellRender: { name: JVXETypes._prefix + JVXETypes.rowDragSort }
          }
          if (dragSortColumn) {
            col = Object.assign(col, dragSortColumn, {type: JVXETypes.rowDragSort})
            col = Object.assign(col, dragSortColumn, { type: JVXETypes.rowDragSort })
          }
          innerColumns.unshift(col)
        }
@@ -525,7 +539,7 @@
          this.innerLinkageConfig = null
        }
      }
    },
    }
  },
  created() {
  },
@@ -559,7 +573,7 @@
    },
    handleVxeScroll(event) {
      let {$refs, scroll} = this
      let { $refs, scroll } = this
      // 记录滚动条的位置
      scroll.top = event.scrollTop
@@ -609,8 +623,8 @@
    // 点击单元格时触发的事件
    handleCellClick(event) {
      let {row, column, $event, $table} = event
      let {$refs} = this
      let { row, column, $event, $table } = event
      let { $refs } = this
      // 点击了可编辑的
      if (column.editRender) {
@@ -651,20 +665,20 @@
    },
    // 单元格编辑状态下被关闭时会触发该事件
    handleEditClosed({column}) {
    handleEditClosed({ column }) {
      // 执行增强
      getEnhancedMixins(column.own.$type, 'aopEvents').editClosed.apply(this, arguments)
    },
    // 单元格被激活编辑时会触发该事件
    handleEditActived({column}) {
    handleEditActived({ column }) {
      // 执行增强
      getEnhancedMixins(column.own.$type, 'aopEvents').editActived.apply(this, arguments)
    },
    /** 表尾数据处理方法,用于显示统计信息 */
    handleFooterMethod({columns, data}) {
      const {statistics} = this
    handleFooterMethod({ columns, data }) {
      const { statistics } = this
      let footers = []
      if (statistics.has) {
        if (statistics.sum.length > 0) {
@@ -687,7 +701,7 @@
      return footers
    },
    getFooterStatisticsMap({columns, title, checks, method}) {
    getFooterStatisticsMap({ columns, title, checks, method }) {
      return columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return title
@@ -702,7 +716,7 @@
    /** 表尾单元格合并方法 */
    handleFooterSpanMethod(event) {
      if (event.columnIndex === 0) {
        return {colspan: 2}
        return { colspan: 2 }
      }
    },
@@ -716,10 +730,10 @@
      this.scrollTo(null, (top == null || top === '') ? this.scroll.top : top)
    },
    clearAllData() {
      let {xTable} = this.$refs.vxe.$refs
        // issues/2784
        // 先清空所有数据
        xTable.loadData([])
      let { xTable } = this.$refs.vxe.$refs
      // issues/2784
      // 先清空所有数据
      xTable.loadData([])
    },
    /**
     * 加载新数据,和 loadData 不同的是,用该方法加载的数据都是相当于点新增按钮新增的数据。
@@ -728,7 +742,7 @@
     */
    async loadNewData(dataSource) {
      if (Array.isArray(dataSource)) {
        let {xTable} = this.$refs.vxe.$refs
        let { xTable } = this.$refs.vxe.$refs
        // issues/2784
        // 先清空所有数据
        xTable.loadData([])
@@ -771,8 +785,8 @@
      // 是否更新了数据
      let updated = false
      values.forEach((item, idx) => {
        let {rowKey, values: record} = item
        let {row} = this.getIfRowById(rowKey)
        let { rowKey, values: record } = item
        let { row } = this.getIfRowById(rowKey)
        if (!row) {
          return
        }
@@ -791,7 +805,7 @@
                oldValue: oldValue,
                col: column.own,
                column: column,
                isSetValues: true,
                isSetValues: true
              })
            }
          } else {
@@ -802,10 +816,10 @@
      // 【issues/3828】数据更新后,重新计算统计列
      if (updated && this.statistics.has) {
        this.$nextTick(async () => {
          let {xTable} = this.$refs.vxe.$refs;
          await xTable.updateCache(true);
          await xTable.updateData();
        });
          let { xTable } = this.$refs.vxe.$refs
          await xTable.updateCache(true)
          await xTable.updateData()
        })
      }
    },
@@ -818,18 +832,18 @@
    },
    /** 获取表格表单里的值 */
    getValues(callback, rowIds) {
      let tableData = this.getTableData({rowIds: rowIds})
      let tableData = this.getTableData({ rowIds: rowIds })
      callback('', tableData)
    },
    /** 获取表格数据 */
    getTableData(options = {}) {
      let {rowIds} = options
      let { rowIds } = options
      let tableData
      // 仅查询指定id的行
      if (Array.isArray(rowIds) && rowIds.length > 0) {
        tableData = []
        rowIds.forEach(rowId => {
          let {row} = this.getIfRowById(rowId)
          let { row } = this.getIfRowById(rowId)
          if (row) {
            tableData.push(row)
          }
@@ -858,11 +872,11 @@
        row = this.getNewRowById(id)
        if (!row) {
          console.warn(`JVxeTable.getIfRowById:没有找到id为"${id}"的行`)
          return {row: null}
          return { row: null }
        }
        isNew = true
      }
      return {row, isNew}
      return { row, isNew }
    },
    /** 通过临时ID获取新增的行 */
    getNewRowById(id) {
@@ -885,9 +899,9 @@
     * @param isOnlJs 是否是onlineJS增强触发的
     * @return
     */
  /*   async addRows(rows = {}, isOnlJs) {
    async addRows(rows = {}, isOnlJs) {
      return this._addOrInsert(rows, -1, 'added', isOnlJs)
    }, */
    },
    /**
     * 添加一行或多行
@@ -910,8 +924,8 @@
     * @param options.setActive 是否激活最后一行的编辑模式
     */
    async pushRows(rows = {}, options = {}) {
      let {xTable} = this.$refs.vxe.$refs
      let {setActive, index} = options
      let { xTable } = this.$refs.vxe.$refs
      let { setActive, index } = options
      setActive = setActive == null ? false : !!setActive
      index = index == null ? -1 : index
      index = index === -1 ? index : xTable.tableFullData[index]
@@ -927,7 +941,7 @@
    /** 清空选择行 */
    clearSelection() {
      let event = {$table: this.$refs.vxe, target: this}
      let event = { $table: this.$refs.vxe, target: this }
      if (this.rowSelectionType === JVXETypes.rowRadio) {
        this.$refs.vxe.clearRadioRow()
        this.handleVxeRadioChange(event)
@@ -953,7 +967,7 @@
        rowIds = [rowId]
      }
      let rows = rowIds.map((id) => {
        let {row} = this.getIfRowById(id)
        let { row } = this.getIfRowById(id)
        if (!row) {
          return
        }
@@ -1061,7 +1075,7 @@
          values[config.keys[i]] = ''
        }
        // 清空后几列的数据
        this.setValues([{rowKey: row.id, values}])
        this.setValues([{ rowKey: row.id, values }])
      }
    },
@@ -1084,12 +1098,12 @@
      })
    },
    //options自定义赋值 刷新
    virtualRefresh(){
    virtualRefresh() {
      this.scrolling = true
      this.closeScrolling()
    },
    // 设置 this.scrolling 防抖模式
    closeScrolling: simpleDebounce(function () {
    closeScrolling: simpleDebounce(function() {
      this.scrolling = false
    }, 100),
@@ -1105,7 +1119,7 @@
      for (let row of rows) {
        let item = cloneObject(row)
        if (insertRecords.includes(row)) {
          handler ? handler({item, row, insertRecords}) : null
          handler ? handler({ item, row, insertRecords }) : null
          if (remove) {
            continue
@@ -1134,9 +1148,19 @@
    _remove(rows) {
      const xTable = this.$refs.vxe.$refs.xTable
      const {afterFullData, tableFullData, tableSourceData, editStore, treeConfig, checkboxOpts, selection, isInsertByRow, scrollYLoad} = xTable
      const {actived, removeList, insertList} = editStore
      const {checkField: property} = checkboxOpts
      const {
        afterFullData,
        tableFullData,
        tableSourceData,
        editStore,
        treeConfig,
        checkboxOpts,
        selection,
        isInsertByRow,
        scrollYLoad
      } = xTable
      const { actived, removeList, insertList } = editStore
      const { checkField: property } = checkboxOpts
      let rest = []
      const nowData = afterFullData
      if (treeConfig) {
@@ -1187,7 +1211,7 @@
      }
      return xTable.$nextTick().then(() => {
        xTable.recalculate()
        return {row: rest.length ? rest[rest.length - 1] : null, rows: rest}
        return { row: rest.length ? rest[rest.length - 1] : null, rows: rest }
      })
    },
@@ -1220,7 +1244,7 @@
    },
    async _addOrInsert(rows = {}, index, triggerName, isOnlJs) {
      let {xTable} = this.$refs.vxe.$refs
      let { xTable } = this.$refs.vxe.$refs
      let records
      if (Array.isArray(rows)) {
        records = rows
@@ -1229,7 +1253,7 @@
      }
      // 遍历添加默认值
      records.forEach(record => this._createRow(record))
      let result = await this.pushRows(records, {index: index, setActive: true})
      let result = await this.pushRows(records, { index: index, setActive: true })
      // 遍历插入的行
      // update--begin--autor:lvdandan-----date:20201117------for:LOWCOD-987 【新行编辑】js增强附表内置方法调用问题 #1819
      // online js增强时以传过来值为准,不再赋默认值
@@ -1239,7 +1263,7 @@
          this.trigger(triggerName, {
            row: row,
            $table: xTable,
            target: this,
            target: this
          })
        }
      }
@@ -1248,14 +1272,14 @@
    },
    // 创建新行,自动添加默认值
    _createRow(record = {}) {
      let {xTable} = this.$refs.vxe.$refs
      let { xTable } = this.$refs.vxe.$refs
      // 添加默认值
      xTable.tableFullColumn.forEach(column => {
        let col = column.own
        if (col.key && (record[col.key] == null || record[col.key] === '')) {
          // 设置默认值
          let createValue = getEnhancedMixins(col.$type || col.type, 'createValue')
          record[col.key] = createValue({row: record, column, $table: xTable})
          record[col.key] = createValue({ row: record, column, $table: xTable })
        }
        // update-begin--author:sunjianlei---date:20210819------for: 处理联动列,联动列只能作用于 select 组件
        if (col.$type === JVXETypes.select && this.innerLinkageConfig != null) {
@@ -1280,7 +1304,7 @@
        props: this.vxeProps,
        on: this.vxeEvents,
        // 作用域插槽的格式为
        scopedSlots: this.$scopedSlots,
        scopedSlots: this.$scopedSlots
      })
    },
    // 渲染工具栏
@@ -1293,7 +1317,7 @@
            size: this.size,
            disabled: this.disabled,
            disabledRows: this.disabledRows,
            selectedRowIds: this.selectedRowIds,
            selectedRowIds: this.selectedRowIds
          },
          on: {
            // 新增事件
@@ -1301,7 +1325,7 @@
            // 保存事件
            save: () => this.trigger('save', {
              $table: this.$refs.vxe,
              target: this,
              target: this
            }),
            // 删除事件
            remove: () => {
@@ -1309,7 +1333,7 @@
              let deleteRows = this.filterNewRows(this.selectedRows)
              // 触发删除事件
              if (deleteRows.length > 0) {
                let removeEvent = {deleteRows, $table, target: this}
                let removeEvent = { deleteRows, $table, target: this }
                if (this.asyncRemove) {
                  // 确认删除,只有调用这个方法才会真删除
                  removeEvent.confirmRemove = () => this.removeSelection()
@@ -1326,8 +1350,8 @@
          },
          scopedSlots: {
            toolbarPrefix: this.$scopedSlots.toolbarPrefix,
            toolbarSuffix: this.$scopedSlots.toolbarSuffix,
          },
            toolbarSuffix: this.$scopedSlots.toolbarSuffix
          }
        })
      }
      return null
@@ -1345,7 +1369,7 @@
        return h('j-vxe-sub-popover', {
          ref: 'subPopover',
          scopedSlots: {
            subForm: this.$scopedSlots.subForm,
            subForm: this.$scopedSlots.subForm
          }
        })
      }
@@ -1374,17 +1398,17 @@
          },
          on: {
            change: (e) => this.trigger('pageChange', e)
          },
          }
        })
      }
      return null
    },
    loadExcludeCode(){
      if(!this.authPre || this.authPre.length==0){
    loadExcludeCode() {
      if (!this.authPre || this.authPre.length == 0) {
        this.excludeCode = []
      }else{
      } else {
        let pre = this.authPre
        if(!pre.endsWith(':')){
        if (!pre.endsWith(':')) {
          pre += ':'
        }
        this.excludeCode = getNoAuthCols(pre)
@@ -1401,7 +1425,7 @@
      this.renderToolbar(h),
      this.renderToolbarAfterSlot(),
      this.renderVxeGrid(h),
      this.renderPagination(h),
      this.renderPagination(h)
    ])
  },
  beforeDestroy() {
@@ -1411,23 +1435,27 @@
// 兼容 online 的规则
const fooPatterns = [
  {title: '非空', value: '*', pattern: /^.+$/},
  {title: '6到16位数字', value: 'n6-16', pattern: /^\d{6,16}$/},
  {title: '6到16位任意字符', value: '*6-16', pattern: /^.{6,16}$/},
  {title: '6到18位字母', value: 's6-18', pattern: /^[a-z|A-Z]{6,18}$/},
  {title: '网址', value: 'url', pattern: /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/},
  {title: '电子邮件', value: 'e', pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/},
  {title: '手机号码', value: 'm', pattern: /^1[3456789]\d{9}$/},
  {title: '邮政编码', value: 'p', pattern: /^[0-9]{6}$/},
  {title: '字母', value: 's', pattern: /^[A-Z|a-z]+$/},
  {title: '数字', value: 'n', pattern: /^-?\d+(\.?\d+|\d?)$/},
  {title: '整数', value: 'z', pattern: /^-?\d+$/},
  {title: '金额', value: 'money', pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,5}))$/},
  { title: '非空', value: '*', pattern: /^.+$/ },
  { title: '6到16位数字', value: 'n6-16', pattern: /^\d{6,16}$/ },
  { title: '6到16位任意字符', value: '*6-16', pattern: /^.{6,16}$/ },
  { title: '6到18位字母', value: 's6-18', pattern: /^[a-z|A-Z]{6,18}$/ },
  {
    title: '网址',
    value: 'url',
    pattern: /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/
  },
  { title: '电子邮件', value: 'e', pattern: /^([\w]+\.*)([\w]+)@[\w]+\.\w{3}(\.\w{2}|)$/ },
  { title: '手机号码', value: 'm', pattern: /^1[3456789]\d{9}$/ },
  { title: '邮政编码', value: 'p', pattern: /^[0-9]{6}$/ },
  { title: '字母', value: 's', pattern: /^[A-Z|a-z]+$/ },
  { title: '数字', value: 'n', pattern: /^-?\d+(\.?\d+|\d?)$/ },
  { title: '整数', value: 'z', pattern: /^-?\d+$/ },
  { title: '金额', value: 'money', pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,5}))$/ }
]
/** 旧版handler转为新版Validator */
function handlerConvertToValidator(event) {
  const {column, rule} = event
  const { column, rule } = event
  return new Promise((resolve, reject) => {
    rule.handler(event, (flag, msg) => {
      let message = rule.message
@@ -1447,7 +1475,7 @@
/** 唯一校验器 */
function uniqueValidator(event) {
  const {cellValue, column, rule} = event
  const { cellValue, column, rule } = event
  let tableData = this.getTableData()
  let findCount = 0
  for (let rowData of tableData) {