Commit 57c370b2dd54a8c4f65a04ebdf96221c047fe6e8
1 parent
0b10c798
v1.9 优化巡检地图展示问题
Showing
10 changed files
with
50 additions
and
14 deletions
src/components/inspection/inspectionRouteMap.vue
| ... | ... | @@ -29,6 +29,24 @@ export default { |
| 29 | 29 | }, |
| 30 | 30 | |
| 31 | 31 | initMap() { |
| 32 | + // 若已有地图或图层,先清理避免重复初始化 | |
| 33 | + if (this.markerLayer) { | |
| 34 | + this.markerLayer.setMap(null) | |
| 35 | + this.markerLayer = null | |
| 36 | + } | |
| 37 | + if (this.labelLayer) { | |
| 38 | + this.labelLayer.setMap(null) | |
| 39 | + this.labelLayer = null | |
| 40 | + } | |
| 41 | + if (this.polylineLayer) { | |
| 42 | + this.polylineLayer.setMap(null) | |
| 43 | + this.polylineLayer = null | |
| 44 | + } | |
| 45 | + if (this.map) { | |
| 46 | + this.map.destroy() | |
| 47 | + this.map = null | |
| 48 | + } | |
| 49 | + | |
| 32 | 50 | // 默认中心点(北京) |
| 33 | 51 | const center = new window.TMap.LatLng(39.916527, 116.397128) |
| 34 | 52 | ... | ... |
src/components/inspection/inspectionTaskMap.vue
| ... | ... | @@ -26,12 +26,33 @@ export default { |
| 26 | 26 | }, |
| 27 | 27 | methods: { |
| 28 | 28 | loadData(task) { |
| 29 | + console.log('loadData',task) | |
| 29 | 30 | this.initMap() |
| 30 | 31 | this.loadTask(task) |
| 31 | 32 | }, |
| 32 | 33 | initMap() { |
| 34 | + // 若已有地图或图层,先清理避免重复初始化 | |
| 35 | + if (this.markerLayer) { | |
| 36 | + this.markerLayer.setMap(null) | |
| 37 | + this.markerLayer = null | |
| 38 | + } | |
| 39 | + if (this.labelLayer) { | |
| 40 | + this.labelLayer.setMap(null) | |
| 41 | + this.labelLayer = null | |
| 42 | + } | |
| 43 | + if (this.polylineLayer) { | |
| 44 | + this.polylineLayer.setMap(null) | |
| 45 | + this.polylineLayer = null | |
| 46 | + } | |
| 47 | + if (this.map) { | |
| 48 | + this.map.destroy() | |
| 49 | + this.map = null | |
| 50 | + } | |
| 51 | + console.log('initMap',this.map) | |
| 52 | + | |
| 33 | 53 | // 默认中心点(北京) |
| 34 | 54 | const center = new window.TMap.LatLng(39.916527, 116.397128) |
| 55 | + console.log('center',center) | |
| 35 | 56 | |
| 36 | 57 | // 创建地图实例 |
| 37 | 58 | this.map = new window.TMap.Map(document.getElementById('inspectionTaskMap'), { | ... | ... |
src/components/inspection/pointPlan.vue
src/components/inspection/pointRoute.vue
| 1 | 1 | <template> |
| 2 | - <div class="point-route-container"> | |
| 3 | - <el-row :gutter="20"> | |
| 2 | + <div class="point-route-container" > | |
| 3 | + <el-row :gutter="20" v-if="pointRouteInfo.routes && pointRouteInfo.routes.length>0"> | |
| 4 | 4 | <el-col :span="6"> |
| 5 | 5 | <el-card class="route-list-card"> |
| 6 | 6 | <div class="route-list"> |
| 7 | 7 | <ul> |
| 8 | 8 | <li v-for="(route, index) in pointRouteInfo.routes" :key="index" @click="_switchPointRoute(route)" |
| 9 | - :class="{ 'active': route.inspectionRouteId === pointRouteInfo.inspectionRouteId }"> | |
| 9 | + :class="{ 'active': route.inspectionRouteId == pointRouteInfo.inspectionRouteId }"> | |
| 10 | 10 | {{ route.routeName }} |
| 11 | 11 | </li> |
| 12 | 12 | </ul> |
| ... | ... | @@ -116,7 +116,6 @@ export default { |
| 116 | 116 | |
| 117 | 117 | .route-list li { |
| 118 | 118 | padding: 12px 15px; |
| 119 | - border-bottom: 1px solid #ebeef5; | |
| 120 | 119 | cursor: pointer; |
| 121 | 120 | transition: all 0.3s; |
| 122 | 121 | } | ... | ... |
src/components/inspection/pointTask.vue
| 1 | 1 | <template> |
| 2 | 2 | <div class="point-task-container"> |
| 3 | - <el-row :gutter="20"> | |
| 3 | + <el-row :gutter="20" v-if="pointTaskInfo.tasks && pointTaskInfo.tasks.length>0"> | |
| 4 | 4 | <el-col :span="6"> |
| 5 | 5 | <el-card class="task-list-card"> |
| 6 | 6 | <div class="task-list"> |
| 7 | 7 | <ul> |
| 8 | 8 | <li v-for="(task, index) in pointTaskInfo.tasks" :key="index" @click="_switchPointTask(task)" |
| 9 | - :class="{ 'active': task.inspectionRouteId === pointTaskInfo.inspectionRouteId }"> | |
| 9 | + :class="{ 'active': task.inspectionRouteId == pointTaskInfo.inspectionRouteId }"> | |
| 10 | 10 | {{ task.planUserName }}({{ task.inspectionPlanName }}) |
| 11 | 11 | </li> |
| 12 | 12 | </ul> |
| ... | ... | @@ -82,7 +82,7 @@ export default { |
| 82 | 82 | // 通知地图组件加载任务 |
| 83 | 83 | this.$nextTick(() => { |
| 84 | 84 | if (this.$refs.inspectionTaskMap) { |
| 85 | - this.$refs.inspectionTaskMap.loadTask(task) | |
| 85 | + this.$refs.inspectionTaskMap.loadData(task) | |
| 86 | 86 | } |
| 87 | 87 | }) |
| 88 | 88 | } | ... | ... |
src/components/inspection/pointTaskDetail.vue
| 1 | 1 | <template> |
| 2 | 2 | <div class="point-task-detail-container"> |
| 3 | - <el-row :gutter="20" class="margin-top-lg"> | |
| 3 | + <el-row :gutter="20" class=""> | |
| 4 | 4 | <el-col :span="6"> |
| 5 | 5 | <el-input :placeholder="$t('pointTaskDetail.placeholder.planUserName')" v-model="pointTaskDetailInfo.planUserName" |
| 6 | 6 | clearable /> | ... | ... |
src/views/inspection/inspectionItemManageList.vue
| ... | ... | @@ -29,10 +29,10 @@ |
| 29 | 29 | <div slot="header" class="flex justify-between"> |
| 30 | 30 | <span>{{ $t('inspectionItemManage.inspectionItems') }}</span> |
| 31 | 31 | <div style="float: right;"> |
| 32 | - <el-button type="primary" size="small" @click="handleShowDoc"> | |
| 32 | + <!-- <el-button type="primary" size="small" @click="handleShowDoc"> | |
| 33 | 33 | <i class="el-icon-document"></i> |
| 34 | 34 | {{ $t('inspectionItemManage.doc') }} |
| 35 | - </el-button> | |
| 35 | + </el-button> --> | |
| 36 | 36 | <el-button type="primary" size="small" @click="openAddModal"> |
| 37 | 37 | <i class="el-icon-plus"></i> |
| 38 | 38 | {{ $t('inspectionItemManage.addBtn') }} | ... | ... |
src/views/inspection/inspectionItemTitleManageList.vue
src/views/inspection/inspectionPointList.vue