Commit 5b51508bd8092638c3a0bf39484b40d96addb61f

Authored by wuxw
1 parent 27a95e94

v1.9 优化巡检明细 无法点击查看按钮

src/api/inspection/inspectionTaskDetailsApi.js
@@ -69,11 +69,7 @@ export function listInspectionRoutes(params) { @@ -69,11 +69,7 @@ export function listInspectionRoutes(params) {
69 params 69 params
70 }).then(response => { 70 }).then(response => {
71 const res = response.data 71 const res = response.data
72 - if (res.code === 0) {  
73 resolve(res) 72 resolve(res)
74 - } else {  
75 - reject(new Error(res.msg || '获取巡检路线列表失败'))  
76 - }  
77 }).catch(error => { 73 }).catch(error => {
78 reject(error) 74 reject(error)
79 }) 75 })
@@ -89,11 +85,7 @@ export function listInspectionPoints(params) { @@ -89,11 +85,7 @@ export function listInspectionPoints(params) {
89 params 85 params
90 }).then(response => { 86 }).then(response => {
91 const res = response.data 87 const res = response.data
92 - if (res.code === 0) {  
93 resolve(res) 88 resolve(res)
94 - } else {  
95 - reject(new Error(res.msg || '获取巡检点列表失败'))  
96 - }  
97 }).catch(error => { 89 }).catch(error => {
98 reject(error) 90 reject(error)
99 }) 91 })
src/components/system/ViewMap.vue
1 <template> 1 <template>
2 - <div id="viewMap" :style="{ visibility: viewMapInfo.showMap }">  
3 - <div class="map-container">  
4 - <div id="qqmapcontainer" style="width: 1200px; height: 400px; background-color: antiquewhite;"></div>  
5 - <i class="el-icon-close close-icon" @click="closeMap" />  
6 - </div> 2 + <el-dialog
  3 + :title="$t('common.map')"
  4 + :visible.sync="viewMapInfo.showMap"
  5 + width="80%"
  6 + :before-close="closeMap"
  7 + :close-on-click-modal="false"
  8 + :close-on-press-escape="true"
  9 + >
  10 + <div class="map-container">
  11 + <div id="qqmapcontainer" style="width: 100%; height: 500px; background-color: antiquewhite;"></div>
