king
2024-04-25 dcd660c86dba586c1b78c0530ddee7c1dc093ee6
src/menu/components/share/pastecomponent/index.jsx
@@ -114,6 +114,10 @@
        return
      }
      if (res.copyType === 'editcols') {
        res.copyType = 'cols'
      }
      let type = res.copyType
      let config = fromJS(this.props.config).toJS()
@@ -168,13 +172,29 @@
      } else if (type === 'cols') {
        config.cols = config.cols.filter(col => !col.origin)
        let keys = config.cols.map(col => (col.field || '$empty'))
        res.cols.forEach(col => {
          if (!keys.includes(col.field)) {
            config.cols.push(col)
        if ((config.subtype === 'normaltable' || config.subtype === 'editable') && res.cols.length === 1) {
          config.cols.push(...res.cols)
        } else {
          let keys = config.cols.map(col => (col.field || '$empty'))
          let cols = []
          res.cols.forEach(col => {
            if (!col.field || !keys.includes(col.field)) {
              cols.push(col)
            }
          })
          if (cols.length === 0) {
            notification.warning({
              top: 92,
              message: '显示列已存在!',
              duration: 5
            })
            return
          } else {
            config.cols.push(...cols)
          }
        })
        }
      }
      this.props.updateConfig(config, type)