From 783ab4e467c95e26f7f031151507bd7ad8333a63 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 08 九月 2023 17:34:47 +0800 Subject: [PATCH] 2023-09-08 --- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 76 +++++++++++++++++-------------------- 1 files changed, 35 insertions(+), 41 deletions(-) diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 48e1382..46c4260 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -207,7 +207,7 @@ let xc = {label: { formatter: (val) => { - if (!val || /^\s*$/.test(val)) return val + if (!val || /^\s+$/.test(val)) return val let _val = `${val}` if (_val.length <= limit) return val return _val.substring(0, limit) + '...' @@ -328,7 +328,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' @@ -344,7 +344,6 @@ BID: BID || '', vFields: vFields, vstFields: vstFields, - arr_field: _config.columns.map(col => col.field).join(','), plot: _config.plot, search: _config.$searches, transfield @@ -374,7 +373,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -399,21 +398,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.data = res + this.data = res.data this.handleData() }) } else { @@ -421,17 +420,17 @@ } } 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() }) } if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.handleData() @@ -447,20 +446,18 @@ } 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))) { - this.data = _data - this.handleData() - } + this.data = _data + this.handleData() this.loaded = true @@ -520,7 +517,7 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ queryModuleParam = (menuId, callback) => { - const { arr_field, config, search } = this.state + const { config, search } = this.state if (config.uuid !== menuId) return @@ -536,7 +533,6 @@ } callback({ - arr_field: arr_field, orderBy: config.setting.order || '', search: searches, menuName: config.name @@ -546,8 +542,8 @@ /** * @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 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� if (!is(fromJS(this.data), fromJS([]))) { @@ -573,19 +569,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 @@ -1879,34 +1875,32 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (plot.click === 'menu') { let menuId = plot.menu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && plot.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (plot.MenuID) { + menu = { MenuID: plot.MenuID, MenuName: plot.MenuName, - MenuNo: plot.MenuNo, type: plot.tabType } - } else if (!newtab) { - return } + + if (!menu) return - newtab = { - ...newtab, - param: {} - } + menu.param = {} if (plot.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else { MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), data) } -- Gitblit v1.8.0