Browse Source

bug 修复

lilei 4 năm trước cách đây
mục cha
commit
cce61f2457
1 tập tin đã thay đổi với 8 bổ sung20 xóa
  1. 8 20
      src/views/equipmentManage/network/equipmentModal.vue

+ 8 - 20
src/views/equipmentManage/network/equipmentModal.vue

@@ -14,7 +14,7 @@
         id="equipment-search"
         class="search-s"
         allow-clear
-        placeholder="请通过设备编号搜索"
+        placeholder="请通过设备编号或MAC地址搜索"
         enter-button="查询"
         size="large"
         v-model="searchVal"
@@ -51,7 +51,7 @@
         :pagination="false">
         <!-- 设备状态 -->
         <template slot="onlineFlag" slot-scope="record">
-			<span :style="{'color':(record.onlineFlag==0 ? 'red' : record.onlineFlag==1 ? 'green' : '')}">{{ record.onlineFlag == 0 ? '离线' : record.onlineFlag == 1 ? '在线' :'--'  }}</span>
+          <span :style="{'color':(record.onlineFlag==0 ? 'red' : record.onlineFlag==1 ? 'green' : '')}">{{ record.onlineFlag == 0 ? '离线' : record.onlineFlag == 1 ? '在线' :'--' }}</span>
         </template>
         <!-- 箱体类型 -->
         <template slot="type" slot-scope="record">
@@ -73,11 +73,11 @@
             checkedChildren="启用"
             unCheckedChildren="禁用"
             id="equipment-changeFlagHandle"
-			v-if="record.state && record.deviceType!='STEELYARD'"
+            v-if="record.state && record.deviceType!='STEELYARD'"
             v-model="record.state == 1 ? true : false"
             @change="changeFlagHandle(record)"
           />
-		  <span v-else>--</span>
+          <span v-else>--</span>
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="record">
@@ -125,7 +125,7 @@ export default {
         { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
         { title: '设备编号', dataIndex: 'srcDeviceCode', width: 100, align: 'center' },
         { title: '设备状态', scopedSlots: { customRender: 'onlineFlag' }, width: 150, align: 'center' },
-		{ title: '设备类型', dataIndex:'deviceTypeDictValue', width: 150, align: 'center' },
+        { title: '设备类型', dataIndex: 'deviceTypeDictValue', width: 150, align: 'center' },
         { title: '箱体类型', scopedSlots: { customRender: 'type' }, width: 150, align: 'center' },
         { title: '工作状态', scopedSlots: { customRender: 'workStatus' }, width: 150, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center' }
@@ -140,12 +140,11 @@ export default {
     getDevice () {
       deviceListQuery({ stationNo: this.networkNo }).then(res => {
         if (res.status == 200) {
-          res.data.map((item, index) => {
-            item.no = index + 1
-          })
           this.equipmentData = res.data
           this.equipmentData.map((item, index) => {
-            item.deviceTypeList = this.setDeviceType(item.boxNum)
+            item.no = index + 1
+            //  处理每个设备所对应的箱体类型
+            item.deviceTypeList = this.typeList.filter(tk => !item.boxNum || tk.boxNum == item.boxNum)
           })
         } else {
           this.equipmentData = []
@@ -164,17 +163,6 @@ export default {
         this.getDevice()
       })
     },
-    //  处理每个设备所对应的箱体类型
-    setDeviceType (boxNum) {
-      const arr = []
-      let j = 0
-      for (const i in this.typeList) {
-        if (this.typeList[i].boxNum == boxNum) {
-          arr[j++] = this.typeList[i]
-        }
-      }
-      return arr
-    },
     //  搜索设备
     onSearch (value) {
       if (value) {