7 </div> 12 </div>
8 - </template>  
9 -  
10 - <script>  
11 - export default {  
12 - name: 'ViewMap',  
13 - data() {  
14 - return {  
15 - viewMapInfo: {  
16 - lat: '',  
17 - lng: '',  
18 - showMap: 'hidden',  
19 - map: null  
20 - } 13 + </el-dialog>
  14 +</template>
  15 +
  16 +<script>
  17 +export default {
  18 + name: 'ViewMap',
  19 + data() {
  20 + return {
  21 + viewMapInfo: {
  22 + lat: '',
  23 + lng: '',
  24 + showMap: false,
  25 + map: null
21 } 26 }
22 - },  
23 - methods: {  
24 - open(param) { 27 + }
  28 + },
  29 + methods: {
  30 + open(param) {
  31 + this.viewMapInfo.showMap = true
  32 +
  33 + if (param.lng && param.lat) {
25 const lngLat = this.wgs84togcj02(param.lng, param.lat) 34 const lngLat = this.wgs84togcj02(param.lng, param.lat)
26 this.viewMapInfo.lat = lngLat.lat 35 this.viewMapInfo.lat = lngLat.lat
27 this.viewMapInfo.lng = lngLat.lon 36 this.viewMapInfo.lng = lngLat.lon
28 - this.viewMapInfo.showMap = 'visible'  
29 - this.launchIntoMapFullscreen()  
30 - this.$nextTick(() => this.initMap())  
31 - },  
32 - initMap() {  
33 - const center = new window.TMap.LatLng(this.viewMapInfo.lat, this.viewMapInfo.lng)  
34 - const container = document.getElementById('qqmapcontainer')  
35 - this.viewMapInfo.map = new window.TMap.Map(container, {  
36 - center,  
37 - zoom: 17.2,  
38 - viewMode: '2D'  
39 - })  
40 - new window.TMap.MultiMarker({  
41 - id: 'marker-layer',  
42 - map: this.viewMapInfo.map,  
43 - styles: {  
44 - marker: new window.TMap.MarkerStyle({  
45 - width: 25,  
46 - height: 35,  
47 - anchor: { x: 16, y: 32 },  
48 - src: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/markerDefault.png'  
49 - })  
50 - },  
51 - geometries: [{  
52 - id: 'demo',  
53 - styleId: 'marker',  
54 - position: new window.TMap.LatLng(this.viewMapInfo.lat, this.viewMapInfo.lng),  
55 - properties: { title: 'marker' }  
56 - }]  
57 - })  
58 - },  
59 - closeMap() {  
60 - this.exitMapFullscreen()  
61 - this.viewMapInfo.showMap = 'hidden' 37 + } else {
  38 + this.viewMapInfo.lat = 36.72
  39 + this.viewMapInfo.lng = 100.985
  40 + }
  41 +
  42 + this.$nextTick(() => this.initMap())
  43 + },
  44 + initMap() {
  45 + const center = new window.TMap.LatLng(this.viewMapInfo.lat, this.viewMapInfo.lng)
  46 + const container = document.getElementById('qqmapcontainer')
  47 + this.viewMapInfo.map = new window.TMap.Map(container, {
  48 + center,
  49 + zoom: 17.2,
  50 + viewMode: '2D'
  51 + })
  52 + new window.TMap.MultiMarker({
  53 + id: 'marker-layer',
  54 + map: this.viewMapInfo.map,
  55 + styles: {
  56 + marker: new window.TMap.MarkerStyle({
  57 + width: 25,
  58 + height: 35,
  59 + anchor: { x: 16, y: 32 },
  60 + src: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/markerDefault.png'
  61 + })
  62 + },
  63 + geometries: [{
  64 + id: 'demo',
  65 + styleId: 'marker',
  66 + position: new window.TMap.LatLng(this.viewMapInfo.lat, this.viewMapInfo.lng),
  67 + properties: { title: 'marker' }
  68 + }]
  69 + })
  70 + },
  71 + closeMap() {
  72 + this.viewMapInfo.showMap = false
  73 + if (this.viewMapInfo.map) {
62 this.viewMapInfo.map.destroy() 74 this.viewMapInfo.map.destroy()
63 - },  
64 - launchIntoMapFullscreen() {  
65 - const full = document.getElementById('viewMap')  
66 - if (full.requestFullscreen) full.requestFullscreen()  
67 - else if (full.mozRequestFullScreen) full.mozRequestFullScreen()  
68 - else if (full.webkitRequestFullscreen) full.webkitRequestFullscreen()  
69 - else if (full.msRequestFullscreen) full.msRequestFullscreen()  
70 - },  
71 - exitMapFullscreen() {  
72 - if (document.exitFullscreen) document.exitFullscreen()  
73 - else if (document.mozCancelFullScreen) document.mozCancelFullScreen()  
74 - else if (document.webkitExitFullscreen) document.webkitExitFullscreen()  
75 - },  
76 - wgs84togcj02(lng, lat) {  
77 - // Placeholder for coordinate conversion  
78 - return { lon: lng, lat } 75 + this.viewMapInfo.map = null
79 } 76 }
  77 + },
  78 + wgs84togcj02(lng, lat) {
  79 + // Placeholder for coordinate conversion
  80 + return { lon: lng, lat }
80 } 81 }
81 } 82 }
82 - </script>  
83 -  
84 - <style lang="scss" scoped>  
85 - #viewMap {  
86 - .map-container {  
87 - position: fixed;  
88 - left: 50%;  
89 - top: 50%;  
90 - transform: translate(-50%, -50%);  
91 - background-color: #fff;  
92 - }  
93 - .close-icon {  
94 - position: absolute;  
95 - right: 20px;  
96 - top: 20px;  
97 - font-size: 20px;  
98 - color: red;  
99 - cursor: pointer;  
100 - }  
101 - }  
102 - </style>  
103 \ No newline at end of file 83 \ No newline at end of file
  84 +}
  85 +</script>
  86 +
  87 +<style lang="scss" scoped>
  88 +.map-container {
  89 + width: 100%;
  90 + height: 500px;
  91 +}
  92 +</style>
104 \ No newline at end of file 93 \ No newline at end of file
src/i18n/commonLang.js
@@ -80,6 +80,7 @@ export const messages = { @@ -80,6 +80,7 @@ export const messages = {
80 friday: 'Friday', 80 friday: 'Friday',
81 saturday: 'Saturday', 81 saturday: 'Saturday',
82 sunday: 'Sunday', 82 sunday: 'Sunday',
  83 + map:'Map'
83 } 84 }
84 }, 85 },
85 zh: { 86 zh: {
@@ -162,7 +163,8 @@ export const messages = { @@ -162,7 +163,8 @@ export const messages = {
162 thursday:'星期四', 163 thursday:'星期四',
163 friday:'星期五', 164 friday:'星期五',
164 saturday:'星期六', 165 saturday:'星期六',
165 - sunday:'星期日' 166 + sunday:'星期日',
  167 + map:'地图'
166 } 168 }
167 } 169 }
168 } 170 }
169 \ No newline at end of file 171 \ No newline at end of file
src/views/inspection/inspectionTaskDetailsList.vue
@@ -43,22 +43,22 @@ @@ -43,22 +43,22 @@
43 </el-row> 43 </el-row>
44 44
45 <div v-show="inspectionTaskDetailManageInfo.moreCondition"> 45 <div v-show="inspectionTaskDetailManageInfo.moreCondition">
46 - <el-row :gutter="20">  
47 - <el-col :span="8"> 46 + <el-row :gutter="20" class="margin-top">
  47 + <el-col :span="6">
