From 523cec6c87d88b43954a4409a8dfde6aade095a1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 22 五月 2020 11:02:10 +0800 Subject: [PATCH] 2020-05-22 --- src/templates/sharecomponent/chartgroupcomponent/index.jsx | 37 ++++++++++++++++++++++++++++++++----- 1 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/templates/sharecomponent/chartgroupcomponent/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/index.jsx index ea90177..a88b96c 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/index.jsx @@ -93,15 +93,42 @@ } } - 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, modaltype: _type, -- Gitblit v1.8.0