Commit d367e13021af5fa2bcbf93ea63ec368927fac111

Authored by wuxw
1 parent b5dad34f

巡检功能测试

src/components/inspection/ChooseInspectionRoutePoint.vue
1 1 <template>
2   - <el-dialog
3   - :title="$t('inspectionRoute.choosePointTitle')"
4   - :visible.sync="visible"
5   - width="70%"
6   - @close="handleClose"
7   - >
  2 + <el-dialog :title="$t('inspectionRoute.choosePointTitle')" :visible.sync="visible" width="70%" @close="handleClose">
8 3 <el-row :gutter="20">
9 4 <el-col :span="24">
10   - <el-card>
  5 +
11 6 <el-row :gutter="20" class="margin-bottom">
12 7 <el-col :span="18"></el-col>
13 8 <el-col :span="6">
14   - <el-input
15   - v-model="chooseInspectionRoutePointInfo.inspectionName"
16   - :placeholder="$t('inspectionRoute.pointNamePlaceholder')"
17   - clearable
18   - class="search-input"
19   - >
20   - <el-button
21   - slot="append"
22   - type="primary"
23   - @click="queryPoints"
24   - >
  9 + <el-input v-model="chooseInspectionRoutePointInfo.inspectionName"
  10 + :placeholder="$t('inspectionRoute.pointNamePlaceholder')" clearable class="search-input">
  11 + <el-button slot="append" type="primary" @click="queryPoints">
25 12 <i class="el-icon-search"></i>
26 13 </el-button>
27   - <el-button
28   - slot="append"
29   - type="primary"
30   - @click="resetPoints"
31   - >
  14 + <el-button slot="append" type="primary" @click="resetPoints">
32 15 <i class="el-icon-refresh"></i>
33 16 </el-button>
34 17 </el-input>
35 18 </el-col>
36 19 </el-row>
37 20  
38   - <el-table
39   - :data="chooseInspectionRoutePointInfo.points"
40   - border
41   - style="width: 100%"
42   - @selection-change="handleSelectionChange"
43   - >
44   - <el-table-column
45   - type="selection"
46   - width="55"
47   - align="center"
48   - />
49   - <el-table-column
50   - prop="inspectionId"
51   - :label="$t('inspectionRoute.pointId')"
52   - align="center"
53   - />
54   - <el-table-column
55   - prop="inspectionName"
56   - :label="$t('inspectionRoute.pointName')"
57   - align="center"
58   - />
  21 + <el-table :data="chooseInspectionRoutePointInfo.points" border style="width: 100%"
  22 + @selection-change="handleSelectionChange">
  23 + <el-table-column type="selection" width="55" align="center" />
  24 + <el-table-column prop="inspectionId" :label="$t('inspectionRoute.pointId')" align="center" />
  25 + <el-table-column prop="inspectionName" :label="$t('inspectionRoute.pointName')" align="center" />
59 26 </el-table>
60 27  
61   - <el-pagination
62   - :current-page.sync="page.current"
63   - :page-size="page.size"
64   - :total="page.total"
65   - layout="total, prev, pager, next"
66   - @current-change="handlePageChange"
67   - />
  28 + <el-pagination :current-page.sync="page.current" :page-size="page.size" :total="page.total"
  29 + layout="total, prev, pager, next" @current-change="handlePageChange" />
68 30  
69 31 <div class="text-right margin-top">
70 32 <el-button @click="handleClose">
71 33 {{ $t('common.cancel') }}
72 34 </el-button>
73   - <el-button
74   - type="primary"
75   - @click="_chooseInspectionRoutePoint"
76   - >
  35 + <el-button type="primary" @click="_chooseInspectionRoutePoint">
77 36 {{ $t('common.confirm') }}
78 37 </el-button>
79 38 </div>
80   - </el-card>
81 39 </el-col>
82 40 </el-row>
83 41 </el-dialog>
... ... @@ -126,8 +84,8 @@ export default {
126 84 inspectionRouteId: this.chooseInspectionRoutePointInfo.inspectionRouteId,
127 85 communityId: this.communityId
128 86 }
129   - const { data, total } = await listInspectionPoints(params)
130   - this.chooseInspectionRoutePointInfo.points = data
  87 + const { inspectionPoints, total } = await listInspectionPoints(params)
  88 + this.chooseInspectionRoutePointInfo.points = inspectionPoints