48 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionPlanId" 48 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionPlanId"
49 :placeholder="$t('inspectionTaskDetails.selectInspectionPlan')" style="width:100%"> 49 :placeholder="$t('inspectionTaskDetails.selectInspectionPlan')" style="width:100%">
50 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionPlanList" :key="index" 50 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionPlanList" :key="index"
51 :label="item.inspectionPlanName" :value="item.inspectionPlanId"></el-option> 51 :label="item.inspectionPlanName" :value="item.inspectionPlanId"></el-option>
52 </el-select> 52 </el-select>
53 </el-col> 53 </el-col>
54 - <el-col :span="8"> 54 + <el-col :span="6">
55 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionRouteId" 55 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionRouteId"
56 :placeholder="$t('inspectionTaskDetails.selectInspectionRoute')" style="width:100%"> 56 :placeholder="$t('inspectionTaskDetails.selectInspectionRoute')" style="width:100%">
57 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionRouteList" :key="index" 57 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionRouteList" :key="index"
58 :label="item.routeName" :value="item.inspectionRouteId"></el-option> 58 :label="item.routeName" :value="item.inspectionRouteId"></el-option>
59 </el-select> 59 </el-select>
60 </el-col> 60 </el-col>
61 - <el-col :span="8"> 61 + <el-col :span="6">
62 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionId" 62 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionId"
63 :placeholder="$t('inspectionTaskDetails.selectInspectionPoint')" style="width:100%"> 63 :placeholder="$t('inspectionTaskDetails.selectInspectionPoint')" style="width:100%">
64 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionPointList" :key="index" 64 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionPointList" :key="index"
@@ -68,20 +68,20 @@ @@ -68,20 +68,20 @@
68 </el-row> 68 </el-row>
69 69
70 <el-row :gutter="20" class="margin-top"> 70 <el-row :gutter="20" class="margin-top">
71 - <el-col :span="8"> 71 + <el-col :span="6">
72 <div class="form-group"> 72 <div class="form-group">
73 <el-input :placeholder="$t('inspectionTaskDetails.inputTaskDetailId')" 73 <el-input :placeholder="$t('inspectionTaskDetails.inputTaskDetailId')"
74 v-model="inspectionTaskDetailManageInfo.conditions.taskDetailId" clearable></el-input> 74 v-model="inspectionTaskDetailManageInfo.conditions.taskDetailId" clearable></el-input>
75 </div> 75 </div>
76 </el-col> 76 </el-col>
77 - <el-col :span="8"> 77 + <el-col :span="6">
78 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionState" 78 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionState"
79 :placeholder="$t('inspectionTaskDetails.selectSignStatus')" style="width:100%"> 79 :placeholder="$t('inspectionTaskDetails.selectSignStatus')" style="width:100%">
80 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionStateTypes" :key="index" 80 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionStateTypes" :key="index"
81 :label="item.name" :value="item.statusCd"></el-option> 81 :label="item.name" :value="item.statusCd"></el-option>
82 </el-select> 82 </el-select>
83 </el-col> 83 </el-col>
84 - <el-col :span="8"> 84 + <el-col :span="6">
85 <el-select v-model="inspectionTaskDetailManageInfo.conditions.state" 85 <el-select v-model="inspectionTaskDetailManageInfo.conditions.state"
86 :placeholder="$t('inspectionTaskDetails.selectInspectionPointStatus')" style="width:100%"> 86 :placeholder="$t('inspectionTaskDetails.selectInspectionPointStatus')" style="width:100%">
87 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.stateTypes" :key="index" 87 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.stateTypes" :key="index"
@@ -90,15 +90,15 @@ @@ -90,15 +90,15 @@
90 </el-col> 90 </el-col>
91 </el-row> 91 </el-row>
92 92
93 - <el-row :gutter="20">  
94 - <el-col :span="8"> 93 + <el-row :gutter="20" class="margin-top">
  94 + <el-col :span="6">
