Selaa lähdekoodia

设备管理页面

chenxr3 4 vuotta sitten
vanhempi
commit
1013865ef3

+ 46 - 83
ebc-middle-platform/src/modules/system-management/equipment-management.vue

@ -16,28 +16,12 @@
16 16
          <div class="label">设备名称:</div>
17 17
          <div class="input-rule">
18 18
            <t-input v-model="queryCondition.equipmentName" style="width: 200px" placeholder="请输入..." clearable></t-input>
19
<!--            <t-select v-model="queryCondition.equipmentName" filterable clearable :loading.sync="currentLoading" @load="$_onLoad" width="200">-->
20
<!--              <t-option v-for="item in searchResult"-->
21
<!--                        :key="item.value"-->
22
<!--              >{{ item.FACILITY_NAME }}</t-option>-->
23
<!--            </t-select>-->
24 19
          </div>
25 20
        </div>
26 21
        <div>
27 22
          <div class="label">设备编号:</div>
28 23
          <div class="input-rule">
29 24
            <t-input v-model="queryCondition.equipmentNumber" style="width: 200px" placeholder="请输入..." clearable></t-input>
30
<!--            <t-select filterable-->
31
<!--                      clearable-->
32
<!--                      :loading.sync="currentLoading_n"-->
33
<!--                      @load="$_onLoad_n"-->
34
<!--                      v-model="queryCondition.equipmentNumber"-->
35
<!--                      width="200" id="ccc"-->
36
<!--            >-->
37
<!--              <t-option v-for="item in searchResult_n"-->
38
<!--                        :key="item.value"-->
39
<!--              >{{ item.FACILITY_CODE }}</t-option>-->
40
<!--            </t-select>-->
41 25
          </div>
42 26
        </div>
43 27
        <div class="btns">
@ -57,6 +41,7 @@
57 41
    </div>
58 42
    <div>
59 43
      <t-table :data="table.data">
44
        <t-table-column type="selection" width="70"></t-table-column>
60 45
        <t-table-column prop="FACILITY_NAME" label="设备名称"></t-table-column>
61 46
        <t-table-column prop="FACILITY_CODE" label="设备编号"></t-table-column>
62 47
        <t-table-column prop="FACILITY_TYPE" label="设备类型">
@ -122,17 +107,6 @@
122 107
    </t-modal>
123 108
    <t-modal :visibled.sync="updateModal" title="编辑设备" >
124 109
      <t-form ref="updateRow" :model="updateRow" :rules="updateRowValidate" :label-width="80" label-position="left">
125
<!--        <t-form-item label="设备类型" prop="type">-->
126
<!--          <template v-if="updateRow.FACILITY_TYPE==1">-->
127
<!--            风机-->
128
<!--          </template>-->
129
<!--          <template v-if="updateRow.FACILITY_TYPE==2">-->
130
<!--            升压站-->
131
<!--          </template>-->
132
<!--          <template v-if="updateRow.FACILITY_TYPE==3">-->
133
<!--            船舶-->
134
<!--          </template>-->
135
<!--        </t-form-item>-->
136 110
        <t-form-item label="设备类型" prop="FACILITY_TYPE">
137 111
          <t-select v-model="updateRow.FACILITY_TYPE" placeholder="请选择设备类型" clearable>
138 112
            <t-option v-for="(item, index) in typeList" :value="item.value" :key="index">{{ item.label }}</t-option>
@ -142,7 +116,7 @@
142 116
          <t-input v-model="updateRow.FACILITY_NAME" placeholder="请输入风机名称"></t-input>
143 117
        </t-form-item>
144 118
        <t-form-item label="设备编号" prop="FACILITY_CODE">
145
          {{updateRow.FACILITY_CODE }}
119
          {{ updateRow.FACILITY_CODE }}
146 120
        </t-form-item>
147 121
        <t-form-item label="经度" prop="LONGITUDE">
148 122
          <t-input v-model="updateRow.LONGITUDE" placeholder="请输入数字"></t-input>
