riku
2024-12-19 e74e332308a341b153b142d025f1ebeb1a6e7a8e
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
167
<template>
  <el-row class="wrap">
    <BaseCard size="medium" direction="left">
      <template #content>
        <SatelliteSearchBar
          :loading="loading"
          @search="onSearch"
        ></SatelliteSearchBar>
 
        <el-table
          :data="gridDataList"
          table-layout="fixed"
          size="small"
          :show-overflow-tooltip="true"
          border
          height="50vh"
          row-class-name="t-row-normal"
          cell-class-name="t-cell"
          header-row-class-name="t-header-row"
          header-cell-class-name="t-header-cell"
          :highlight-current-row="true"
          @row-click="handleRowClick"
        >
          <el-table-column
            type="index"
            label="序号"
            align="center"
            width="50"
          />
          <el-table-column
            prop="dataTime"
            label="时间"
            align="center"
            :formatter="timeFormatter"
            width="150"
          />
          <el-table-column
            prop="type"
            label="数据类型"
            align="center"
            :formatter="dataTypeFormatter"
            width="150"
          />
        </el-table>
      </template>
 
      <template #footer> </template>
    </BaseCard>
  </el-row>
</template>
<script setup>
import { ref } from 'vue';
import moment from 'moment';
import SatelliteSearchBar from './SatelliteSearchBar.vue';
import { useFetchData } from '@/composables/fetchData';
import gridApi from '@/api/gridApi';
import SatelliteProxy from '../SatelliteProxy';
 
// eslint-disable-next-line no-unused-vars
function timeFormatter(row, col, cellValue, index) {
  return moment(cellValue).format('YYYY-MM-DD');
}
 
// eslint-disable-next-line no-unused-vars
function dataTypeFormatter(row, col, cellValue, index) {
  switch (cellValue) {
    case 0:
      return '原始数据';
    case 1:
      return '融合数据';
    default:
      return '-';
  }
}
 
defineProps({
  loading: Boolean,
  gridDataList: {
    type: Array,
    default: () => []
  }
});
 
const emits = defineEmits(['search', 'rowClick']);
 
// const { loading, fetchData } = useFetchData(10000);
// // 网格信息
// let gridInfo = [];
// // 网格数据组
// const gridDataList = ref([]);
// // 网格数据详情
// const gridDataDetailMap = new Map();
// // 地图网格相关对象
// let mapViews;
 
// 查询网格信息和遥感数据组
function onSearch(options) {
  emits('search', options);
}
 
// // 获取网格信息
// function fetchGridCell(groupId) {
//   return fetchData(() => {
//     return gridApi.fetchGridCell(groupId).then((res) => {
//       gridInfo = res.data;
//       drawGrid(gridInfo);
//     });
//   });
// }
 
// // 获取遥感数据组
// function fetchGridData(groupId) {
//   return gridApi.fetchGridData(groupId).then((res) => {
//     gridDataList.value = res.data;
//   });
// }
 
// function drawGrid(gridInfo) {
//   SatelliteProxy.clearAll(mapViews);
//   mapViews = SatelliteProxy.drawPolyline(gridInfo);
// }
 
// // 绘制网格遥感数据值和网格颜色
// function drawTextAndColor(gridData) {
//   // SatelliteProxy.clearText(mapViews);
//   // 文本标记
//   mapViews.textViews = SatelliteProxy.drawDataText(
//     mapViews.points,
//     gridData,
//     mapViews.textViews
//   );
//   SatelliteProxy.drawColor(mapViews.gridViews, gridData);
// }
 
function handleRowClick(row, col, event) {
  emits('rowClick', row);
}
</script>
<style scoped>
:deep(.el-table) {
  --el-table-bg-color: transparent;
  --el-table-row-hover-bg-color: var(--select_color);
  --el-table-current-row-bg-color: var(--select_color);
  /* --el-table-current-row-bg-color: #7dff5d96; */
  --el-table-text-color: var(--font-color);
}
 
:deep(.t-row-normal) {
  cursor: pointer;
  background-color: transparent !important;
}
 
:deep(.t-cell) {
  /* background: red !important; */
  /* height: 40px;
  border: 1px solid black; */
}
 
:deep(.t-header-row) {
}
 
:deep(.t-header-cell) {
  background-color: var(--bg-color-2) !important;
  /* text-align: center !important; */
  color: white !important;
}
</style>