Commit 5b51508bd8092638c3a0bf39484b40d96addb61f

Authored by wuxw
1 parent 27a95e94

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

src/api/inspection/inspectionTaskDetailsApi.js
... ... @@ -69,11 +69,7 @@ export function listInspectionRoutes(params) {
69 69 params
70 70 }).then(response => {
71 71 const res = response.data
72   - if (res.code === 0) {
73 72 resolve(res)
74   - } else {
75   - reject(new Error(res.msg || '获取巡检路线列表失败'))
76   - }
77 73 }).catch(error => {
78 74 reject(error)
79 75 })
... ... @@ -89,11 +85,7 @@ export function listInspectionPoints(params) {
89 85 params
90 86 }).then(response => {
91 87 const res = response.data
92   - if (res.code === 0) {
93 88 resolve(res)
94   - } else {
95   - reject(new Error(res.msg || '获取巡检点列表失败'))
96   - }
97 89 }).catch(error => {
98 90 reject(error)
99 91 })
... ...
src/components/system/ViewMap.vue
1 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 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 34 const lngLat = this.wgs84togcj02(param.lng, param.lat)
26 35 this.viewMapInfo.lat = lngLat.lat
27 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 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 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 93 \ No newline at end of file
... ...
src/i18n/commonLang.js
... ... @@ -80,6 +80,7 @@ export const messages = {
80 80 friday: 'Friday',
81 81 saturday: 'Saturday',
82 82 sunday: 'Sunday',
  83 + map:'Map'
83 84 }
84 85 },
85 86 zh: {
... ... @@ -162,7 +163,8 @@ export const messages = {
162 163 thursday:'星期四',
163 164 friday:'星期五',
164 165 saturday:'星期六',
165   - sunday:'星期日'
  166 + sunday:'星期日',
  167 + map:'地图'
166 168 }
167 169 }
168 170 }
169 171 \ No newline at end of file
... ...
src/views/inspection/inspectionTaskDetailsList.vue
... ... @@ -43,22 +43,22 @@
43 43 </el-row>
44 44  
45 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 48 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionPlanId"
49 49 :placeholder="$t('inspectionTaskDetails.selectInspectionPlan')" style="width:100%">
50 50 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionPlanList" :key="index"
51 51 :label="item.inspectionPlanName" :value="item.inspectionPlanId"></el-option>
52 52 </el-select>
53 53 </el-col>
54   - <el-col :span="8">
  54 + <el-col :span="6">
55 55 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionRouteId"
56 56 :placeholder="$t('inspectionTaskDetails.selectInspectionRoute')" style="width:100%">
57 57 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionRouteList" :key="index"
58 58 :label="item.routeName" :value="item.inspectionRouteId"></el-option>
59 59 </el-select>
60 60 </el-col>
61   - <el-col :span="8">
  61 + <el-col :span="6">
62 62 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionId"
63 63 :placeholder="$t('inspectionTaskDetails.selectInspectionPoint')" style="width:100%">
64 64 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionPointList" :key="index"
... ... @@ -68,20 +68,20 @@
68 68 </el-row>
69 69  
70 70 <el-row :gutter="20" class="margin-top">
71   - <el-col :span="8">
  71 + <el-col :span="6">
72 72 <div class="form-group">
73 73 <el-input :placeholder="$t('inspectionTaskDetails.inputTaskDetailId')"
74 74 v-model="inspectionTaskDetailManageInfo.conditions.taskDetailId" clearable></el-input>
75 75 </div>
76 76 </el-col>
77   - <el-col :span="8">
  77 + <el-col :span="6">
78 78 <el-select v-model="inspectionTaskDetailManageInfo.conditions.inspectionState"
79 79 :placeholder="$t('inspectionTaskDetails.selectSignStatus')" style="width:100%">
80 80 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.inspectionStateTypes" :key="index"
81 81 :label="item.name" :value="item.statusCd"></el-option>
82 82 </el-select>
83 83 </el-col>
84   - <el-col :span="8">
  84 + <el-col :span="6">
85 85 <el-select v-model="inspectionTaskDetailManageInfo.conditions.state"
86 86 :placeholder="$t('inspectionTaskDetails.selectInspectionPointStatus')" style="width:100%">
87 87 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.stateTypes" :key="index"
... ... @@ -90,15 +90,15 @@
90 90 </el-col>
91 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 95 <el-select v-model="inspectionTaskDetailManageInfo.conditions.taskState"
96 96 :placeholder="$t('inspectionTaskDetails.selectTaskStatus')" style="width:100%">
97 97 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.taskStates" :key="index"
98 98 :label="item.name" :value="item.statusCd"></el-option>
99 99 </el-select>
100 100 </el-col>
101   - <el-col :span="8">
  101 + <el-col :span="6">
102 102 <el-select v-model="inspectionTaskDetailManageInfo.conditions.patrolType"
103 103 :placeholder="$t('inspectionTaskDetails.selectPatrolStatus')" style="width:100%">
104 104 <el-option v-for="(item, index) in inspectionTaskDetailManageInfo.patrolTypes" :key="index"
... ... @@ -228,7 +228,7 @@
228 228 </template>
229 229  
230 230 <script>
231   -import { listInspectionTaskDetails, exportInspectionTaskDetails } from '@/api/inspection/inspectionTaskDetailsApi'
  231 +import { listInspectionTaskDetails, exportInspectionTaskDetails,listInspectionPlans,listInspectionRoutes,listInspectionPoints } from '@/api/inspection/inspectionTaskDetailsApi'
232 232 import { getDict } from '@/api/community/communityApi'
233 233 import { getCommunityId } from '@/api/community/communityApi'
234 234 import ViewMap from '@/components/system/ViewMap'
... ... @@ -334,8 +334,8 @@ export default {
334 334 page: 1,
335 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 339 } catch (error) {
340 340 console.error('获取巡检计划列表失败:', error)
341 341 }
... ... @@ -348,8 +348,8 @@ export default {
348 348 page: 1,
349 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 353 } catch (error) {
354 354 console.error('获取巡检路线列表失败:', error)
355 355 }
... ... @@ -362,8 +362,8 @@ export default {
362 362 page: 1,
363 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 367 } catch (error) {
368 368 console.error('获取巡检点列表失败:', error)
369 369 }
... ... @@ -414,7 +414,7 @@ export default {
414 414 },
415 415  
416 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 420 async exportExcel() {
... ...