Blame view

src/views/inspection/inspectionPointList.vue 10 KB
48ea9c43   wuxw   巡检开发完成
1
2
3
4
5
6
7
8
9
10
  <template>
    <div class="inspection-point-container">
      <el-row class="margin-bottom-20" :gutter="20">
        <el-col :span="4">
          <el-card>
            <div class="flex justify-start">
              <div style="width: 300px; margin-right: 10px;">
                <el-input :placeholder="$t('inspectionPoint.placeholder.inspectionName')"
                  v-model="inspectionPointInfo.conditions.inspectionName" clearable />
              </div>
b5dad34f   wuxw   巡检功能测试中
11
              <el-button type="text" class="margin-left-xs" size="small" @click="_queryInspectionPointMethod()">
48ea9c43   wuxw   巡检开发完成
12
13
                {{ $t('common.search') }}
              </el-button>
b5dad34f   wuxw   巡检功能测试中
14
              <el-button type="text" class="margin-left-xs" size="small" @click="_openAddInspectionPointModal()">
48ea9c43   wuxw   巡检开发完成
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
45
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
84
85
86
87
88
89
90
91
92
93
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
                {{ $t('common.add') }}
              </el-button>
            </div>
  
            <div class="vc-org margin-top">
              <ul class="point-list">
                <li v-for="(point, index) in inspectionPointInfo.points" :key="index" @click="_switchInspectionPoint(point)"
                  :class="{ 'active': point.inspectionId == inspectionPointInfo.point.inspectionId }">
                  {{ point.inspectionName }}
                </li>
              </ul>
            </div>
          </el-card>
        </el-col>
        <el-col :span="20">
          <el-row v-if="inspectionPointInfo.point.inspectionId">
            <el-col :span="24">
              <el-card>
                <div slot="header" class="flex justify-between">
                  <span>{{ $t('inspectionPoint.title') }}</span>
                  <div class="ibox-tools">
                    <el-button size="small" class="margin-left-xs"
                      @click="_openEditInspectionPointModel(inspectionPointInfo.point)">
                      {{ $t('common.edit') }}
                    </el-button>
                    <el-button size="small" type="danger" class="margin-left-xs"
                      @click="_openDeleteInspectionPointModel(inspectionPointInfo.point)">
                      {{ $t('common.delete') }}
                    </el-button>
                    <el-button size="small" class="margin-left-xs" @click="_pointQrCode(inspectionPointInfo.point)">
                      {{ $t('inspectionPoint.qrCode') }}
                    </el-button>
                  </div>
                </div>
  
                <div class="">
                  <el-row :gutter="20" class="text-left">
                    <el-col :span="6">
                      <div class="form-group">
                        <label class="col-form-label">
                          {{ $t('inspectionPoint.inspectionPoint') }}:
                        </label>
                        <label>{{ inspectionPointInfo.point.inspectionName }}</label>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="form-group">
                        <label class="col-form-label">
                          {{ $t('inspectionPoint.inspectionType') }}:
                        </label>
                        <label>{{ inspectionPointInfo.point.pointTypeName }}</label>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="form-group">
                        <label class="col-form-label">
                          {{ $t('inspectionPoint.inspectionLocation') }}:
                        </label>
                        <label>{{ inspectionPointInfo.point.pointObjName }}</label>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="form-group">
                        <label class="col-form-label">
                          {{ $t('inspectionPoint.inspectionItem') }}:
                        </label>
                        <label>{{ inspectionPointInfo.point.itemName }}</label>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="form-group">
                        <label class="col-form-label">
                          NFC:
                        </label>
                        <label>{{ inspectionPointInfo.point.nfcCode }}</label>
                      </div>
                    </el-col>
                  </el-row>
                </div>
              </el-card>
            </el-col>
          </el-row>
  
          <el-row v-if="inspectionPointInfo.point.inspectionId" class="margin-top">
            <el-col :span="24">
              <el-card>
                <el-tabs v-model="inspectionPointInfo._currentTab" @tab-click="changeTab(inspectionPointInfo._currentTab)">
                  <el-tab-pane name="pointTaskDetail" :label="$t('inspectionPoint.tabs.pointTaskDetail')">
                    <point-task-detail v-if="inspectionPointInfo._currentTab === 'pointTaskDetail'" ref="pointTaskDetail" />
                  </el-tab-pane>
                  <el-tab-pane name="pointRoute" :label="$t('inspectionPoint.tabs.pointRoute')">
                    <point-route v-if="inspectionPointInfo._currentTab === 'pointRoute'" ref="pointRoute" />
                  </el-tab-pane>
                  <el-tab-pane name="pointPlan" :label="$t('inspectionPoint.tabs.pointPlan')">
                    <point-plan v-if="inspectionPointInfo._currentTab === 'pointPlan'" ref="pointPlan" />
                  </el-tab-pane>
                  <el-tab-pane name="pointTask" :label="$t('inspectionPoint.tabs.pointTask')">
                    <point-task v-if="inspectionPointInfo._currentTab === 'pointTask'" ref="pointTask" />
                  </el-tab-pane>
                </el-tabs>
              </el-card>
            </el-col>
          </el-row>
        </el-col>
      </el-row>
      <!-- 模态框组件 -->
