From 076c2b693da1d42cf3a468c0f3d631c1ed424285 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 08 十一月 2023 18:22:56 +0800 Subject: [PATCH] 2023-11-08 --- src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 47 ++++++++++++++++++++++------------------------- 1 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index df3dd7f..698328e 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -59,7 +59,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' @@ -99,7 +99,6 @@ BData: BData || '', data: _data, config: _config, - arr_field: _config.columns.map(col => col.field).join(',') }) } @@ -123,7 +122,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -150,21 +149,21 @@ } 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.setState({data: res.map((item, index) => { + this.setState({data: res.data.map((item, index) => { item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$Index = index + 1 + '' @@ -175,10 +174,10 @@ } } 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.setState({data: res.map((item, index) => { + this.setState({data: res.data.map((item, index) => { item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$Index = index + 1 + '' @@ -190,7 +189,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } } @@ -211,7 +210,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.map((item, index) => { @@ -300,7 +299,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config } = this.state + const { config } = this.state if (config.uuid !== menuId) return @@ -310,15 +309,13 @@ } callback({ - arr_field: arr_field, orderBy: config.setting.order || '', - search: searches, - menuName: config.name + search: searches }) } - async loadData (hastimer) { - const { config, arr_field, BID, BData } = this.state + async loadData (type) { + const { config, BID, BData } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� this.setState({ @@ -343,20 +340,20 @@ 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, config.setting.pageSize, BID) + let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, config.setting.pageSize, BID) let result = await Api.genericInterface(param) if (result.status) { 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) } let data = result.data.map((item, index) => { @@ -562,7 +559,7 @@ if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null return ( - <div className="normal-timeline-box" id={'anchor' + config.uuid} style={{...config.style}}> + <div className={'normal-timeline-box ' + (config.wrap.btnControl || '')} id={'anchor' + config.uuid} style={{...config.style}}> {loading ? <div className="loading-mask"> {data ? <div className="ant-spin-blur"></div> : null} -- Gitblit v1.8.0