From 0eb129a9beddbb86ae74d7106a8e60823206b8d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 14 十二月 2023 11:29:15 +0800 Subject: [PATCH] 2023-12-14 --- src/tabviews/custom/components/form/tab-form/index.jsx | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 7151d62..ba5f788 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -56,6 +56,13 @@ window.GLOB.SyncData.delete(_config.dataName) } + } else if (_config.wrap.datatype === 'public') { + if (window.GLOB.CacheData.has(_config.wrap.publicId)) { + _data = window.GLOB.CacheData.get(_config.wrap.publicId) + _data = fromJS(_data).toJS() + _data.$$BID = BID || '' + _data.$$BData = BData || '' + } } else { _data = {$$empty: true} } @@ -100,12 +107,14 @@ MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) - if (config.setting.useMSearch) { - MKEmitter.addListener('searchRefresh', this.searchRefresh) - } - if (config.setting.sync === 'true') { MKEmitter.addListener('transferSyncData', this.transferSyncData) + } + + if (config.wrap.datatype === 'public') { + MKEmitter.addListener('mkPublicData', this.mkPublicData) + } else if (config.setting.useMSearch) { + MKEmitter.addListener('searchRefresh', this.searchRefresh) } this.initExec() @@ -120,6 +129,7 @@ return } MKEmitter.removeListener('reloadData', this.reloadData) + MKEmitter.removeListener('mkPublicData', this.mkPublicData) MKEmitter.removeListener('mkFormSubmit', this.mkFormSubmit) MKEmitter.removeListener('searchRefresh', this.searchRefresh) MKEmitter.removeListener('resetSelectLine', this.resetParentParam) @@ -153,6 +163,23 @@ MKEmitter.removeListener('transferSyncData', this.transferSyncData) } + mkPublicData = (publicId, data) => { + const { config, BID, BData } = this.state + + if (config.wrap.datatype === 'public' && config.wrap.publicId === publicId) { + let _data = fromJS(data).toJS() + + _data.$$BID = BID || '' + _data.$$BData = BData || '' + + this.setState({ + data: null + }, () => { + this.setState({data: _data}) + }) + } + } + searchRefresh = (searchId) => { const { config } = this.state @@ -178,9 +205,9 @@ * @param {*} btn // 鎵ц鐨勬寜閽� */ refreshByButtonResult = (menuId, position, btn, id) => { - const { config, group, BID } = this.state + const { config, BID } = this.state - if (group.uuid !== menuId) return + if (config.uuid !== menuId) return if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { MKEmitter.emit('reloadData', config.setting.supModule, BID) @@ -243,7 +270,10 @@ async loadData () { const { config, BID } = this.state - if (config.wrap.datatype === 'static') { + if (config.wrap.datatype === 'public') { + MKEmitter.emit('reloadData', config.wrap.publicId) + return + } else if (config.wrap.datatype === 'static') { this.setState({ data: {$$empty: true} }) @@ -322,13 +352,15 @@ } } - mkFormSubmit = (btnId) => { + mkFormSubmit = (btnId, callback) => { const { group } = this.state if (group.uuid !== btnId) return this.formRef.handleConfirm().then(res => { MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res}) + }, () => { + callback && callback() }) } -- Gitblit v1.8.0