Commit 57c370b2dd54a8c4f65a04ebdf96221c047fe6e8

Authored by wuxw
1 parent 0b10c798

v1.9 优化巡检地图展示问题

src/components/inspection/inspectionRouteMap.vue
@@ -29,6 +29,24 @@ export default { @@ -29,6 +29,24 @@ export default {
29 }, 29 },
30 30
31 initMap() { 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 const center = new window.TMap.LatLng(39.916527, 116.397128) 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,12 +26,33 @@ export default {
26 }, 26 },
27 methods: { 27 methods: {
28 loadData(task) { 28 loadData(task) {
  29 + console.log('loadData',task)
29 this.initMap() 30 this.initMap()
30 this.loadTask(task) 31 this.loadTask(task)
31 }, 32 },
32 initMap() { 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 const center = new window.TMap.LatLng(39.916527, 116.397128) 54 const center = new window.TMap.LatLng(39.916527, 116.397128)
  55 + console.log('center',center)
35 56
36 // 创建地图实例 57 // 创建地图实例
37 this.map = new window.TMap.Map(document.getElementById('inspectionTaskMap'), { 58 this.map = new window.TMap.Map(document.getElementById('inspectionTaskMap'), {
src/components/inspection/pointPlan.vue
@@ -129,7 +129,7 @@ export default { @@ -129,7 +129,7 @@ export default {
129 129
130 <style scoped> 130 <style scoped>
131 .point-plan-container { 131 .point-plan-container {
132 - padding: 20px; 132 + padding: 0px;
133 } 133 }
134 134
135 .margin-top { 135 .margin-top {
src/components/inspection/pointRoute.vue
1 <template> 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 <el-col :span="6"> 4 <el-col :span="6">
5 <el-card class="route-list-card"> 5 <el-card class="route-list-card">
6 <div class="route-list"> 6 <div class="route-list">
7 <ul> 7 <ul>
8 <li v-for="(route, index) in pointRouteInfo.routes" :key="index" @click="_switchPointRoute(route)" 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 {{ route.routeName }} 10 {{ route.routeName }}
11 </li> 11 </li>
12 </ul> 12 </ul>
@@ -116,7 +116,6 @@ export default { @@ -116,7 +116,6 @@ export default {
116 116
117 .route-list li { 117 .route-list li {
118 padding: 12px 15px; 118 padding: 12px 15px;
119 - border-bottom: 1px solid #ebeef5;  
120 cursor: pointer; 119 cursor: pointer;
121 transition: all 0.3s; 120 transition: all 0.3s;
122 } 121 }
src/components/inspection/pointTask.vue
1 <template> 1 <template>
2 <div class="point-task-container"> 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 <el-col :span="6"> 4 <el-col :span="6">
5 <el-card class="task-list-card"> 5 <el-card class="task-list-card">
6 <div class="task-list"> 6 <div class="task-list">
7 <ul> 7 <ul>
8 <li v-for="(task, index) in pointTaskInfo.tasks" :key="index" @click="_switchPointTask(task)" 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 {{ task.planUserName }}({{ task.inspectionPlanName }}) 10 {{ task.planUserName }}({{ task.inspectionPlanName }})
11 </li> 11 </li>
12 </ul> 12 </ul>
@@ -82,7 +82,7 @@ export default { @@ -82,7 +82,7 @@ export default {
82 // 通知地图组件加载任务 82 // 通知地图组件加载任务
83 this.$nextTick(() => { 83 this.$nextTick(() => {
84 if (this.$refs.inspectionTaskMap) { 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 <template> 1 <template>
2 <div class="point-task-detail-container"> 2 <div class="point-task-detail-container">
3 - <el-row :gutter="20" class="margin-top-lg"> 3 + <el-row :gutter="20" class="">
4 <el-col :span="6"> 4 <el-col :span="6">
5 <el-input :placeholder="$t('pointTaskDetail.placeholder.planUserName')" v-model="pointTaskDetailInfo.planUserName" 5 <el-input :placeholder="$t('pointTaskDetail.placeholder.planUserName')" v-model="pointTaskDetailInfo.planUserName"
6 clearable /> 6 clearable />
src/views/inspection/inspectionItemManageList.vue
@@ -29,10 +29,10 @@ @@ -29,10 +29,10 @@
29 <div slot="header" class="flex justify-between"> 29 <div slot="header" class="flex justify-between">
30 <span>{{ $t('inspectionItemManage.inspectionItems') }}</span> 30 <span>{{ $t('inspectionItemManage.inspectionItems') }}</span>
31 <div style="float: right;"> 31 <div style="float: right;">
32 - <el-button type="primary" size="small" @click="handleShowDoc"> 32 + <!-- <el-button type="primary" size="small" @click="handleShowDoc">
33 <i class="el-icon-document"></i> 33 <i class="el-icon-document"></i>
34 {{ $t('inspectionItemManage.doc') }} 34 {{ $t('inspectionItemManage.doc') }}
35 - </el-button> 35 + </el-button> -->
36 <el-button type="primary" size="small" @click="openAddModal"> 36 <el-button type="primary" size="small" @click="openAddModal">
37 <i class="el-icon-plus"></i> 37 <i class="el-icon-plus"></i>
38 {{ $t('inspectionItemManage.addBtn') }} 38 {{ $t('inspectionItemManage.addBtn') }}
src/views/inspection/inspectionItemTitleManageList.vue
1 <template> 1 <template>
2 - <div> 2 + <div class="padding">
3 <!-- 查询条件 --> 3 <!-- 查询条件 -->
4 <el-card class="search-wrapper"> 4 <el-card class="search-wrapper">
5 <div slot="header" class="flex juistify-between"> 5 <div slot="header" class="flex juistify-between">
src/views/inspection/inspectionPointList.vue
@@ -275,7 +275,6 @@ export default { @@ -275,7 +275,6 @@ export default {
275 .point-list li { 275 .point-list li {
276 padding: 10px; 276 padding: 10px;
277 cursor: pointer; 277 cursor: pointer;
278 - border-bottom: 1px solid #ebeef5;  
279 } 278 }
280 279
281 .point-list li:last-child { 280 .point-list li:last-child {
src/views/inspection/inspectionRouteList.vue
@@ -223,7 +223,6 @@ export default { @@ -223,7 +223,6 @@ export default {
223 li { 223 li {
224 padding: 10px; 224 padding: 10px;
225 cursor: pointer; 225 cursor: pointer;
226 - border-bottom: 1px solid #eee;  
227 226
228 &:hover { 227 &:hover {
229 background-color: #f5f5f5; 228 background-color: #f5f5f5;