king
2020-02-27 822bc67061448c6e3a1eb77d39be4ad2b84b416a
src/templates/tableshare/verifycardexcelin/index.jsx
@@ -12,6 +12,7 @@
class VerifyCard extends Component {
  static propTpyes = {
    columns: PropTypes.array,  // 显示列
    dict: PropTypes.object,    // 字典项
    card: PropTypes.object,
  }
@@ -153,6 +154,52 @@
        range: _verify.range || 0,
        columns: _columns,
        scripts: _verify.scripts || []
      }
    })
  }
  columnFieldInput = () => {
    const { columns } = this.props
    const { verify } = this.state
    let _columns = JSON.parse(JSON.stringify(verify.columns))
    let _cols = _columns.map(col => col.Column )
    columns.forEach(col => {
      if (col.field && !_cols.includes(col.field)) {
        let _type = 'Nvarchar(50)'
        let _limit = '50'
        if (col.type === 'number' && col.decimal === 0) {
          _type = 'Int'
          _limit = ''
        } else if (col.type === 'number') {
          _type = 'Decimal(18,' + col.decimal + ')'
          _limit = col.decimal
        }
        let _cell = {
          uuid: col.uuid,
          Column: col.field,
          Text: col.label,
          type: _type,
          limit: _limit,
          required: 'true'
        }
        if (_type !== 'Nvarchar(50)') {
          _cell.min = 0
          _cell.max = 999999
        }
        _columns.push(_cell)
      }
    })
    this.setState({
      verify: {
        ...verify,
        columns: _columns
      }
    })
  }
@@ -441,6 +488,9 @@
              columnChange={this.columnChange}
              wrappedComponentRef={(inst) => this.columnForm = inst}
            />
            <Button className="excel-col-add" title="添加显示列字段" onClick={this.columnFieldInput} type="primary">
              快捷添加
            </Button>
            <Table
              bordered
              rowKey="uuid"