Blame view

src/views/inspection/inspectionRouteList.vue 7.82 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
48ea9c43   wuxw   巡检开发完成
2
3
4
5
6
7
8
    <div class="inspection-route-container">
      <el-row :gutter="20">
        <el-col :span="4" class="left-panel">
          <el-card class="search-card">
            <div class="flex justify-start">
              <el-input v-model="inspectionRouteInfo.conditions.routeName"
                :placeholder="$t('inspectionRoute.routeNamePlaceholder')" class="search-input" clearable />
d367e130   wuxw   巡检功能测试
9
              <el-button type="text" class="margin-left-xs" size="small" @click="_queryInspectionRouteMethod">
48ea9c43   wuxw   巡检开发完成
10
11
                {{ $t('common.search') }}
              </el-button>
d367e130   wuxw   巡检功能测试
12
              <el-button type="text" class="margin-left-xs" size="small" @click="_openAddInspectionRouteModal">
48ea9c43   wuxw   巡检开发完成
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
                {{ $t('common.add') }}
              </el-button>
            </div>
  
            <div class="route-list margin-top">
              <ul class="route-ul">
                <li v-for="(route, index) in inspectionRouteInfo.inspectionRoutes" :key="index" :class="{
                  'active-route':
                    route.inspectionRouteId ==
                    inspectionRouteInfo.route.inspectionRouteId
                }" @click="_switchInspectionRoute(route)">
                  {{ route.routeName }}
                </li>
              </ul>
            </div>
          </el-card>
        </el-col>
  
        <el-col :span="20" class="right-panel">
          <el-card class="route-detail-card">
            <div slot="header" class="flex justify-between">
              <span>{{ $t('inspectionRoute.routeInfo') }}</span>
              <div class="ibox-tools">
                <el-button size="mini" @click="_openEditInspectionRouteModel(inspectionRouteInfo.route)">
                  {{ $t('common.edit') }}
                </el-button>
                <el-button size="mini" type="danger" @click="_openDeleteInspectionRouteModel(inspectionRouteInfo.route)">
                  {{ $t('common.delete') }}
                </el-button>
              </div>
            </div>
  
d367e130   wuxw   巡检功能测试
45
            <el-row class="text-left">
48ea9c43   wuxw   巡检开发完成
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
              <el-col :span="6">
                <div class="form-group">
                  <label class="col-form-label">
                    {{ $t('inspectionRoute.routeName') }}:
                  </label>
                  <label>{{ inspectionRouteInfo.route.routeName }}</label>
                </div>
              </el-col>
              <el-col :span="6">
                <div class="form-group">
                  <label class="col-form-label">
                    {{ $t('inspectionRoute.sequence') }}:
                  </label>
                  <label>{{ inspectionRouteInfo.route.seq }}</label>
                </div>
              </el-col>
              <el-col :span="6">
                <div class="form-group">
                  <label class="col-form-label">
                    {{ $t('inspectionRoute.createTime') }}:
                  </label>
                  <label>{{ inspectionRouteInfo.route.createTime }}</label>
                </div>
              </el-col>
              <el-col :span="6">
                <div class="form-group">
                  <label class="col-form-label">
                    {{ $t('inspectionRoute.remark') }}:
                  </label>
                  <label>{{ inspectionRouteInfo.route.remark }}</label>
                </div>
              </el-col>
            </el-row>
          </el-card>
  
          <el-card class="tab-card margin-top">
            <el-tabs v-model="inspectionRouteInfo._currentTab" @tab-click="changeTab(inspectionRouteInfo._currentTab)">
              <el-tab-pane label="巡检点" name="inspectionRoutePoint">
d367e130   wuxw   巡检功能测试
84
                <inspection-route-point ref="inspectionRoutePoint" />
48ea9c43   wuxw   巡检开发完成
85
86
              </el-tab-pane>
              <el-tab-pane label="巡检地图" name="inspectionRouteMap">
d367e130   wuxw   巡检功能测试
87
                <inspection-route-map ref="inspectionRouteMap" />
48ea9c43   wuxw   巡检开发完成
88
89
              </el-tab-pane>
              <el-tab-pane label="巡检计划" name="routePlan">
d367e130   wuxw   巡检功能测试
90
                <route-plan ref="routePlan" />
48ea9c43   wuxw   巡检开发完成
91
92
              </el-tab-pane>
              <el-tab-pane label="巡检任务" name="routeTask">
d367e130   wuxw   巡检功能测试
93
                <route-task ref="routeTask" />
