| | |
| | | :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"> |
| | |
| | | </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="primary" @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: { |
| | |
| | | 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) => { |
| | |
| | | }) |
| | | |
| | | 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 |
| | | }) |
| | |
| | | if (showMore.value) { |
| | | return tableData.value |
| | | } else { |
| | | return tableData.value.slice(0, 3) |
| | | return tableData.value.slice(0, showCount) |
| | | } |
| | | }) |
| | | |
| | |
| | | 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() |
| | | |
| | | mapStore.focusMarker = row |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | .btn-more { |