Merge pull request #11192 from dataease/de-v2@feat_refresh

De v2@feat refresh
This commit is contained in:
王嘉豪 2024-07-26 13:29:04 +08:00 committed by GitHub
commit d019c91ed8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 34 additions and 5 deletions

View File

@ -1,2 +0,0 @@
INSERT INTO `core_sys_setting` (`id`, `pkey`, `pval`, `type`, `sort`) VALUES (10, 'basic.exportFileLiveTime', '30', 'text', 2);
delete from visualization_background where id ='dark_1';

View File

@ -52,3 +52,6 @@ ALTER TABLE `visualization_template`
MODIFY COLUMN `node_type` varchar(255) NULL DEFAULT NULL COMMENT '节点类型 app or template 应用 或者 模板' AFTER `dv_type`,
ADD COLUMN `app_data` longtext NULL COMMENT 'app数据' AFTER `dynamic_data`;
INSERT INTO `core_sys_setting` (`id`, `pkey`, `pval`, `type`, `sort`) VALUES (10, 'basic.exportFileLiveTime', '30', 'text', 2);
delete from visualization_background where id ='dark_1';

View File

@ -1,2 +0,0 @@
INSERT INTO `core_sys_setting` (`id`, `pkey`, `pval`, `type`, `sort`) VALUES (10, 'basic.exportFileLiveTime', '30', 'text', 2);
delete from visualization_background where id ='dark_1';

View File

@ -73,3 +73,6 @@ ALTER TABLE `visualization_template`
MODIFY COLUMN `node_type` varchar(255) NULL DEFAULT NULL COMMENT '节点类型 app or template 应用 或者 模板' AFTER `dv_type`,
ADD COLUMN `app_data` longtext NULL COMMENT 'app数据' AFTER `dynamic_data`;
INSERT INTO `core_sys_setting` (`id`, `pkey`, `pval`, `type`, `sort`) VALUES (10, 'basic.exportFileLiveTime', '30', 'text', 2);
delete from visualization_background where id ='dark_1';

View File

@ -9,7 +9,7 @@ import { storeToRefs } from 'pinia'
import elementResizeDetectorMaker from 'element-resize-detector'
import UserViewEnlarge from '@/components/visualization/UserViewEnlarge.vue'
import CanvasOptBar from '@/components/visualization/CanvasOptBar.vue'
import { isDashboard, isMainCanvas } from '@/utils/canvasUtils'
import { isDashboard, isMainCanvas, refreshOtherComponent } from '@/utils/canvasUtils'
import { activeWatermark } from '@/components/watermark/watermark'
import { personInfoApi } from '@/api/user'
import router from '@/router'
@ -220,6 +220,9 @@ const initRefreshTimer = () => {
}
refreshTimer.value = setInterval(() => {
searchCount.value++
if (isMainCanvas(canvasId.value)) {
refreshOtherComponent(dvInfo.value.id, dvInfo.value.type)
}
}, refreshTime)
}
}

View File

@ -170,6 +170,30 @@ export function historyAdaptor(
})
}
// 重置仪表板大屏中的其他组件
export function refreshOtherComponent(dvId, busiFlag) {
// 富文本 跑马灯组件进行刷新
const refreshComponentList = componentData.value.filter(
ele => ['ScrollText'].includes(ele.component) || ele.innerType === 'rich-text'
)
if (refreshComponentList && refreshComponentList.length > 0) {
const refreshIdList = refreshComponentList.map(ele => ele.id)
findById(dvId, busiFlag, {}).then(rsp => {
const canvasInfo = rsp.data
const canvasDataResult = JSON.parse(canvasInfo.componentData)
const canvasDataResultMap = canvasDataResult.reduce((acc, comp) => {
acc.set(comp.id, comp)
return acc
}, new Map())
componentData.value.map(component =>
refreshIdList.includes(component.id) && canvasDataResultMap[component.id]
? canvasDataResultMap[component.id]
: component
)
})
}
}
export function initCanvasDataPrepare(dvId, busiFlag, callBack) {
const copyFlag = busiFlag != null && busiFlag.includes('-copy')
const busiFlagCustom = copyFlag ? busiFlag.split('-')[0] : busiFlag