From 5025901e459ae49d85210573ad38fb3f3c1d9230 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 25 六月 2023 18:48:54 +0800 Subject: [PATCH] 2023-06-25 --- src/menu/components/chart/antv-X6/chartcompile/index.jsx | 139 +++++++++++++++++++++------------------------- 1 files changed, 64 insertions(+), 75 deletions(-) diff --git a/src/menu/components/chart/antv-X6/chartcompile/index.jsx b/src/menu/components/chart/antv-X6/chartcompile/index.jsx index 4396a49..6e61020 100644 --- a/src/menu/components/chart/antv-X6/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-X6/chartcompile/index.jsx @@ -39,92 +39,81 @@ } onSubmit = () => { - const { config } = this.props const { plot, view } = this.state if (view === 'normal') { this.norRef.handleConfirm().then(res => { - let _plot = {...plot, ...res} - - if (_plot.click !== 'menus') { - delete _plot.menus - } - if (_plot.click !== 'menu') { - delete _plot.menu - delete _plot.MenuID - delete _plot.MenuName - delete _plot.MenuNo - delete _plot.tabType - } else if (sessionStorage.getItem('appType') === '' && _plot.menu) { - let list = null - try { - list = JSON.parse(sessionStorage.getItem('thdMenuList')) || [] - } catch (e) { - list = [] - } - - let id = _plot.menu[_plot.menu.length - 1] - - list.forEach(item => { - if (item.MenuID === id) { - _plot.MenuID = id - _plot.MenuName = item.MenuName - _plot.MenuNo = item.MenuNo - _plot.tabType = item.type - } - }) - } - - this.setState({ - plot: _plot, - visible: false - }) - - this.props.plotchange({...config, plot: _plot}) + this.resetPlot({...plot, ...res}) }) } else if (view === 'base') { this.baseRef.handleConfirm().then(res => { - let _plot = {...plot, ...res} - - if (_plot.click !== 'menus') { - delete _plot.menus - } - if (_plot.click !== 'menu') { - delete _plot.menu - delete _plot.MenuID - delete _plot.MenuName - delete _plot.MenuNo - delete _plot.tabType - } else if (sessionStorage.getItem('appType') === '' && _plot.menu) { - let list = null - try { - list = JSON.parse(sessionStorage.getItem('thdMenuList')) || [] - } catch (e) { - list = [] - } - - let id = _plot.menu[_plot.menu.length - 1] - - list.forEach(item => { - if (item.MenuID === id) { - _plot.MenuID = id - _plot.MenuName = item.MenuName - _plot.MenuNo = item.MenuNo - _plot.tabType = item.type - } - }) - } - - this.setState({ - plot: _plot, - visible: false - }) - - this.props.plotchange({...config, plot: _plot}) + this.resetPlot({...plot, ...res}) }) } } + resetPlot = (plot) => { + const { config } = this.props + + if (plot.click !== 'menus') { + delete plot.menus + } + if (plot.click !== 'menu') { + delete plot.menu + delete plot.MenuID + delete plot.MenuName + delete plot.MenuNo + delete plot.tabType + } else if (sessionStorage.getItem('appType') === '' && plot.menu) { + let list = null + try { + list = JSON.parse(sessionStorage.getItem('thdMenuList')) || [] + } catch (e) { + list = [] + } + + let id = plot.menu[plot.menu.length - 1] + + list.forEach(item => { + if (item.MenuID === id) { + plot.MenuID = id + plot.MenuName = item.MenuName + plot.MenuNo = item.MenuNo + plot.tabType = item.type + } + }) + } + + if (plot.gridType === 'none') { + plot.grid = {visible: false} + } else if (plot.gridType === 'dot') { + plot.grid = { + visible: true, + type: 'dot', + args: { + color: '#a0a0a0', + thickness: 1 + } + } + } else if (plot.gridType === 'mesh') { + plot.grid = { + visible: true, + type: 'mesh', + args: { + color: '#ddd', + thickness: 1 + } + } + } + + this.setState({ + plot: plot, + visible: false + }) + + this.props.plotchange({...config, plot: plot}) + } + changeTab = (tab) => { const { plot, view } = this.state -- Gitblit v1.8.0