From 0c1a33a33b45fc3265cb7fef20beb48407cd6c98 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 八月 2023 14:54:06 +0800 Subject: [PATCH] 2023-08-24 --- src/tabviews/custom/components/card/prop-card/index.jsx | 57 +++++++++++++++++++++++++++++---------------------------- 1 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index dbb8131..f114efa 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -47,7 +47,7 @@ if (BData) { BID = BData.$BID || '' } - + if (_config.wrap.datatype === 'dynamic') { _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' @@ -55,7 +55,7 @@ _data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID) } _config.setting.sync = 'false' @@ -118,8 +118,7 @@ data: _data, BID: BID || '', BData: BData || '', - config: _config, - arr_field: _config.columns.map(col => col.field).join(',') + config: _config }) } @@ -146,7 +145,7 @@ if (config.timer && config.wrap.datatype === 'dynamic') { this.timer = new TimerTask() - this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData('timer')}) } this.initExec() @@ -173,16 +172,16 @@ } initExec = () => { - const { config, selected, data } = this.state + const { config, selected, data, BID } = this.state if (config.wrap.datatype === 'dynamic') { if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -191,7 +190,11 @@ let _data = res.data[0] || {$$empty: true} _data.$$uuid = _data[config.setting.primaryKey] || '' - this.setState({data: _data}) + this.setState({data: _data}, () => { + if (selected !== 'false') { + this.checkTopLine() + } + }) }) } else { if (config.wrap.goback === 'true' && data.$$empty) { @@ -209,7 +212,7 @@ } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { if (!res.data || this.loaded) return let _data = res.data[0] || {$$empty: true} @@ -221,7 +224,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { if (config.wrap.goback === 'true' && data.$$empty) { @@ -277,12 +280,12 @@ } if (config.$cache && config.$time && config.wrap.autoExec) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { - if (!res.valid) { - this.autoExec() - } else { - Api.writeCacheConfig(config.uuid, []) - } + Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { + if (res.valid) return + + this.autoExec() + + Api.writeCacheConfig(config.uuid, [], BID) }) } else { this.autoExec() @@ -300,7 +303,7 @@ let _data = window.GLOB.SyncData.get(config.dataName) || [] if (config.$cache) { - Api.writeCacheConfig(config.uuid, fromJS(_data).toJS()) + Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID) } _data = _data[0] || {$$empty: true} @@ -429,7 +432,7 @@ if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠� MKEmitter.emit('reloadData', config.setting.supModule, BID) } else { - this.loadData(false, btn) + this.loadData('', btn) } } @@ -472,10 +475,8 @@ } callback({ - arr_field: '', orderBy: '', - search: searches, - menuName: config.name + search: searches }) } @@ -487,8 +488,8 @@ this.loadData() } - async loadData (hastimer, btn) { - const { config, arr_field, BID, BData, selected } = this.state + async loadData (type, btn) { + const { config, BID, BData, selected } = this.state if (config.wrap.datatype === 'public') { MKEmitter.emit('reloadData', config.wrap.publicId) @@ -521,22 +522,22 @@ return } - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) } 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) { let _data = {} this.loaded = true - if (config.$cache && config.setting.onload !== 'false') { - Api.writeCacheConfig(config.uuid, result.data || []) + if (config.$cache && type === 'init') { + Api.writeCacheConfig(config.uuid, result.data || [], BID) } if (!result.data || !result.data[0]) { -- Gitblit v1.8.0