From cdd5b449130ea4d7223fde4f414a11a7d0c33d6d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 07 三月 2024 17:52:16 +0800 Subject: [PATCH] 2024-03-07 --- src/tabviews/custom/components/chart/custom-chart/index.jsx | 51 ++++++++++++++++++++++++--------------------------- 1 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx index 25c9741..1fcd7c8 100644 --- a/src/tabviews/custom/components/chart/custom-chart/index.jsx +++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx @@ -57,7 +57,7 @@ this.data = window.GLOB.SyncData.get(_config.dataName) || [] if (_config.$cache) { - Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) + Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS(), BID) } _config.setting.sync = 'false' @@ -72,7 +72,6 @@ config: _config, empty: this.data.length === 0, BID: BID || '', - arr_field: _config.columns.map(col => col.field).join(','), plot: _config.plot, search: _config.$searches }) @@ -101,7 +100,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -126,43 +125,43 @@ } initExec = () => { - const { config } = this.state + const { config, BID } = this.state if (config.$cache) { if (config.$time) { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, config.$time).then(res => { - if (!res && config.setting.onload === 'true') { + 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) } - if (!res || this.loaded) return + if (!res.data || this.loaded) return - this.data = res + this.data = res.data this.handleData() - this.setState({empty: res.length === 0}) + this.setState({empty: res.data.length === 0}) }) } else { this.handleData() } } else { if (!this.loaded) { - Api.getLCacheConfig(config.uuid, 0).then(res => { - if (!res || this.loaded) return + Api.getLCacheConfig(config.uuid, 0, BID).then(res => { + if (!res.data || this.loaded) return - this.data = res + this.data = res.data this.handleData() - this.setState({empty: res.length === 0}) + this.setState({empty: res.data.length === 0}) }) } if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.handleData() @@ -178,14 +177,14 @@ } transferSyncData = (syncId) => { - const { config } = this.state + const { config, BID } = this.state if (config.$syncId !== syncId) return 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) } if (!is(fromJS(this.data), fromJS(_data))) { @@ -253,7 +252,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config, search } = this.state + const { config, search } = this.state if (config.uuid !== menuId) return @@ -269,18 +268,16 @@ } callback({ - arr_field: arr_field, orderBy: config.setting.order || '', - search: searches, - menuName: config.name + search: searches }) } /** * @description 鏁版嵁鍔犺浇 */ - async loadData (hastimer) { - const { config, arr_field, BID, search } = this.state + async loadData (type) { + const { config, BID, search } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� this.setState({ @@ -311,19 +308,19 @@ 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, '', '', BID) + let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID) let result = await Api.genericInterface(param) if (result.status) { - 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) } this.loaded = true -- Gitblit v1.8.0