From f07c42a322f41e14ef5b1bf8f2fd66fc5d338cdd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 六月 2023 18:17:09 +0800 Subject: [PATCH] 2023-06-28 --- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 1 src/components/header/index.jsx | 5 src/menu/components/group/groupcomponents/index.jsx | 1 src/menu/components/group/paste/index.jsx | 2 src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx | 52 ++- src/menu/components/chart/antv-X6/chartcompile/index.jsx | 2 src/tabviews/zshare/normalTable/index.jsx | 5 src/views/mkiframe/index.jsx | 90 ++++++ src/menu/components/chart/antv-X6/index.jsx | 29 - src/views/menudesign/menuform/index.jsx | 16 src/tabviews/custom/popview/index.jsx | 7 src/menu/components/tabs/tabcomponents/index.jsx | 1 src/views/tabledesign/menuform/index.jsx | 11 src/tabviews/zshare/actionList/index.jsx | 1 src/tabviews/zshare/actionList/newpagebutton/index.jsx | 27 + src/views/billprint/index.jsx | 7 src/menu/modulesource/option.jsx | 4 src/menu/components/form/formaction/formconfig.jsx | 2 src/tabviews/custom/components/card/cardcellList/index.jsx | 12 src/tabviews/zshare/actionList/tabbutton/index.jsx | 9 src/tabviews/custom/components/share/tabtransfer/index.jsx | 7 src/menu/components/share/actioncomponent/formconfig.jsx | 49 +++ src/tabviews/custom/components/group/normal-group/index.jsx | 7 src/router/index.js | 2 src/menu/pastecontroller/index.jsx | 2 src/menu/components/group/groupcomponents/card.jsx | 3 src/tabviews/custom/components/chart/antv-X6/index.scss | 22 + src/tabviews/custom/components/chart/antv-X6/index.jsx | 397 +++++++++++++++++++++++---- src/menu/components/share/actioncomponent/actionform/index.jsx | 11 src/assets/mobimg/xflow.png | 0 src/tabviews/custom/index.jsx | 4 src/menu/components/tabs/tabcomponents/card.jsx | 3 src/menu/components/tabs/paste/index.jsx | 2 33 files changed, 638 insertions(+), 155 deletions(-) diff --git a/src/assets/mobimg/xflow.png b/src/assets/mobimg/xflow.png index 3fa7da2..f15d8dd 100644 --- a/src/assets/mobimg/xflow.png +++ b/src/assets/mobimg/xflow.png Binary files differ diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 730c358..5ddbc2a 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -251,6 +251,9 @@ trdItem.type = 'iframe' trdItem.OpenType = 'newtab' } + } else if (trdItem.OpenType === 'view') { + trdItem.OpenType = 'newpage' + trdItem.src = '#/view/' + trd.MenuID } else { trdItem.src = '#/tab/' + trd.MenuID } @@ -457,6 +460,8 @@ window.addEventListener('storage', (e) => { if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) { localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)) + } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) { + localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions})) } else if (e.key === 'menuUpdate') { let menuId = e.newValue.split(',')[1] if (menuId) { diff --git a/src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx index 4b70bf9..2be6ca1 100644 --- a/src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx @@ -1,3 +1,6 @@ + +import MenuUtils from '@/utils/utils-custom.js' + /** * @description 鑾峰彇鍥捐〃瑙嗗浘閰嶇疆琛ㄥ崟 * @param {object} card // 鍥捐〃瀵硅薄 @@ -197,12 +200,15 @@ * @param {object} card // 鍥捐〃瀵硅薄 * @param {Array} columns // 鏄剧ず鍒� */ -export function getOptionForm (card, columns) { +export function getOptionForm (card, uuid) { + let menu = window.GLOB.customMenu + let modules = MenuUtils.getSupModules(menu.components, uuid, menu.interfaces) + return [ { type: 'select', field: 'subtype', - label: '绫诲瀷', + label: '鍥捐〃绫诲瀷', initval: card.subtype || 'xflow', required: true, options: [{ @@ -219,26 +225,26 @@ }, { type: 'radio', - field: 'export', - label: '涓嬭浇', - initval: card.export || 'png', - required: false, + field: 'function', + label: '鍔熻兘', + initval: card.function || 'show', + required: true, options: [ - {value: 'none', label: '绂佺敤'}, - {value: 'png', label: 'PNG鍥�'}, + {value: 'edit', label: '娴佺▼缂栬緫'}, + {value: 'show', label: '娴佺▼灞曠ず'}, ], + controlFields: [ + {field: 'empty', values: ['show']} + ] }, { - type: 'radio', - field: 'empty', - label: '绌哄�奸殣钘�', - initval: card.empty || 'show', - tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', + type: 'cascader', + field: 'supModule', + label: '涓婄骇缁勪欢', + initval: card.supModule || [], required: false, - options: [ - {value: 'show', label: '鍚�'}, - {value: 'hidden', label: '鏄�'}, - ], + options: modules, + allowClear: true }, { type: 'radio', @@ -259,6 +265,18 @@ initval: card.backgroundColor || '', required: false, allowClear: true + }, + { + type: 'radio', + field: 'empty', + label: '绌哄�奸殣钘�', + initval: card.empty || 'show', + tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', + required: false, + options: [ + {value: 'show', label: '鍚�'}, + {value: 'hidden', label: '鏄�'}, + ], } ] } diff --git a/src/menu/components/chart/antv-X6/chartcompile/index.jsx b/src/menu/components/chart/antv-X6/chartcompile/index.jsx index 6e61020..8d72d4c 100644 --- a/src/menu/components/chart/antv-X6/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-X6/chartcompile/index.jsx @@ -34,7 +34,7 @@ view: 'normal', plot: fromJS(config.plot).toJS(), baseFormlist: getBaseForm(config.plot, config.columns), - formlist: getOptionForm(config.plot, config.columns) + formlist: getOptionForm(config.plot, config.uuid) }) } diff --git a/src/menu/components/chart/antv-X6/index.jsx b/src/menu/components/chart/antv-X6/index.jsx index 9f923b2..c161470 100644 --- a/src/menu/components/chart/antv-X6/index.jsx +++ b/src/menu/components/chart/antv-X6/index.jsx @@ -8,12 +8,11 @@ import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' -import { resetStyle, getTables, checkComponent } from '@/utils/utils-custom.js' +import { resetStyle } from '@/utils/utils-custom.js' import lanes from './lane.json' import xflows from './xflow.json' import './index.scss' -const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) @@ -221,7 +220,8 @@ } }, gridType: 'dot', - export: 'png' + function: 'show', + supModule: [] } let _card = { @@ -233,7 +233,7 @@ width: _plot.width, name: _plot.name, subtype: card.subtype, - setting: { interType: 'system' }, + setting: { interType: '' }, style: { borderWidth: '1px', borderColor: 'rgb(217, 217, 217)', marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' @@ -479,13 +479,8 @@ card.width = card.plot.width card.name = card.plot.name card.subtype = card.plot.subtype - - card.$c_ds = true - card.errors = checkComponent(card) - - if (card.errors.length === 0) { - card.$tables = getTables(card) - } + card.errors = [] + card.$tables = [] this.setState({ card: card @@ -526,10 +521,9 @@ <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <ChartCompileForm config={card} plotchange={this.plotchange}/> - <CopyComponent type="antvG6" card={card}/> + <CopyComponent type="antvX6" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)}/> - <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> } trigger="hover"> <ToolOutlined/> @@ -541,15 +535,6 @@ <div className="component-name"> <div className="center"> <div className="title">{card.name}</div> - <div className="content"> - {card.errors && card.errors.map((err, index) => { - if (err.level === 0) { - return <span key={index} className="error">{err.detail}</span> - } else { - return <span key={index} className="waring">{err.detail}锛�</span> - } - })} - </div> </div> </div> </div> diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index 6be2240..ace6550 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -97,7 +97,7 @@ key: 'procMode', label: '鍙傛暟澶勭悊', initVal: card.procMode || 'system', - tooltip: '褰撹繑鍥炲�煎瓨鍦� mk_ex_invoke 涓斿�间负 false 鏃讹紝涓嶄細璋冪敤澶栭儴鎺ュ彛銆�', + tooltip: '褰撹繑鍥炲�煎瓨鍦� mk_ex_invoke 涓斿�间负 false 鏃讹紝涓嶄細璋冪敤澶栭儴鎺ュ彛銆傛敞锛氬綋閫夆�滄棤鈥濇椂锛屾寜閽�夎鏃朵細浼犻�掍富閿紝瀛樺湪琛ㄥ崟鏃朵細浼犻�掕〃鍗曞瓧娈碉紝瀛樺湪BID鏃朵細浼燘ID瀛楁銆�', required: true, options: [{ value: 'system', diff --git a/src/menu/components/group/groupcomponents/card.jsx b/src/menu/components/group/groupcomponents/card.jsx index 7dbdbb0..1ad8d52 100644 --- a/src/menu/components/group/groupcomponents/card.jsx +++ b/src/menu/components/group/groupcomponents/card.jsx @@ -25,6 +25,7 @@ const CustomChart = asyncComponent(() => import('@/menu/components/chart/chart-custom')) const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6')) +const AntvX6 = asyncComponent(() => import('@/menu/components/chart/antv-X6')) const DoubleDataCard = asyncComponent(() => import('@/menu/components/card/double-data-card')) const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { @@ -109,6 +110,8 @@ return (<CustomChart card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'antvG6') { return (<AntvG6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'antvX6') { + return (<AntvX6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } } diff --git a/src/menu/components/group/groupcomponents/index.jsx b/src/menu/components/group/groupcomponents/index.jsx index 3d18434..5754e85 100644 --- a/src/menu/components/group/groupcomponents/index.jsx +++ b/src/menu/components/group/groupcomponents/index.jsx @@ -77,6 +77,7 @@ balcony: '娴姩鍗�', timeline: '鏃堕棿杞�', antvG6: '鏍戝浘', + antvX6: '娴佺▼鍥�', card: '鍗$墖' } let i = 1 diff --git a/src/menu/components/group/paste/index.jsx b/src/menu/components/group/paste/index.jsx index 8db0190..2660dd7 100644 --- a/src/menu/components/group/paste/index.jsx +++ b/src/menu/components/group/paste/index.jsx @@ -33,7 +33,7 @@ } if (appType !== 'mob') { - options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart') + options.push('editable', 'antvG6', 'antvX6', 'tree', 'dashboard', 'chart') } this.pasteFormRef.handleConfirm().then(res => { diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 1f430f5..bd8ddb5 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -20,7 +20,7 @@ excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'], excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden'], popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'width', 'display', 'ratio', 'syncComponent', 'clickouter', 'maskStyle', 'closeButton', 'hidden'], - tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'linkmenu', 'width', 'hidden'], + tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'linkmenu', 'width', 'hidden', 'openTab'], innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'swipe', 'icon', 'class', 'color', 'width', 'hidden'], funcbutton: ['label', 'OpenType', 'funcType', 'show', 'swipe', 'icon', 'class', 'color', 'width', 'hidden'], form: ['label', 'OpenType', 'formType', 'intertype', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'width', 'refreshTab', 'title', 'hidden'] @@ -401,7 +401,7 @@ reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) if (this.record.pageTemplate === 'custom') { - shows.push('url', 'joint', 'open') + shows.push('url', 'proUrl', 'joint', 'open') } else if (this.record.pageTemplate === 'linkpage') { shows.push('linkmenu', 'open') @@ -906,6 +906,13 @@ { required: item.readonly ? false : item.required, message: '璇疯緭鍏�' + item.label + '!' } ] + if (item.key === 'url' || item.key === 'proUrl') { + rules.push({ + pattern: /^[^\s]*$/, + message: '鍦板潃涓笉鍙娇鐢ㄧ┖鏍硷紒' + }) + } + content = <TextArea rows={2} readOnly={item.readonly}/> } else if (item.type === 'keyinterface') { span = 24 diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index ce35e6e..550b969 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -245,7 +245,7 @@ { type: 'select', key: 'OpenType', - label: '鎵撳紑鏂瑰紡', + label: '鎸夐挳绫诲瀷', initVal: card.OpenType, required: true, options: opentypes @@ -340,7 +340,7 @@ key: 'procMode', label: '鍙傛暟澶勭悊', initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'), - tooltip: '褰撹繑鍥炲�煎瓨鍦� mk_ex_invoke 涓斿�间负 false 鏃讹紝涓嶄細璋冪敤澶栭儴鎺ュ彛銆�', + tooltip: '褰撹繑鍥炲�煎瓨鍦� mk_ex_invoke 涓斿�间负 false 鏃讹紝涓嶄細璋冪敤澶栭儴鎺ュ彛銆傛敞锛氬綋閫夆�滄棤鈥濇椂锛屾寜閽�夎鏃朵細浼犻�掍富閿紝瀛樺湪琛ㄥ崟鏃朵細浼犻�掕〃鍗曞瓧娈碉紝瀛樺湪BID鏃朵細浼燘ID瀛楁銆�', required: true, options: [{ value: 'system', @@ -426,6 +426,14 @@ initVal: card.url || '', tooltip: appType === '' ? '鍦板潃鏍煎紡涓猴細http://******/admin/index.html#/iframe/menuId/loginuid/BID 浼氭墦寮�鏍囩椤点�傛敞锛氫娇鐢ˊloginuid@鏃惰嚜鍔ㄦ浛鎹负褰撳墠绯荤粺鐨刲oginuid锛涢�夋嫨鍗曡涓旀嫾鎺ュ弬鏁版椂浼氭嫾鎺ID銆�' : '', required: true + }, + { + type: 'textarea', + key: 'proUrl', + label: '姝e紡鍦板潃', + initVal: card.proUrl || '', + tooltip: appType === '' ? '鍦板潃鏍煎紡涓猴細http://******/admin/index.html#/iframe/menuId/loginuid/BID 浼氭墦寮�鏍囩椤点�傛敞锛氫娇鐢ˊloginuid@鏃惰嚜鍔ㄦ浛鎹负褰撳墠绯荤粺鐨刲oginuid锛涢�夋嫨鍗曡涓旀嫾鎺ュ弬鏁版椂浼氭嫾鎺ID銆�' : '', + required: false }, { type: 'radio', @@ -876,6 +884,19 @@ }, { type: 'radio', + key: 'openTab', + label: '鎵撳紑鏂瑰紡', + initVal: card.openTab || 'newtab', + tooltip: '鑿滃崟鎵撳紑鏂瑰紡銆�', + forbid: appType !== '', + options: [ + {value: 'newtab', text: '鏍囩椤�'}, + // {value: 'newpage', text: '鏂伴〉闈紙鏍囩椤碉級'}, + {value: 'view', text: '鏂伴〉闈紙鍏ㄥ睆锛�'} + ] + }, + { + type: 'radio', key: 'display', label: '鏄剧ず鏂瑰紡', initVal: card.display || 'modal', @@ -1318,7 +1339,7 @@ { type: 'select', key: 'OpenType', - label: '鎵撳紑鏂瑰紡', + label: '鎸夐挳绫诲瀷', initVal: card.OpenType, required: true, options: opentypes @@ -1392,7 +1413,7 @@ key: 'procMode', label: '鍙傛暟澶勭悊', initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'), - tooltip: '褰撹繑鍥炲�煎瓨鍦� mk_ex_invoke 涓斿�间负 false 鏃讹紝涓嶄細璋冪敤澶栭儴鎺ュ彛銆�', + tooltip: '褰撹繑鍥炲�煎瓨鍦� mk_ex_invoke 涓斿�间负 false 鏃讹紝涓嶄細璋冪敤澶栭儴鎺ュ彛銆傛敞锛氬綋閫夆�滄棤鈥濇椂锛屾寜閽�夎鏃朵細浼犻�掍富閿紝瀛樺湪琛ㄥ崟鏃朵細浼犻�掕〃鍗曞瓧娈碉紝瀛樺湪BID鏃朵細浼燘ID瀛楁銆�', required: true, options: [{ value: 'system', @@ -1470,6 +1491,14 @@ initVal: card.url || '', tooltip: '鍦板潃鏍煎紡涓猴細http://******/admin/index.html#/iframe/menuId/loginuid/BID 浼氭墦寮�鏍囩椤点�傛敞锛氫娇鐢ˊloginuid@鏃惰嚜鍔ㄦ浛鎹负褰撳墠绯荤粺鐨刲oginuid锛涢�夋嫨鍗曡涓旀嫾鎺ュ弬鏁版椂浼氭嫾鎺ID銆�', required: true + }, + { + type: 'textarea', + key: 'proUrl', + label: '姝e紡鍦板潃', + initVal: card.proUrl || '', + tooltip: '鍦板潃鏍煎紡涓猴細http://******/admin/index.html#/iframe/menuId/loginuid/BID 浼氭墦寮�鏍囩椤点�傛敞锛氫娇鐢ˊloginuid@鏃惰嚜鍔ㄦ浛鎹负褰撳墠绯荤粺鐨刲oginuid锛涢�夋嫨鍗曡涓旀嫾鎺ュ弬鏁版椂浼氭嫾鎺ID銆�', + required: false }, { type: 'radio', @@ -1836,6 +1865,18 @@ }, { type: 'radio', + key: 'openTab', + label: '鎵撳紑鏂瑰紡', + initVal: card.openTab || 'newtab', + tooltip: '鑿滃崟鎵撳紑鏂瑰紡銆�', + options: [ + {value: 'newtab', text: '鏍囩椤�'}, + // {value: 'newpage', text: '鏂伴〉闈紙鏍囩椤碉級'}, + {value: 'view', text: '鏂伴〉闈紙鍏ㄥ睆锛�'} + ] + }, + { + type: 'radio', key: 'display', label: '鏄剧ず鏂瑰紡', initVal: card.display || 'modal', diff --git a/src/menu/components/tabs/paste/index.jsx b/src/menu/components/tabs/paste/index.jsx index 9391b7c..be4a281 100644 --- a/src/menu/components/tabs/paste/index.jsx +++ b/src/menu/components/tabs/paste/index.jsx @@ -63,7 +63,7 @@ if (appType === 'mob') { options.push('menubar') } else { - options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart') + options.push('editable', 'antvG6', 'antvX6', 'tree', 'dashboard', 'chart') } this.pasteFormRef.handleConfirm().then(res => { diff --git a/src/menu/components/tabs/tabcomponents/card.jsx b/src/menu/components/tabs/tabcomponents/card.jsx index cf77eba..74f3bf9 100644 --- a/src/menu/components/tabs/tabcomponents/card.jsx +++ b/src/menu/components/tabs/tabcomponents/card.jsx @@ -28,6 +28,7 @@ const CustomChart = asyncComponent(() => import('@/menu/components/chart/chart-custom')) const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6')) +const AntvX6 = asyncComponent(() => import('@/menu/components/chart/antv-X6')) const DoubleDataCard = asyncComponent(() => import('@/menu/components/card/double-data-card')) const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { @@ -118,6 +119,8 @@ return (<CustomChart card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'antvG6') { return (<AntvG6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'antvX6') { + return (<AntvX6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } } diff --git a/src/menu/components/tabs/tabcomponents/index.jsx b/src/menu/components/tabs/tabcomponents/index.jsx index bda63dd..62b0ac4 100644 --- a/src/menu/components/tabs/tabcomponents/index.jsx +++ b/src/menu/components/tabs/tabcomponents/index.jsx @@ -117,6 +117,7 @@ balcony: '娴姩鍗�', timeline: '鏃堕棿杞�', antvG6: '鏍戝浘', + antvX6: '娴佺▼鍥�', card: '鍗$墖' } let i = 1 diff --git a/src/menu/modulesource/option.jsx b/src/menu/modulesource/option.jsx index 50d70b5..4b50498 100644 --- a/src/menu/modulesource/option.jsx +++ b/src/menu/modulesource/option.jsx @@ -29,7 +29,7 @@ import mindmap from '@/assets/mobimg/mindmap.png' import indent from '@/assets/mobimg/indent.jfif' import kapmap from '@/assets/mobimg/kapmap.jfif' -// import xflow from '@/assets/mobimg/xflow.png' +import xflow from '@/assets/mobimg/xflow.png' import Voucher from '@/assets/mobimg/voucher.png' import Account from '@/assets/mobimg/account.png' @@ -64,7 +64,7 @@ { type: 'menu', url: mindmap, component: 'antvG6', subtype: 'mindmap', title: '鎬濈淮瀵煎浘', width: 24 }, { type: 'menu', url: indent, component: 'antvG6', subtype: 'indentTree', title: '缂╄繘鏂囦欢鏍�', width: 24 }, { type: 'menu', url: kapmap, component: 'antvG6', subtype: 'kapmap', title: '鐭ヨ瘑鍥捐氨鏍�', width: 24 }, - // { type: 'menu', url: xflow, component: 'antvX6', subtype: 'xflow', title: '娴佺▼鍥�', width: 24 }, + { type: 'menu', url: xflow, component: 'antvX6', subtype: 'xflow', title: '娴佺▼鍥�', width: 24 }, { type: 'menu', url: chart, component: 'chart', subtype: 'custom', title: '鑷畾涔夊浘琛�', width: 24, forbid: ['billPrint'] }, { type: 'menu', url: Editor, component: 'editor', subtype: 'brafteditor', title: '瀵屾枃鏈�', width: 24 }, { type: 'menu', url: SandBox, component: 'code', subtype: 'sandbox', title: '鑷畾涔�', width: 24 }, diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index 5179037..a39a3fb 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -63,7 +63,7 @@ options.push('menubar', 'singleSearch') } } else { - options.push('editable', 'mainsearch', 'antvG6', 'tree', 'dashboard', 'chart') + options.push('editable', 'mainsearch', 'antvG6', 'antvX6', 'tree', 'dashboard', 'chart') } this.pasteFormRef.handleConfirm().then(res => { diff --git a/src/router/index.js b/src/router/index.js index 07613bd..efa1c0c 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -50,6 +50,8 @@ {path: '/proc', name: 'proc', component: SystemProc}, {path: '/iframe/:menuId/:loginUid', name: 'iframe', component: MkIframe}, {path: '/iframe/:menuId/:loginUid/:bid', name: 'iframe', component: MkIframe}, + {path: '/view/:menuId', name: 'iframe', component: MkIframe}, + {path: '/view/:menuId/:bid', name: 'iframe', component: MkIframe}, {path: '/interface', name: 'interface', component: Interface} ] diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index f87948f..33e1622 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -200,11 +200,6 @@ // } let Id = '' - let con = '?' - - if (/\?/ig.test(url)) { - con = '&' - } if (cards.subtype === 'propcard' && cardCell) { Id = cardCell.setting.primaryId || '' @@ -213,6 +208,12 @@ } if (card.joint === 'true') { + let con = '?' + + if (/\?/ig.test(url)) { + con = '&' + } + url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` } @@ -987,6 +988,7 @@ <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> <NewPageButton btn={card} + BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} selectedData={_data} diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx index 467d0da..784e4a6 100644 --- a/src/tabviews/custom/components/chart/antv-X6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx @@ -1,8 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, Tooltip, Empty, message, Modal, notification } from 'antd' -import { VerticalAlignTopOutlined, VerticalAlignBottomOutlined, SaveOutlined, ZoomInOutlined, ZoomOutOutlined, OneToOneOutlined, DownloadOutlined } from '@ant-design/icons' +import { Spin, Tooltip, message, Modal, notification } from 'antd' +import { UndoOutlined, RedoOutlined, VerticalAlignTopOutlined, VerticalAlignBottomOutlined, SaveOutlined, ZoomInOutlined, ZoomOutOutlined, OneToOneOutlined } from '@ant-design/icons' import { Graph, Shape } from '@antv/x6' import { Stencil } from '@antv/x6-plugin-stencil' import { Transform } from '@antv/x6-plugin-transform' @@ -14,10 +14,11 @@ import { Export } from '@antv/x6-plugin-export' import Api from '@/api' -import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import NormalHeader from '@/tabviews/custom/components/share/normalheader' +import lanes from '@/menu/components/chart/antv-X6/lane.json' +import xflows from '@/menu/components/chart/antv-X6/xflow.json' import './index.scss' const NodeUpdate = asyncComponent(() => import('./nodeupdate')) @@ -334,20 +335,19 @@ class antvX6Chart extends Component { static propTpyes = { - config: PropTypes.object, - mainSearch: PropTypes.any + config: PropTypes.object } state = { config: null, editing: false, node: null, - arr_field: 'id,cells', loading: false } selectNode = null mkGraph = null + cells = [] UNSAFE_componentWillMount () { const { config } = this.props @@ -356,8 +356,14 @@ let BID = '' let BData = '' - if (config.setting.supModule) { - BData = window.GLOB.CacheData.get(config.setting.supModule) + _config.setting.supModule = '' + + if (_config.plot.supModule && _config.plot.supModule.length > 0) { + _config.setting.supModule = _config.plot.supModule.pop() + } + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) } else { BData = window.GLOB.CacheData.get(config.$pageId) } @@ -371,12 +377,13 @@ BData: BData || '', plot: _config.plot }, () => { - if (config.setting.onload === 'true') { - setTimeout(() => { - this.loadData() - }, _config.setting.delay || 0) - } + this.loadData() }) + } + + componentDidMount () { + MKEmitter.addListener('reloadData', this.reloadData) + MKEmitter.addListener('resetSelectLine', this.resetParentParam) } shouldComponentUpdate (nextProps, nextState) { @@ -390,24 +397,38 @@ this.setState = () => { return } + + MKEmitter.removeListener('reloadData', this.reloadData) + MKEmitter.removeListener('resetSelectLine', this.resetParentParam) + } + + reloadData = (menuId) => { + const { config } = this.state + + if (config.uuid !== menuId) return + + this.loadData() + } + + resetParentParam = (MenuID, id) => { + const { config } = this.state + + if (!config.setting.supModule || config.setting.supModule !== MenuID) return + if (id !== this.state.BID || id !== '') { + this.setState({ BID: id }, () => { + this.loadData() + }) + } } async loadData () { - const { mainSearch } = this.props - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� if (!is(fromJS(this.data), fromJS([]))) { - this.data = [] + this.cells = [] this.handleData() } - return - } - - let searches = config.setting.useMSearch && mainSearch ? mainSearch : [] - - let requireFields = searches.filter(item => item.required && item.value === '') - if (requireFields.length > 0) { return } @@ -415,23 +436,35 @@ loading: true }) - let _orderBy = config.setting.order || '' - let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) + if (config) { + if (config.plot.subtype === 'xflow') { + this.cells = xflows + } else { + this.cells = lanes + } + this.handleData() + + setTimeout(() => { + this.setState({ + loading: false + }) + }, 2000) + return + } + + let param = { + func: '', + BID: BID + } let result = await Api.genericInterface(param) if (result.status) { - if (config.$cache && config.setting.onload !== 'false') { - Api.writeCacheConfig(config.uuid, result.data || '') - } - this.setState({ loading: false }) - if (!is(fromJS(this.data), fromJS(result.data || []))) { - this.data = result.data || [] - this.handleData() - } + this.cells = result.data || [] + this.handleData() if (result.message) { if (result.ErrCode === 'Y') { @@ -484,10 +517,196 @@ viewrender = () => { const { plot } = this.state - if (plot.subtype === 'xflow') { - this.xflowrender() - } else if (plot.subtype === 'lane') { - this.lanerender() + if (plot.function === 'show') { + if (plot.subtype === 'xflow') { + this.xflowSrender() + } else if (plot.subtype === 'lane') { + this.laneSrender() + } + } else { + if (plot.subtype === 'xflow') { + this.xflowrender() + } else if (plot.subtype === 'lane') { + this.lanerender() + } + } + } + + xflowSrender = () => { + const { config } = this.state + + const graph = new Graph({ + container: document.getElementById(config.uuid + 'container'), + grid: config.plot.grid, + scaling: { + min: 0.5, + max: 2 + }, + autoResize: true, + panning: true, + background: { + color: config.plot.backgroundColor || 'transparent' + }, + mousewheel: { + enabled: true, + zoomAtMousePosition: true, + modifiers: 'ctrl' + }, + connecting: { + router: 'manhattan', + connector: { + name: 'rounded', + args: { + radius: 8 + } + }, + anchor: 'center', + connectionPoint: 'anchor', + allowBlank: false, + snap: { + radius: 20 + }, + createEdge() { + return new Shape.Edge({ + attrs: { + line: { + stroke: '#000000', + strokeWidth: 1, + targetMarker: { + name: 'block', + width: 12, + height: 8 + } + } + }, + zIndex: 0 + }) + }, + validateConnection({ targetMagnet }) { + return !!targetMagnet + } + }, + highlighting: { + magnetAdsorbed: { + name: 'stroke', + args: { + attrs: { + fill: '#5F95FF', + stroke: '#5F95FF' + } + } + } + } + }) + + if (this.cells.length > 0) { + let cells = [] + this.cells.forEach((item) => { + if (item.shape === 'edge') { + cells.push(graph.createEdge(item)) + } else { + cells.push(graph.createNode(item)) + } + }) + graph.resetCells(cells) + graph.positionContent('center') + } + } + + laneSrender = () => { + const { config } = this.state + + const graph = new Graph({ + container: document.getElementById(config.uuid + 'container'), + scaling: { + min: 0.5, + max: 2 + }, + autoResize: true, + panning: true, + background: { color: '#ffffff' }, + mousewheel: { + enabled: true, + zoomAtMousePosition: true, + modifiers: 'ctrl' + }, + connecting: { + router: 'manhattan', + connector: { + name: 'rounded', + args: { + radius: 8 + } + }, + anchor: 'center', + connectionPoint: 'anchor', + allowBlank: false, + snap: { + radius: 20 + }, + createEdge() { + return new Shape.Edge({ + attrs: { + line: { + stroke: '#000000', + strokeWidth: 1, + targetMarker: { + name: 'block', + width: 12, + height: 8 + } + } + }, + zIndex: 2 + }) + }, + validateConnection({ targetMagnet }) { + return !!targetMagnet + } + }, + highlighting: { + magnetAdsorbed: { + name: 'stroke', + args: { + attrs: { + fill: '#5F95FF', + stroke: '#5F95FF' + } + } + } + }, + translating: { + restrict(cellView) { + const cell = cellView.cell + const parentId = cell.prop('parent') + + if (parentId) { + const parentNode = graph.getCellById(parentId) + if (parentNode) { + return parentNode.getBBox().moveAndExpand({ + x: 0, + y: 36, + width: 0, + height: -36, + }) + } + } + return cell.getBBox() + } + } + }) + + if (this.cells.length > 0) { + let cells = [] + this.cells.forEach((item) => { + if (item.shape === 'edge') { + cells.push(graph.createEdge(item)) + } else { + cells.push(graph.createNode(item)) + } + }) + graph.resetCells(cells) + graph.positionContent('top') } } @@ -745,6 +964,19 @@ }) stencil.load([p1, p2, p3], 'group2') + + if (this.cells.length > 0) { + let cells = [] + this.cells.forEach((item) => { + if (item.shape === 'edge') { + cells.push(graph.createEdge(item)) + } else { + cells.push(graph.createNode(item)) + } + }) + graph.resetCells(cells) + graph.positionContent('center') + } this.mkGraph = graph } @@ -1047,17 +1279,18 @@ stencil.load([g1], 'group3') - // let data = [{"id":"1","shape":"lane","width":260,"height":500,"position":{"x":0,"y":0},"label":"闃舵1", preId: '', nextId: '2'},{"id":"2","shape":"lane","width":200,"height":500,"position":{"x":260,"y":0},"label":"<Function>", preId: '1', nextId: '3'},{"id":"3","shape":"lane","width":200,"height":500,"position":{"x":460,"y":0},"label":"<Function>", preId: '2', nextId: '4'},{"id":"4","shape":"lane","width":200,"height":500,"position":{"x":660,"y":0},"label":"<Function>", preId: '3', nextId: ''}] - // let cells = [] - // data.forEach((item) => { - // if (item.shape === 'edge') { - // cells.push(graph.createEdge(item)) - // } else { - // cells.push(graph.createNode(item)) - // } - // }) - // graph.resetCells(cells) - // graph.zoomToFit({ padding: 10, maxScale: 1 }) + if (this.cells.length > 0) { + let cells = [] + this.cells.forEach((item) => { + if (item.shape === 'edge') { + cells.push(graph.createEdge(item)) + } else { + cells.push(graph.createNode(item)) + } + }) + graph.resetCells(cells) + graph.positionContent('top') + } this.mkGraph = graph } @@ -1081,6 +1314,18 @@ } // zoom() 鍙幏鍙栨垨鑰呰缃缉鏀炬瘮渚� + setback = () => { + if (this.mkGraph.canUndo()) { + this.mkGraph.undo() + } + } + + setprev = () => { + if (this.mkGraph.canRedo()) { + this.mkGraph.redo() + } + } + setZoomIn = () => { this.mkGraph.zoom(0.1) } @@ -1095,11 +1340,12 @@ save = () => { // let nodes = this.mkGraph.toJSON() - } - - savePicture = () => { - const { config } = this.state - this.mkGraph.exportPNG(config.name, {padding: 20}) + // this.mkGraph.toPNG((dataUri) => { + // Api.fileuploadbase64({ + // Base64Img: dataUri + // }).then(res => { + // }) + // }, {padding: 20}) } addLane = (cell, graph) => { @@ -1297,7 +1543,30 @@ } render() { - const { loading, config, empty, node } = this.state + const { loading, config, node } = this.state + + let style = {...config.style} + + if (config.plot.function === 'show') { + if (config.plot.empty === 'hidden' && this.cells.length === 0) { + style.display = 'none' + } + + return ( + <div className="custom-x6-plot-box" id={'anchor' + config.uuid} style={config.style}> + {loading ? + <div className="loading-mask"> + <div className="ant-spin-blur"></div> + <Spin /> + </div> : null + } + <NormalHeader config={config} /> + <div className="canvas" style={{width: '100%', minHeight: config.plot.height, height: config.plot.height}} id={config.uuid + 'canvas'}> + <div id={config.uuid + 'container'} className="mk-container"></div> + </div> + </div> + ) + } return ( <div className="custom-x6-plot-box" id={'anchor' + config.uuid} style={config.style}> @@ -1308,7 +1577,6 @@ </div> : null } <NormalHeader config={config} /> - {empty ? <Empty description={false}/> : null} <div className="mk-toolbar"> <div className="left-tool"> {config.plot.subtype === 'xflow' ? <Tooltip title="缃墠"> @@ -1317,14 +1585,6 @@ {config.plot.subtype === 'xflow' ? <Tooltip title="缃悗"> <VerticalAlignBottomOutlined onClick={this.setBottom}/> </Tooltip> : null} - <Tooltip title="淇濆瓨"> - <SaveOutlined onClick={this.save}/> - </Tooltip> - {config.plot.export === 'png' ? <Tooltip title="瀵煎嚭鍥剧墖"> - <DownloadOutlined onClick={this.savePicture}/> - </Tooltip> : null} - </div> - <div className="right-tool"> <Tooltip title="鏀惧ぇ"> <ZoomInOutlined onClick={this.setZoomIn}/> </Tooltip> @@ -1334,6 +1594,17 @@ <Tooltip title="1:1"> <OneToOneOutlined onClick={this.setZoomInt}/> </Tooltip> + <Tooltip title="鍚庨��"> + <UndoOutlined onClick={this.setback}/> + </Tooltip> + <Tooltip title="鍓嶈繘"> + <RedoOutlined onClick={this.setprev}/> + </Tooltip> + </div> + <div className="right-tool"> + <Tooltip title="淇濆瓨"> + <SaveOutlined onClick={this.save}/> + </Tooltip> </div> </div> <div className="canvas" style={{width: '100%', minHeight: config.plot.height, height: config.plot.height}} id={config.uuid + 'canvas'}> diff --git a/src/tabviews/custom/components/chart/antv-X6/index.scss b/src/tabviews/custom/components/chart/antv-X6/index.scss index e335bc1..7bf3861 100644 --- a/src/tabviews/custom/components/chart/antv-X6/index.scss +++ b/src/tabviews/custom/components/chart/antv-X6/index.scss @@ -9,7 +9,7 @@ .mk-toolbar { width: 100%; height: 40px; - border: 1px solid #1890ff; + border-bottom: 1px solid #dfe3e8; .left-tool { float: left; @@ -184,4 +184,24 @@ z-index: 1; } } + .loading-mask { + position: absolute; + left: 0px; + top: 0; + right: 0px; + bottom: 0px; + display: flex; + align-items: center; + justify-content: center; + text-align: justify; + z-index: 3; + + .ant-spin-blur { + position: absolute; + width: 100%; + height: 100%; + opacity: 0.5; + background: #ffffff; + } + } } diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 710b433..68651c3 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -17,7 +17,6 @@ import NormalHeader from '@/tabviews/custom/components/share/normalheader' import './index.scss' -// const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) const ExcelOutButton = asyncComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton')) const ExcelInButton = asyncComponent(() => import('@/tabviews/zshare/actionList/excelInbutton')) diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx index 6cbc3cb..407241a 100644 --- a/src/tabviews/custom/components/group/normal-group/index.jsx +++ b/src/tabviews/custom/components/group/normal-group/index.jsx @@ -35,6 +35,7 @@ const TimeLine = asyncComponent(() => import('@/tabviews/custom/components/timeline/normal-timeline')) const CustomChart = asyncComponent(() => import('@/tabviews/custom/components/chart/custom-chart')) const AntvG6 = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-G6')) +const AntvX6 = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-X6')) class TabTransfer extends Component { static propTpyes = { @@ -290,6 +291,12 @@ <AntvG6 config={item} data={data} mainSearch={mainSearch}/> </Col> ) + } else if (item.type === 'antvX6') { + return ( + <Col span={item.width} style={style} key={item.uuid}> + <AntvX6 config={item}/> + </Col> + ) } else { return null } diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx index 79c6827..f2be4a6 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.jsx +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -39,6 +39,7 @@ const CustomChart = asyncComponent(() => import('@/tabviews/custom/components/chart/custom-chart')) const MkBaseTable = asyncComponent(() => import('@/tabviews/custom/components/table/base-table')) const AntvG6 = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-G6')) +const AntvX6 = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-X6')) class TabTransfer extends Component { static propTpyes = { @@ -345,6 +346,12 @@ <AntvG6 config={item} data={data} mainSearch={mainSearch}/> </Col> ) + } else if (item.type === 'antvX6') { + return ( + <Col span={item.width} style={style} key={item.uuid}> + <AntvX6 config={item}/> + </Col> + ) } else { return null } diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 8584e63..c34c160 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -440,7 +440,7 @@ item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName) return true - } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { + } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) { if ( item.plot.blacklist && item.plot.blacklist.length > 0 && item.plot.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0 @@ -1434,7 +1434,7 @@ } else if (item.type === 'antvX6') { return ( <Col span={item.width} style={style} key={item.uuid}> - <AntvX6 config={item} mainSearch={mainSearch}/> + <AntvX6 config={item}/> </Col> ) } else if (item.type === 'module' && item.subtype === 'voucher') { diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 8be4069..67bdd49 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -41,6 +41,7 @@ const Voucher = asyncComponent(() => import('../components/module/voucher')) const Iframe = asyncComponent(() => import('../components/iframe')) const AntvG6 = asyncComponent(() => import('../components/chart/antv-G6')) +const AntvX6 = asyncComponent(() => import('../components/chart/antv-X6')) class CustomPage extends Component { static propTpyes = { @@ -1075,6 +1076,12 @@ <AntvG6 config={item} data={data} mainSearch={mainSearch}/> </Col> ) + } else if (item.type === 'antvX6') { + return ( + <Col span={item.width} style={style} key={item.uuid}> + <AntvX6 config={item}/> + </Col> + ) } else { return null } diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 8723fa0..4852e23 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -129,6 +129,7 @@ key={item.uuid} show={item.show || 'actionList'} disabled={false} + BID={BID} btn={item} BData={BData} selectedData={selectedData} diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index 94e7202..c8f8539 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -13,6 +13,7 @@ class NewPageButton extends Component { static propTpyes = { + BID: PropTypes.any, // BID BData: PropTypes.any, // 涓昏〃鏁版嵁 btn: PropTypes.object, // 鎸夐挳 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 @@ -102,7 +103,7 @@ * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ actionTrigger = (triggerId, record, type) => { - const { btn, selectedData } = this.props + const { btn, selectedData, BID } = this.props const { disabled } = this.state if (disabled) return @@ -192,10 +193,19 @@ }) window.open(url) } else if (btn.pageTemplate === 'custom') { - if (/#\/iframe\//.test(btn.url)) { - let url = btn.url.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID')) + let url = btn.url + if (window.GLOB.systemType === 'production' && btn.proUrl) { + url = btn.proUrl + } - if (btn.Ot === 'requiredSgl' && btn.joint !== 'false') { + if (btn.Ot === 'notRequired' && BID) { + Id = BID + } + + if (/#\/iframe\//.test(url)) { + url = url.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID')) + + if (btn.joint === 'true' && Id) { url = url + '/' + Id } @@ -211,19 +221,16 @@ return } - let url = btn.url let con = '?' if (/\?/ig.test(url)) { con = '&' } - - if (btn.Ot === 'requiredSgl' && btn.joint !== 'false') { + + if (btn.joint === 'true') { url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` - } else if (btn.Ot === 'requiredSgl' && btn.joint === 'false') { + } else if (Id) { url = url + `${con}id=${Id}` - } else if (btn.joint !== 'false') { - url = url + `${con}appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` } window.open(url) diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index 9a7662a..7a7fee1 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -177,9 +177,14 @@ } } - MKEmitter.emit('modifyTabs', newtab, true) + if (btn.openTab === 'view') { + window.open('#/view/' + newtab.MenuID + '/' + primaryId) + } else { + MKEmitter.emit('modifyTabs', newtab, true) + + MKEmitter.emit('openNewTab') + } - MKEmitter.emit('openNewTab') if (window.GLOB.systemType === 'production') { MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '鏍囩椤�'}) } diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 2f6d9ab..ea0c51a 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -710,7 +710,7 @@ } if (item.joint === 'true' && _href) { - let _quary = `id=${record[this.props.setting.primaryKey]}&userid=${sessionStorage.getItem('UserID')}&appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}` + let _quary = `id=${record[this.props.setting.primaryKey]}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID')}` let _param = '' try { @@ -783,6 +783,7 @@ <NewPageButton key={btn.uuid} btn={btn} + BID={record.$$BID} disabled={record.$disabled} selectedData={[record]} BData={this.props.BData} @@ -912,7 +913,7 @@ } if (col.joint === 'true' && _href) { - let _quary = `id=${record[this.props.setting.primaryKey]}&userid=${sessionStorage.getItem('UserID')}&appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}` + let _quary = `id=${record[this.props.setting.primaryKey]}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID')}` let _param = '' try { diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index de28f47..a7be0ab 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -29,6 +29,7 @@ const BraftEditor = asyncComponent(() => import('@/tabviews/custom/components/editor/braft-editor')) const Balcony = asyncComponent(() => import('@/tabviews/custom/components/card/balcony')) const AntvG6 = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-G6')) +const AntvX6 = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-X6')) const DebugTable = asyncComponent(() => import('@/tabviews/debugtable')) class BillPrint extends Component { @@ -961,6 +962,12 @@ <AntvG6 config={item} initdata={item.data} mainSearch={[]}/> </Col> ) + } else if (item.type === 'antvX6') { + return ( + <Col span={item.width} style={style} key={item.uuid}> + <AntvX6 config={item}/> + </Col> + ) } else { return null } diff --git a/src/views/menudesign/menuform/index.jsx b/src/views/menudesign/menuform/index.jsx index f746df1..f7dd467 100644 --- a/src/views/menudesign/menuform/index.jsx +++ b/src/views/menudesign/menuform/index.jsx @@ -293,17 +293,13 @@ <Form.Item label="鎵撳紑鏂瑰紡"> {getFieldDecorator('OpenType', { initialValue: config.OpenType || 'newtab', - rules: [ - { - required: true, - message: '璇烽�夋嫨鎵撳紑鏂瑰紡!' - } - ] + rules: [{ required: true, message: '璇烽�夋嫨鎵撳紑鏂瑰紡!' }] })( - <Radio.Group onChange={(e) => {this.selectChange('OpenType', e.target.value)}}> - <Radio value="newtab">鏍囩椤�</Radio> - <Radio value="newpage">鏂伴〉闈�</Radio> - </Radio.Group> + <Select onChange={(value) => {this.selectChange('OpenType', value)}}> + <Select.Option value="newtab">鏍囩椤�</Select.Option> + <Select.Option value="newpage">鏂伴〉闈紙鏍囩椤碉級</Select.Option> + <Select.Option value="view">鏂伴〉闈紙鍏ㄥ睆锛�</Select.Option> + </Select> )} </Form.Item> </Col> diff --git a/src/views/mkiframe/index.jsx b/src/views/mkiframe/index.jsx index e443da7..b2f079b 100644 --- a/src/views/mkiframe/index.jsx +++ b/src/views/mkiframe/index.jsx @@ -3,6 +3,7 @@ import Api from '@/api' import asyncComponent from '@/utils/asyncLoadComponent' +import MKEmitter from '@/utils/events.js' import './index.scss' const CustomPage = asyncComponent(() => import('@/tabviews/custom')) @@ -17,9 +18,33 @@ } UNSAFE_componentWillMount() { - const { menuId, loginUid, bid } = this.props.match.params + const { params, path } = this.props.match + const { menuId, loginUid, bid } = params - if (sessionStorage.getItem('UserID')) { + if (/^\/view\//.test(path)) { + localStorage.setItem('getSysPermission', window.GLOB.appkey) + + window.addEventListener('storage', function(event) { + if (event.key === 'sysPermissions' && event.newValue) { + let values = event.newValue + values = JSON.parse(values) + + window.GLOB.mkThdMenus = values.mkThdMenus + window.GLOB.mkActions = values.mkActions + } + }) + + setTimeout(() => { + localStorage.removeItem('getSysPermission') + localStorage.removeItem('sysPermissions') + + if (window.GLOB.mkActions) { + this.setState({loading: false}) + } else { + this.getPermRole() + } + }, 20) + } else if (sessionStorage.getItem('UserID')) { this.getPermRole() } else { sessionStorage.setItem('LoginUID', loginUid) @@ -49,6 +74,67 @@ this.setState({BID: bid || '', MenuId: menuId}) } + componentDidMount () { + MKEmitter.addListener('modifyTabs', this.modifyTabs) + MKEmitter.addListener('closeTabView', this.closeTabView) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('modifyTabs', this.modifyTabs) + MKEmitter.removeListener('closeTabView', this.closeTabView) + } + + modifyTabs = (tab) => { + const { MenuId, BID } = this.state + + let _menuId = tab.MenuID + let _BID = tab.param && tab.param.$BID ? tab.param.$BID : '' + + let historys = sessionStorage.getItem('page_historys') + historys = historys ? JSON.parse(historys) : [] + + historys.push({MenuId: MenuId, BID: BID}) + + sessionStorage.setItem('page_historys', JSON.stringify(historys)) + + this.setState({ + MenuId: _menuId, + BID: _BID, + loading: true + }, () => { + this.setState({ + loading: false + }) + }) + } + + closeTabView = () => { + let historys = sessionStorage.getItem('page_historys') + historys = historys ? JSON.parse(historys) : [] + + if (historys.length === 0) return + + let tab = historys.shift() + + sessionStorage.setItem('page_historys', JSON.stringify(historys)) + + this.setState({ + MenuId: tab.MenuId, + BID: tab.BID, + loading: true + }, () => { + this.setState({ + loading: false + }) + }) + } + getPermRole = () => { Api.getSystemConfig({ func: 's_Get_TrdMenu_Role', diff --git a/src/views/tabledesign/menuform/index.jsx b/src/views/tabledesign/menuform/index.jsx index fe0a8e6..06fedc7 100644 --- a/src/views/tabledesign/menuform/index.jsx +++ b/src/views/tabledesign/menuform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, notification, Radio, Switch } from 'antd' +import { Form, Row, Col, Input, Select, notification, Switch } from 'antd' import Api from '@/api' import options from '@/store/options.js' @@ -324,10 +324,11 @@ } ] })( - <Radio.Group onChange={(e) => {this.selectChange('OpenType', e.target.value)}}> - <Radio value="newtab">鏍囩椤�</Radio> - <Radio value="newpage">鏂伴〉闈�</Radio> - </Radio.Group> + <Select onChange={(value) => {this.selectChange('OpenType', value)}}> + <Select.Option value="newtab">鏍囩椤�</Select.Option> + <Select.Option value="newpage">鏂伴〉闈紙鏍囩椤碉級</Select.Option> + <Select.Option value="view">鏂伴〉闈紙鍏ㄥ睆锛�</Select.Option> + </Select> )} </Form.Item> </Col> -- Gitblit v1.8.0