king
2020-12-23 706cda8fee92196639acc4bd6073398686925fc5
2020-12-23
2个文件已修改
45 ■■■■■ 已修改文件
src/menu/components/table/normal-table/columns/index.jsx 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/normal-table/columns/index.scss 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/normal-table/columns/index.jsx
@@ -206,6 +206,7 @@
      this.setState({fields: fromJS(nextProps.config.columns).toJS()})
    }
  }
  shouldComponentUpdate (nextProps, nextState) {
    const { config } = this.props
@@ -417,6 +418,46 @@
    })
  }
  syncfield = () => {
    const { fields } = this.state
    let columns = fromJS(this.state.columns).toJS()
    columns = columns.filter(c => !c.origin)
    let keys = columns.map(col => col.field)
    fields.forEach(item => {
      if (keys.includes(item.field)) return
      let cell = { uuid: Utils.getuuid(), label: item.label, field: item.field, Align: 'left', Hide: 'false', IsSort: 'true', Width: 120, blacklist: [], postfix: '', prefix: '', linkmenu: [], marks: [], perspective: 'linkmenu' }
      if (/Nvarchar/ig.test(item.datatype)) {
        cell.type = 'text'
        cell.rowspan = 'false'
        cell.textFormat = 'none'
      } else {
        cell.type = 'number'
        cell.format = 'none'
        cell.sum = 'false'
        cell.decimal = item.decimal || 0
      }
      columns.push(cell)
    })
    const _this = this
    confirm({
      content: '确定同步字段集吗?',
      onOk() {
        _this.setState({columns}, () => {
          _this.props.updatecolumn({..._this.props.config, cols: columns})
        })
      },
      onCancel() {}
    })
  }
  render() {
    const { config } = this.props
    const { fields, card, lineMarks, dict } = this.state
@@ -436,6 +477,7 @@
        <div className="col-control">
          <Icon title="复制" type="copy" onClick={this.copycolumn} />
          <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} />
          <Icon title="同步" type="file-sync" onClick={this.syncfield} />
        </div>
        <DndProvider>
          <Table
src/menu/components/table/normal-table/columns/index.scss
@@ -59,6 +59,9 @@
    >.anticon-copy {
      color: #26C281;
    }
    >.anticon-file-sync {
      color: #1890ff;
    }
    >div >.profile {
      color: purple;
    }