From c23ac06446a9a1edc41cc13723e5d0b8eabdfd63 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期三, 16 七月 2025 17:30:50 +0800 Subject: [PATCH] 2025.7.16 动态溯源新增合并异常 --- src/views/sourcetrace/SourceTrace.vue | 4 src/api/index.js | 8 +- src/views/sourcetrace/component/PollutedExceptionItem.vue | 61 ++++++++++---------- src/views/sourcetrace/component/ClueRecordItem.vue | 70 ++++++++++------------ 4 files changed, 68 insertions(+), 75 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 1792861..efcd5a1 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -13,10 +13,10 @@ } if (debug) { - // ip1 = 'http://192.168.0.103:8084/'; - ip1 = 'http://localhost:8084/'; - // ws = `192.168.0.103:9031`; - ws = `localhost:9031`; + ip1 = 'http://192.168.0.103:8084/'; + // ip1 = 'http://localhost:8084/'; + ws = `192.168.0.103:9031`; + // ws = `localhost:9031`; } const $http = axios.create({ diff --git a/src/views/sourcetrace/SourceTrace.vue b/src/views/sourcetrace/SourceTrace.vue index a00879a..9cfbd0e 100644 --- a/src/views/sourcetrace/SourceTrace.vue +++ b/src/views/sourcetrace/SourceTrace.vue @@ -7,7 +7,7 @@ " > <el-col span="2" class="flex-col"> - <el-row justify="end"> + <el-row :justify="direction == 'left' ? 'end' : 'start'"> <CardButton :direction="direction" name="鍔ㄦ�佹函婧�" @@ -242,7 +242,7 @@ function dealMsg(data) { const { type, content } = websocketMsgParser.parseMsg(data); const obj = reactive(JSON.parse(content)); - if (obj[0].deviceCode == props.deviceCode) { + if (obj.deviceCode == props.deviceCode) { obj._type = type; dealObj(obj); } diff --git a/src/views/sourcetrace/component/ClueRecordItem.vue b/src/views/sourcetrace/component/ClueRecordItem.vue index dedec77..25a1b59 100644 --- a/src/views/sourcetrace/component/ClueRecordItem.vue +++ b/src/views/sourcetrace/component/ClueRecordItem.vue @@ -30,7 +30,9 @@ round class="m-r-4" > - <div v-html="formatFactorName(item.pollutedData.factorName)"></div> + <div + v-html="formatFactorName(item.pollutedData.statisticMap)" + ></div> </el-tag> <el-text type="info"> {{ item.pollutedData.exception + '锛�' }} @@ -100,7 +102,9 @@ round class="m-r-4" > - <div v-html="formatFactorName(item.pollutedData.factorName)"></div> + <div + v-html="formatFactorName(item.pollutedData.statisticMap)" + ></div> </el-tag> <el-text type="info">{{ item.pollutedData.exception }}</el-text> </div> @@ -119,22 +123,6 @@ </div> </div> </el-col> - - <!-- <el-row justify="space-between"> - <el-space> - <el-tag type="info" effect="dark" size="small">鎻愰啋</el-tag> - <el-text type="info">{{ - item.pollutedData.startTime + ' - ' + item.pollutedData.endTime - }}</el-text> - </el-space> - <el-link type="info" @click="emits('open', item)"> 璇︽儏 </el-link> - </el-row> - <el-col :span="24"> - <el-tag effect="plain" type="info" size="small" hit round class="m-r-4"> - <div v-html="formatFactorName(item.pollutedData.factorName)"></div> - </el-tag> - <el-text type="info">{{ item.pollutedData.exception }}</el-text> - </el-col> --> </el-row> </div> </template> @@ -180,27 +168,33 @@ } } -function formatFactorName(name) { - switch (name) { - case 'PM25': - return 'PM<sub>2.5</sub>'; - // return '<span>PM2.5</span>'; - case 'PM10': - return 'PM<sub>10</sub>'; - case 'NO2': - return 'NO<sub>2</sub>'; - case 'H2S': - return 'H<sub>2</sub>S'; - case 'SO2': - return 'SO<sub>2</sub>'; - case 'O3': - return 'O<sub>3</sub>'; - case 'VOC': - return 'VOC<sub>s</sub>'; - - default: - break; +function formatFactorName(statisticMap) { + const mapName = (n) => { + switch (n) { + case 'PM25': + return 'PM<sub>2.5</sub>'; + case 'PM10': + return 'PM<sub>10</sub>'; + case 'NO2': + return 'NO<sub>2</sub>'; + case 'H2S': + return 'H<sub>2</sub>S'; + case 'SO2': + return 'SO<sub>2</sub>'; + case 'O3': + return 'O<sub>3</sub>'; + case 'VOC': + return 'VOC<sub>s</sub>'; + default: + return ''; + } + }; + let name = []; + for (const key in statisticMap) { + const value = statisticMap[key]; + name.push(mapName(value.factorName)); } + return name.join('銆�'); } function handleSetCenter(item, scene) { diff --git a/src/views/sourcetrace/component/PollutedExceptionItem.vue b/src/views/sourcetrace/component/PollutedExceptionItem.vue index a6c80f9..d269ccd 100644 --- a/src/views/sourcetrace/component/PollutedExceptionItem.vue +++ b/src/views/sourcetrace/component/PollutedExceptionItem.vue @@ -52,37 +52,36 @@ 寮傚父绫诲瀷锛歿{ item.pollutedData.exception }} </el-text> </div> - <el-row style="border-top: 1px solid white"> - <el-col :span="6"> - <el-statistic - title="绐佸彉鍥犲瓙" - :value="item.pollutedData.factorName" - /> - </el-col> - <el-col :span="6"> - <el-statistic - v-if="item.pollutedData.exceptionType == 4" - title="鍙樺寲骞呭害" - :value="formatPercentage(item.pollutedData.avgPer)" - /> - <el-statistic - v-else-if="item.pollutedData.exceptionType == 9" - title="鍙樺寲閫熺巼" - :value="formatChangeRate(item.pollutedData.avgRate)" - suffix="" - /> - </el-col> - <el-col :span="6"> - <el-statistic title="鍙戠敓娆℃暟" :value="item.pollutedData.times" /> - </el-col> - <el-col :span="6"> - <el-statistic - title="骞冲潎椋庨��" - :value="item.pollutedData.windSpeed" - suffix="m/s" - /> - </el-col> - </el-row> + <div v-for="s in item.pollutedData.statisticMap" :key="s"> + <el-row style="border-top: 1px solid white"> + <el-col :span="6"> + <el-statistic title="绐佸彉鍥犲瓙" :value="s.factorName" /> + </el-col> + <el-col :span="6"> + <el-statistic + v-if="item.pollutedData.exceptionType == 4" + title="鍙樺寲骞呭害" + :value="formatPercentage(s.avgPer)" + /> + <el-statistic + v-else-if="item.pollutedData.exceptionType == 9" + title="鍙樺寲閫熺巼" + :value="formatChangeRate(s.avgRate)" + suffix="" + /> + </el-col> + <el-col :span="6"> + <el-statistic title="鍙戠敓娆℃暟" :value="item.pollutedData.times" /> + </el-col> + <el-col :span="6"> + <el-statistic + title="骞冲潎椋庨��" + :value="item.pollutedData.windSpeed" + suffix="m/s" + /> + </el-col> + </el-row> + </div> <el-row justify="space-between"> <!-- <el-link type="info" -- Gitblit v1.9.3