From a030cd7ebede3762fda4dcb6511f43712a417a58 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 20 六月 2025 13:25:45 +0800 Subject: [PATCH] 2025.6.20 --- src/views/inspection/problem/component/ProblemTable.vue | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/views/inspection/problem/component/ProblemTable.vue b/src/views/inspection/problem/component/ProblemTable.vue index 50c65e2..e85bda7 100644 --- a/src/views/inspection/problem/component/ProblemTable.vue +++ b/src/views/inspection/problem/component/ProblemTable.vue @@ -6,6 +6,7 @@ :row-class-name="tableRowClassName" :height="tableHeight" size="small" + @row-click="handleRowClick" > <el-table-column type="index" label="" width="30"> </el-table-column> <el-table-column prop="scene.name" :show-overflow-tooltip="true" label="鍚嶇О" width="150"> @@ -27,13 +28,22 @@ </template> </el-table-column> </el-table> - <div class="btn-more font-small"> - <el-link type="primary" @click="showMore = !showMore">鏌ョ湅鏇村</el-link> + <div v-if="showMoreBtn" class="btn-more font-small"> + <el-link type="success" @click="showMore = !showMore"> + {{ showMore ? '鏀惰捣鏇村' : '鏌ョ湅鏇村' }} + </el-link> </div> </template> <script setup> import { computed, ref } from 'vue' import dayjs from 'dayjs' +import { useMapStore } from '@/stores/map.js' + +import marks from '@/utils/map/marks.js' +import mapUtil from '@/utils/map/util.js' +import scene_1 from '@/assets/icon/scene_1.png' + +const mapStore = useMapStore() const props = defineProps({ data: { @@ -42,19 +52,30 @@ loading: Boolean }) +const showCount = 3 + const showMore = ref(false) +const showMoreBtn = computed(() => { + return props.data.length > showCount +}) const tableData = computed(() => { const l = props.data.map((value) => { - const time = value.subtask.executionendtime - ? value.subtask.executionendtime - : value.subtask.executionstarttime + const time = value.subtask.executionstarttime + ? value.subtask.executionstarttime + : value.subtask.executionendtime value.updateTime = time return value }) return l.sort((a, b) => { - return dayjs(b.updateTime) - dayjs(a.updateTime) + if (!a.updateTime) { + return 1 + } else if (!b.updateTime) { + return -1 + } else { + return dayjs(b.updateTime) - dayjs(a.updateTime) + } }) // return l }) @@ -63,7 +84,7 @@ if (showMore.value) { return tableData.value } else { - return tableData.value.slice(0, 3) + return tableData.value.slice(0, showCount) } }) @@ -76,9 +97,22 @@ if (p == 0) { return '/' } else { - return Math.round((c / p) * 100) / 100 + '%' + return Math.round((c / p) * 100) + '%' } } + +function handleRowClick(row, col, event) { + const title = row.scene.name + const lnglat = [row.scene.longitude, row.scene.latitude] + const img = scene_1 + // mapUtil.clearViews() + // marks.drawMarker(title, lnglat, img) + // mapUtil.setFitView() + mapUtil.setCenter(lnglat) + mapUtil.setZoomSmall() + + mapStore.focusMarker = row +} </script> <style scoped> .btn-more { -- Gitblit v1.9.3