From 8175de04bbb70dd85ee7cee81b3ef5e113f1ae72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Thu, 29 Feb 2024 10:31:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=9B=91=E6=B5=8B=E7=82=B9=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/tree/pms/pointTree.vue | 13 +++++++------ src/stores/monitoringPoint.ts | 9 ++++----- .../monitoringPoint/online/index.vue | 8 +++++--- .../online/wentaishujufenxi/index.vue | 5 +++-- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/components/tree/pms/pointTree.vue b/src/components/tree/pms/pointTree.vue index 9c02dfc8..f53d24ae 100644 --- a/src/components/tree/pms/pointTree.vue +++ b/src/components/tree/pms/pointTree.vue @@ -14,7 +14,7 @@ >
- +
@@ -37,7 +37,7 @@ const dictData = useDictData() const config = useConfig() const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type']) const tree = ref() -const treRef = ref() +const treeRef = ref() const formData = ref({ deptIndex: adminInfo.$state.deptIndex, monitorFlag: 2, @@ -48,10 +48,10 @@ const formData = ref({ statisticalType: classificationData[2].id, scale: null }) -const loadData = (val: string) => { +const loadData = () => { let obj = classificationData.find(function (i) { return i.id === formData.value.statisticalType - }) + }) || { code: '' } let form = JSON.parse(JSON.stringify(formData.value)) form.statisticalType = classificationData.find((item: any) => item.id == form.statisticalType) let nodeKey = '' @@ -84,6 +84,7 @@ const loadData = (val: string) => { nodeKey = item5.id emit('init', item5) } + item5.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}` item5.icon = 'fa-solid fa-location-dot' item5.color = config.getColorVal('elementUiPrimary') if (item5.comFlag === 0) { @@ -101,8 +102,8 @@ const loadData = (val: string) => { tree.value = res.data if (nodeKey) { nextTick(() => { - treRef.value.treeRef.setCurrentKey(nodeKey) - treRef.value.treeRef.setExpandedKeys(nodeKey) + treeRef.value.treeRef.setCurrentKey(nodeKey) + treeRef.value.treeRef.setExpandedKeys(nodeKey) }) } }) diff --git a/src/stores/monitoringPoint.ts b/src/stores/monitoringPoint.ts index 1c6fb5e7..ae92be59 100644 --- a/src/stores/monitoringPoint.ts +++ b/src/stores/monitoringPoint.ts @@ -1,6 +1,5 @@ import { reactive } from 'vue' import { defineStore } from 'pinia' - interface MonitoringPoint { lineId: string lineName: string @@ -21,9 +20,7 @@ export const useMonitoringPoint = defineStore( state[key] = val } const setShowCheckBox = (val: boolean) => { - if (!val) { - state.lineIds = [] - } else { + if (val && state.lineIds.length === 0) { state.lineIds = [state.lineId] } state.showCheckBox = val @@ -31,6 +28,8 @@ export const useMonitoringPoint = defineStore( return { state, setValue, setShowCheckBox } }, { - persist: true + persist: { + paths: ['state.lineId', 'state.lineName'] + } } ) diff --git a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/index.vue b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/index.vue index ae22e961..7689911e 100644 --- a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/index.vue +++ b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/index.vue @@ -39,7 +39,9 @@ -
当前位置:{{ monitoringPoint.state.lineName }}
+
+ 当前位置:{{ monitoringPoint.state.lineName }} +
@@ -80,11 +82,11 @@ onMounted(() => { const handleNodeClick = (data: any, node: any) => { if (data.level === 6) { monitoringPoint.setValue('lineId', data.id) + monitoringPoint.setValue('lineName', data.alias) } } const handleCheckChange = (data: any, node: any) => { - // let checkNodes = pointTree.value.getCheckedNodes() - // console.log(checkNodes) + console.log(data) } watch( () => router.currentRoute.value.query.lineId, diff --git a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaishujufenxi/index.vue b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaishujufenxi/index.vue index 4dfc9e7c..e427289f 100644 --- a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaishujufenxi/index.vue +++ b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaishujufenxi/index.vue @@ -2,7 +2,7 @@
- + @@ -25,7 +25,7 @@ import { getProbabilityDistribution } from '@/api/event-boot/monitor' const datePickerRef = ref() const monitoringPoint = useMonitoringPoint() -const checked = ref(false) +const checked = ref(monitoringPoint.state.showCheckBox) const loading = ref(true) const formData = reactive({ lineIndex: monitoringPoint.state.lineId, @@ -38,6 +38,7 @@ const checkChange = () => { monitoringPoint.setShowCheckBox(true) } else { monitoringPoint.setShowCheckBox(false) + init() } } const init = () => {