From 27ca4b36d00fe966f095abba9a2ab2f4096b6f14 Mon Sep 17 00:00:00 2001 From: pengwei Date: Mon, 27 Oct 2025 09:36:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BC=98=E5=8C=96=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/enums/JwpyOrgMapping.js | 10 +++++++++- src/views/datav/CaseVerif.vue | 6 +----- src/views/datav/Global.vue | 6 +----- src/views/datav/MailVisits.vue | 5 ----- src/views/datav/RightsComfort.vue | 10 +++------- src/views/datav/SceneInsp.vue | 8 ++------ src/views/datav/VideoInsp.vue | 6 +----- 7 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/enums/JwpyOrgMapping.js b/src/enums/JwpyOrgMapping.js index a2aa572..a6412ef 100644 --- a/src/enums/JwpyOrgMapping.js +++ b/src/enums/JwpyOrgMapping.js @@ -34,13 +34,21 @@ export function mapOrgNameMapping(backendData, valueMapping) { const mappedName = orgMapping[item.OrganizeName] || item.OrganizeName; return { ...item, - originalName: item.OrganizeName, // 保留原始名称,就是后端传送的名字 + originalName: setNameFun(item.OrganizeName) , // 保留原始名称,就是后端传送的名字 name: mappedName, value: Number(item[valueMapping] || 0), // 自定义属性 }; }); } +export function setNameFun(name){ + if(name == '湘江新区公安局'){ + return '湘江新区' + } + return name; +} + + export function mapOrgNameMappingJwpy(backendData, valueMapping) { return backendData.map(item => { const mappedName = orgMappingTwo[item.OrganizeName] || item.OrganizeName; diff --git a/src/views/datav/CaseVerif.vue b/src/views/datav/CaseVerif.vue index 59b1448..80ba105 100644 --- a/src/views/datav/CaseVerif.vue +++ b/src/views/datav/CaseVerif.vue @@ -543,11 +543,7 @@ const getCaseVerificationCountData = async (timeValue) => { const getCaseVerificationMapData = async (timeValue) => { const res = await getCaseVerificationMap(timeValue); const mappedData = mapOrgNameMapping(res.caseVerificationMapList, "total"); - mappedData.map((s)=>{ - if(s.name == '湘江新区公安局'){ - s.name = '湘江新区' - } - }) + const maxItem = mappedData.reduce((max, item) => (Number(item.value) > Number(max.value) ? item : max), mappedData[0]); const range60Percent = maxItem.value * 0.6 // 不用取整,小数也可以 const range80Percent = maxItem.value * 0.8 // 不用取整,小数也可以 diff --git a/src/views/datav/Global.vue b/src/views/datav/Global.vue index 2871a6c..dda27df 100644 --- a/src/views/datav/Global.vue +++ b/src/views/datav/Global.vue @@ -464,11 +464,7 @@ const getAllGlobalCountData = async (timeValue = time.value) => { const getGlobalMapData = async (timeValue = time.value) => { const res = await getGlobalMap(timeValue); const mappedData = mapOrgNameMapping(res.globalTempMapVoList, "totalPro"); - mappedData.map((s)=>{ - if(s.name == '湘江新区公安局'){ - s.name = '湘江新区' - } - }) + console.log('mappedData',mappedData) // 所有问题总数 const maxItem = mappedData.reduce( diff --git a/src/views/datav/MailVisits.vue b/src/views/datav/MailVisits.vue index 7356786..256ffc6 100644 --- a/src/views/datav/MailVisits.vue +++ b/src/views/datav/MailVisits.vue @@ -847,11 +847,6 @@ const getMailMapIconData = async (timeValue = time.value) => { console.log('-------执行') const res = await getMailMapIcon(timeValue); const mappedData = mapOrgNameMapping(res.mailMapIconList, "total"); - mappedData.map((s)=>{ - if(s.name == '湘江新区公安局'){ - s.name = '湘江新区' - } - }) mailMapIconList.value = mappedData; console.log('-------执行2') console.log(mailMapIconList) diff --git a/src/views/datav/RightsComfort.vue b/src/views/datav/RightsComfort.vue index 14654ad..ecddb16 100644 --- a/src/views/datav/RightsComfort.vue +++ b/src/views/datav/RightsComfort.vue @@ -216,6 +216,7 @@ import vCharts from "vue-echarts"; import changshaMap from "@/assets/data/changsha.json"; import * as echarts from "echarts/core"; import moment from "moment"; +import {setNameFun} from "@/enums/orgMapping.js"; import { getALlComfortCount, getPunishmentSituation, @@ -459,16 +460,11 @@ const getMapData = async (timeValue) => { } return { ...item, - originalName: item.name, // 添加原始名称 - name: name, + originalName: setNameFun(item.name), // 添加原始名称 + name: setNameFun(item.name), value: item.totalCase, }; }); - mappedData.map((s)=>{ - if(s.name == '湘江新区公安局'){ - s.name = '湘江新区' - } - }) globalTempMapVoList.value = mappedData const total = mappedData.reduce((sum, item) => sum + (Number(item.rightsNumber) || 0), 0); diff --git a/src/views/datav/SceneInsp.vue b/src/views/datav/SceneInsp.vue index abd9bb2..6572d42 100644 --- a/src/views/datav/SceneInsp.vue +++ b/src/views/datav/SceneInsp.vue @@ -975,7 +975,7 @@ const getSupervisionNotifyMapData = async () => { const res = await getSupervisionNotifyMap(time.value); - const mappedData = mapOrgNameMapping( + let mappedData = mapOrgNameMapping( res.superviseTempMapVoList, "totalPro" ); @@ -1001,11 +1001,7 @@ const getSupervisionNotifyMapData = async () => { color: "#D34343", }, ]; - mappedData.map((s)=>{ - if(s.name == '湘江新区公安局'){ - s.name = '湘江新区' - } - }) + superviseTempMapVoList.value = mappedData; console.log('mappedData',mappedData) option.value.series[0].data = mappedData; diff --git a/src/views/datav/VideoInsp.vue b/src/views/datav/VideoInsp.vue index f42f3ca..eff0bff 100644 --- a/src/views/datav/VideoInsp.vue +++ b/src/views/datav/VideoInsp.vue @@ -485,11 +485,7 @@ const getVideoSuperviseMapData = async (timeValue) => { ); const range60Percent = maxItem.value * 0.6; // 不用取整,小数也可以 const range80Percent = maxItem.value * 0.8; // 不用取整,小数也可以 - mappedData.map((s)=>{ - if(s.name == '湘江新区公安局'){ - s.name = '湘江新区' - } - }) + mapIconList.value = mappedData; option.value.series[0].data = mappedData; option.value.visualMap.pieces = [