riku
2025-07-16 c23ac06446a9a1edc41cc13723e5d0b8eabdfd63
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<template>
  <!-- <CardDialog
    :model-value="modelValue"
    @update:model-value="handleDialogShow"
    title="污染线索"
    draggable
    :modal="false"
    width="400px"
  >
    <template #default> -->
  <BaseCard v-if="item" v-show="modelValue">
    <template #content>
      <el-scrollbar class="clue-card">
        <el-row justify="space-between" align="bottom">
          <el-text type="danger" style="font-weight: 600" size="large">
            污染线索
          </el-text>
 
          <el-link
            type="info"
            :underline="true"
            @click="handleDialogShow(!modelValue)"
          >
            {{ modelValue ? '收起' : '打开' }}
            <el-icon size="large"><CircleClose /></el-icon>
          </el-link>
        </el-row>
        <el-row>
          <el-text type="info" size="small">{{ item._timestr }}</el-text>
        </el-row>
        <el-space>
          <el-icon color="#F56C6C" :size="40"><WarnTriangleFilled /></el-icon>
          <el-text type="info">
            {{ item.advice }}
          </el-text>
        </el-space>
        <el-row justify="space-between">
          <el-text type="info" size="small">
            推荐路线总长{{ item.direction.distance }}米
          </el-text>
          <el-link type="info" 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>
      </el-scrollbar>
    </template>
  </BaseCard>
  <!-- </template>
    <template #footer> </template>
  </CardDialog> -->
</template>
<script setup>
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 lineShow = ref(true);
// 上一条导航路线
let lastPolyline = undefined;
// 上一个导航目的地
// let lastDestination = undefined;
// let layer = undefined;
 
const emits = defineEmits(['update:modelValue']);
 
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] != oV[1]) {
      // showPolyline(nV[1]);
      handleDialogShow(nV[1]);
    }
  }
);
 
function showPolyline(show) {
  if (typeof show === 'boolean') {
    lineShow.value = show;
  } else {
    lineShow.value = !lineShow.value;
  }
 
  if (lineShow.value && lastPolyline) {
    mapUtil.addViews(lastPolyline);
  } else {
    mapUtil.removeViews(lastPolyline);
  }
}
 
// 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-text.el-text--primary) {
  --el-text-color: white;
}
 
:deep(.el-link) {
  --el-link-text-color: #23dad1;
} */
 
.clue-card {
  padding: 0 4px;
  /* margin-right: 2px; */
  width: 340px;
  height: 360px;
  /* border-right: 1px solid white; */
  border-radius: 2px;
}
</style>