From da5ff4b9866a2d458d950f0c743ab9244e16c66d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 12 十一月 2023 12:23:08 +0800 Subject: [PATCH] 2023-11-12 --- src/menu/components/chart/antv-bar/index.jsx | 75 +++++++++++-------------------------- 1 files changed, 23 insertions(+), 52 deletions(-) diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 4afefb9..ad556b3 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -9,7 +9,7 @@ import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' -import { resetStyle, getTables, getHeight } from '@/utils/utils-custom.js' +import { resetStyle, getTables, getHeight, checkComponent } from '@/utils/utils-custom.js' import Utils from '@/utils/utils.js' import { chartColors } from '@/utils/option.js' import './index.scss' @@ -20,7 +20,6 @@ const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) class antvBarLineChart extends Component { @@ -84,27 +83,6 @@ search: [], action: [], plot: _plot, - } - - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.plot = config.plot - _card.plot.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - - _card.action = config.action.map(col => { - col.uuid = Utils.getuuid() - return col - }) - _card.search = config.search.map(col => { - col.uuid = Utils.getuuid() - return col - }) } this.updateComponent(_card, true) @@ -572,7 +550,8 @@ }) } - if (!plot.legend || plot.legend === 'hidden') { + let noLegend = !plot.legend || plot.legend === 'hidden' + if (noLegend) { chart.legend(false) } else { chart.legend({ @@ -665,7 +644,9 @@ } view1.axis('value', yc) - // view1.legend(false) + if (!noLegend) { + view1.legend(false) + } if (plot.mutilBar !== 'stack') { let _chart = view1 @@ -792,7 +773,9 @@ view2.data(dv.rows) - // view2.legend(false) + if (!noLegend) { + view2.legend(false) + } fields.forEach(item => { if (item.chartType === 'bar' && !Bar_axis.length) { @@ -1220,48 +1203,37 @@ card.width = card.plot.width card.name = card.plot.name - card.errors = [] - let columns = card.columns.map(c => c.field) - - if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { - card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) - } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) { - card.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'}) - } else if (!card.setting.primaryKey) { - card.errors.push({ level: 0, detail: '鏈缃富閿紒'}) - } else if (!columns.includes(card.setting.primaryKey)) { - card.errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'}) - } else if (!card.setting.supModule) { - card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) - } + card.$c_ds = true + card.$c_ac = this.state.appType !== 'mob' + + card.errors = checkComponent(card) if (card.errors.length === 0) { card.$tables = getTables(card) } - + + let columns = card.columns.map(c => c.field) if (!card.plot.Xaxis) { card.errors.push({ level: 0, detail: '鍧愭爣杞村皻鏈缃紒'}) } else if (card.plot.datatype === 'query') { if (!columns.includes(card.plot.Xaxis)) { - card.errors.push({ level: 1, detail: 'X杞村湪瀛楁闆嗕腑涓嶅瓨鍦�'}) + card.errors.push({ level: 0, detail: 'X杞村湪瀛楁闆嗕腑涓嶅瓨鍦�'}) } if (card.plot.Yaxis) { card.plot.Yaxis.forEach(m => { if (!columns.includes(m)) { - card.errors.push({ level: 1, detail: `Y杞翠腑瀛楁鈥�${m}鈥濆凡澶辨晥`}) + card.errors.push({ level: 0, detail: `Y杞翠腑瀛楁鈥�${m}鈥濆凡澶辨晥`}) } }) } } else if (card.plot.datatype === 'statistics') { if (!columns.includes(card.plot.Xaxis)) { - card.errors.push({ level: 1, detail: 'X杞村湪瀛楁闆嗕腑涓嶅瓨鍦�'}) - } - if (!columns.includes(card.plot.InfoType)) { - card.errors.push({ level: 1, detail: '鍥捐〃涓粺璁$被鍨嬪瓧娈靛凡澶辨晥'}) - } - if (!columns.includes(card.plot.InfoValue)) { - card.errors.push({ level: 1, detail: '鍥捐〃涓粺璁″�煎瓧娈靛凡澶辨晥'}) + card.errors.push({ level: 0, detail: 'X杞村湪瀛楁闆嗕腑涓嶅瓨鍦�'}) + } else if (!columns.includes(card.plot.InfoType)) { + card.errors.push({ level: 0, detail: '鍥捐〃涓粺璁$被鍨嬪瓧娈靛凡澶辨晥'}) + } else if (!columns.includes(card.plot.InfoValue)) { + card.errors.push({ level: 0, detail: '鍥捐〃涓粺璁″�煎瓧娈靛凡澶辨晥'}) } } @@ -1369,7 +1341,6 @@ <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <ClockComponent config={card} updateConfig={this.updateComponent}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> @@ -1377,7 +1348,7 @@ <ToolOutlined/> </Popover> <NormalHeader config={card} updateComponent={this.updateComponent}/> - <div className="canvas" id={card.uuid + 'canvas'}></div> + <div className="canvas" style={{minHeight: card.plot.height}} id={card.uuid + 'canvas'}></div> {appType !== 'mob' ? <ActionComponent config={card} updateaction={this.updateComponent} -- Gitblit v1.8.0