king
2021-10-11 d17368d4a5bdec6db2d8a85c7901cdb25cc59cd4
src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -192,6 +192,7 @@
  tdFocus = (id) => {
    const { col, record } = this.props
    if (id !== col.uuid + record.$Index) return
    this.focus()
  }
@@ -419,7 +420,8 @@
    fields: [],
    pickup: false,        // 收起未选择项
    orderfields: {},      // 排序id与field转换
    loading: false
    loading: false,
    editable: 'false'
  }
  UNSAFE_componentWillMount () {
@@ -474,22 +476,28 @@
      if (item.type !== 'action') {
        let _copy = fromJS(_item).toJS()
        _copy.sorter = false
        if (item.editable === 'true') {
          _copy.title = <span>{item.label}<Icon className="system-color" style={{position: 'absolute', bottom: 0, right: 0}} type="edit" /></span>
        }
        edColumns.push(_copy)
      }
      _columns.push(_item)
    })
    edColumns.push({
      align: 'center',
      dataIndex: 'mkoperation',
      title: '操作',
      sorter: false,
      width: 100,
      onCell: record => ({
        record,
        col: {type: 'operation', tableId: tableId},
    if (setting.delable !== 'false') {
      edColumns.push({
        align: 'center',
        dataIndex: 'mkoperation',
        title: '操作',
        sorter: false,
        width: 100,
        onCell: record => ({
          record,
          col: {type: 'operation', tableId: tableId},
        })
      })
    })
    }
    if (setting.borderColor) { // 边框颜色
      let style = `#${tableId} table, #${tableId} tr, #${tableId} th, #${tableId} td {border-color: ${setting.borderColor}}`
@@ -504,7 +512,8 @@
      edColumns,
      tableId,
      orderfields,
      initEditLine
      initEditLine,
      editable: setting.editable
    })
  }
@@ -514,6 +523,7 @@
  componentDidMount () {
    const { fields, columns } = this.props
    const { data, editable } = this.state
    let _fields = []
@@ -531,6 +541,12 @@
    this.setState({
      fields: _fields,
    })
    if (editable === 'true' && data && data.length > 0) {
      setTimeout(() => {
        this.pickupChange()
      }, 200)
    }
    MKEmitter.addListener('nextLine', this.nextLine)
    MKEmitter.addListener('delRecord', this.delRecord)
@@ -554,6 +570,11 @@
  UNSAFE_componentWillReceiveProps(nextProps) {
    if (!is(fromJS(this.props.data), fromJS(nextProps.data))) {
      this.setState({data: nextProps.data || []})
      if (this.state.editable === 'true') {
        setTimeout(() => {
          this.pickupChange()
        }, 200)
      }
    }
  }
  
@@ -844,6 +865,9 @@
      loading: false
    })
    if (submit.closetab === 'true') {
      MKEmitter.emit('popclose')
    }
    if (submit.execSuccess !== 'never') {
      this.repick()
      MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit)
@@ -961,7 +985,8 @@
        data: [],
        edData: [],
        pickup,
        loading: false
        loading: false,
        editable: 'false'
      }, () => {
        this.setState({
          data: data,
@@ -972,7 +997,7 @@
  }
  render() {
    const { setting, statFValue, lineMarks } = this.props
    const { setting, statFValue, lineMarks, submit } = this.props
    const { pickup, tableId, data, edData, columns, edColumns, loading } = this.state
    const components = {
@@ -1015,7 +1040,7 @@
    return (
      <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''}`} id={tableId}>
        <Switch title="编辑" className="main-pickup" checkedChildren="开" unCheckedChildren="关" checked={pickup} onChange={this.pickupChange} />
        {pickup ? <Button onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">提交</Button> : null}
        {pickup ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">提交</Button> : null}
        <Table
          components={components}
          style={setting.style}