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/step-form/index.jsx | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index 0ef5907..03ab2b7 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -57,6 +57,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} } @@ -126,12 +133,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() @@ -146,6 +155,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) @@ -187,6 +197,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 @@ -212,9 +239,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) @@ -290,7 +317,10 @@ async loadData (type) { 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} }) @@ -388,13 +418,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() }) } @@ -461,7 +493,7 @@ inputSubmit={() => this.mkFormSubmit(group.uuid)} wrappedComponentRef={(inst) => this.formRef = inst} /> : null} - {group && data ? <div className={'mk-form-action ' + (group.$button || '')}> + {group && data ? <div className={'mk-form-action ' + (group.$button || '') + (group.nextButton.enable === 'true' ? ' has-skip' : '')}> {group.prevButton.enable === 'true' ? <Button type="link" className="prev" onClick={this.prevStep} style={group.prevButton.style}>{group.prevButton.label}</Button> : null} <NormalButton BID={BID} -- Gitblit v1.8.0