From 8f394e7ef20cc0abba3f47c23a63b069e9dd0e45 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 19 十月 2022 15:09:30 +0800 Subject: [PATCH] 2022-10-19 --- src/menu/components/timeline/normal-timeline/index.jsx | 2 src/menu/components/card/table-card/index.jsx | 10 src/mob/components/tabs/antv-tabs/index.jsx | 125 +---- src/tabviews/zshare/normalTable/index.jsx | 2 src/utils/utils-custom.js | 41 - public/options.json | 10 src/menu/components/module/voucher/index.jsx | 2 src/menu/components/chart/antv-scatter/index.jsx | 11 src/menu/components/tabs/tabcomponents/index.jsx | 12 src/mob/components/official/index.jsx | 2 src/menu/components/tree/antd-tree/index.jsx | 10 src/tabviews/zshare/actionList/newpagebutton/index.jsx | 7 src/menu/stylecombcontroller/index.jsx | 10 src/menu/tableshell/card.jsx | 2 src/views/mobdesign/index.jsx | 34 - src/views/interface/history/index.jsx | 8 src/views/menudesign/index.jsx | 24 - src/tabviews/custom/components/card/cardcellList/index.jsx | 2 src/menu/components/card/cardcellcomponent/index.jsx | 4 src/menu/components/form/tab-form/index.jsx | 32 - src/mob/components/menubar/normal-menubar/index.jsx | 10 src/menu/components/carousel/prop-card/index.jsx | 32 - src/menu/pastecontroller/index.jsx | 7 src/menu/components/card/data-card/index.jsx | 10 src/menu/components/chart/antv-pie/index.jsx | 11 src/views/popdesign/index.jsx | 24 - src/menu/components/chart/antv-dashboard/index.jsx | 11 src/mob/components/menubar/common-menubar/index.jsx | 10 src/menu/components/card/prop-card/index.jsx | 29 - src/menu/components/table/normal-table/index.jsx | 10 src/menu/components/tabs/antv-tabs/index.jsx | 125 +---- src/tabviews/zshare/cardcomponent/index.jsx | 2 src/menu/components/group/normal-group/index.jsx | 53 -- src/menu/components/tabs/paste/index.jsx | 18 src/pc/components/navbar/normal-navbar/index.jsx | 9 src/menu/components/group/groupcomponents/index.jsx | 2 src/menu/components/chart/chart-custom/index.jsx | 11 src/menu/components/tabs/table-tabs/index.jsx | 116 ----- src/menu/components/card/cardcellcomponent/dragaction/card.jsx | 2 src/menu/components/form/simple-form/index.jsx | 32 - src/menu/components/chart/antv-bar/index.jsx | 11 src/menu/components/code/sandbox/index.jsx | 10 src/views/tabledesign/index.jsx | 4 src/mob/components/tabs/tabcomponents/index.jsx | 22 - src/tabviews/zshare/actionList/index.jsx | 2 src/menu/components/table/edit-table/index.jsx | 10 src/menu/components/carousel/data-card/index.jsx | 10 src/mob/components/search/single-search/index.jsx | 10 src/menu/components/card/balcony/index.jsx | 2 src/tabviews/zshare/actionList/tabbutton/index.jsx | 9 src/menu/components/form/step-form/index.jsx | 32 - src/views/pcdesign/index.jsx | 24 - src/menu/components/search/main-search/index.jsx | 10 src/pc/components/login/normal-login/index.jsx | 10 src/mob/components/topbar/normal-navbar/index.jsx | 9 src/menu/components/editor/braft-editor/index.jsx | 10 src/menu/stylecombcontrolbutton/index.jsx | 163 +++--- src/menu/components/table/base-table/index.jsx | 2 58 files changed, 332 insertions(+), 892 deletions(-) diff --git a/public/options.json b/public/options.json index 32085f0..ea0061e 100644 --- a/public/options.json +++ b/public/options.json @@ -1,12 +1,12 @@ { - "appId": "202108312122504607B107A83F55B40C98CCF", - "appkey": "20210831212235413F287EC3BF489424496C8", + "appId": "201912040924165801464FF1788654BC5AC73", + "appkey": "20191106103859640976D6E924E464D029CF0", "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", "systemType": "", "externalDatabase": "false", "lineColor": "", "filter": "false", - "defaultApp": "mkindustry", + "defaultApp": "mk", "defaultLang": "zh-CN", "WXAppID": "", "WXminiAppID": "", @@ -17,6 +17,6 @@ "transfer": "false", "keepPassword": "true", "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], - "host": "http://demo.mk9h.cn", - "service": "erp_new/" + "host": "http://qingqiumarket.cn", + "service": "MKWMS/" } \ No newline at end of file diff --git a/src/menu/components/card/balcony/index.jsx b/src/menu/components/card/balcony/index.jsx index 114c9ba..31c5004 100644 --- a/src/menu/components/card/balcony/index.jsx +++ b/src/menu/components/card/balcony/index.jsx @@ -39,8 +39,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� diff --git a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx index e0c82a5..0410a0b 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx @@ -181,7 +181,7 @@ const clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'cardcell') { e.stopPropagation() - MKEmitter.emit('clickComponent', card, parent, 'cardcell') + MKEmitter.emit('clickComponent', card.uuid, parent.uuid) } } diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 2cb20e5..8ab612e 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -99,9 +99,7 @@ if (cardCell.uuid !== parentId) return - const { elements } = this.state - - let _elements = elements.map(item => { + let _elements = this.state.elements.map(item => { if (keys.includes(item.uuid)) { return this.resetCardStyle(item, {...item.style, ...style}) } diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 74ab7e1..7e33108 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -46,8 +46,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: true, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -661,7 +659,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx index d379bfc..0bec608 100644 --- a/src/menu/components/card/prop-card/index.jsx +++ b/src/menu/components/card/prop-card/index.jsx @@ -44,8 +44,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: true, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -107,7 +105,6 @@ componentDidMount () { MKEmitter.addListener('mkUpdateInter', this.mkUpdateInter) - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } shouldComponentUpdate (nextProps, nextState) { @@ -122,24 +119,6 @@ return } MKEmitter.removeListener('mkUpdateInter', this.mkUpdateInter) - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) - } - - updateComponentStyle = (parentId, keys, style) => { - const { card } = this.state - - if (card.uuid !== parentId) return - - let subcards = card.subcards.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({card: {...card, subcards: []}}, () => { - this.updateComponent({...card, subcards: subcards}) - }) } mkUpdateInter = (inter, split) => { @@ -540,7 +519,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 6f24dab..91e11b6 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -45,8 +45,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -499,7 +497,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/carousel/data-card/index.jsx b/src/menu/components/carousel/data-card/index.jsx index d4af996..820ee56 100644 --- a/src/menu/components/carousel/data-card/index.jsx +++ b/src/menu/components/carousel/data-card/index.jsx @@ -41,8 +41,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -235,7 +233,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/carousel/prop-card/index.jsx b/src/menu/components/carousel/prop-card/index.jsx index bb43d43..30a541e 100644 --- a/src/menu/components/carousel/prop-card/index.jsx +++ b/src/menu/components/carousel/prop-card/index.jsx @@ -42,8 +42,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -92,10 +90,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -107,24 +101,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) - } - - updateComponentStyle = (parentId, keys, style) => { - const { card } = this.state - - if (card.uuid !== parentId) return - - let subcards = card.subcards.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({card: {...card, subcards: []}}, () => { - this.updateComponent({...card, subcards: subcards}) - }) } /** @@ -322,7 +298,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 51de3eb..319cd3f 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -67,8 +67,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: card.type === 'bar' ? true : false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -143,7 +141,7 @@ handleTabsChange = (parentId) => { const { card } = this.state - if (parentId === card.parentId || parentId === 'all') { + if (parentId.indexOf(card.uuid) > -1 || parentId === 'all') { let _element = document.getElementById(card.uuid + 'canvas') if (_element) { _element.innerHTML = '' @@ -1345,7 +1343,12 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.updateComponent(_card) + }) } } diff --git a/src/menu/components/chart/antv-dashboard/index.jsx b/src/menu/components/chart/antv-dashboard/index.jsx index b05efaa..22f6b8e 100644 --- a/src/menu/components/chart/antv-dashboard/index.jsx +++ b/src/menu/components/chart/antv-dashboard/index.jsx @@ -110,8 +110,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: card.subtype === 'ratioboard' ? 'array' : 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -177,7 +175,7 @@ handleTabsChange = (parentId) => { const { card } = this.state - if (parentId === card.parentId || parentId === 'all') { + if (parentId.indexOf(card.uuid) > -1 || parentId === 'all') { let _element = document.getElementById(card.uuid + 'dashboard') if (_element) { _element.innerHTML = '' @@ -522,7 +520,12 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.updateComponent(_card) + }) } } diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index d8aa2b3..9009ffd 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -60,8 +60,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -134,7 +132,7 @@ handleTabsChange = (parentId) => { const { card } = this.state - if (parentId === card.parentId || parentId === 'all') { + if (parentId.indexOf(card.uuid) > -1 || parentId === 'all') { let _element = document.getElementById(card.uuid + 'canvas') if (_element) { _element.innerHTML = '' @@ -679,7 +677,12 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.updateComponent(_card) + }) } } diff --git a/src/menu/components/chart/antv-scatter/index.jsx b/src/menu/components/chart/antv-scatter/index.jsx index bfc607a..2180026 100644 --- a/src/menu/components/chart/antv-scatter/index.jsx +++ b/src/menu/components/chart/antv-scatter/index.jsx @@ -54,8 +54,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -131,7 +129,7 @@ handleTabsChange = (parentId) => { const { card } = this.state - if (parentId === card.parentId || parentId === 'all') { + if (parentId.indexOf(card.uuid) > -1 || parentId === 'all') { let _element = document.getElementById(card.uuid + 'canvas') if (_element) { _element.innerHTML = '' @@ -364,7 +362,12 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.updateComponent(_card) + }) } } diff --git a/src/menu/components/chart/chart-custom/index.jsx b/src/menu/components/chart/chart-custom/index.jsx index 4a1590c..d5ea198 100644 --- a/src/menu/components/chart/chart-custom/index.jsx +++ b/src/menu/components/chart/chart-custom/index.jsx @@ -47,8 +47,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -118,7 +116,7 @@ handleTabsChange = (parentId) => { const { card } = this.state - if (parentId === card.parentId || parentId === 'all') { + if (parentId.indexOf(card.uuid) > -1 || parentId === 'all') { let _element = document.getElementById(card.uuid + 'canvas') if (_element) { _element.innerHTML = '' @@ -245,7 +243,12 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.updateComponent(_card) + }) } } diff --git a/src/menu/components/code/sandbox/index.jsx b/src/menu/components/code/sandbox/index.jsx index 4f4d644..635e948 100644 --- a/src/menu/components/code/sandbox/index.jsx +++ b/src/menu/components/code/sandbox/index.jsx @@ -38,8 +38,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -149,7 +147,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/editor/braft-editor/index.jsx b/src/menu/components/editor/braft-editor/index.jsx index bcb095f..a8d23f8 100644 --- a/src/menu/components/editor/braft-editor/index.jsx +++ b/src/menu/components/editor/braft-editor/index.jsx @@ -39,8 +39,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -152,7 +150,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index 20e3704..3b87f6c 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -55,8 +55,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -107,10 +105,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -122,24 +116,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) - } - - updateComponentStyle = (parentId, keys, style) => { - const { card } = this.state - - if (card.uuid !== parentId) return - - let subcards = card.subcards.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({card: {...card, subcards: []}}, () => { - this.updateComponent({...card, subcards: subcards}) - }) } /** @@ -644,7 +620,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx index 83e0c76..a28b55f 100644 --- a/src/menu/components/form/step-form/index.jsx +++ b/src/menu/components/form/step-form/index.jsx @@ -56,8 +56,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -114,10 +112,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -129,24 +123,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) - } - - updateComponentStyle = (parentId, keys, style) => { - const { card } = this.state - - if (card.uuid !== parentId) return - - let subcards = card.subcards.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({card: {...card, subcards: []}}, () => { - this.updateComponent({...card, subcards: subcards}) - }) } /** @@ -727,7 +703,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/form/tab-form/index.jsx b/src/menu/components/form/tab-form/index.jsx index bcc0621..b5ccead 100644 --- a/src/menu/components/form/tab-form/index.jsx +++ b/src/menu/components/form/tab-form/index.jsx @@ -56,8 +56,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -126,10 +124,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -141,24 +135,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) - } - - updateComponentStyle = (parentId, keys, style) => { - const { card } = this.state - - if (card.uuid !== parentId) return - - let subcards = card.subcards.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({card: {...card, subcards: []}}, () => { - this.updateComponent({...card, subcards: subcards}) - }) } /** @@ -753,7 +729,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/group/groupcomponents/index.jsx b/src/menu/components/group/groupcomponents/index.jsx index 63e02b1..b126069 100644 --- a/src/menu/components/group/groupcomponents/index.jsx +++ b/src/menu/components/group/groupcomponents/index.jsx @@ -98,8 +98,6 @@ let newcard = { uuid: Utils.getuuid(), - tabId: config.uuid, - parentId: config.parentId, type: item.component, subtype: item.subtype, config: item.config, diff --git a/src/menu/components/group/normal-group/index.jsx b/src/menu/components/group/normal-group/index.jsx index 08229ed..3d5ec2f 100644 --- a/src/menu/components/group/normal-group/index.jsx +++ b/src/menu/components/group/normal-group/index.jsx @@ -35,8 +35,6 @@ let _group = { uuid: group.uuid, type: group.type, - tabId: group.tabId || '', - parentId: group.parentId || '', subtype: group.subtype, width: 24, name: group.name, @@ -59,11 +57,6 @@ return !is(fromJS(this.state), fromJS(nextState)) } - componentDidMount () { - MKEmitter.addListener('tabsChange', this.handleTabsChange) - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) - } - /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ @@ -71,27 +64,6 @@ this.setState = () => { return } - MKEmitter.removeListener('tabsChange', this.handleTabsChange) - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) - } - - updateComponentStyle = (parentId, keys, style) => { - const { group } = this.state - - if (group.uuid !== parentId) return - - let components = group.components.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({ - group: {...group, components: []} - }, () => { - this.updateComponent({...group, components: components}) - }) } changeStyle = () => { @@ -110,20 +82,16 @@ this.props.updateConfig(_card) } - handleTabsChange = (parentId) => { - const { group } = this.state - - if (parentId === group.parentId) { - MKEmitter.emit('tabsChange', group.uuid) - } - } - updateComponent = (component) => { const { group } = this.state if (!is(fromJS(group.setting), fromJS(component.setting)) || !is(fromJS(group.style), fromJS(component.style))) { // 娉ㄥ唽浜嬩欢-鏍囩鍙樺寲锛岄�氱煡缁勫唴鍏冪礌 - MKEmitter.emit('tabsChange', group.uuid) + let ids = [] + group.components.forEach(item => { + ids.push(item.uuid) + }) + MKEmitter.emit('tabsChange', ids.join(',')) } component.width = component.setting.width @@ -137,8 +105,6 @@ insert = (item) => { let group = fromJS(this.state.group).toJS() - - item.parentId = group.parentId group.components.push(item) @@ -156,13 +122,6 @@ this.updateComponent({...this.state.group, setting: res}) } - clickComponent = (e) => { - if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { - e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.group) - } - } - render() { const { group } = this.state let _style = resetStyle(group.style) @@ -173,7 +132,7 @@ } return ( - <div className={'menu-group-edit-box ' + (paddingTop ? 'padding ' : '') + (group.setting.layout || '')} style={_style} onClick={this.clickComponent} id={group.uuid}> + <div className={'menu-group-edit-box ' + (paddingTop ? 'padding ' : '') + (group.setting.layout || '')} style={_style} id={group.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <NormalForm title="鍒嗙粍璁剧疆" width={700} update={this.updateWrap} getForms={this.getWrapForms}> diff --git a/src/menu/components/module/voucher/index.jsx b/src/menu/components/module/voucher/index.jsx index 7f230bd..329d64d 100644 --- a/src/menu/components/module/voucher/index.jsx +++ b/src/menu/components/module/voucher/index.jsx @@ -33,8 +33,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index d6250e4..3595d12 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -50,8 +50,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', width: 24, name: card.name, subtype: card.subtype, @@ -397,7 +395,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/table/base-table/index.jsx b/src/menu/components/table/base-table/index.jsx index 4979704..9620ec9 100644 --- a/src/menu/components/table/base-table/index.jsx +++ b/src/menu/components/table/base-table/index.jsx @@ -38,8 +38,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: true, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx index 029fcd2..d95042e 100644 --- a/src/menu/components/table/edit-table/index.jsx +++ b/src/menu/components/table/edit-table/index.jsx @@ -43,8 +43,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -370,7 +368,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx index 4092f00..4b65160 100644 --- a/src/menu/components/table/normal-table/index.jsx +++ b/src/menu/components/table/normal-table/index.jsx @@ -45,8 +45,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: true, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -424,7 +422,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx index a272815..80cd4c0 100644 --- a/src/menu/components/tabs/antv-tabs/index.jsx +++ b/src/menu/components/tabs/antv-tabs/index.jsx @@ -44,17 +44,15 @@ let _tabs = { uuid: tabs.uuid, type: tabs.type, - tabId: tabs.tabId || '', - parentId: tabs.parentId || '', subtype: tabs.subtype, width: 24, name: tabs.name, setting: {width: 24, position: 'top', tabStyle: 'line', name: tabs.name}, style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, subtabs: [ - { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 1', icon: '', components: [] }, - { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 2', icon: '', components: [] }, - { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 3', icon: '', components: [] } + { uuid: Utils.getuuid(), label: 'Tab 1', icon: '', components: [] }, + { uuid: Utils.getuuid(), label: 'Tab 2', icon: '', components: [] }, + { uuid: Utils.getuuid(), label: 'Tab 3', icon: '', components: [] } ] } this.setState({ @@ -74,12 +72,6 @@ return !is(fromJS(this.state), fromJS(nextState)) } - componentDidMount () { - MKEmitter.addListener('submitSearch', this.getSearch) - MKEmitter.addListener('tabsChange', this.handleTabsChange) - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) - } - /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ @@ -87,42 +79,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitSearch', this.getSearch) - MKEmitter.removeListener('tabsChange', this.handleTabsChange) - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) - } - - updateComponentStyle = (parentId, keys, style) => { - const { tabs } = this.state - - if (tabs.subtabs.findIndex(tab => tab.uuid === parentId) === -1) return - - let _tabs = fromJS(tabs).toJS() - let _tabs_ = fromJS(tabs).toJS() - - let components = [] - _tabs.subtabs.forEach(tab => { - if (tab.uuid === parentId) { - components = tab.components.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - tab.components = [] - } - }) - - _tabs_.subtabs = _tabs_.subtabs.map(tab => { - if (tab.uuid === parentId) { - tab.components = components - } - return tab - }) - - this.setState({tabs: _tabs}, () => { - this.updateComponent(_tabs_) - }) } changeStyle = () => { @@ -141,12 +97,18 @@ this.props.updateConfig(_card) } - handleTabsChange = (parentId) => { - const { tabs } = this.state - - if (parentId === tabs.parentId) { - MKEmitter.emit('tabsChange', tabs.uuid) - } + getSubIds = (components, ids) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + this.getSubIds(tab.components, ids) + }) + } else if (item.type === 'group') { + this.getSubIds(item.components, ids) + } else { + ids.push(item.uuid) + } + }) } updateComponent = (component) => { @@ -154,7 +116,11 @@ if (!is(fromJS(tabs.setting), fromJS(component.setting)) || !is(fromJS(tabs.style), fromJS(component.style))) { // 娉ㄥ唽浜嬩欢-鏍囩鍙樺寲锛岄�氱煡鏍囩鍐呭厓绱� - MKEmitter.emit('tabsChange', tabs.uuid) + let ids = [] + tabs.subtabs.forEach(tab => { + this.getSubIds(tab.components, ids) + }) + MKEmitter.emit('tabsChange', ids.join(',')) } component.width = component.setting.width @@ -236,59 +202,12 @@ this.props.updateConfig(tabs) } - getSearch = (config) => { - const { tabs } = this.state - - if (tabs.uuid !== config.uuid) return - - let _tabs = fromJS(tabs).toJS() - - _tabs.subtabs = _tabs.subtabs.map(t => { - if (t.uuid === config.tabId) { - t.search = config.search - } - return t - }) - - this.setState({ - tabs: _tabs - }) - this.props.updateConfig(_tabs) - } - - setSearch = (tab) => { - const { tabs } = this.state - let card = { - uuid: tabs.uuid, - tabId: tab.uuid, - search: tab.search - } - - if (!card.search) { - card.search = { - floor: 1, - setting: { type: 'title', field: '', title: '', focus: 'true', btn: 'hidden' }, - groups: [], - fields: [] - } - } - MKEmitter.emit('changeSearch', card) - } - - clickComponent = (e) => { - if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { - e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.tabs) - } - } - getTabForms = (tab) => { const { tabs } = this.state if (!tab) { tab = { uuid: '', - parentId: tabs.uuid, label: '', icon: '', components: [] @@ -356,7 +275,7 @@ let _style = resetStyle(tabs.style) return ( - <div className={'menu-tabs-edit-box ' + (tabs.setting.display || '')} style={_style} onClick={this.clickComponent} id={tabs.uuid}> + <div className={'menu-tabs-edit-box ' + (tabs.setting.display || '')} style={_style} id={tabs.uuid}> <DraggableTabs defaultActiveKey={defaultActiveKey} tabBarStyle={{background: tabs.setting.backgroundColor || 'transparent'}} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch} onChange={this.onChange}> {tabs.subtabs.map(tab => ( <TabPane tab={ @@ -372,8 +291,6 @@ <span style={{textDecoration: tab.hide === 'true' ? 'line-through' : 'none'}}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span> </Popover> } key={tab.uuid} style={{backgroundColor: tab.backgroundColor || 'transparent'}}> - {/* {appType === 'mob' && tabs.setting.position === 'top' && tabs.setting.display === 'inline-block' && tab.hasSearch === 'icon' ? - <SearchOutlined className="search-icon" onDoubleClick={() => this.setSearch(tab)}/> : null} */} <TabComponents config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> </TabPane> ))} diff --git a/src/menu/components/tabs/paste/index.jsx b/src/menu/components/tabs/paste/index.jsx index 0f6fb9a..5fadf9c 100644 --- a/src/menu/components/tabs/paste/index.jsx +++ b/src/menu/components/tabs/paste/index.jsx @@ -24,10 +24,7 @@ this.setState({visible: true}) } - resetconfig = (item, Tab, copyBtns, uuids = {}, floor) => { - item.tabId = Tab.uuid - item.parentId = Tab.parentId - + resetconfig = (item, copyBtns, uuids = {}) => { if (item.type === 'tabs') { uuids[item.uuid] = MenuUtils.getuuid() item.uuid = uuids[item.uuid] @@ -37,14 +34,9 @@ item.subtabs.forEach(tab => { uuids[tab.uuid] = MenuUtils.getuuid() tab.uuid = uuids[tab.uuid] - tab.parentId = item.uuid - - if (floor >= 3) { - tab.components = tab.components.filter(cell => cell.type !== 'tabs') - } tab.components = tab.components.map(cell => { - cell = this.resetconfig(cell, tab, copyBtns, uuids, floor + 1) + cell = this.resetconfig(cell, copyBtns, uuids) return cell }) }) @@ -55,9 +47,6 @@ item.name = item.setting.name item.components = item.components.map(cell => { - cell.tabId = Tab.uuid - cell.parentId = Tab.parentId - cell = MenuUtils.resetComponentConfig(cell, copyBtns, uuids) return cell @@ -100,9 +89,8 @@ } let copyBtns = new Map() - let floor = MenuUtils.getFloor(Tab.parentId) - res = this.resetconfig(res, Tab, copyBtns, {}, floor) + res = this.resetconfig(res, copyBtns, {}) delete res.copyType diff --git a/src/menu/components/tabs/tabcomponents/index.jsx b/src/menu/components/tabs/tabcomponents/index.jsx index d6bf416..ccecb5f 100644 --- a/src/menu/components/tabs/tabcomponents/index.jsx +++ b/src/menu/components/tabs/tabcomponents/index.jsx @@ -84,16 +84,6 @@ }) return } - } else if (item.component === 'tabs') { - let floor = MenuUtils.getFloor(config.parentId) - if (floor >= 3 ) { - notification.warning({ - top: 92, - message: '鏍囩椤垫渶澶氫负涓夐噸缁撴瀯锛�', - duration: 5 - }) - return - } } let name = '' @@ -129,8 +119,6 @@ let newcard = { uuid: Utils.getuuid(), - tabId: config.uuid, - parentId: config.parentId, type: item.component, subtype: item.subtype, config: item.config, diff --git a/src/menu/components/tabs/table-tabs/index.jsx b/src/menu/components/tabs/table-tabs/index.jsx index a272815..5fe8e2f 100644 --- a/src/menu/components/tabs/table-tabs/index.jsx +++ b/src/menu/components/tabs/table-tabs/index.jsx @@ -31,7 +31,6 @@ } state = { - appType: sessionStorage.getItem('appType'), tabs: null, editab: null, defaultActiveKey: '' @@ -44,17 +43,13 @@ let _tabs = { uuid: tabs.uuid, type: tabs.type, - tabId: tabs.tabId || '', - parentId: tabs.parentId || '', subtype: tabs.subtype, width: 24, name: tabs.name, setting: {width: 24, position: 'top', tabStyle: 'line', name: tabs.name}, style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, subtabs: [ - { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 1', icon: '', components: [] }, - { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 2', icon: '', components: [] }, - { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 3', icon: '', components: [] } + { uuid: Utils.getuuid(), label: 'Tab 1', icon: '', components: [] }, ] } this.setState({ @@ -74,11 +69,7 @@ return !is(fromJS(this.state), fromJS(nextState)) } - componentDidMount () { - MKEmitter.addListener('submitSearch', this.getSearch) - MKEmitter.addListener('tabsChange', this.handleTabsChange) - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) - } + componentDidMount () {} /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 @@ -87,42 +78,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitSearch', this.getSearch) - MKEmitter.removeListener('tabsChange', this.handleTabsChange) - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) - } - - updateComponentStyle = (parentId, keys, style) => { - const { tabs } = this.state - - if (tabs.subtabs.findIndex(tab => tab.uuid === parentId) === -1) return - - let _tabs = fromJS(tabs).toJS() - let _tabs_ = fromJS(tabs).toJS() - - let components = [] - _tabs.subtabs.forEach(tab => { - if (tab.uuid === parentId) { - components = tab.components.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - tab.components = [] - } - }) - - _tabs_.subtabs = _tabs_.subtabs.map(tab => { - if (tab.uuid === parentId) { - tab.components = components - } - return tab - }) - - this.setState({tabs: _tabs}, () => { - this.updateComponent(_tabs_) - }) } changeStyle = () => { @@ -141,22 +96,7 @@ this.props.updateConfig(_card) } - handleTabsChange = (parentId) => { - const { tabs } = this.state - - if (parentId === tabs.parentId) { - MKEmitter.emit('tabsChange', tabs.uuid) - } - } - updateComponent = (component) => { - const { tabs } = this.state - - if (!is(fromJS(tabs.setting), fromJS(component.setting)) || !is(fromJS(tabs.style), fromJS(component.style))) { - // 娉ㄥ唽浜嬩欢-鏍囩鍙樺寲锛岄�氱煡鏍囩鍐呭厓绱� - MKEmitter.emit('tabsChange', tabs.uuid) - } - component.width = component.setting.width component.name = component.setting.name @@ -236,59 +176,12 @@ this.props.updateConfig(tabs) } - getSearch = (config) => { - const { tabs } = this.state - - if (tabs.uuid !== config.uuid) return - - let _tabs = fromJS(tabs).toJS() - - _tabs.subtabs = _tabs.subtabs.map(t => { - if (t.uuid === config.tabId) { - t.search = config.search - } - return t - }) - - this.setState({ - tabs: _tabs - }) - this.props.updateConfig(_tabs) - } - - setSearch = (tab) => { - const { tabs } = this.state - let card = { - uuid: tabs.uuid, - tabId: tab.uuid, - search: tab.search - } - - if (!card.search) { - card.search = { - floor: 1, - setting: { type: 'title', field: '', title: '', focus: 'true', btn: 'hidden' }, - groups: [], - fields: [] - } - } - MKEmitter.emit('changeSearch', card) - } - - clickComponent = (e) => { - if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { - e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.tabs) - } - } - getTabForms = (tab) => { const { tabs } = this.state if (!tab) { tab = { uuid: '', - parentId: tabs.uuid, label: '', icon: '', components: [] @@ -308,7 +201,6 @@ editab.label = res.label editab.icon = res.icon - // editab.hasSearch = res.hasSearch || '' editab.hide = res.hide || 'false' editab.backgroundColor = res.backgroundColor editab.controlVal = res.controlVal || '' @@ -356,7 +248,7 @@ let _style = resetStyle(tabs.style) return ( - <div className={'menu-tabs-edit-box ' + (tabs.setting.display || '')} style={_style} onClick={this.clickComponent} id={tabs.uuid}> + <div className={'menu-tabs-edit-box ' + (tabs.setting.display || '')} style={_style} id={tabs.uuid}> <DraggableTabs defaultActiveKey={defaultActiveKey} tabBarStyle={{background: tabs.setting.backgroundColor || 'transparent'}} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch} onChange={this.onChange}> {tabs.subtabs.map(tab => ( <TabPane tab={ @@ -372,8 +264,6 @@ <span style={{textDecoration: tab.hide === 'true' ? 'line-through' : 'none'}}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span> </Popover> } key={tab.uuid} style={{backgroundColor: tab.backgroundColor || 'transparent'}}> - {/* {appType === 'mob' && tabs.setting.position === 'top' && tabs.setting.display === 'inline-block' && tab.hasSearch === 'icon' ? - <SearchOutlined className="search-icon" onDoubleClick={() => this.setSearch(tab)}/> : null} */} <TabComponents config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> </TabPane> ))} diff --git a/src/menu/components/timeline/normal-timeline/index.jsx b/src/menu/components/timeline/normal-timeline/index.jsx index 547ef31..7dda5d2 100644 --- a/src/menu/components/timeline/normal-timeline/index.jsx +++ b/src/menu/components/timeline/normal-timeline/index.jsx @@ -39,8 +39,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� diff --git a/src/menu/components/tree/antd-tree/index.jsx b/src/menu/components/tree/antd-tree/index.jsx index 8d2ecb6..04211aa 100644 --- a/src/menu/components/tree/antd-tree/index.jsx +++ b/src/menu/components/tree/antd-tree/index.jsx @@ -40,8 +40,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: true, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -153,7 +151,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index 9d11f70..fbe0827 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -31,16 +31,12 @@ item.subtabs.forEach(tab => { uuids[tab.uuid] = MenuUtils.getuuid() tab.uuid = uuids[tab.uuid] - tab.parentId = item.uuid if (appType !== 'mob') { tab.components = tab.components.filter(cell => cell.type !== 'menubar') } tab.components = tab.components.map(cell => { - cell.tabId = tab.uuid - cell.parentId = tab.parentId - cell = this.resetconfig(cell, copyBtns, uuids) return cell }) @@ -52,9 +48,6 @@ item.name = item.setting.name item.components = item.components.map(cell => { - cell.tabId = item.tabId || '' - cell.parentId = item.parentId || '' - cell = MenuUtils.resetComponentConfig(cell, copyBtns, uuids) return cell }) diff --git a/src/menu/stylecombcontrolbutton/index.jsx b/src/menu/stylecombcontrolbutton/index.jsx index 1df5924..e83fd2d 100644 --- a/src/menu/stylecombcontrolbutton/index.jsx +++ b/src/menu/stylecombcontrolbutton/index.jsx @@ -1,6 +1,5 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { fromJS } from 'immutable' import { Button } from 'antd' import { FontColorsOutlined } from '@ant-design/icons' @@ -18,6 +17,10 @@ type: '', components: [] } + + type = null + + components = {} componentDidMount () { sessionStorage.setItem('style-control', 'false') @@ -37,90 +40,76 @@ } submitCombineStyle = (style) => { - const { components, parent } = this.state - - let keys = components.map(item => item.uuid) - - MKEmitter.emit('submitComponentStyle', parent.uuid, keys, style) - - setTimeout(() => { - keys.forEach(key => { - document.getElementById(key).classList.add('selected-control-element') - }) - }, 100) - } - - clickComponent = (card, _p, _type) => { - const { menu } = this.props - const { parent, type } = this.state - let components = fromJS(this.state.components).toJS() - - if (!parent) { - let _parent = null - - if (_type === 'cardcell') { - _parent = _p - MKEmitter.emit('switchMultiStyle', 'open') - } else { - let getParents = (box) => { - box.components.forEach(item => { - if (item.type === 'tabs') { - item.subtabs.forEach(tab => { - if (tab.components.findIndex(cell => cell.uuid === card.uuid) > -1) { - _parent = tab - } else { - getParents(tab) - } - }) - } else if (item.type === 'group') { - if (item.components.findIndex(cell => cell.uuid === card.uuid) > -1) { - _parent = item - } - } - }) - } - - if (menu.components.findIndex(cell => cell.uuid === card.uuid) > -1) { - _parent = menu - } else { - getParents(menu) - } - - MKEmitter.emit('switchMultiStyle', 'open') - } - - document.getElementById(card.uuid).classList.add('selected-control-element') - - sessionStorage.setItem('style-control', (_type ? _type : 'component')) - - this.setState({ - type: _type ? _type : 'component', - parent: _parent, - components: [card] + if (this.type === 'component') { + Object.keys(this.components).forEach((key, i) => { + setTimeout(() => { + this.components[key](style) + }, i * 10) }) } else { - if (components.findIndex(cell => cell.uuid === card.uuid) > -1) { - components = components.filter(cell => cell.uuid !== card.uuid) - document.getElementById(card.uuid).classList.remove('selected-control-element') - } else if (type === 'cardcell' && parent.elements.findIndex(cell => cell.uuid === card.uuid) > -1) { - components.push(card) - document.getElementById(card.uuid).classList.add('selected-control-element') - } - - if (components.length === 0) { - MKEmitter.emit('switchMultiStyle', 'close') - sessionStorage.setItem('style-control', 'true') - } - - this.setState({ - components: components, - parent: components.length ? parent : null + Object.keys(this.components).forEach((key, i) => { + setTimeout(() => { + MKEmitter.emit('submitComponentStyle', key, this.components[key], style) + }, i * 10) }) } } + clickComponent = (id, pid, callback) => { + if (!this.type) { + if (pid) { + this.type = 'cardcell' + } else { + this.type = 'component' + } + } else if ((this.type === 'cardcell' && !pid) || (this.type === 'component' && pid)) { + return + } + + let plus = true + if (this.type === 'cardcell') { + if (this.components[pid]) { + if (this.components[pid].includes(id)) { + this.components[pid] = this.components[pid].filter(item => item !== id) + if (this.components[pid].length === 0) { + delete this.components[pid] + } + plus = false + } else { + this.components[pid].push(id) + } + } else { + this.components[pid] = [id] + } + } else { + if (this.components[id]) { + delete this.components[id] + plus = false + } else { + this.components[id] = callback + } + } + + if (plus) { + document.getElementById(id).classList.add('selected-control-element') + MKEmitter.emit('switchMultiStyle', 'open', this.type) + } else { + document.getElementById(id).classList.remove('selected-control-element') + } + + let length = Object.keys(this.components).length + + if (length === 0) { + MKEmitter.emit('switchMultiStyle', 'close') + sessionStorage.setItem('style-control', 'true') + this.type = null + } else { + sessionStorage.setItem('style-control', this.type) + } + } + triggerStyleChange = () => { - const { label, components } = this.state + const { label } = this.state if (label === '鎵归噺璋冩暣') { document.body.className = 'style-control' @@ -130,13 +119,23 @@ document.body.className = '' sessionStorage.setItem('style-control', 'false') - components.forEach(item => { - document.getElementById(item.uuid).classList.remove('selected-control-element') - }) + if (this.type === 'cardcell') { + Object.keys(this.components).forEach(key => { + this.components[key].forEach(id => { + document.getElementById(id).classList.remove('selected-control-element') + }) + }) + } else { + Object.keys(this.components).forEach(key => { + document.getElementById(key).classList.remove('selected-control-element') + }) + } MKEmitter.emit('switchMultiStyle', 'close') + this.components = {} + this.type = null - this.setState({label: '鎵归噺璋冩暣', parent: null, components: []}) + this.setState({label: '鎵归噺璋冩暣'}) } } diff --git a/src/menu/stylecombcontroller/index.jsx b/src/menu/stylecombcontroller/index.jsx index 4e06d4f..e47bdd3 100644 --- a/src/menu/stylecombcontroller/index.jsx +++ b/src/menu/stylecombcontroller/index.jsx @@ -44,6 +44,7 @@ state = { style: {}, + type: '', borposition: 'outer' } @@ -65,11 +66,12 @@ MKEmitter.removeListener('switchMultiStyle', this.switchMultiStyle) } - switchMultiStyle = (type) => { - if (type === 'open') { + switchMultiStyle = (swit, type) => { + if (swit === 'open') { this.setState({ visible: true, style: {}, + type: type, borposition: 'outer' }) } else { @@ -269,7 +271,7 @@ <div className="menu-combine-style-controller"> <Form {...formItemLayout}> <Collapse expandIconPosition="right" destroyInactivePanel={true} defaultActiveKey="margin"> - <Panel header="瀛椾綋" key="font"> + {this.state.type === 'cardcell' ? <Panel header="瀛椾綋" key="font"> <Col span={12}> <Form.Item colon={false} label={<FontSizeOutlined title="瀛椾綋澶у皬"/>}> <InputNumber defaultValue={''} min={12} max={100} precision={0} onChange={this.changeFontSize} /> @@ -353,7 +355,7 @@ </Radio.Group> </Form.Item> </Col> - </Panel> + </Panel> : null} <Panel header="鑳屾櫙" key="background"> <Col span={24}> <Form.Item diff --git a/src/menu/tableshell/card.jsx b/src/menu/tableshell/card.jsx index 0015811..55926ea 100644 --- a/src/menu/tableshell/card.jsx +++ b/src/menu/tableshell/card.jsx @@ -4,7 +4,7 @@ import asyncComponent from '@/utils/asyncComponent' import './index.scss' -const AntvTabs = asyncComponent(() => import('@/menu/components/tabs/antv-tabs')) +const AntvTabs = asyncComponent(() => import('@/menu/components/tabs/table-tabs')) const BaseTable = asyncComponent(() => import('@/menu/components/table/base-table')) const Card = ({ id, card, delCard, updateConfig }) => { diff --git a/src/mob/components/menubar/common-menubar/index.jsx b/src/mob/components/menubar/common-menubar/index.jsx index 09e5410..37c24c3 100644 --- a/src/mob/components/menubar/common-menubar/index.jsx +++ b/src/mob/components/menubar/common-menubar/index.jsx @@ -36,8 +36,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: '', - parentId: '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -135,7 +133,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/mob/components/menubar/normal-menubar/index.jsx b/src/mob/components/menubar/normal-menubar/index.jsx index 3ccf007..a3ca2dc 100644 --- a/src/mob/components/menubar/normal-menubar/index.jsx +++ b/src/mob/components/menubar/normal-menubar/index.jsx @@ -41,8 +41,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: '', - parentId: '', format: 'object', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� @@ -273,7 +271,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/mob/components/official/index.jsx b/src/mob/components/official/index.jsx index dc25062..7a1c6d0 100644 --- a/src/mob/components/official/index.jsx +++ b/src/mob/components/official/index.jsx @@ -32,8 +32,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', width: 24, name: card.name, subtype: card.subtype, diff --git a/src/mob/components/search/single-search/index.jsx b/src/mob/components/search/single-search/index.jsx index 95feec1..b733a7c 100644 --- a/src/mob/components/search/single-search/index.jsx +++ b/src/mob/components/search/single-search/index.jsx @@ -31,8 +31,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', width: 24, name: card.name, subtype: card.subtype, @@ -109,7 +107,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/mob/components/tabs/antv-tabs/index.jsx b/src/mob/components/tabs/antv-tabs/index.jsx index 3800c62..dc73a22 100644 --- a/src/mob/components/tabs/antv-tabs/index.jsx +++ b/src/mob/components/tabs/antv-tabs/index.jsx @@ -44,17 +44,15 @@ let _tabs = { uuid: tabs.uuid, type: tabs.type, - tabId: tabs.tabId || '', - parentId: tabs.parentId || '', subtype: tabs.subtype, width: 24, name: tabs.name, setting: {width: 24, position: 'top', tabStyle: 'line', name: tabs.name}, style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, subtabs: [ - { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 1', icon: '', components: [] }, - { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 2', icon: '', components: [] }, - { uuid: Utils.getuuid(), parentId: tabs.uuid, label: 'Tab 3', icon: '', components: [] } + { uuid: Utils.getuuid(), label: 'Tab 1', icon: '', components: [] }, + { uuid: Utils.getuuid(), label: 'Tab 2', icon: '', components: [] }, + { uuid: Utils.getuuid(), label: 'Tab 3', icon: '', components: [] } ] } @@ -79,12 +77,6 @@ return !is(fromJS(this.state), fromJS(nextState)) } - componentDidMount () { - MKEmitter.addListener('submitSearch', this.getSearch) - MKEmitter.addListener('tabsChange', this.handleTabsChange) - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) - } - /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ @@ -92,42 +84,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitSearch', this.getSearch) - MKEmitter.removeListener('tabsChange', this.handleTabsChange) - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) - } - - updateComponentStyle = (parentId, keys, style) => { - const { tabs } = this.state - - if (tabs.subtabs.findIndex(tab => tab.uuid === parentId) === -1) return - - let _tabs = fromJS(tabs).toJS() - let _tabs_ = fromJS(tabs).toJS() - - let components = [] - _tabs.subtabs.forEach(tab => { - if (tab.uuid === parentId) { - components = tab.components.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - tab.components = [] - } - }) - - _tabs_.subtabs = _tabs_.subtabs.map(tab => { - if (tab.uuid === parentId) { - tab.components = components - } - return tab - }) - - this.setState({tabs: _tabs}, () => { - this.updateComponent(_tabs_) - }) } changeStyle = () => { @@ -162,12 +118,18 @@ this.props.updateConfig(_card) } - handleTabsChange = (parentId) => { - const { tabs } = this.state - - if (parentId === tabs.parentId) { - MKEmitter.emit('tabsChange', tabs.uuid) - } + getSubIds = (components, ids) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + this.getSubIds(tab.components, ids) + }) + } else if (item.type === 'group') { + this.getSubIds(item.components, ids) + } else { + ids.push(item.uuid) + } + }) } updateComponent = (component) => { @@ -175,7 +137,11 @@ if (!is(fromJS(tabs.setting), fromJS(component.setting)) || !is(fromJS(tabs.style), fromJS(component.style))) { // 娉ㄥ唽浜嬩欢-鏍囩鍙樺寲锛岄�氱煡鏍囩鍐呭厓绱� - MKEmitter.emit('tabsChange', tabs.uuid) + let ids = [] + tabs.subtabs.forEach(tab => { + this.getSubIds(tab.components, ids) + }) + MKEmitter.emit('tabsChange', ids.join(',')) } component.width = component.setting.width @@ -266,52 +232,12 @@ this.props.updateConfig(tabs) } - getSearch = (config) => { - const { tabs } = this.state - - if (tabs.uuid !== config.uuid) return - - let _tabs = fromJS(tabs).toJS() - - _tabs.subtabs = _tabs.subtabs.map(t => { - if (t.uuid === config.tabId) { - t.search = config.search - } - return t - }) - - this.setState({ - tabs: _tabs - }) - this.props.updateConfig(_tabs) - } - - setSearch = (tab) => { - const { tabs } = this.state - let card = { - uuid: tabs.uuid, - tabId: tab.uuid, - search: tab.search - } - - if (!card.search) { - card.search = { - floor: 1, - setting: { type: 'title', field: '', title: '', focus: 'true', btn: 'hidden' }, - groups: [], - fields: [] - } - } - MKEmitter.emit('changeSearch', card) - } - getTabForms = (tab) => { const { tabs } = this.state if (!tab) { tab = { uuid: '', - parentId: tabs.uuid, label: '', icon: '', components: [] @@ -374,20 +300,13 @@ window.GLOB.TabsMap.set(tabs.uuid, key) } - clickComponent = (e) => { - if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { - e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.tabs) - } - } - render() { const { tabs, defaultActiveKey } = this.state let _style = resetStyle(tabs.style) let _tabStyle = resetStyle(tabs.tabStyle) return ( - <div className={'mob-tabs-edit-box ' + tabs.setting.display} style={_style} onClick={this.clickComponent} id={tabs.uuid}> + <div className={'mob-tabs-edit-box ' + tabs.setting.display} style={_style} id={tabs.uuid}> <DraggableTabs defaultActiveKey={defaultActiveKey} tabBarStyle={{background: tabs.setting.backgroundColor || 'transparent'}} tabPosition={'top'} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch} onChange={this.onChange}> {tabs.subtabs.map(tab => ( <TabPane tab={ @@ -404,8 +323,6 @@ <span style={{..._tabStyle, textDecoration: tab.hide === 'true' ? 'line-through' : 'none'}}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span> </Popover> } key={tab.uuid} style={{backgroundColor: tab.backgroundColor || 'transparent'}}> - {/* {appType === 'mob' && tabs.setting.display === 'inline-block' && tab.hasSearch === 'icon' ? - <SearchOutlined className="search-icon" onDoubleClick={() => this.setSearch(tab)}/> : null} */} <TabComponents config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> </TabPane> ))} diff --git a/src/mob/components/tabs/tabcomponents/index.jsx b/src/mob/components/tabs/tabcomponents/index.jsx index 8cd28e1..474cd2c 100644 --- a/src/mob/components/tabs/tabcomponents/index.jsx +++ b/src/mob/components/tabs/tabcomponents/index.jsx @@ -2,7 +2,7 @@ import { useDrop } from 'react-dnd' import { is, fromJS } from 'immutable' import update from 'immutability-helper' -import { Empty, notification, Modal } from 'antd' +import { Empty, Modal } from 'antd' import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' @@ -76,26 +76,8 @@ item.added = true if (item.component === 'search') { // 绉诲姩绔爣绛鹃〉涓笉鍙坊鍔犳悳绱� - // if (cards.filter(card => card.type === 'search').length > 0) { - // notification.warning({ - // top: 92, - // message: '鎼滅储鏉′欢涓嶅彲閲嶅娣诲姞锛�', - // duration: 5 - // }) - // return - // } item.added = false return - } else if (item.component === 'tabs') { - let floor = MenuUtils.getFloor(config.parentId) - if (floor >= 3 ) { - notification.warning({ - top: 92, - message: '鏍囩椤垫渶澶氫负涓夐噸缁撴瀯锛�', - duration: 5 - }) - return - } } let name = '' @@ -131,8 +113,6 @@ let newcard = { uuid: Utils.getuuid(), - tabId: config.uuid, - parentId: config.parentId, type: item.component, subtype: item.subtype, config: item.config, diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx index 123fa23..d711391 100644 --- a/src/mob/components/topbar/normal-navbar/index.jsx +++ b/src/mob/components/topbar/normal-navbar/index.jsx @@ -140,13 +140,6 @@ MKEmitter.emit('changeStyle', ['font', 'background', 'border'], card.searchStyle || {}, this.getSearchStyle) } - clickComponent = (e) => { - if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { - e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) - } - } - getSearch = (config) => { const { card } = this.state @@ -223,7 +216,7 @@ } return ( - <div className="normal-topbar-edit-box" style={card.style} onClick={this.clickComponent} id={card.uuid}> + <div className="normal-topbar-edit-box" style={card.style} id={card.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <NormalForm title="瀵艰埅鏍忚缃�" width={900} update={this.updateWrap} getForms={this.getWrapForms}> diff --git a/src/pc/components/login/normal-login/index.jsx b/src/pc/components/login/normal-login/index.jsx index 683d9dc..a35605f 100644 --- a/src/pc/components/login/normal-login/index.jsx +++ b/src/pc/components/login/normal-login/index.jsx @@ -36,8 +36,6 @@ let _card = { uuid: card.uuid, type: card.type, - tabId: card.tabId || '', - parentId: card.parentId || '', width: card.width || 24, name: card.name, subtype: card.subtype, @@ -128,7 +126,13 @@ clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) + MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => { + let _card = {...this.state.card} + _card.style = {..._card.style, ...style} + + this.setState({ card: _card }) + this.props.updateConfig(_card) + }) } } diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx index 474c8f1..f14e91b 100644 --- a/src/pc/components/navbar/normal-navbar/index.jsx +++ b/src/pc/components/navbar/normal-navbar/index.jsx @@ -120,13 +120,6 @@ MKEmitter.emit('changeStyle', ['width', 'margin'], card.logoStyle, this.getLogoStyle) } - clickComponent = (e) => { - if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { - e.stopPropagation() - MKEmitter.emit('clickComponent', this.state.card) - } - } - changeMenu = (menu) => { if (menu.property === 'link') { window.open(menu.link) @@ -168,7 +161,7 @@ const { card } = this.state return ( - <div className="normal-navbar-edit-box" style={card.style} onClick={this.clickComponent} id={card.uuid}> + <div className="normal-navbar-edit-box" style={card.style} id={card.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <MenuComponent config={card} updateConfig={this.updateComponent} /> diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 8b3d7ad..aa8772a 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -835,7 +835,6 @@ btn={card} BData={data.$$BData || ''} disabled={_disabled} - setting={cards.setting} selectedData={_data} /> </Col> @@ -847,7 +846,6 @@ btn={card} BData={data.$$BData || ''} disabled={_disabled} - setting={cards.setting} selectedData={_data} /> </Col> diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index addbbd0..24767fe 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -106,7 +106,6 @@ btn={item} BData={BData} MenuID={MenuID} - setting={setting} selectedData={selectedData} /> ) @@ -118,7 +117,6 @@ disabled={lock || false} btn={item} BData={BData} - setting={setting} selectedData={selectedData} /> ) diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index 1237a91..2ca6b55 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -16,7 +16,6 @@ BData: PropTypes.any, // 涓昏〃鏁版嵁 btn: PropTypes.object, // 鎸夐挳 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 - setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 disabled: PropTypes.any, // 琛屾寜閽鐢� } @@ -110,7 +109,7 @@ * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ actionTrigger = (triggerId, record, type) => { - const { setting, btn, selectedData } = this.props + const { btn, selectedData } = this.props const { disabled } = this.state if (disabled) return @@ -152,7 +151,7 @@ let MenuNo = '' let Remark = '' if (btn.Ot === 'requiredSgl' && data[0]) { - Id = setting.primaryKey ? (data[0][setting.primaryKey] || '') : '' + Id = data[0].$$uuid || '' name = data[0].PrintTempName || '' MenuNo = data[0].PrintTempNO || '' Remark = data[0].Remark || '' @@ -164,7 +163,7 @@ _name = '鍗曟嵁鎵撳嵃' if (btn.Ot === 'required' && data && data.length > 0) { data.forEach((item, i) => { - let _id = setting.primaryKey ? (item[setting.primaryKey] || '') : '' + let _id = item.$$uuid || '' let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: _id, tempId: btn.printTemp, dataM: sessionStorage.getItem('dataM') }))) window.open(url) }) diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index 6158165..ba8c96a 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -15,7 +15,6 @@ MenuID: PropTypes.string, // 鑿滃崟ID btn: PropTypes.object, // 鎸夐挳 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 - setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 disabled: PropTypes.any, // 琛屾寜閽鐢� } @@ -109,7 +108,7 @@ * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ actionTrigger = (triggerId, record, type) => { - const { setting, btn, selectedData } = this.props + const { btn, selectedData } = this.props const { disabled } = this.state if (disabled) return @@ -133,8 +132,10 @@ let primaryId = '' - if (btn.Ot === 'requiredSgl' && setting.primaryKey) { - primaryId = data[0][setting.primaryKey] || '' + if (btn.Ot === 'requiredSgl') { + primaryId = data[0].$$uuid || '' + } else if (btn.Ot === 'notRequired' && data[0]) { + primaryId = data[0].$$BID || '' } let newtab = {} diff --git a/src/tabviews/zshare/cardcomponent/index.jsx b/src/tabviews/zshare/cardcomponent/index.jsx index f9eac6c..54c1b95 100644 --- a/src/tabviews/zshare/cardcomponent/index.jsx +++ b/src/tabviews/zshare/cardcomponent/index.jsx @@ -182,7 +182,6 @@ key={item.uuid} btn={item} MenuID={MenuID} - setting={setting} selectedData={[data]} /> ) @@ -191,7 +190,6 @@ <NewPageButton key={item.uuid} btn={item} - setting={setting} selectedData={[data]} /> ) diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index c3147cc..e01df0a 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -782,7 +782,6 @@ selectedData={[record]} BData={this.props.BData} MenuID={this.props.MenuID} - setting={this.props.setting} /> ) } else if (btn.OpenType === 'innerpage' || btn.OpenType === 'outerpage') { @@ -793,7 +792,6 @@ disabled={record.$disabled} selectedData={[record]} BData={this.props.BData} - setting={this.props.setting} /> ) } diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index e667b47..cbd1923 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -438,20 +438,10 @@ item.subtabs.forEach(tab => { uuids[tab.uuid] = this.getuuid() tab.uuid = uuids[tab.uuid] - tab.parentId = item.uuid - - tab.components = tab.components.map(cell => { - cell.tabId = tab.uuid - cell.parentId = item.uuid - return cell - }) + tab.components = this.resetConfig(tab.components, uuids, clear) }) } else if (item.type === 'group') { - item.components = item.components.map(cell => { - cell.parentId = item.uuid - return cell - }) item.components = this.resetConfig(item.components, uuids, clear) } else if (item.type === 'menubar') { item.subMenus = item.subMenus.map(cell => { @@ -668,35 +658,6 @@ return item }) - } - - /** - * @description 閲嶇疆鑿滃崟閰嶇疆锛岄〉闈㈡暣浣撳鍒� - * @return {String} components 閰嶇疆淇℃伅 - */ - static getFloor = (id) => { - let floor = 1 - let finish = false - - let reCheck = (components, f) => { - components.forEach(item => { - if (finish) return - if (item.type === 'tabs') { - if (item.uuid === id) { - floor = f - finish = true - } else { - item.subtabs.forEach(tab => { - reCheck(tab.components, f + 1) - }) - } - } - }) - } - - reCheck(window.GLOB.customMenu.components, 1) - - return floor } /** diff --git a/src/views/interface/history/index.jsx b/src/views/interface/history/index.jsx index 5e882c2..a35551f 100644 --- a/src/views/interface/history/index.jsx +++ b/src/views/interface/history/index.jsx @@ -200,11 +200,15 @@ createDate: '', formData: [], headers: [], - interface: window.GLOB.baseurl + 'webapi/logon', + interface: window.GLOB.baseurl + 'webapi/dologon', method: 'POST', params: [], raw: "{\n \"UserName\":\"******\",\n \"Password\":\"******\",\n \"systemType\":\"local\",\n \"Type\":\"鍏挜\",\n \"privatekey\":\"绉侀挜\",\n \"timestamp\":\"" + moment().format('YYYY-MM-DD HH:mm:ss') + "\",\n \"appkey\":\"" + window.GLOB.appkey + "\"\n}", uuid: 'dologon' + } + + if (window.GLOB.mainSystemApi) { + m.raw = "{\n \"UserName\":\"******\",\n \"Password\":\"******\",\n \"systemType\":\"local\",\n \"Type\":\"鍏挜\",\n \"privatekey\":\"绉侀挜\",\n \"timestamp\":\"" + moment().format('YYYY-MM-DD HH:mm:ss') + "\",\n \"appkey\":\"" + window.GLOB.appkey + "\",\n \"rduri\":\"" + window.GLOB.mainSystemApi.replace(/\/webapi(.*)/, '/webapi/dologon') + "\"\n}" } MKEmitter.emit('useInterface', m) } @@ -269,7 +273,7 @@ <div className="line-title">绀轰緥</div> <div className="line-item" key="dologon"> <div className="method">POST</div> - <div className="inter" style={{lineHeight: '40px'}}>logon</div> + <div className="inter" style={{lineHeight: '40px'}}>dologon</div> <div className="action" style={{paddingLeft: '40px'}}> <RightOutlined onClick={this.uselogon} /> </div> diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 7e761fe..510bace 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -110,7 +110,6 @@ MKEmitter.addListener('copyButtons', this.copyButtons) MKEmitter.addListener('changePopview', this.initPopview) MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) setTimeout(() => { if (sessionStorage.getItem('app_custom_components')) { @@ -180,7 +179,6 @@ MKEmitter.removeListener('copyButtons', this.copyButtons) MKEmitter.removeListener('changePopview', this.initPopview) MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave) - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) } @@ -321,28 +319,6 @@ }) }) this.setState({customComponents: coms}) - } - - updateComponentStyle = (parentId, keys, style) => { - const { config } = this.state - - if (config.uuid !== parentId) return - - let components = config.components.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({ - config: {...config, components}, - comloading: true - }, () => { - this.setState({ - comloading: false - }) - }) } delButtons = (items) => { diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 384ca4e..6d3d572 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -152,7 +152,6 @@ MKEmitter.addListener('modalStatus', this.modalStatus) MKEmitter.addListener('triggerMenuSave', this.submitConfig) MKEmitter.addListener('changeEditMenu', this.changeEditMenu) - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) setTimeout(() => { if (sessionStorage.getItem('app_custom_components')) { @@ -220,7 +219,6 @@ MKEmitter.removeListener('modalStatus', this.modalStatus) MKEmitter.removeListener('triggerMenuSave', this.submitConfig) MKEmitter.removeListener('changeEditMenu', this.changeEditMenu) - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) } @@ -457,28 +455,6 @@ this.setState({customComponents: coms}) } - updateComponentStyle = (parentId, keys, style) => { - const { config } = this.state - - if (config.uuid !== parentId) return - - let components = config.components.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({ - config: {...config, components}, - comloading: true - }, () => { - this.setState({ - comloading: false - }) - }) - } - closeView = () => { const { oriConfig, config } = this.state @@ -656,18 +632,16 @@ backElements: [] } ], - headerStyle: {}, parentId: '', width: 24, scripts: [], pageable: false, + headerStyle: {}, width: 24, scripts: [], pageable: false, wrap: {name: 'logo', width: 24, datatype: 'static', cardType: '', blacklist: []}, name: 'logo', floor: 1, switchable: true, - setting:{interType: 'system'}, tabId: '', style:{paddingTop: '8vh', paddingBottom: '10vh'}, format: 'object', subtype: 'propcard', type: 'card', uuid: Utils.getuuid(), columns: [] + setting:{interType: 'system'}, style:{paddingTop: '8vh', paddingBottom: '10vh'}, format: 'object', subtype: 'propcard', type: 'card', uuid: Utils.getuuid(), columns: [] }) config.components.push({ uuid: Utils.getuuid(), type: 'login', floor: 1, - tabId: '', - parentId: '', width: 24, name: '鐢ㄦ埛缁戝畾', subtype: 'bindlogin', @@ -687,10 +661,10 @@ backElements: [] } ], - headerStyle: {}, parentId: '', width: 24, scripts: [], pageable: false, + headerStyle: {}, width: 24, scripts: [], pageable: false, wrap: {name: 'Power', width: 24, datatype: 'static', cardType: '', blacklist: []}, name: 'Power', floor: 1, switchable: true, - setting:{interType: 'system'}, tabId: '', style:{}, format: 'object', subtype: 'propcard', type: 'card', uuid: Utils.getuuid(), columns: [] + setting:{interType: 'system'}, style:{}, format: 'object', subtype: 'propcard', type: 'card', uuid: Utils.getuuid(), columns: [] }) } diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 06059cb..74943e6 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -132,7 +132,6 @@ MKEmitter.addListener('changePopview', this.initPopview) MKEmitter.addListener('changeEditMenu', this.changeEditMenu) MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) setTimeout(() => { if (sessionStorage.getItem('app_custom_components')) { @@ -206,7 +205,6 @@ MKEmitter.removeListener('changePopview', this.initPopview) MKEmitter.removeListener('changeEditMenu', this.changeEditMenu) MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave) - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) } @@ -500,28 +498,6 @@ }) }) this.setState({customComponents: coms}) - } - - updateComponentStyle = (parentId, keys, style) => { - const { config } = this.state - - if (config.uuid !== parentId) return - - let components = config.components.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({ - config: {...config, components}, - comloading: true - }, () => { - this.setState({ - comloading: false - }) - }) } delButtons = (items) => { diff --git a/src/views/popdesign/index.jsx b/src/views/popdesign/index.jsx index d804815..ee36fc4 100644 --- a/src/views/popdesign/index.jsx +++ b/src/views/popdesign/index.jsx @@ -83,7 +83,6 @@ componentDidMount () { MKEmitter.addListener('delButtons', this.delButtons) MKEmitter.addListener('triggerMenuSave', this.submitConfig) - MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) setTimeout(() => { if (sessionStorage.getItem('app_custom_components')) { @@ -151,7 +150,6 @@ } MKEmitter.removeListener('delButtons', this.delButtons) MKEmitter.removeListener('triggerMenuSave', this.submitConfig) - MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) } @@ -201,28 +199,6 @@ }) }) this.setState({customComponents: coms}) - } - - updateComponentStyle = (parentId, keys, style) => { - const { config } = this.state - - if (config.uuid !== parentId) return - - let components = config.components.map(item => { - if (keys.includes(item.uuid)) { - item.style = {...item.style, ...style} - } - return item - }) - - this.setState({ - config: {...config, components}, - comloading: true - }, () => { - this.setState({ - comloading: false - }) - }) } delButtons = (items) => { diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 19d5c67..3ebbafb 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -721,10 +721,6 @@ changeSetting = () => { this.setState({settingshow: !this.state.settingshow}) - - setTimeout(() => { - MKEmitter.emit('tabsChange', 'all') - }, 400) } render () { -- Gitblit v1.8.0