From d6e6f8b5b31e132e4597eb531168d3e88f3bda72 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 04 七月 2025 17:26:49 +0800
Subject: [PATCH] 2025.7.4 动态溯源

---
 src/views/sourcetrace/component/PollutedClueItem.vue |  309 ++++++++++++++++++---------------------------------
 1 files changed, 111 insertions(+), 198 deletions(-)

diff --git a/src/views/sourcetrace/component/PollutedClueItem.vue b/src/views/sourcetrace/component/PollutedClueItem.vue
index 0bf7086..784771b 100644
--- a/src/views/sourcetrace/component/PollutedClueItem.vue
+++ b/src/views/sourcetrace/component/PollutedClueItem.vue
@@ -1,222 +1,135 @@
 <template>
-  <!-- <BaseCard>
-    <template #content> -->
-  <el-scrollbar class="clue-card">
-    <el-row justify="space-between">
-      <!-- <el-tag v-if="index == 0" type="danger">鏈�鏂�</el-tag> -->
-      <el-text type="primary">{{
-        '鍒囩墖鏃堕棿锛�' +
-        item.pollutedData.startTime +
-        ' - ' +
-        item.pollutedData.endTime
-      }}</el-text>
-      <el-link
-        type="primary"
-        :underline="true"
-        @click="showMarksAndPolygon(item)"
-      >
-        {{ item.showMore ? '鏀惰捣寮傚父' : '瀹氫綅寮傚父' }}
-      </el-link>
-    </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>
-    <div>
-      <el-text type="primary">
-        寮傚父绫诲瀷锛歿{ 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="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-row>
-    <!-- <div style="width: 320px; height: 80px"> -->
-    <RealTimeLineChart
-      v-for="(item1, index1) in item._chartOptions"
-      :key="index1"
-      :model-value="item1"
-      chart-height="80px"
-    ></RealTimeLineChart>
-    <!-- </div> -->
-    <div class="border-dashed">
-      <el-text type="" tag="mark">
-        {{ item.pollutedSource.conclusion }}
-      </el-text>
-    </div>
-    <SceneTable
-      :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 /> -->
-  </el-scrollbar>
-  <!-- </template>
-  </BaseCard> -->
+  <CardDialog
+    :model-value="modelValue"
+    @update:model-value="handleDialogShow"
+    title="姹℃煋绾跨储"
+    draggable
+    :modal="false"
+    width="400px"
+  >
+    <template #default>
+      <template v-if="item">
+        <el-row>
+          <el-text type="primary" size="small">{{ item._timestr }}</el-text>
+        </el-row>
+        <el-space>
+          <el-icon color="#F56C6C" :size="40"><WarnTriangleFilled /></el-icon>
+          <el-text type="primary">
+            {{ item.advice }}
+          </el-text>
+        </el-space>
+        <el-row justify="space-between">
+          <el-text type="primary" size="small">
+            鎺ㄨ崘璺嚎鎬婚暱{{ item.direction.distance }}绫�
+          </el-text>
+          <el-link type="primary" size="small" @click="showPolyline">
+            {{ lineShow ? '鏀惰捣璺嚎' : '瀹氫綅璺嚎' }}
+          </el-link>
+        </el-row>
+        <SceneTable
+          :show-marks="lineShow"
+          :scene-list="formatSceneList(item.sortedSceneList)"
+        >
+          <el-table-column prop="_count" width="42" label="婧簮娆℃暟" />
+        </SceneTable>
+      </template>
+    </template>
+    <template #footer> </template>
+  </CardDialog>
 </template>
 <script setup>
-import { ref } from 'vue';
+import { ref, onMounted, onUnmounted, reactive, watch } from 'vue';
+
+import { sceneTypes, sceneIcon } from '@/constant/scene-types';
+import mapLine from '@/utils/map/line';
+import mapUtil from '@/utils/map/util';
+import marks from '@/utils/map/marks';
 
 const props = defineProps({
+  modelValue: Boolean,
   item: Object
 });
 
-const emits = defineEmits(['showMarksAndPolygon']);
+const lineShow = ref(true);
+// 涓婁竴鏉″鑸矾绾�
+let lastPolyline = undefined;
+// 涓婁竴涓鑸洰鐨勫湴
+// let lastDestination = undefined;
+// let layer = undefined;
 
-function showMarksAndPolygon(item) {
-  emits('showMarksAndPolygon', item);
-}
+const emits = defineEmits(['update:modelValue']);
 
-function formatPercentage(value) {
-  return Math.round(value * 100) + '%';
-}
+watch(
+  () => [props.item, props.modelValue],
+  (nV, oV) => {
+    if (nV[0] != oV[0]) {
+      const polyline = mapLine.drawDirection(
+        nV[0].direction.paths.map((v) => [v.first, v.second])
+      );
+      // polylineList.unshift(polyline);
+      if (lastPolyline) {
+        mapUtil.removeViews(lastPolyline);
+      }
+      lastPolyline = polyline;
+      lineShow.value = true;
+    } else if (nV[1]) {
+      showPolyline(true);
+    }
+  }
+);
 
-function formatDistanceType(value) {
-  switch (value) {
-    case 'TYPE1':
-      return '50绫�';
-    case 'TYPE2':
-      return '50绫� - 500绫�';
-    case 'TYPE3':
-      return '50绫� - 1鍏噷';
-    case 'TYPE4':
-      return '50绫� - 2鍏噷';
+function showPolyline(show) {
+  if (typeof show === 'boolean') {
+    lineShow.value = show;
+  } else {
+    lineShow.value = !lineShow.value;
+  }
 
-    default:
-      break;
+  if (lineShow.value && lastPolyline) {
+    mapUtil.addViews(lastPolyline);
+  } else {
+    mapUtil.removeViews(lastPolyline);
   }
 }
 
-function formatChangeRate() {
-  
+// function removeLayer() {
+//   if (layer != undefined) {
+//     mapUtil.removeViews(layer);
+//     layer = undefined;
+//   }
+// }
+
+// function drawMarks(sceneList) {
+//   removeLayer();
+//   if (sceneList.length != 0) {
+//     const icons = [];
+//     sceneList.forEach((s) => {
+//       icons.push(sceneIcon(s.typeId));
+//     });
+//     layer = marks.createLabelMarks(icons, sceneList, false);
+//   }
+// }
+
+function formatSceneList(sceneList) {
+  return sceneList.map((v) => {
+    return {
+      ...v.first,
+      _count: v.second
+    };
+  });
+}
+
+function handleDialogShow(value) {
+  showPolyline(value);
+  emits('update:modelValue', value);
 }
 </script>
 <style scoped>
-:deep(.el-statistic) {
-  --el-statistic-title-color: rgb(215, 215, 215);
-  --el-statistic-content-color: white;
-}
-
-:deep(.el-text.el-text--primary) {
+/* :deep(.el-text.el-text--primary) {
   --el-text-color: white;
 }
 
 :deep(.el-link) {
   --el-link-text-color: #23dad1;
-}
-
-.scrollbar {
-  min-width: 300px;
-  max-width: 60vw;
-  /* height: 35vh; */
-  /* color: #02ffea; */
-}
-
-.clue-card {
-  padding: 0 4px;
-  /* 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