riku
2025-03-07 2592dc279ec82bf3649a4dbe644c6416263a10ef
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
<template>
  <CardDialog
    v-model="dialogVisible"
    title="网格信息"
    draggable
    :modal="false"
    width="300px"
  >
    <template #default>
      <DescriptionsList v-if="data">
        <DescriptionsListItem label="网格编号" :content="data.cellIndex" />
        <DescriptionsListItem
          label="经纬度"
          :content="data.longitude + ', ' + data.latitude"
        />
        <DescriptionsListItem label="PM2.5" :content="data.pm25 + ' μg/m³'" />
        <DescriptionsListItem label="四至范围" content="/" />
      </DescriptionsList>
    </template>
    <template #footer> </template>
  </CardDialog>
</template>
<script setup>
import { ref, watch, computed } from 'vue';
import { useGridStore } from '@/stores/grid-info';
 
const gridStore = useGridStore();
 
const dialogVisible = ref(false);
 
const data = computed(() => {
  if (gridStore.selectedGridCellAndDataDetail) {
    return {
      cellIndex: gridStore.selectedGridCellAndDataDetail.gridCell.cellIndex,
      longitude: gridStore.selectedGridCellAndDataDetail.gridCell.longitude,
      latitude: gridStore.selectedGridCellAndDataDetail.gridCell.latitude,
      pm25: gridStore.selectedGridCellAndDataDetail.gridDataDetail.pm25
    };
  } else {
    return {
      cellIndex: '/',
      longitude: '/',
      latitude: '/',
      pm25: '/'
    };
  }
});
 
watch(
  () => gridStore.selectedGridCellAndDataDetail,
  (nv, ov) => {
    if (nv != ov) {
      dialogVisible.value = true;
    }
  },
  { deep: true }
);
</script>