| | |
| | | } |
| | | |
| | | render() { |
| | | let { col, config, record, style, className, ...resProps } = this.props |
| | | let { col, record, style, className, ...resProps } = this.props |
| | | const { editing } = this.state |
| | | |
| | | if (!col) return (<td {...resProps} className={className} style={style}/>) |
| | |
| | | if (col.editType === 'select' && col.options.length > 0) { |
| | | content = col.map.get(content) || content |
| | | } else if (col.editType === 'switch') { |
| | | if (content === config.openVal) { |
| | | content = config.openText |
| | | } else if (content === config.closeVal) { |
| | | content = config.closeText |
| | | if (content === col.openVal) { |
| | | content = col.openText |
| | | } else if (content === col.closeVal) { |
| | | content = col.closeText |
| | | } |
| | | } else if (col.editType === 'popSelect') { |
| | | if (col.showField) { |
| | |
| | | } |
| | | |
| | | children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | <CardCellComponent data={record} cards={col.config} elements={col.elements}/> |
| | | ) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | let { col, config, record, style, className, ...resProps } = this.props |
| | | let { col, record, style, className, ...resProps } = this.props |
| | | |
| | | if (!col) return (<td {...resProps} className={className} style={style}/>) |
| | | |
| | |
| | | if (col.editType === 'select' && col.options.length > 0) { |
| | | content = col.map.get(content) || content |
| | | } else if (col.editType === 'switch') { |
| | | if (content === config.openVal) { |
| | | content = config.openText |
| | | } else if (content === config.closeVal) { |
| | | content = config.closeText |
| | | if (content === col.openVal) { |
| | | content = col.openText |
| | | } else if (content === col.closeVal) { |
| | | content = col.closeText |
| | | } |
| | | } else if (col.editType === 'popSelect') { |
| | | if (col.showField) { |
| | |
| | | } |
| | | |
| | | children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | <CardCellComponent data={record} cards={col.config} elements={col.elements}/> |
| | | ) |
| | | } |
| | | |
| | |
| | | let deForms = [] |
| | | let _forms = {} |
| | | let hasBid = false |
| | | let index = 0 |
| | | let checkForms = [] |
| | | let allForms = [] |
| | | |
| | |
| | | cell.children = getColumns(item.subcols, sk || item.uuid) |
| | | } else { |
| | | if (item.editable === 'true') { |
| | | item.$sort = index |
| | | index++ |
| | | _forms[item.field] = item |
| | | |
| | | allForms.push({uuid: sk || item.uuid, field: item.field}) |
| | | checkForms.push(item.field) |
| | | |
| | | if (item.ctrlField) { |
| | | item.ctrlValue = item.ctrlValue.split(',') |
| | | } |
| | | |
| | | if (item.type === 'number' && item.clearField) { |
| | | fields.forEach(cell => { |
| | | if (cell.field === item.clearField) { |
| | | item.clearName = cell.label |
| | | } |
| | | }) |
| | | } else if (item.type === 'text' && item.editType === 'select') { |
| | | item.map = new Map() |
| | | if (item.type === 'text' && item.editType === 'select') { |
| | | if (item.resourceType === '1') { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | |
| | |
| | | item.arr_field = _option.field |
| | | |
| | | deForms.push(item) |
| | | } else { |
| | | item.options.forEach(cell => { |
| | | item.map.set(cell.value, cell.label) |
| | | }) |
| | | } |
| | | } else if (item.type === 'text' && item.editType === 'date') { |
| | | item.format = 'YYYY-MM-DD' |
| | | |
| | | if (item.precision === 'hour') { |
| | | item.format = 'YYYY-MM-DD HH' |
| | | } else if (item.precision === 'minute') { |
| | | item.format = 'YYYY-MM-DD HH:mm' |
| | | } else if (item.precision === 'second') { |
| | | item.format = 'YYYY-MM-DD HH:mm:ss' |
| | | } |
| | | } |
| | | } |
| | |
| | | $key: item.uuid, |
| | | onCell: record => ({ |
| | | record, |
| | | col: item, |
| | | config: item.type === 'custom' ? {setting, columns: fields} : null, |
| | | col: item |
| | | }) |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { BID } = this.props |
| | | const { BID, parCtrl } = this.props |
| | | const { deForms } = this.state |
| | | |
| | | if (deForms && nextProps.BID !== BID) { |
| | | this.improveActionForm(deForms, nextProps.BID) |
| | | } |
| | | if (parCtrl && !is(fromJS(this.props.columns), fromJS(nextProps.columns))) { |
| | | let getColumns = (cols, sk) => { |
| | | return cols.map(item => { |
| | | let cell = null |
| | | |
| | | if (item.type === 'colspan') { |
| | | cell = { title: item.label, align: item.Align, $key: item.uuid } |
| | | cell.children = getColumns(item.subcols, sk || item.uuid) |
| | | } else { |
| | | cell = { |
| | | align: item.Align, |
| | | dataIndex: item.uuid, |
| | | title: item.editable === 'true' ? <span>{item.label}<EditOutlined className="system-color mk-edit-sign"/></span> : item.label, |
| | | sorter: (item.field || item.sortField) && item.IsSort === 'true', |
| | | width: item.Width || 120, |
| | | $key: item.uuid, |
| | | onCell: record => ({ |
| | | record, |
| | | col: item |
| | | }) |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | | |
| | | let _columns = getColumns(nextProps.columns) |
| | | |
| | | this.setState({ |
| | | columns: _columns |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | transferData = (data, type) => { |
| | | const { edData, tableId } = this.state |
| | | |
| | | if (type === 'delete') { |
| | | if (type === 'clear') { |
| | | this.setState({edData: [], midData: []}) |
| | | return |
| | | } else if (type === 'delete') { |
| | | |
| | | } else if (type === 'line') { |
| | | let value = '' |