From c5e5a7580632bc39a9e0c78d548f22a8be5f2019 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 18 十月 2023 18:04:51 +0800 Subject: [PATCH] 2023-10-18 --- src/tabviews/custom/components/form/tab-form/index.jsx | 41 ++++++++++++++++++++++------------------- 1 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 92a5018..01a21ed 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -24,7 +24,7 @@ loading: false, // 鏁版嵁鍔犺浇鐘舵�� data: null, BData: '', - group: null, + group: null } UNSAFE_componentWillMount () { @@ -44,7 +44,9 @@ BID = BData.$BID || '' } - if (_config.wrap.datatype !== 'static') { + if (_config.wrap.datatype === 'dynamic') { + _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' + if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { _data = window.GLOB.SyncData.get(_config.dataName) || [] _data = _data[0] || {$$empty: true} @@ -86,14 +88,7 @@ group: _config.subcards[0], BID: BID || '', BData: BData || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(','), - }, () => { - if (_config.wrap.datatype !== 'static' && config.setting.sync !== 'true' && _config.setting.onload === 'true') { - setTimeout(() => { - this.loadData() - }, _config.setting.delay || 0) - } + config: _config }) } @@ -112,6 +107,8 @@ if (config.setting.sync === 'true') { MKEmitter.addListener('transferSyncData', this.transferSyncData) } + + this.initExec() } shouldComponentUpdate (nextProps, nextState) { @@ -130,8 +127,18 @@ MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } + initExec = () => { + const { config } = this.state + + if (config.wrap.datatype === 'dynamic' && config.setting.onload === 'true') { + setTimeout(() => { + this.loadData() + }, config.setting.delay || 0) + } + } + transferSyncData = (syncId) => { - const { config, group } = this.state + const { config } = this.state if (config.$syncId !== syncId) return @@ -139,11 +146,7 @@ _data = _data[0] || {$$empty: true} _data.$$uuid = _data[config.setting.primaryKey] || '' - let _group = group - - this.setState({data: _data, group: null}, () => { - this.setState({group: _group}) - }) + this.setState({data: _data}) window.GLOB.SyncData.delete(config.dataName) @@ -218,7 +221,7 @@ execSuccess = (btn, id) => { if (btn.linkmenu && btn.linkmenu.length > 0) { let menu_id = btn.linkmenu[btn.linkmenu.length - 1] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + let menu = window.GLOB.mkThdMenus.get(menu_id) || '' if (!menu) return @@ -232,7 +235,7 @@ } async loadData () { - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.wrap.datatype === 'static') { this.setState({ @@ -263,7 +266,7 @@ }) let _orderBy = config.setting.order || '' - let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) + let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, 1, BID) let result = await Api.genericInterface(param) if (result.status) { -- Gitblit v1.8.0