Browse Source

Merge branch 'master' of git.sagacloud.cn:web/ibms

zhangyu 5 years ago
parent
commit
d576627d2c

+ 9 - 19
src/views/ledger/facility/parts/index.vue

@@ -197,13 +197,8 @@ export default {
         Filters: `type='Equipment' or type='${this.tabVal}'`
       };
       await getDataDictionary(params, res => {
-        let response = res;
-        if (response.Result == "success") {
-          this.tableHeader = response.Content;
-          this.getTableData();
-        } else {
-          this.$message.error("请求错误:" + response.Result);
-        }
+        this.tableHeader = res.Content;
+        this.getTableData();
       });
     },
     //获取表格数据
@@ -214,18 +209,13 @@ export default {
         Filters: `category='${this.tabVal}';parentId='${this.deviceId}'`
       };
       await getEquipPartsCon(params, res => {
-        let response = res;
-        if (response.Result) {
-          this.tableData = response.Content;
-          this.copyTableData = tools.deepCopy(response.Content);
-          this.page.pageNumber = response.PageNumber;
-          this.page.total = response.Total;
-          if (this.tableData && this.tableData.length) {
-            this.getBatch(response.Content);
-            this.initTable();
-          }
-        } else {
-          this.$message.error("请求错误:" + response.Result);
+        this.tableData = res.Content;
+        this.copyTableData = tools.deepCopy(res.Content);
+        this.page.pageNumber = res.PageNumber;
+        this.page.total = res.Total;
+        if (this.tableData && this.tableData.length) {
+          this.getBatch(res.Content);
+          this.initTable();
         }
       });
     },

+ 17 - 42
src/views/ledger/facility/partsmanage/addparts/index.vue

@@ -190,13 +190,8 @@ export default {
         Filters: `type='Equipment' or type='${this.category.Code}'`
       };
       await getDataDictionary(params, res => {
-        let response = res;
-        if (response.Result == "success") {
-          this.tableHeader = response.Content;
-          this.initTable();
-        } else {
-          this.$message.error("请求错误:" + response.Result);
-        }
+        this.tableHeader = res.Content;
+        this.initTable();
       });
     },
     // 创建部件数据
@@ -228,49 +223,29 @@ export default {
         this.$message.info("存在设备的本地名称为空,请检查")
         return;
       }
-      let params = { projectId: this.projectId }
 
       for (let i = 0; i < newData.length; i++) {
+        let params = { projectId: this.projectId }
         let data = {
           ParentId: this.category.deviceId, //当前设备id
           Category: this.category.Code //当前部件分类
         };
         params.data = Object.assign(data, newData[i]);
-        // await createPart(params).then(res => {
-        //   let response = res;
-        //   if(response.Result=='success'){
-        //     if(newData[i].Checked){//同时创建资产
-        //       params.data.EquipmentId = response.Id
-        //       createPropertyData(params);
-        //     }
-        //     if(i==newData.length-1){
-        //       this.$router.push({
-        //         path: "/ledger/partsmanage",
-        //         query: {
-        //           deviceId: this.category.deviceId,
-        //           typeId: this.category.ParentId
-        //         }
-        //       });
-        //       session.remove("partsAddData")
-        //     }
-        //   }
-        // });
         if(newData[i].Checked){//同时创建资产
-          await createPropertyData(params, res => {
-            let response = res;
-            params.data.PropertyId = response.Id;
-          })
-          await createPart(params, res=>{
-            if(i==newData.length-1){
-              this.$router.push({
-                path: "/ledger/partsmanage",
-                query: {
-                  deviceId: this.category.deviceId,
-                  typeId: this.category.ParentId
-                }
-              });
-              session.remove("partsAddData")
-            }
+          await createPropertyData(params, async res => {
+            params.data.PropertyId = res.Id
+            await createPart(params, res=>{
+              if(i==newData.length-1){
+                this.$router.push({
+                  path: "/ledger/partsmanage",
+                  query: {
+                    deviceId: this.category.deviceId,
+                    typeId: this.category.ParentId
+                  }
+                });
+                session.remove("partsAddData")
+              }
+            })
           })
         }else{
           await createPart(params, res=>{

+ 6 - 12
src/views/ledger/facility/partsmanage/index.vue

@@ -226,13 +226,8 @@ export default {
         Filters: `type='Equipment' or type='${this.tabVal}'`
       };
       await getDataDictionary(params, res => {
-        let response = res;
-        if (response.Result == "success") {
-          this.tableHeader = response.Content;
-          this.getTableData();
-        } else {
-          this.$message.error("请求错误:" + response.Result);
-        }
+        this.tableHeader = res.Content;
+        this.getTableData();
       });
     },
     //获取表格数据
@@ -243,11 +238,10 @@ export default {
         Filters: `category='${this.tabVal}';parentId='${this.deviceId}'`
       };
       await getEquipPartsCon(params, res => {
-        let response = res;
-        this.tableData = response.Content;
-        this.copyTableData = tools.deepCopy(response.Content);
-        this.page.pageNumber = response.PageNumber;
-        this.page.total = response.Total;
+        this.tableData = res.Content;
+        this.copyTableData = tools.deepCopy(res.Content);
+        this.page.pageNumber = res.PageNumber;
+        this.page.total = res.Total;
         if (this.tableData && this.tableData.length) {
           this.initTable();
         }