b5dad34f   wuxw   巡检功能测试中
121
122
123
124
      <add-inspection-point ref="addInspectionPoint" @success="_listInspectionPoints"/>
      <edit-inspection-point ref="editInspectionPoint" @success="_listInspectionPoints"/>
      <delete-inspection-point ref="deleteInspectionPoint" @success="_listInspectionPoints"/>
      <inspection-point-qr-code ref="inspectionPointQrCode" @success="_listInspectionPoints"/>
48ea9c43   wuxw   巡检开发完成
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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
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
    </div>
  </template>
  
  <script>
  import { listInspectionPoints } from '@/api/inspection/inspectionPointApi'
  import { getDict } from '@/api/community/communityApi'
  import { getCommunityId } from '@/api/community/communityApi'
  import PointTaskDetail from '@/components/inspection/pointTaskDetail'
  import PointRoute from '@/components/inspection/pointRoute'
  import PointPlan from '@/components/inspection/pointPlan'
  import PointTask from '@/components/inspection/pointTask'
  import AddInspectionPoint from '@/components/inspection/addInspectionPoint'
  import EditInspectionPoint from '@/components/inspection/editInspectionPoint'
  import DeleteInspectionPoint from '@/components/inspection/deleteInspectionPoint'
  import InspectionPointQrCode from '@/components/inspection/inspectionPointQrCode'
  
  export default {
    name: 'InspectionPointList',
    components: {
      PointTaskDetail,
      PointRoute,
      PointPlan,
      PointTask,
      AddInspectionPoint,
      EditInspectionPoint,
      DeleteInspectionPoint,
      InspectionPointQrCode
    },
    data() {
      return {
        inspectionPointInfo: {
          points: [],
          point: {},
          total: 0,
          records: 1,
          moreCondition: false,
          inspectionName: '',
          pointObjTypes: [],
          _currentTab: 'pointTaskDetail',
          conditions: {
            inspectionId: '',
            machineId: '',
            inspectionName: '',
            machineCode: '',
            pointObjType: '',
            communityId: '',
            page: 1,
            row: 1000
          }
        },
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
      this.inspectionPointInfo.conditions.communityId = this.communityId
      this.getDictData()
      this._listInspectionPoints()
    },
    methods: {
      async getDictData() {
        try {
          const data = await getDict('inspection_point', 'point_obj_type')
          this.inspectionPointInfo.pointObjTypes = data
        } catch (error) {
          console.error('获取字典数据失败:', error)
        }
      },
      async _listInspectionPoints() {
        try {
          const response = await listInspectionPoints(this.inspectionPointInfo.conditions)
          this.inspectionPointInfo.points = response.inspectionPoints
          this.inspectionPointInfo.total = response.total
          this.inspectionPointInfo.records = response.records
  
          if (response.inspectionPoints && response.inspectionPoints.length > 0) {
            this._switchInspectionPoint(response.inspectionPoints[0])
          }
        } catch (error) {
          console.error('获取巡检点列表失败:', error)
        }
      },
      _queryInspectionPointMethod() {
        this.inspectionPointInfo.conditions.page = 1
        this._listInspectionPoints()
      },
      _switchInspectionPoint(point) {
        this.inspectionPointInfo.point = point
        this.changeTab(this.inspectionPointInfo._currentTab)
      },
      changeTab(tab) {
        this.inspectionPointInfo._currentTab = tab
  
        // 触发子组件加载数据
        setTimeout(() => {
          if (this.$refs[tab]) {
            this.$refs[tab].loadData(this.inspectionPointInfo.point)
          }
        },500)
       
      },
      _openAddInspectionPointModal() {
        this.$refs.addInspectionPoint.open()
      },
      _openEditInspectionPointModel(point) {
        this.$refs.editInspectionPoint.open(point)
      },
      _openDeleteInspectionPointModel(point) {
        this.$refs.deleteInspectionPoint.open(point)
      },
      _pointQrCode(point) {
        this.$refs.inspectionPointQrCode.open(point)
      }
    }
  }
  </script>
  
  <style scoped>
  .inspection-point-container {
    padding: 20px;
  }
  
  .margin-bottom-20 {
    margin-bottom: 20px;
  }
  
  .margin-top {
    margin-top: 15px;
  }
  
  .margin-left-xs {
    margin-left: 10px;
  }
  
  .vc-org {
b5dad34f   wuxw   巡检功能测试中
260
    padding: 5px;
48ea9c43   wuxw   巡检开发完成
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
    max-height: 600px;
    overflow-y: auto;
  }
  
  .point-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  
  .point-list li {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #ebeef5;
  }
  
  .point-list li:last-child {
    border-bottom: none;
  }
  
  .point-list li:hover {
    background-color: #f5f7fa;
  }
  
  .point-list li.active {
b5dad34f   wuxw   巡检功能测试中
286
287
    background-color: #409eff;
    color: #ecf5ff;
48ea9c43   wuxw   巡检开发完成
288
289
290
291
292
293
294
295
296
297
298
299
300
301
    font-weight: bold;
  }
  
  .ibox-tools {
    float: right;
  }
  
  .form-group {
    margin-bottom: 15px;
  }
  
  .col-form-label {
    display: inline-block;
    margin-right: 10px;
48ea9c43   wuxw   巡检开发完成
302
303
  }
  </style>