131 89 this.page.total = total
132 90 } catch (error) {
133 91 console.error('获取巡检点列表失败:', error)
... ...
src/components/inspection/DeleteInspectionRoute.vue
1 1 <template>
2   - <el-dialog
3   - :title="$t('common.confirmOperation')"
4   - :visible.sync="visible"
5   - width="30%"
6   - @close="handleClose"
7   - >
  2 + <el-dialog :title="$t('common.confirmDelete')" :visible.sync="visible" width="30%" @close="handleClose">
8 3 <div class="text-center">
9 4 <p>{{ $t('inspectionRoute.confirmDeleteRoute') }}</p>
10 5 </div>
... ... @@ -12,10 +7,7 @@
12 7 <el-button @click="handleClose">
13 8 {{ $t('common.cancel') }}
14 9 </el-button>
15   - <el-button
16   - type="primary"
17   - @click="deleteInspectionRoute"
18   - >
  10 + <el-button type="primary" @click="deleteInspectionRoute">
19 11 {{ $t('common.confirm') }}
20 12 </el-button>
21 13 </div>
... ...
src/components/inspection/EditInspectionRoute.vue
1 1 <template>
2   - <el-dialog
3   - :title="$t('inspectionRoute.editRouteTitle')"
4   - :visible.sync="visible"
5   - width="50%"
6   - @close="handleClose"
7   - >
8   - <el-form
9   - ref="form"
10   - :model="editInspectionRouteInfo"
11   - :rules="rules"
12   - label-width="120px"
13   - >
14   - <el-form-item
15   - :label="$t('inspectionRoute.routeName')"
16   - prop="routeName"
17   - >
18   - <el-input
19   - v-model.trim="editInspectionRouteInfo.routeName"
20   - :placeholder="$t('inspectionRoute.routeNamePlaceholder')"
21   - clearable
22   - />
  2 + <el-dialog :title="$t('inspectionRoute.editRouteTitle')" :visible.sync="visible" width="40%" @close="handleClose">
  3 + <el-form ref="form" :model="editInspectionRouteInfo" :rules="rules" label-width="120px">
  4 + <el-form-item :label="$t('inspectionRoute.routeName')" prop="routeName">
  5 + <el-input v-model.trim="editInspectionRouteInfo.routeName"
  6 + :placeholder="$t('inspectionRoute.routeNamePlaceholder')" clearable />
23 7 </el-form-item>
24   - <el-form-item
25   - :label="$t('inspectionRoute.sequence')"
26   - prop="seq"
27   - >
28   - <el-input
29   - v-model.number="editInspectionRouteInfo.seq"
30   - :placeholder="$t('inspectionRoute.sequencePlaceholder')"
31   - clearable
32   - />
  8 + <el-form-item :label="$t('inspectionRoute.sequence')" prop="seq">
  9 + <el-input v-model.number="editInspectionRouteInfo.seq" :placeholder="$t('inspectionRoute.sequencePlaceholder')"
  10 + clearable />
33 11 </el-form-item>
34   - <el-form-item
35   - :label="$t('inspectionRoute.remark')"
36   - prop="remark"
37   - >
38   - <el-input
39   - v-model.trim="editInspectionRouteInfo.remark"
40   - :placeholder="$t('inspectionRoute.remarkPlaceholder')"
41   - type="textarea"
42   - :rows="3"
43   - clearable
44   - />
  12 + <el-form-item :label="$t('inspectionRoute.remark')" prop="remark">
  13 + <el-input v-model.trim="editInspectionRouteInfo.remark" :placeholder="$t('inspectionRoute.remarkPlaceholder')"
  14 + type="textarea" :rows="3" clearable />
45 15 </el-form-item>
46 16 </el-form>
47 17 <div slot="footer" class="dialog-footer">
48 18 <el-button @click="handleClose">
49 19 {{ $t('common.cancel') }}
50 20 </el-button>
51   - <el-button
52   - type="primary"
53   - @click="editInspectionRoute"
54   - >
  21 + <el-button type="primary" @click="editInspectionRoute">
55 22 {{ $t('common.save') }}
56 23 </el-button>
57 24 </div>
... ... @@ -81,7 +48,6 @@ export default {
81 48 ],
82 49 seq: [
83 50 { required: true, message: this.$t('inspectionRoute.sequenceRequired'), trigger: 'blur' },
84   - { type: 'number', message: this.$t('inspectionRoute.sequenceMustBeNumber'), trigger: 'blur' }
85 51 ],
86 52 remark: [
87 53 { max: 200, message: this.$t('inspectionRoute.remarkMaxLength'), trigger: 'blur' }
... ... @@ -107,7 +73,7 @@ export default {
107 73 async editInspectionRoute() {
108 74 try {
109 75 await this.$refs.form.validate()
110   -
  76 +
111 77 await updateInspectionRoute(this.editInspectionRouteInfo)
112 78 this.$message.success(this.$t('inspectionRoute.editSuccess'))
113 79 this.$emit('success')
... ...
src/components/inspection/inspectionRouteMap.vue
... ... @@ -19,29 +19,15 @@ export default {
19 19 },
20 20 async mounted() {
21 21 this.communityId = getCommunityId()
22   - await this.loadQQMapScript()
23 22 // 延迟初始化地图,确保DOM已经渲染
24   - setTimeout(() => {
25   - this.initMap()
26   - }, 500)
27 23 },
28 24 methods: {
29 25 loadData(route) {
  26 + this.initMap()
  27 +
30 28 this.loadRoute(route)
31 29 },
32   - loadQQMapScript() {
33   - if (window.TMap) {
34   - return Promise.resolve();
35   - }
36 30  
37   - return new Promise((resolve, reject) => {
38   - const script = document.createElement('script');
39   - script.src = `https://map.qq.com/api/gljs?v=1.exp&key=您的腾讯地图KEY`;
40   - script.onload = resolve;
41   - script.onerror = reject;
42   - document.head.appendChild(script);
43   - });
44   - },
45 31 initMap() {
46 32 // 默认中心点(北京)
47 33 const center = new window.TMap.LatLng(39.916527, 116.397128)
... ...
src/components/inspection/pointRoute.vue
... ... @@ -78,7 +78,7 @@ export default {
78 78 // 通知地图组件加载路线
79 79 this.$nextTick(() => {
80 80 if (this.$refs.inspectionRouteMap) {
81   - this.$refs.inspectionRouteMap.loadRoute(route)
  81 + this.$refs.inspectionRouteMap.loadData(route)
82 82 }
83 83 })
84 84 }
... ...
src/views/inspection/addInspectionPlanList.vue
1 1 <template>
2 2 <div class="add-inspection-plan-container">
3 3 <el-card class="box-card">
4   - <div slot="header">
5   - <h5>{{ $t('addInspectionPlan.title') }}</h5>
  4 + <div slot="header" class="text-left">
  5 + <span>{{ $t('addInspectionPlan.title') }}</span>
6 6 </div>
7 7  
8 8 <el-form ref="form" :model="form" label-width="150px" label-position="right">
... ...
src/views/inspection/inspectionPlanList.vue
... ... @@ -7,38 +7,21 @@
7 7 <div class="card-content">
8 8 <el-row :gutter="20">
9 9 <el-col :span="5">
10   - <el-input
11   - :placeholder="$t('inspectionPlan.inspectionPlanIdPlaceholder')"
12   - v-model="searchConditions.inspectionPlanId"
13   - clearable
14   - />
  10 + <el-input :placeholder="$t('inspectionPlan.inspectionPlanIdPlaceholder')"
  11 + v-model="searchConditions.inspectionPlanId" clearable />
15 12 </el-col>
16 13 <el-col :span="5">
17   - <el-input
18   - :placeholder="$t('inspectionPlan.inspectionPlanNamePlaceholder')"
19   - v-model="searchConditions.inspectionPlanName"
20   - clearable
21   - />
  14 + <el-input :placeholder="$t('inspectionPlan.inspectionPlanNamePlaceholder')"
  15 + v-model="searchConditions.inspectionPlanName" clearable />
22 16 </el-col>
23 17 <el-col :span="5">
24   - <el-input
25   - :placeholder="$t('inspectionPlan.staffNamePlaceholder')"
26   - v-model="searchConditions.staffNameLike"
27   - clearable
28   - />
  18 + <el-input :placeholder="$t('inspectionPlan.staffNamePlaceholder')" v-model="searchConditions.staffNameLike"
  19 + clearable />
29 20 </el-col>
30 21 <el-col :span="5">
31   - <el-select
32   - v-model="searchConditions.state"
33   - :placeholder="$t('inspectionPlan.statePlaceholder')"
34   - style="width:100%"
35   - >
36   - <el-option
37   - v-for="(item, index) in stateOptions"
38   - :key="index"
39   - :label="item.name"
40   - :value="item.statusCd"
41   - />
  22 + <el-select v-model="searchConditions.state" :placeholder="$t('inspectionPlan.statePlaceholder')"
  23 + style="width:100%">
  24 + <el-option v-for="(item, index) in stateOptions" :key="index" :label="item.name" :value="item.statusCd" />
42 25 </el-select>
43 26 </el-col>
44 27 <el-col :span="4">
... ... @@ -97,18 +80,11 @@
97 80 <el-button size="mini" @click="openDeleteModal(scope.row)">
98 81 {{ $t('inspectionPlan.delete') }}
99 82 </el-button>
100   - <el-button
101   - v-if="scope.row.state === '2020025'"
102   - size="mini"
103   - @click="openStateModal(scope.row, '2020026', $t('inspectionPlan.disable'))"
104   - >
  83 + <el-button v-if="scope.row.state === '2020025'" size="mini"
  84 + @click="openStateModal(scope.row, '2020026', $t('inspectionPlan.disable'))">
105 85 {{ $t('inspectionPlan.disable') }}
106 86 </el-button>
107   - <el-button
108   - v-else
109   - size="mini"
110   - @click="openStateModal(scope.row, '2020025', $t('inspectionPlan.enable'))"
111   - >
  87 + <el-button v-else size="mini" @click="openStateModal(scope.row, '2020025', $t('inspectionPlan.enable'))">
112 88 {{ $t('inspectionPlan.enable') }}
113 89 </el-button>
114 90 <el-button size="mini" @click="viewDetail(scope.row)">
... ... @@ -118,21 +94,15 @@
118 94 </template>
119 95 </el-table-column>
120 96 </el-table>
121   -
  97 +
122 98 <el-row class="margin-top">
123   - <el-col :span="18">
  99 + <el-col :span="18" class="text-left table-desc">
124 100 <div>{{ $t('inspectionPlan.note') }}</div>
125 101 </el-col>
126 102 <el-col :span="6">
127   - <el-pagination
128   - :current-page.sync="pagination.current"
129   - :page-sizes="[10, 20, 30, 50]"
130   - :page-size="pagination.size"
131   - layout="total, sizes, prev, pager, next"
132   - :total="pagination.total"
133   - @size-change="handleSizeChange"
134   - @current-change="handlePageChange"
135   - />
  103 + <el-pagination :current-page.sync="pagination.current" :page-sizes="[10, 20, 30, 50]"
  104 + :page-size="pagination.size" layout="total, sizes, prev, pager, next" :total="pagination.total"
  105 + @size-change="handleSizeChange" @current-change="handlePageChange" />
136 106 </el-col>
137 107 </el-row>
138 108 </el-card>
... ... @@ -148,7 +118,7 @@ import { listInspectionPlans } from &#39;@/api/inspection/inspectionPlanApi&#39;
148 118 import EditInspectionPlan from '@/components/inspection/editInspectionPlan'
149 119 import DeleteInspectionPlan from '@/components/inspection/deleteInspectionPlan'
150 120 import InspectionPlanState from '@/components/inspection/inspectionPlanState'
151   -import {getDict} from '@/api/community/communityApi'
  121 +import { getDict } from '@/api/community/communityApi'
152 122 export default {
153 123 name: 'InspectionPlanList',
154 124 components: {
... ... @@ -185,7 +155,7 @@ export default {
185 155 console.error('Failed to load dictionary data:', error)
186 156 }
187 157 },
188   -
  158 +
189 159 async fetchInspectionPlans() {
190 160 try {
191 161 const params = {
... ... @@ -193,7 +163,7 @@ export default {
193 163 page: this.pagination.current,
194 164 row: this.pagination.size
195 165 }
196   -
  166 +
197 167 const { data, total } = await listInspectionPlans(params)
198 168 this.planList = data
199 169 this.pagination.total = total
... ... @@ -201,7 +171,7 @@ export default {
201 171 this.$message.error(this.$t('inspectionPlan.fetchError'))
202 172 }
203 173 },
204   -
  174 +
205 175 resetSearch() {
206 176 this.searchConditions = {
207 177 inspectionPlanId: '',
... ... @@ -212,29 +182,29 @@ export default {
212 182 this.pagination.current = 1
213 183 this.fetchInspectionPlans()
214 184 },
215   -
  185 +
216 186 handleSizeChange(size) {
217 187 this.pagination.size = size
218 188 this.fetchInspectionPlans()
219 189 },
220   -
  190 +
221 191 handlePageChange(page) {
222 192 this.pagination.current = page
223 193 this.fetchInspectionPlans()
224 194 },
225   -
  195 +
226 196 openAddModal() {
227 197 this.$router.push({ path: '/views/inspection/addInspectionPlan' })
228 198 },
229   -
  199 +
230 200 openEditModal(plan) {
231 201 this.$refs.editModal.open(plan)
232 202 },
233   -
  203 +
234 204 openDeleteModal(plan) {
235 205 this.$refs.deleteModal.open(plan)
236 206 },
237   -
  207 +
238 208 openStateModal(plan, state, stateName) {
239 209 this.$refs.stateModal.open({
240 210 inspectionPlanId: plan.inspectionPlanId,
... ... @@ -242,11 +212,11 @@ export default {
242 212 stateName
243 213 })
244 214 },
245   -
  215 +
246 216 viewDetail(plan) {
247 217 window.open(`/#/pages/inspection/inspectionPlanDetail?inspectionPlanId=${plan.inspectionPlanId}`)
248 218 },
249   -
  219 +
250 220 handleSuccess() {
251 221 this.fetchInspectionPlans()
252 222 }
... ... @@ -258,6 +228,7 @@ export default {
258 228 .margin-top {
259 229 margin-top: 20px;
260 230 }
  231 +
261 232 .card-content {
262 233 padding: 20px;
263 234 }
... ...
src/views/inspection/inspectionPointList.vue
... ... @@ -18,7 +18,8 @@
18 18  
19 19 <div class="vc-org margin-top">
20 20 <ul class="point-list">
21   - <li v-for="(point, index) in inspectionPointInfo.points" :key="index" @click="_switchInspectionPoint(point)"
  21 + <li v-for="(point, index) in inspectionPointInfo.points" :key="index"
  22 + @click="_switchInspectionPoint(point)"
22 23 :class="{ 'active': point.inspectionId == inspectionPointInfo.point.inspectionId }">
23 24 {{ point.inspectionName }}
24 25 </li>
... ... @@ -98,9 +99,11 @@
98 99 <el-row v-if="inspectionPointInfo.point.inspectionId" class="margin-top">
99 100 <el-col :span="24">
100 101 <el-card>
101   - <el-tabs v-model="inspectionPointInfo._currentTab" @tab-click="changeTab(inspectionPointInfo._currentTab)">
  102 + <el-tabs v-model="inspectionPointInfo._currentTab"
  103 + @tab-click="changeTab(inspectionPointInfo._currentTab)">
102 104 <el-tab-pane name="pointTaskDetail" :label="$t('inspectionPoint.tabs.pointTaskDetail')">
103   - <point-task-detail v-if="inspectionPointInfo._currentTab === 'pointTaskDetail'" ref="pointTaskDetail" />
  105 + <point-task-detail v-if="inspectionPointInfo._currentTab === 'pointTaskDetail'"
  106 + ref="pointTaskDetail" />
104 107 </el-tab-pane>
105 108 <el-tab-pane name="pointRoute" :label="$t('inspectionPoint.tabs.pointRoute')">
106 109 <point-route v-if="inspectionPointInfo._currentTab === 'pointRoute'" ref="pointRoute" />
... ... @@ -118,10 +121,10 @@
118 121 </el-col>
119 122 </el-row>
120 123 <!-- 模态框组件 -->
121   - <add-inspection-point ref="addInspectionPoint" @success="_listInspectionPoints"/>
122   - <edit-inspection-point ref="editInspectionPoint" @success="_listInspectionPoints"/>
123   - <delete-inspection-point ref="deleteInspectionPoint" @success="_listInspectionPoints"/>
124   - <inspection-point-qr-code ref="inspectionPointQrCode" @success="_listInspectionPoints"/>
  124 + <add-inspection-point ref="addInspectionPoint" @success="_listInspectionPoints" />
  125 + <edit-inspection-point ref="editInspectionPoint" @success="_listInspectionPoints" />
  126 + <delete-inspection-point ref="deleteInspectionPoint" @success="_listInspectionPoints" />
  127 + <inspection-point-qr-code ref="inspectionPointQrCode" @success="_listInspectionPoints" />
125 128 </div>
126 129 </template>
127 130  
... ... @@ -220,8 +223,8 @@ export default {
220 223 if (this.$refs[tab]) {
221 224 this.$refs[tab].loadData(this.inspectionPointInfo.point)
222 225 }
223   - },500)
224   -
  226 + }, 500)
  227 +
225 228 },
226 229 _openAddInspectionPointModal() {
227 230 this.$refs.addInspectionPoint.open()
... ...
src/views/inspection/inspectionRouteList.vue
... ... @@ -6,10 +6,10 @@
6 6 <div class="flex justify-start">
7 7 <el-input v-model="inspectionRouteInfo.conditions.routeName"
8 8 :placeholder="$t('inspectionRoute.routeNamePlaceholder')" class="search-input" clearable />
9   - <el-button type="primary" class="margin-left-xs" size="small" @click="_queryInspectionRouteMethod">
  9 + <el-button type="text" class="margin-left-xs" size="small" @click="_queryInspectionRouteMethod">
10 10 {{ $t('common.search') }}
11 11 </el-button>
12   - <el-button type="primary" class="margin-left-xs" size="small" @click="_openAddInspectionRouteModal">
  12 + <el-button type="text" class="margin-left-xs" size="small" @click="_openAddInspectionRouteModal">
13 13 {{ $t('common.add') }}
14 14 </el-button>
15 15 </div>
... ... @@ -42,7 +42,7 @@
42 42 </div>
43 43 </div>
44 44  
45   - <el-row>
  45 + <el-row class="text-left">
46 46 <el-col :span="6">
47 47 <div class="form-group">
48 48 <label class="col-form-label">
... ... @@ -81,16 +81,16 @@
81 81 <el-card class="tab-card margin-top">
82 82 <el-tabs v-model="inspectionRouteInfo._currentTab" @tab-click="changeTab(inspectionRouteInfo._currentTab)">
83 83 <el-tab-pane label="巡检点" name="inspectionRoutePoint">
84   - <inspection-route-point ref="inspectionRoutePoint"/>
  84 + <inspection-route-point ref="inspectionRoutePoint" />
85 85 </el-tab-pane>
86 86 <el-tab-pane label="巡检地图" name="inspectionRouteMap">
87   - <inspection-route-map ref="inspectionRouteMap"/>
  87 + <inspection-route-map ref="inspectionRouteMap" />
88 88 </el-tab-pane>
89 89 <el-tab-pane label="巡检计划" name="routePlan">
90   - <route-plan ref="routePlan"/>
  90 + <route-plan ref="routePlan" />
91 91 </el-tab-pane>
92 92 <el-tab-pane label="巡检任务" name="routeTask">
93   - <route-task ref="routeTask"/>
  93 + <route-task ref="routeTask" />
94 94 </el-tab-pane>
95 95 </el-tabs>
96 96 </el-card>
... ... @@ -187,7 +187,7 @@ export default {
187 187 if (this.$refs[tab]) {
188 188 this.$refs[tab].loadData(this.inspectionRouteInfo.route)
189 189 }
190   - },500)
  190 + }, 500)
191 191 },
192 192 handleSuccess() {
193 193 this._listInspectionRoutes(1, 10)
... ...