Browse Source

代码提交

LAPTOP-16IUEB3P\Lenovo 3 years ago
parent
commit
cef8947933
1 changed files with 5 additions and 25 deletions
  1. 5 25
      src/components/addPatrolConfigDialog/index.vue

+ 5 - 25
src/components/addPatrolConfigDialog/index.vue

@@ -548,26 +548,22 @@
           categoryId: val,
           rootCategoryLevelId: this.rootId
         };
-        try {
           const res = await getAssetList(params);
           this.planRuleEquiList = res.list
-		  console.log(' this.planRuleEquiList', this.planRuleEquiList)
+		  if(!res.list.length) return
           this.planRuleEquiList.map((item) => {
             item.showName = item.name + '(' + item.code + ')'
           })
           this.currentEquItemIndex = 0
           const item = this.planRuleEquiList[0]
-          const equiLocation = this.getEquiLocation(item)
           this.$nextTick(() => {
             this.$refs.equiListTree.setCurrentKey(item.id)
             this.equipmentInfo = {
               equiCode: item.code,
               equiName: item.name,
               equiModel: item.category.modelType,
-              equiLocation: equiLocation
+              equiLocation: item.position[0].pathName
             }
-            this.planRuleEquiList[0]['equiLocation'] = equiLocation
-
             // 对比详情返回的数据和设备分类下面所有的设备列表,将sparePart同步过去
             if (this.addForm.deviceInfo) {
               for (let i = 0; i < this.planRuleEquiList.length; i++) {
@@ -590,10 +586,7 @@
                 }
               }
             }
-          });
-        } catch (error) {
-          this.planRuleEquiList = [];
-        }
+          })
       },
 
       // 获取审核人列表、巡点检人员
@@ -637,6 +630,7 @@
       async categoryEquipment(id) {
         const params = { categoryLevelId: id, pageNum: 1, size: -1 };
         const data = await getCategory(params);
+		// this.addForm.categoryId = '';
         this.equipmentList = data.list;
       },
 
@@ -652,34 +646,20 @@
         }
       },
 
-      // 封装 - 获取设备位置名称和code方法
-      getEquiLocation(data) {
-        // 设备位置名称
-        const path = data.position[0].path;
-        const arry = [];
-        path.map((item) => {
-          arry.push(item.name);
-        });
-        const equiLocation = arry.join('/');
-        return equiLocation;
-      },
       // 设备列表树点击
       handleNodeClick(data, node) {
-        const equiLocation = this.getEquiLocation(data);
         this.equipmentInfo = {
           equiCode: data.code,
           equiName: data.name,
           equiId: data.id,
           equiModel: data.category.modelType,
-          equiLocation: equiLocation
+          equiLocation: data.position[0].pathName
         };
         // 保存当前点击的设备列表某节点的index,在添加操作事项的时候,可以将事项list放到对应的节点对象中,以及切换节点的时候回显事项list
         this.currentEquItemIndex = this.planRuleEquiList.findIndex(
           (item) => item.code === data.code
         );
         this.clickedTreeNode = true;
-        this.planRuleEquiList[this.currentEquItemIndex]['equiLocation'] =
-          equiLocation;
       },
       // 获取规则名列表
       async _getRuleNameList() {