| | |
| | | width="400px" |
| | | > |
| | | <template #default> |
| | | <div v-show="nextPage"> |
| | | <div> |
| | | <el-text size="small" type="warning"> |
| | | 共计{{ sceneStore.sceneList.length }}个点位,其中{{ |
| | | sceneTypeSummary |
| | | }} |
| | | </el-text> |
| | | </div> |
| | | <!-- <div v-for="(t, i) in closestScene" :key="i"> --> |
| | | <el-text |
| | | v-for="(t, i) in closestScene" |
| | | :key="i" |
| | | size="small" |
| | | type="warning" |
| | | > |
| | | {{ t }} |
| | | </el-text> |
| | | <!-- </div> --> |
| | | <!-- <el-row> 共计{{ sceneStore.sceneList.length }}个点位,其中 </el-row> --> |
| | | <el-row class="scene-table"> |
| | | <!-- <el-col :span="20"> --> |
| | | <el-table |
| | |
| | | </el-table> |
| | | <!-- </el-col> --> |
| | | </el-row> |
| | | </div> |
| | | <div v-show="!nextPage"> |
| | | <el-button |
| | | @click="nextPage = false" |
| | | type="primary" |
| | | class="el-button-custom p-events-auto" |
| | | >返回</el-button |
| | | > |
| | | </div> |
| | | </template> |
| | | <template #footer> |
| | | <el-row justify="start" align="middle" class="p-b-2 one-row"> |
| | | <el-text size="small" type="warning">搜索范围</el-text> |
| | | <!-- <el-row justify="start" align="middle" class="p-b-2 one-row"> --> |
| | | <!-- <el-text size="small" type="warning">搜索范围</el-text> |
| | | <el-input |
| | | class="input-radius m-h-2" |
| | | size="small" |
| | |
| | | /> |
| | | <el-text size="small" type="warning"> |
| | | 公里以内,结果{{ sceneStore.sceneList.length }}条</el-text |
| | | > |
| | | </el-row> |
| | | > --> |
| | | |
| | | <!-- </el-row> --> |
| | | </template> |
| | | </CardDialog> |
| | | </template> |
| | |
| | | import { useSceneStore } from '@/stores/scene'; |
| | | import { useToolboxStore } from '@/stores/toolbox'; |
| | | import MapUtil from '@/utils/map/util'; |
| | | import calculate from '@/utils/map/calculate'; |
| | | |
| | | let layer = undefined; |
| | | const devices = [ |
| | | { |
| | | name: '程桥站', |
| | | typeId: 20, |
| | | type: 'type', |
| | | longitude: 121.362928, |
| | | latitude: 31.192925 |
| | | }, |
| | | { |
| | | name: '华阳站', |
| | | typeId: 20, |
| | | type: '市控点', |
| | | longitude: 121.424603, |
| | | latitude: 31.223644 |
| | | }, |
| | | { |
| | | name: '仙霞站', |
| | | typeId: 19, |
| | | type: '国控点', |
| | | longitude: 121.394775, |
| | | latitude: 31.203982 |
| | | } |
| | | ]; |
| | | |
| | | export default { |
| | | setup() { |
| | |
| | | return { |
| | | dialogVisible: false, |
| | | onConfirm: undefined, |
| | | showSceneTypes: [] |
| | | showSceneTypes: [], |
| | | nextPage: false |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | return this.showSceneTypes.indexOf(v.type) != -1; |
| | | }); |
| | | } |
| | | }, |
| | | // 搜索结果场景类型统计 |
| | | sceneTypeSummary() { |
| | | const typeMap = new Map(); |
| | | this.sceneStore.sceneList.forEach((s) => { |
| | | if (!typeMap.has(s.type)) { |
| | | typeMap.set(s.type, []); |
| | | } |
| | | typeMap.get(s.type).push(s); |
| | | }); |
| | | |
| | | let summary = ''; |
| | | typeMap.forEach((v, k) => { |
| | | summary += `${k}${v.length}个、`; |
| | | }); |
| | | summary = summary.slice(0, summary.length - 1); |
| | | |
| | | return summary; |
| | | }, |
| | | // 计算距离给定点位最近的场景 |
| | | closestScene() { |
| | | let txt = []; |
| | | devices.forEach((d) => { |
| | | let minDistance, scene; |
| | | this.sceneStore.sceneList.forEach((s) => { |
| | | const dis = calculate.getDistance( |
| | | s.longitude, |
| | | s.latitude, |
| | | d.longitude, |
| | | d.latitude |
| | | ); |
| | | if (!minDistance || dis < minDistance) { |
| | | minDistance = dis; |
| | | scene = s; |
| | | } |
| | | if (!s.closestDevice || dis < s.closestDevice.dis) { |
| | | s.closestDevice = { |
| | | name: d.name, |
| | | dis: dis |
| | | }; |
| | | } |
| | | }); |
| | | if (minDistance) { |
| | | minDistance = Math.round(minDistance); |
| | | } |
| | | if (scene) { |
| | | txt.push(`距${d.name}最近的为${scene.name},距离${minDistance}米;`); |
| | | } |
| | | }); |
| | | |
| | | return txt; |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | } |
| | | }, |
| | | handleRowClick(row, col, event) { |
| | | this.nextPage = true; |
| | | MapUtil.setCenter([row.longitude, row.latitude], true); |
| | | }, |
| | | filterHandler(value, row, column) { |
| | |
| | | /* .ff-content-medium .ff-border-top { |
| | | padding: 0px 0px var(--bevel-length-2) 0px; |
| | | } */ |
| | | |
| | | ::v-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); |
| | | } |
| | | |
| | | ::v-deep .t-row { |
| | | cursor: pointer; |
| | | background-color: transparent !important; |
| | | } |
| | | |
| | | .t-cell { |
| | | } |
| | | |
| | | .t-header-row { |
| | | } |
| | | |
| | | ::v-deep .t-header-cell { |
| | | background-color: var(--bg-color-2) !important; |
| | | color: white !important; |
| | | } |
| | | </style> |