From 46773828b8c46e450a67eb1fc5e6124d87d97ab6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 23 九月 2023 19:51:11 +0800 Subject: [PATCH] 2023-09-23 --- src/tabviews/custom/components/form/simple-form/index.jsx | 34 ++++++++++++++++++++-------------- 1 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index a92f2cf..8115aea 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -25,8 +25,7 @@ loading: false, data: null, group: null, - BData: '', - step: 0 + BData: '' } UNSAFE_componentWillMount () { @@ -46,7 +45,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} @@ -72,14 +73,7 @@ group: _group, 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 }) } @@ -98,6 +92,8 @@ if (config.setting.sync === 'true') { MKEmitter.addListener('transferSyncData', this.transferSyncData) } + + this.initExec() } shouldComponentUpdate (nextProps, nextState) { @@ -114,6 +110,16 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('transferSyncData', this.transferSyncData) 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) => { @@ -201,7 +207,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 @@ -215,7 +221,7 @@ } async loadData () { - const { config, arr_field, BID } = this.state + const { config, BID } = this.state if (config.wrap.datatype === 'static') { this.setState({ @@ -246,7 +252,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