| | |
| | | this.setState({fields: fromJS(nextProps.config.columns).toJS()}) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | const { config } = this.props |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | 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 |
| | |
| | | <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 |