95 <el-select v-model="inspectionTaskDetailManageInfo.conditions.taskState" 95 <el-select v-model="inspectionTaskDetailManageInfo.conditions.taskState"
96 :placeholder="$t('inspectionTaskDetails.selectTaskStatus')" style="width:100%"> 96 :placeholder="$t('inspectionTaskDetails.selectTaskStatus')" style="width:100%">
97 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.taskStates" :key="index" 97 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.taskStates" :key="index"
98 :label="item.name" :value="item.statusCd"></el-option> 98 :label="item.name" :value="item.statusCd"></el-option>
99 </el-select> 99 </el-select>
100 </el-col> 100 </el-col>
101 - <el-col :span="8"> 101 + <el-col :span="6">
102 <el-select v-model="inspectionTaskDetailManageInfo.conditions.patrolType" 102 <el-select v-model="inspectionTaskDetailManageInfo.conditions.patrolType"
103 :placeholder="$t('inspectionTaskDetails.selectPatrolStatus')" style="width:100%"> 103 :placeholder="$t('inspectionTaskDetails.selectPatrolStatus')" style="width:100%">
104 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.patrolTypes" :key="index" 104 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.patrolTypes" :key="index"
@@ -228,7 +228,7 @@ @@ -228,7 +228,7 @@
228 </template> 228 </template>
229 229
230 <script> 230 <script>
231 -import { listInspectionTaskDetails, exportInspectionTaskDetails } from '@/api/inspection/inspectionTaskDetailsApi' 231 +import { listInspectionTaskDetails, exportInspectionTaskDetails,listInspectionPlans,listInspectionRoutes,listInspectionPoints } from '@/api/inspection/inspectionTaskDetailsApi'
232 import { getDict } from '@/api/community/communityApi' 232 import { getDict } from '@/api/community/communityApi'
233 import { getCommunityId } from '@/api/community/communityApi' 233 import { getCommunityId } from '@/api/community/communityApi'
234 import ViewMap from '@/components/system/ViewMap' 234 import ViewMap from '@/components/system/ViewMap'
@@ -334,8 +334,8 @@ export default { @@ -334,8 +334,8 @@ export default {
334 page: 1, 334 page: 1,
335 row: 200 335 row: 200
336 } 336 }
337 - const res = await listInspectionTaskDetails(params)  
338 - this.inspectionTaskDetailManageInfo.inspectionPlanList = res.data.data 337 + const res = await listInspectionPlans(params)
  338 + this.inspectionTaskDetailManageInfo.inspectionPlanList = res.data
339 } catch (error) { 339 } catch (error) {
340 console.error('获取巡检计划列表失败:', error) 340 console.error('获取巡检计划列表失败:', error)
341 } 341 }
@@ -348,8 +348,8 @@ export default { @@ -348,8 +348,8 @@ export default {
348 page: 1, 348 page: 1,
349 row: 200 349 row: 200
350 } 350 }
351 - const res = await listInspectionTaskDetails(params)  
352 - this.inspectionTaskDetailManageInfo.inspectionRouteList = res.data.inspectionRoutes 351 + const res = await listInspectionRoutes(params)
  352 + this.inspectionTaskDetailManageInfo.inspectionRouteList = res.inspectionRoutes
353 } catch (error) { 353 } catch (error) {
354 console.error('获取巡检路线列表失败:', error) 354 console.error('获取巡检路线列表失败:', error)
355 } 355 }
@@ -362,8 +362,8 @@ export default { @@ -362,8 +362,8 @@ export default {
362 page: 1, 362 page: 1,
363 row: 200 363 row: 200
364 } 364 }
365 - const res = await listInspectionTaskDetails(params)  
366 - this.inspectionTaskDetailManageInfo.inspectionPointList = res.data.inspectionPoints 365 + const res = await listInspectionPoints(params)
  366 + this.inspectionTaskDetailManageInfo.inspectionPointList = res.inspectionPoints
367 } catch (error) { 367 } catch (error) {
368 console.error('获取巡检点列表失败:', error) 368 console.error('获取巡检点列表失败:', error)
369 } 369 }
@@ -414,7 +414,7 @@ export default { @@ -414,7 +414,7 @@ export default {
414 }, 414 },
415 415
416 openMap(lat, lng) { 416 openMap(lat, lng) {
417 - this.$refs.viewMap.open(lat, lng) 417 + this.$refs.viewMap.open({lat: lat, lng: lng})
418 }, 418 },
419 419
420 async exportExcel() { 420 async exportExcel() {