48ea9c43   wuxw   巡检开发完成
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col>
      </el-row>
  
      <add-inspection-route ref="addInspectionRoute" @success="handleSuccess" />
      <edit-inspection-route ref="editInspectionRoute" @success="handleSuccess" />
      <delete-inspection-route ref="deleteInspectionRoute" @success="handleSuccess" />
    </div>
  </template>
  
  <script>
  import { getCommunityId } from '@/api/community/communityApi'
  import {
    listInspectionRoutes,
  
  } from '@/api/inspection/inspectionRouteApi'
  import InspectionRoutePoint from '@/components/inspection/InspectionRoutePoint'
  import InspectionRouteMap from '@/components/inspection/inspectionRouteMap'
  import RoutePlan from '@/components/inspection/RoutePlan'
  import RouteTask from '@/components/inspection/RouteTask'
  import AddInspectionRoute from '@/components/inspection/AddInspectionRoute'
  import EditInspectionRoute from '@/components/inspection/EditInspectionRoute'
  import DeleteInspectionRoute from '@/components/inspection/DeleteInspectionRoute'
  
  export default {
    name: 'InspectionRouteList',
    components: {
      InspectionRoutePoint,
      InspectionRouteMap,
      RoutePlan,
      RouteTask,
      AddInspectionRoute,
      EditInspectionRoute,
      DeleteInspectionRoute
    },
    data() {
      return {
        inspectionRouteInfo: {
          inspectionRoutes: [],
          route: {},
          _currentTab: 'inspectionRoutePoint',
          conditions: {
            routeName: '',
            inspectionRouteId: '',
            seq: ''
          }
        },
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
632de291   wuxw   v1.9 优化巡检路线只显示10条问题
148
      this._listInspectionRoutes(1, 100)
48ea9c43   wuxw   巡检开发完成
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
    },
    methods: {
      async _listInspectionRoutes(page, rows) {
        try {
          const params = {
            page,
            row: rows,
            communityId: this.communityId,
            ...this.inspectionRouteInfo.conditions
          }
          const data = await listInspectionRoutes(params)
          this.inspectionRouteInfo.inspectionRoutes = data.inspectionRoutes
          if (data.inspectionRoutes && data.inspectionRoutes.length > 0) {
            this._switchInspectionRoute(data.inspectionRoutes[0])
          }
        } catch (error) {
          console.error('获取巡检路线列表失败:', error)
        }
      },
      _openAddInspectionRouteModal() {
        this.$refs.addInspectionRoute.open()
      },
      _openEditInspectionRouteModel(route) {
        this.$refs.editInspectionRoute.open(route)
      },
      _openDeleteInspectionRouteModel(route) {
        this.$refs.deleteInspectionRoute.open(route)
      },
      _queryInspectionRouteMethod() {
cbeb361b   wuxw   v1.9 巡检功能修复一些显示的bug
178
        this._listInspectionRoutes(1, 100)
48ea9c43   wuxw   巡检开发完成
179
180
181
182
183
184
185
186
187
188
189
      },
      _switchInspectionRoute(route) {
        this.inspectionRouteInfo.route = route
        this.changeTab(this.inspectionRouteInfo._currentTab)
      },
      changeTab(tab) {
        this.inspectionRouteInfo._currentTab = tab
        setTimeout(() => {
          if (this.$refs[tab]) {
            this.$refs[tab].loadData(this.inspectionRouteInfo.route)
          }
d367e130   wuxw   巡检功能测试
190
        }, 500)
48ea9c43   wuxw   巡检开发完成
191
192
      },
      handleSuccess() {
cbeb361b   wuxw   v1.9 巡检功能修复一些显示的bug
193
        this._listInspectionRoutes(1, 100)
48ea9c43   wuxw   巡检开发完成
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .inspection-route-container {
    padding: 20px;
    height: 100%;
  
    .left-panel {
      height: 100%;
  
      .search-card {
        height: 100%;
  
        .search-input {
          width: 60%;
        }
  
        .route-list {
          height: calc(100% - 60px);
          overflow-y: auto;
  
          .route-ul {
            list-style: none;
            padding: 0;
            margin: 0;
  
            li {
              padding: 10px;
              cursor: pointer;
48ea9c43   wuxw   巡检开发完成
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
  
              &:hover {
                background-color: #f5f5f5;
              }
  
              &.active-route {
                background-color: #409eff;
                color: white;
              }
            }
          }
        }
      }
    }
  
    .right-panel {
      height: 100%;
  
      .route-detail-card {
        margin-bottom: 20px;
      }
  
      .tab-card {
        height: calc(100% - 180px);
      }
    }
  
    .margin-top {
      margin-top: 10px;
    }
  
    .margin-left-xs {
      margin-left: 10px;
    }
  }
  </style>