From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 四月 2025 12:18:03 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/components/chart/antv-G6/index.jsx | 59 ++++++++++++++++++++++------------------------------------- 1 files changed, 22 insertions(+), 37 deletions(-) diff --git a/src/menu/components/chart/antv-G6/index.jsx b/src/menu/components/chart/antv-G6/index.jsx index 81c0e09..a90cff0 100644 --- a/src/menu/components/chart/antv-G6/index.jsx +++ b/src/menu/components/chart/antv-G6/index.jsx @@ -8,7 +8,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 './index.scss' const { Util } = G6 @@ -17,7 +17,6 @@ const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const MindData = [ 'Modeling Methods', @@ -56,7 +55,7 @@ yellow_green: '#a0d911', green: '#52c41a', cyan: '#13c2c2', - blue_purple: '#2f54eb', + blue_purple: '#3860f4', purple: '#722ed1', magenta: '#eb2f96', grass_green: '#aeb303', @@ -961,6 +960,7 @@ width: card.width || 24, height: 400, subtype: card.subtype, + click: 'switch', name: card.name } @@ -984,19 +984,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 } this.updateComponent(_card) @@ -1137,7 +1124,7 @@ const { card } = this.state if (card.plot.subtype === 'mindmap') { - this.ponitrender() + this.mindrender() } else if (card.plot.subtype === 'indentTree') { this.indentrender() } else if (card.plot.subtype === 'kapmap') { @@ -1270,9 +1257,9 @@ } /** - * @description 鏁g偣鍥� + * @description 鎬濈淮瀵煎浘 */ - ponitrender = () => { + mindrender = () => { const { card } = this.state const plot = card.plot const data = this.getdata() @@ -1348,28 +1335,27 @@ card.width = card.plot.width card.name = card.plot.name card.subtype = card.plot.subtype - 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.errors = checkComponent(card) if (card.errors.length === 0) { card.$tables = getTables(card) } + + delete card.$c_ds if (!card.plot.valueField) { card.errors.push({ level: 0, detail: '鍥捐〃淇℃伅灏氭湭璁剧疆锛�'}) + } else { + let columns = card.columns.map(c => c.field) + if (!columns.includes(card.plot.valueField)) { + card.errors.push({ level: 0, detail: '鍊煎瓧娈靛湪瀛楁闆嗕腑涓嶅瓨鍦�'}) + } else if (!columns.includes(card.plot.labelField)) { + card.errors.push({ level: 0, detail: '鏂囨湰瀛楁鍦ㄥ瓧娈甸泦涓笉瀛樺湪'}) + } else if (!columns.includes(card.plot.parentField)) { + card.errors.push({ level: 0, detail: '涓婄骇瀛楁鍦ㄥ瓧娈甸泦涓笉瀛樺湪'}) + } } this.setState({ @@ -1407,13 +1393,12 @@ let _style = resetStyle(card.style) return ( - <div className="menu-scatter-chart-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> + <div className="menu-g6-chart-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <ChartCompileForm config={card} plotchange={this.updateComponent}/> <CopyComponent type="antvG6" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)}/> <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> @@ -1421,12 +1406,12 @@ <ToolOutlined/> </Popover> <NormalHeader config={card} updateComponent={this.updateComponent}/> - <div className="canvas" id={card.uuid + 'canvas'} ref={ref => this.wrap = ref}></div> + <div className="canvas" style={{minHeight: card.plot.height}} id={card.uuid + 'canvas'} ref={ref => this.wrap = ref}></div> <div className="component-name"> <div className="center"> <div className="title" onDoubleClick={() => { let oInput = document.createElement('input') - oInput.value = card.uuid + oInput.value = 'anchor' + card.uuid document.body.appendChild(oInput) oInput.select() document.execCommand('Copy') -- Gitblit v1.8.0