From 98c887b79d5dad060e11bf2961f2e8ae422cdcdc Mon Sep 17 00:00:00 2001 From: guanj Date: Mon, 5 Jan 2026 10:13:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=91=E5=8D=97=E6=9B=B2?= =?UTF-8?q?=E9=9D=96=E6=89=93=E5=8C=85=E5=91=BD=E4=BB=A4=E4=BF=AE=E6=94=B9?= =?UTF-8?q?5=E5=B1=82=E6=A0=91=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.qujing | 6 + package.json | 2 + src/components/cockpit/integrity/index.vue | 10 +- src/components/cockpit/onlineRate/index.vue | 10 +- src/components/tree/allocation.vue | 187 ++++++++ src/components/tree/index.vue | 2 +- src/components/tree/pqs/algorithmTree.vue | 1 - src/components/tree/pqs/assessTree.vue | 1 - src/components/tree/pqs/bearingTree.vue | 400 +++++++++++------- src/components/tree/pqs/pointTree.vue | 226 +++++++--- .../embed/lntegruty/index_JB.vue | 12 +- .../embed/onlinerate/index_JB.vue | 12 +- .../online/wentaizhibiaohegelv/index.vue | 2 +- src/views/system/auth/role/index.vue | 51 +-- 14 files changed, 672 insertions(+), 250 deletions(-) create mode 100644 .env.qujing create mode 100644 src/components/tree/allocation.vue diff --git a/.env.qujing b/.env.qujing new file mode 100644 index 00000000..9ddf365e --- /dev/null +++ b/.env.qujing @@ -0,0 +1,6 @@ +# 云南曲靖 +NODE_ENV = qujing +VITE_NAME="qujing" +# 电网一张图 地图图层 +VITE_NARIMAP=null +VITE_NRGISCOMMON=null diff --git a/package.json b/package.json index 08c9e9ac..14f66549 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,12 @@ "dev": "vite --mode dev", "dev:jibei": "vite --mode jibei", "dev:hainan": "vite --mode hainan", + "dev:qujing": "vite --mode qujing", "dev:removeMode": "vite --mode removeMode", "build": "vite build --mode dev", "build:jibei": "vite build --mode jibei", "build:hainan": "vite build --mode hainan", + "build:qujing": "vite build --mode qujing", "build:removeMode": "vite build --mode removeMode", "preview": "vite preview" }, diff --git a/src/components/cockpit/integrity/index.vue b/src/components/cockpit/integrity/index.vue index 78911a26..0e886df3 100644 --- a/src/components/cockpit/integrity/index.vue +++ b/src/components/cockpit/integrity/index.vue @@ -223,7 +223,7 @@ const echart = () => { series: [ { - name: '异常总数', + name: '', type: 'bar', barWidth: 12, data: [100], @@ -240,7 +240,7 @@ const echart = () => { colorStops: [ { offset: 1, - color: '#57bc6e' // 100% 处的颜色 + color: '#FF9100' // 100% 处的颜色 } ], global: false // 缺省为 false @@ -249,7 +249,7 @@ const echart = () => { } }, { - name: '异常占比', + name: '', type: 'bar', barWidth: 13, data: [ @@ -270,11 +270,11 @@ const echart = () => { colorStops: [ { offset: 0, - color: '#FF9100' // 0% 处的颜色 + color: '#57bc6e ' // 0% 处的颜色 }, { offset: 1, - color: '#FF9100' // 100% 处的颜色 + color: '#57bc6e' // 100% 处的颜色 } ], global: false // 缺省为 false diff --git a/src/components/cockpit/onlineRate/index.vue b/src/components/cockpit/onlineRate/index.vue index b9312fc9..67e5c632 100644 --- a/src/components/cockpit/onlineRate/index.vue +++ b/src/components/cockpit/onlineRate/index.vue @@ -222,7 +222,7 @@ const echart = () => { series: [ { - name: '异常总数', + name: '', type: 'bar', barWidth: 12, data: [100], @@ -239,7 +239,7 @@ const echart = () => { colorStops: [ { offset: 1, - color: '#57bc6e' // 100% 处的颜色 + color: '#FF9100' // 100% 处的颜色 } ], global: false // 缺省为 false @@ -248,7 +248,7 @@ const echart = () => { } }, { - name: '异常占比', + name: '', type: 'bar', barWidth: 13, data: [ @@ -269,11 +269,11 @@ const echart = () => { colorStops: [ { offset: 0, - color: '#FF9100' // 0% 处的颜色 + color: '#57bc6e' // 0% 处的颜色 }, { offset: 1, - color: '#FF9100' // 100% 处的颜色 + color: '#57bc6e' // 100% 处的颜色 } ], global: false // 缺省为 false diff --git a/src/components/tree/allocation.vue b/src/components/tree/allocation.vue new file mode 100644 index 00000000..b2682844 --- /dev/null +++ b/src/components/tree/allocation.vue @@ -0,0 +1,187 @@ + + + + + diff --git a/src/components/tree/index.vue b/src/components/tree/index.vue index 16b72413..086cbadf 100644 --- a/src/components/tree/index.vue +++ b/src/components/tree/index.vue @@ -22,7 +22,7 @@ - + -
- -
- -
-
- - - - + + + + diff --git a/src/components/tree/pqs/pointTree.vue b/src/components/tree/pqs/pointTree.vue index b4df90e9..a2ae0a6c 100644 --- a/src/components/tree/pqs/pointTree.vue +++ b/src/components/tree/pqs/pointTree.vue @@ -28,6 +28,7 @@ import { useDictData } from '@/stores/dictData' import { getTerminalTreeForFive } from '@/api/device-boot/terminalTree' import { useConfig } from '@/stores/config' import { defineProps } from 'vue' +const VITE_FLAG = import.meta.env.VITE_NAME == 'qujing' defineOptions({ name: 'pms/pointTree' }) @@ -61,6 +62,9 @@ const loadData = () => { }) || { code: '' } let form = JSON.parse(JSON.stringify(formData.value)) form.statisticalType = classificationData.find((item: any) => item.id == form.statisticalType) + if (VITE_FLAG && form.statisticalType.code == 'Power_Network') { + form.statisticalType.deptName = 'qujing' + } let nodeKey = '' getTerminalTreeForFive(form).then(res => { //console.log('---',res) @@ -74,62 +78,71 @@ const loadData = () => { } ] } - res.data.forEach((item: any) => { - item.icon = 'el-icon-HomeFilled' - item.color = config.getColorVal('elementUiPrimary') - item.children.forEach((item2: any) => { - item2.icon = 'el-icon-CollectionTag' - item2.color = config.getColorVal('elementUiPrimary') - item2.children.forEach((item3: any) => { - item3.icon = 'el-icon-Flag' - item3.color = config.getColorVal('elementUiPrimary') - item3.children.forEach((item4: any) => { - item4.icon = 'el-icon-OfficeBuilding' - item4.color = config.getColorVal('elementUiPrimary') - item4.children.forEach((item5: anyObj) => { - if (item5.level == 7) { - item5.icon = 'el-icon-DataAnalysis' - item5.color = config.getColorVal('elementUiPrimary') - item5.children.forEach((item6: anyObj) => { - item6.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}>${item6.name}` - item6.pid = item4.id - item6.icon = 'fa-solid fa-location-dot' - item6.color = config.getColorVal('elementUiPrimary') - if (item6.comFlag == 0) { - item6.color = 'red !important' - } else if (item6.comFlag == 1) { - item6.color = '#00f93b !important' - } else if (item6.comFlag == 2) { - item6.color = '#8c8c8c !important' - } - }) - } else { - item5.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}` - item5.pid = item4.id - item5.icon = 'fa-solid fa-location-dot' - item5.color = config.getColorVal('elementUiPrimary') - if (item5.comFlag == 0) { - item5.color = 'red !important' - } else if (item5.comFlag == 1) { - item5.color = '#00f93b !important' - } else if (item5.comFlag == 2) { - item5.color = '#8c8c8c !important' - } - } - }) - }) - }) - }) - }) + // if (VITE_FLAG) { + processTreeData(res.data) + let firstLevel6Node = findFirstLevel6Node(res.data) - nodeKey = - res.data[0].children[0].children[0].children[0].children[0].children[0]?.id || - res.data[0].children[0].children[0].children[0].children[0]?.id - emit( - 'init', - res.data[0].children[0].children[0].children[0].children[0]?.children[0] || - res.data[0].children[0].children[0].children[0].children[0] - ) + nodeKey = firstLevel6Node.id + emit('init', firstLevel6Node) + // } else { + // // 正常树处理 + // res.data.forEach((item: any) => { + // item.icon = 'el-icon-HomeFilled' + // item.color = config.getColorVal('elementUiPrimary') + // item.children.forEach((item2: any) => { + // item2.icon = 'el-icon-CollectionTag' + // item2.color = config.getColorVal('elementUiPrimary') + // item2.children.forEach((item3: any) => { + // item3.icon = 'el-icon-Flag' + // item3.color = config.getColorVal('elementUiPrimary') + // item3.children.forEach((item4: any) => { + // item4.icon = 'el-icon-OfficeBuilding' + // item4.color = config.getColorVal('elementUiPrimary') + // item4.children.forEach((item5: anyObj) => { + // if (item5.level == 7) { + // item5.icon = 'el-icon-DataAnalysis' + // item5.color = config.getColorVal('elementUiPrimary') + // item5.children.forEach((item6: anyObj) => { + // item6.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}>${item6.name}` + // item6.pid = item4.id + // item6.icon = 'fa-solid fa-location-dot' + // item6.color = config.getColorVal('elementUiPrimary') + // if (item6.comFlag == 0) { + // item6.color = 'red !important' + // } else if (item6.comFlag == 1) { + // item6.color = '#00f93b !important' + // } else if (item6.comFlag == 2) { + // item6.color = '#8c8c8c !important' + // } + // }) + // } else { + // item5.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}` + // item5.pid = item4.id + // item5.icon = 'fa-solid fa-location-dot' + // item5.color = config.getColorVal('elementUiPrimary') + // if (item5.comFlag == 0) { + // item5.color = 'red !important' + // } else if (item5.comFlag == 1) { + // item5.color = '#00f93b !important' + // } else if (item5.comFlag == 2) { + // item5.color = '#8c8c8c !important' + // } + // } + // }) + // }) + // }) + // }) + // }) + + // nodeKey = + // res.data[0].children[0].children[0].children[0].children[0].children[0]?.id || + // res.data[0].children[0].children[0].children[0].children[0]?.id + // emit( + // 'init', + // res.data[0].children[0].children[0].children[0].children[0]?.children[0] || + // res.data[0].children[0].children[0].children[0].children[0] + // ) + // } tree.value = res.data if (nodeKey) { @@ -145,6 +158,109 @@ const scrollToNode = (id: string) => { // 树滚动 treeRef.value.scrollToNode(id) } + +// 定义不同层级对应的图标配置(可根据实际需求调整) +const levelIconMap = { + '-1': 'el-icon-HomeFilled', + 0: 'el-icon-CollectionTag', + 1: 'el-icon-CollectionTag', + 2: 'el-icon-Flag', + 3: 'el-icon-OfficeBuilding', + 4: 'el-icon-DataAnalysis', + 5: 'el-icon-DataAnalysis', + 7: 'el-icon-DataAnalysis', + 6: 'fa-solid fa-location-dot' +} + +/** + * 递归处理树形数据,为不同层级节点设置图标和颜色 + * @param data 树形数据数组 + * @param level 当前层级(默认从1开始) + */ +function processTreeData(data: any[], level: number = -1, alias: string = '') { + // 空值判断,避免数组为空或undefined时报错 + if (!Array.isArray(data) || data.length === 0) return + + data.forEach(item => { + // 1. 设置基础图标(根据层级匹配) + item.icon = levelIconMap[level] || '' + item.alias = alias + `${item.name}` + // 2. 设置基础颜色 + item.color = config.getColorVal('elementUiPrimary') + + // 3. 第6层特殊处理:根据comFlag调整颜色 + if (level === 6 && item.hasOwnProperty('comFlag')) { + switch (item.comFlag) { + case 0: + item.color = 'red !important' + break + case 1: + item.color = '#00f93b !important' + break + case 2: + item.color = '#8c8c8c !important' + break + // 默认值:保持原有基础颜色 + default: + item.color = config.getColorVal('elementUiPrimary') + } + } + + // 4. 递归处理子节点,层级+1 + if (item.children && item.children.length > 0) { + processTreeData(item.children, item.children[0].level, level == '-1' ? '' : item.alias + '>') + } + }) +} +/** + * 递归查找树形结构中第一个level===6的节点(找到即终止递归) + * @param {Object|Array} tree - 树形数据(根节点数组 或 单个根节点) + * @returns {Object|null} 第一个level为6的节点,无则返回null + */ +function findFirstLevel6Node(tree: any) { + // 统一处理入参:如果是数组,遍历根节点数组(按顺序找第一个符合条件的) + if (Array.isArray(tree)) { + for (const rootNode of tree) { + const result = traverse(rootNode) + // 找到第一个匹配节点,立即返回(终止根节点遍历) + if (result) return result + } + // 所有根节点遍历完未找到 + return null + } else { + // 入参是单个节点,直接递归遍历 + return traverse(tree) + } + + // 核心递归遍历函数 + function traverse(node) { + // 终止条件1:节点不存在,返回null + if (!node) return null + + // 终止条件2:找到level===6的节点,立即返回(终止递归) + if (node.level === 6) { + return node + } + + // 终止条件3:节点无children,返回null + if (!node.children || node.children.length === 0) { + return null + } + + // 按顺序遍历当前节点的子节点 + for (const child of node.children) { + const foundNode = traverse(child) + // 子节点中找到目标节点,立即返回(终止后续子节点遍历) + if (foundNode) { + return foundNode + } + } + + // 当前节点及所有子节点都无匹配,返回null + return null + } +} + defineExpose({ treeRef, scrollToNode, tree }) loadData() diff --git a/src/views/pqs/harmonicMonitoring/embed/lntegruty/index_JB.vue b/src/views/pqs/harmonicMonitoring/embed/lntegruty/index_JB.vue index 8d7e7663..f38bbd0d 100644 --- a/src/views/pqs/harmonicMonitoring/embed/lntegruty/index_JB.vue +++ b/src/views/pqs/harmonicMonitoring/embed/lntegruty/index_JB.vue @@ -1,6 +1,6 @@