diff --git a/src/api/index.ts b/src/api/index.ts index 6069a8b..49b946b 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -82,7 +82,7 @@ export function targetList(params: any) { export function eleEpdChooseTree_ypt() { return http.request({ url: '/cs-system-boot/csDictData/eleEpdChooseTree', - method: 'post', + method: 'GET' }) } // 无锡指标列表 diff --git a/src/components/mt-edit/index.vue b/src/components/mt-edit/index.vue index dda45a5..43f9bf3 100644 --- a/src/components/mt-edit/index.vue +++ b/src/components/mt-edit/index.vue @@ -320,9 +320,13 @@ const onSaveClick = () => { const useData = useDataStore() const onSaveAll = async () => { let data: any = await useData.dataTree.map((item, ind) => { + let pathList = JSON.parse(item.path) + pathList.canvasCfg.lineList = pathList.json.filter(k => k.lineId != '' && k.lineId != null).map(k => k.lineId) + item.path = JSON.stringify(pathList) item.sort = ind return item }) + console.log('🚀 ~ onSaveAll ~ data:', data) let form = new FormData() let blob = new Blob([JSON.stringify(data)], { diff --git a/src/components/mt-edit/utils/index.ts b/src/components/mt-edit/utils/index.ts index 155deac..9a84383 100644 --- a/src/components/mt-edit/utils/index.ts +++ b/src/components/mt-edit/utils/index.ts @@ -819,7 +819,6 @@ export const eventToVOn = (item: IDoneJson, externalMethod: (kid?: string) => vo } if (!Object.prototype.hasOwnProperty.call(event_obj, event.type)) { - event_obj[event.type] = code_str } else { event_obj[event.type] += code_str diff --git a/src/components/mt-preview-ypt/iframeDia.vue b/src/components/mt-preview-ypt/iframeDia.vue index 452e467..369a82c 100644 --- a/src/components/mt-preview-ypt/iframeDia.vue +++ b/src/components/mt-preview-ypt/iframeDia.vue @@ -6,12 +6,13 @@
{{ corner.title }}
-
+
- {{ item.statisticalName }}: {{ item.value === 3.1415926 ? '/' : item.value }} + {{ item.statisticalName.replace(/\//g, '_') }}: + {{ item.value === 3.1415926 ? '/' : item.value + item.unit }}
@@ -29,9 +30,7 @@ import { ref, onMounted, watch } from 'vue' import { Close } from '@element-plus/icons-vue' // 定义 emits -const emit = defineEmits<{ - (e: 'lineListChange', lineList: string[]): void -}>() +const emit = defineEmits(['lineListChange']) // 定义接收的 props const props = defineProps<{ @@ -59,7 +58,6 @@ const corners = ref([ ]) const displayOrder = ref([]) -const lineList = ref([]) // 缓存打开的lineId // 截取名称的最后一部分作为标题 const extractTitleFromLineName = (lineName: string): string => { @@ -117,20 +115,25 @@ const showNextCorner = (elementId: string, lineName: string) => { displayOrder.value.push(replaceIndex) } - // 更新 lineList,去重并触发事件 // updateLineList() } - +const timer = ref(null) // 更新 lineList,根据 corners 的 show 状态来维护 const updateLineList = () => { - // 根据 corners 中 show 为 true 的项来构建 lineList const newLineList = corners.value.filter(corner => corner.show && corner.elementId).map(corner => corner.elementId) - - // 更新 lineList - lineList.value = newLineList - - // 触发事件,传递更新后的 lineList - emit('lineListChange', [...lineList.value]) + if (timer.value) { + clearInterval(timer.value) + timer.value = null + } + if (newLineList.length > 0) { + emit('lineListChange', newLineList) + timer.value = setInterval( + () => { + emit('lineListChange', newLineList) + }, + 3 * 60 * 1000 + ) + } } // 关闭指定角落的函数 @@ -145,9 +148,6 @@ const closeCorner = (id: string) => { if (orderIndex !== -1) { displayOrder.value.splice(orderIndex, 1) } - - // 更新 lineList - // updateLineList() } } @@ -159,7 +159,6 @@ const closeAllCorners = () => { }) displayOrder.value = [] - // 更新 lineList updateLineList() } @@ -188,20 +187,7 @@ defineExpose({