From 30cf71affd5149a1310d84f658b028d267beee8b Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期三, 11 六月 2025 17:30:22 +0800 Subject: [PATCH] 动态溯源(编写中) --- src/views/sourcetrace/SourceTrace.vue | 219 +++++++++++------------------------------------------- 1 files changed, 46 insertions(+), 173 deletions(-) diff --git a/src/views/sourcetrace/SourceTrace.vue b/src/views/sourcetrace/SourceTrace.vue index b0760b3..5286e19 100644 --- a/src/views/sourcetrace/SourceTrace.vue +++ b/src/views/sourcetrace/SourceTrace.vue @@ -10,155 +10,15 @@ <el-col v-show="show" span="10"> <BaseCard> <template #content> - <!-- <div> - <el-input type="text" v-model="inputVal" /> - <button @click="handleSend">send</button> - <button @click="handleLink">link</button> - </div> --> - <!-- <div> - <el-text type="primary" size="large" tag="b">鍔ㄦ�佹函婧�</el-text> - </div> --> - <el-scrollbar ref="scrollbarRef" :height="height" class="scrollbar"> - <el-row ref="scrollContentRef"> - <div - v-for="(item, index) in streams" - :key="index" - class="clue-card" - > - <el-row> - <!-- <el-tag v-if="index == 0" type="danger">鏈�鏂�</el-tag> --> - <el-text type="primary">{{ - '绾跨储鏃堕棿锛�' + - item.pollutedData.startTime + - ' - ' + - item.pollutedData.endTime - }}</el-text> - </el-row> - <div> - <el-text type="primary"> - 姹℃煋鍖哄煙锛歿{ item.pollutedArea.address }} - </el-text> - </div> - <div> - <el-text type="primary"> - 婧簮璺濈锛歿{ - formatDistanceType(item.pollutedArea.distanceType) - }} - </el-text> - </div> - <el-row> - <el-col :span="6"> - <el-statistic - title="绐佸彉鍥犲瓙" - :value="item.pollutedData.factorName" - /> - </el-col> - <el-col :span="6"> - <el-statistic - title="鍙樺寲骞呭害" - :value="formatPercentage(item.pollutedData.avgPer)" - /> - </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> - <el-row justify="space-between"> - <el-link - type="primary" - underline - @click="showMarksAndPolygon(item)" - > - {{ - (item.showMore ? '鏀惰捣婧簮鍦烘櫙' : '鏌ョ湅婧簮鍦烘櫙') + - '锛�' + - item.pollutedSource.sceneList.length + - '锛�' - }} - </el-link> - <!-- <el-link - type="primary" - underline - @click="drawPolygon(item.pollutedArea)" - > - 瀹氫綅寮傚父 - </el-link> --> - </el-row> - <div v-show="item.showMore" style="width: 320px; height: 140px"> - <RealTimeLineChart - v-for="(item1, index1) in item._chartOptions" - :key="index1" - :model-value="item1" - ></RealTimeLineChart> - </div> - <SceneTable - v-show="item.showMore" - :show-marks="item.showMore" - :scene-list="item.pollutedSource.sceneList" - ></SceneTable> - - <!-- <el-space gap="4"> - <el-tag :type="item.status == 1 ? 'danger' : 'info'">{{ - item._statusStr - }}</el-tag> - <el-text type="default">{{ item.exception }}</el-text> - </el-space> - <el-row gap="4"> - <el-text type="primary">鍙戠敓鏃堕棿锛�</el-text> - <el-text type="primary">{{ - item.startTime + ' 鑷� ' - }}</el-text> - <el-text type="primary">{{ - item.status == 1 ? '褰撳墠' : item.endTime - }}</el-text> - </el-row> - <el-row> - <el-col :span="6"> - <el-statistic title="鍥犲瓙" :value="item.factorName" /> - </el-col> - <el-col :span="6"> - <el-statistic title="鍧囧��" :value="item.avg" /> - </el-col> - <el-col :span="6"> - <el-statistic title="宄板��" :value="item.max" /> - </el-col> - <el-col :span="6"> - <el-statistic title="璋峰��" :value="item.min" /> - </el-col> - </el-row> - <el-row justify="space-between"> - <el-link - type="primary" - @click="item.showMore = !item.showMore" - > - {{ - (item.showMore ? '鏀惰捣婧簮鍦烘櫙' : '鏌ョ湅婧簮鍦烘櫙') + - '锛�' + - item.relatedSceneList.length + - '锛�' - }} - </el-link> - <el-link type="primary" @click="drawSector(item)"> - 鏌ョ湅寮傚父 - </el-link> - </el-row> - <SceneTable - v-show="item.showMore" - :scene-list="item.relatedSceneList" - ></SceneTable> - <el-divider /> --> - </div> - </el-row> + <el-scrollbar ref="scrollbarRef" class="scrollbar"> + <div + ref="scrollContentRef" + style="display: flex; width: fit-content" + > + <template v-for="(item, index) in streams" :key="index"> + <PollutedClueItem :item="item"></PollutedClueItem> + </template> + </div> </el-scrollbar> </template> </BaseCard> @@ -179,10 +39,9 @@ import { map, onMapMounted } from '@/utils/map/index_old'; import { FactorDatas } from '@/model/FactorDatas'; import factorDataParser from '@/utils/chart/factor-data-parser'; +import websocketMsgParser from '@/views/sourcetrace/websocketMsgParser.js'; -const START_STR = '##'; -const SPLIT_STR = '&&'; -const END_STR = '%%'; +import PollutedClueItem from './component/PollutedClueItem.vue'; const props = defineProps({ factorType: String @@ -190,7 +49,7 @@ const emits = defineEmits(['update:factorType']); -const height = `48vh`; +const height = `30vh`; const width = `60vh`; const show = ref(false); @@ -219,9 +78,7 @@ let showFirstClueTask; function dealMsg(data) { - const [type, content] = data - .substring(START_STR.length, data.length - END_STR.length) - .split(SPLIT_STR); + const { type, content } = websocketMsgParser.parseMsg(data); // 姹℃煋绾跨储 PollutedClue if (type == '1') { @@ -233,12 +90,13 @@ if (streams.length == 0) { streams.push(obj); } else { - streams.forEach((s) => { - s.showMore = false; - }); + // streams.forEach((s) => { + // showMarksAndPolygon(s); + // }); + hideAll(); streams.unshift(obj); - show.value = true; } + show.value = true; // scrollToBottom(); scrollToTop(); @@ -251,11 +109,6 @@ showFirstClueTask = setTimeout(() => { showMarksAndPolygon(obj); }, 1000); - } - // 姹℃煋鍒嗘瀽缁撴灉 AnalysisResult - else if (type == '2') { - const obj = JSON.parse(content); - console.log('姹℃煋鍒嗘瀽缁撴灉: ', obj); } } @@ -272,9 +125,20 @@ // } }); +function hideAll() { + streams.forEach((s) => { + if (polygonMap.has(s.guid)) { + s.showMore = false; + map.remove(polygonMap.get(s.guid)); + } + }); +} + function showMarksAndPolygon(item) { item.showMore = !item.showMore; if (item.showMore) { + hideAll(); + item.showMore = true; drawPolygon(item); } else { if (polygonMap.has(item.guid)) { @@ -305,13 +169,13 @@ }); polygonMap.set(item.guid, pollutedAreaPolygon); } - map.setFitView(polygonMap.get(item.guid)); + // map.setFitView(polygonMap.get(item.guid)); } function parseChartData(obj) { - console.log('鎶樼嚎鍥撅細start'); + // console.log('鎶樼嚎鍥撅細start'); const factorDatas = new FactorDatas(); - factorDatas.setData(obj.pollutedData.dataVoList, 0, () => { + factorDatas.setData(obj.pollutedData.historyDataList, 0, () => { obj._chartOptions = factorDataParser.parseData(factorDatas, [ { label: obj.pollutedData.factorName, @@ -319,7 +183,7 @@ value: obj.pollutedData.factorId + '' } ]); - console.log('鎶樼嚎鍥撅細', obj._chartOptions); + // console.log('鎶樼嚎鍥撅細', obj._chartOptions); }); } @@ -444,7 +308,7 @@ --el-statistic-content-color: white; } -:deep(.el-text) { +:deep(.el-text.el-text--primary) { --el-text-color: white; } @@ -455,14 +319,23 @@ .scrollbar { min-width: 300px; max-width: 60vw; + /* height: 35vh; */ /* color: #02ffea; */ } .clue-card { padding: 0 4px; - margin-right: 2px; - width: 320px; - border: 1px solid white; + /* margin-right: 2px; */ + width: 340px; + height: 35vh; + border-right: 1px solid white; border-radius: 2px; } + +.border-dashed { + /* border: 1px dashed white; */ + border: 1px dashed #ffbc58; + padding: 0px 1px; + margin-bottom: 4px; +} </style> -- Gitblit v1.9.3