@ -231,9 +205,10 @@ export default {
231 205
          {
232 206
            message: '设备名称重复',
233 207
            trigger: 'blur',
234
            validator: function(rule, value, callback) {
208
            t: this,
209
            validator: async function(rule, value, callback) {
235 210
              // TODO 判断编号重复
236
              if (false) {
211
              if (await rule.t.checkReptition(1, value)) {
237 212
                callback(rule.message)
238 213
              }else {
239 214
                return true
@ -250,15 +225,17 @@ export default {
250 225
          {
251 226
            message: '请输入字母、数字、中划线、下划线、#',
252 227
            trigger: 'blur',
253
            validator: function(rule, value, callback) {
228
            t: this,
229
            validator: async function(rule, value, callback) {
254 230
              if (!/^[a-zA-Z0-9-_#]+$/.test(value)) {
255 231
                callback(rule.message)
256 232
              } else {
257 233
                // TODO 判断编号重复
258
                if (false) {
234
                var y = await rule.t.checkReptition(2, value)
235
                if (y) {
259 236
                  rule.message = '编号重复'
260 237
                  callback(rule.message)
261
                }else {
238
                } else {
262 239
                  return true
263 240
                }
264 241
              }
@ -277,7 +254,7 @@ export default {
277 254
            validator: function(rule, value, callback) {
278 255
              if (isNaN(value)) {
279 256
                callback(rule.message)
280
              }else {
257
              } else {
281 258
                return true
282 259
              }
283 260
            }
@ -295,7 +272,7 @@ export default {
295 272
            validator: function(rule, value, callback) {
296 273
              if (isNaN(value)) {
297 274
                callback(rule.message)
298
              }else {
275
              } else {
299 276
                return true
300 277
              }
301 278
            }
@ -317,11 +294,13 @@ export default {
317 294
          {
318 295
            message: '设备名称重复',
319 296
            trigger: 'blur',
320
            validator: function(rule, value, callback) {
297
            t: this,
298
            validator: async function(rule, value, callback) {
321 299
              // TODO 判断编号重复
322
              if (false) {
300
              var x = await rule.t.checkReptition(3, value)
301
              if (x) {
323 302
                callback(rule.message)
324
              }else {
303
              } else {
325 304
                return true
326 305
              }
327 306
            }
@ -339,7 +318,7 @@ export default {
339 318
            validator: function(rule, value, callback) {
340 319
              if (isNaN(value)) {
341 320
                callback(rule.message)
342
              }else {
321
              } else {
343 322
                return true
344 323
              }
345 324
            }
@ -357,7 +336,7 @@ export default {
357 336
            validator: function(rule, value, callback) {
358 337
              if (isNaN(value)) {
359 338
                callback(rule.message)
360
              }else {
339
              } else {
361 340
                return true
362 341
              }
363 342
            }
@ -370,47 +349,6 @@ export default {
370 349
    this.getList(1, 10, '', '', '')
371 350
  },
372 351
  methods: {
373
374
    // $_onLoad(filterValue) {
375
    //   this.queryCondition.equipmentName = filterValue
376
    //   window.setTimeout(() => {
377
    //     var params = new FormData()
378
    //     params.append('data', JSON.stringify({
379
    //       params: {
380
    //         FACILITY_NAME: filterValue
381
    //       }
382
    //     }))
383
    //     this.$test.post(services.equipment.GET_EQUIPMENT, params
384
    //     ).then(res => {
385
    //       // 请求成功处理...
386
    //       let d = res.data.result.list.concat()
387
    //       this.searchResult = d
388
    //       this.currentLoading = false
389
    //     }).catch(res => {
390
    //       // 请求失败处理...
391
    //     })
392
    //   }, 1000)
393
    // },
394
    // $_onLoad_n(filterValue) {
395
    //   this.queryCondition.equipmentNumber = filterValue
396
    //   window.setTimeout(() => {
397
    //     var params = new FormData()
398
    //     params.append('data', JSON.stringify({
399
    //       params: {
400
    //         FACILITY_CODE: filterValue
401
    //       }
402
    //     }))
403
    //     this.$test.post(services.equipment.GET_EQUIPMENT, params
404
    //     ).then(res => {
405
    //       // 请求成功处理...
406
    //       let d = res.data.result.list.concat()
407
    //       this.searchResult_n = d
408
    //       this.currentLoading_n = false
409
    //     }).catch(res => {
410
    //       // 请求失败处理...
411
    //     })
412
    //   }, 1000)
413
    // },
414 352
    getList(pageNum, pageSize, type, name, number) {
415 353
      var params = new FormData()
416 354
      params.append('data', JSON.stringify({
@ -462,13 +400,36 @@ export default {
462 400
      this.onSearch()
463 401
    },
464 402
    onSearch() {
465
      console.log(this.queryCondition.equipmentType)
466
      console.log(this.queryCondition.equipmentName)
467 403
      this.getList(1, this.table.pager.size, this.queryCondition.equipmentType, this.queryCondition.equipmentName, this.queryCondition.equipmentNumber)
468 404
    },
469 405
    toExport() {
470 406
471 407
    },
408
    checkReptition(type, value) {
409
      var that = this
410
      return new Promise(function(resolve) {
411
        var params = new FormData()
412
        if (type === 1) {
413
          params.append('data', JSON.stringify({
414
            FACILITY_NAME: value
415
          }))
416
        } else if (type === 2) {
417
          params.append('data', JSON.stringify({
418
            FACILITY_CODE: value
419
          }))
420
        } else {
421
          params.append('data', JSON.stringify({
422
            FACILITY_NAME: value,
423
            FACILITY_ID: that.updateRow.FACILITY_ID
424
          }))
425
        }
426
        that.$test.post(services.equipment.REPETITION_EQUIPMENT, params
427
        ).then(res => {
428
          console.log(1)
429
          resolve(res.data.result)
430
        })
431
      })
432
    },
472 433
    onPagerChange(page) {
473 434
      this.getList(page, this.table.pager.size, '', '', '')
474 435
    },
@ -476,6 +437,8 @@ export default {
476 437
      this.getList(1, number, '', '', '')
477 438
    },
478 439
    cancel() {
440
      this.$refs['formValidate'].resetFields()
441
      this.$refs['updateRow'].resetFields()
479 442
      this.modal = false
480 443
      this.updateModal = false
481 444
      this.formValidate.type = ''