| | |
| | | } |
| | | } |
| | | |
| | | let _columns = config.columns.filter(col => ['text', 'number'].includes(col.type) && col.marks && col.marks.filter(_mark => _mark.signType === 'card').length > 0) |
| | | _columns = _columns.map(col => { |
| | | return { |
| | | let _columns = [{ |
| | | uuid: 'x', |
| | | value: '', |
| | | text: '空', |
| | | background: '' |
| | | }] |
| | | config.columns.forEach(col => { |
| | | if (!['text', 'number'].includes(col.type)) return |
| | | if (!col.marks) return |
| | | |
| | | let _marks = col.marks.filter(_mark => _mark.signType === 'card') |
| | | |
| | | if (_marks.length === 0) return |
| | | |
| | | _columns.push({ |
| | | uuid: col.uuid, |
| | | value: col.field, |
| | | text: col.label |
| | | } |
| | | text: col.label, |
| | | background: _marks[0].color ? _marks[0].color[1] : '' |
| | | }) |
| | | }) |
| | | |
| | | if (item.chartType === 'card') { // 检验已添加背景是否修改 |
| | | if (item.bgfield) { |
| | | let _column = _columns.filter(col => col.value === item.bgfield)[0] |
| | | if (_column) { |
| | | item.background = _column.background |
| | | } else { |
| | | item.bgfield = '' |
| | | item.background = '' |
| | | } |
| | | } else { |
| | | item.background = '' |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | card: item, |