Przeglądaj źródła

调试替换模型

YaolongHan 5 lat temu
rodzic
commit
6fbd24a0c5
2 zmienionych plików z 24 dodań i 12 usunięć
  1. 1 1
      src/api/model/file.js
  2. 23 11
      src/views/model/file/index.vue

+ 1 - 1
src/api/model/file.js

@@ -214,7 +214,7 @@ let api = {
             data: payload
         }).then(res => {
             callback2(res);
-        }).then(error => {
+        }).catch(error => {
             console.log('this is a catch')
             console.log(error)
         })

+ 23 - 11
src/views/model/file/index.vue

@@ -240,7 +240,7 @@ export default {
       return new Promise((resolve, reject) => {
         request.queryFloorList(data, res => {
           res.Content.map(item => {
-            Object.assign(item, { isDown: false, precent: 0 });
+            Object.assign(item, { isDown:false, precent: 0 });
           });
           this.tableData = res.Content;
           this.loading = false;
@@ -273,6 +273,7 @@ export default {
     },
     // 上传模型文件
     uploadModelFIle(data) {
+      
       // 在列表中添加
       this.ceshiList.push({
         Id: data.FloorModelId,
@@ -318,8 +319,9 @@ export default {
               });
             });
           },
-          res => {
-            if (res.code === "200") {
+          (val) => {
+            if (val.Result.Result === "success") {
+              this.ceshiList = [];
               this.$message({
                 message: "文件上传成功",
                 type: "success"
@@ -331,6 +333,10 @@ export default {
     },
     //更新模型文件;
     updateModelFile(data) {
+        this.ceshiList.push({
+          Id:data.FloorModelId,
+          precent:0
+        })
       // 修改isdown得值
       this.tableData.map(item => {
         if (item.Id == data.FloorModelId) {
@@ -348,17 +354,23 @@ export default {
             total = res.total; //文件大小
           this.$nextTick(() => {
             let precent = Math.round((loaded / total) * 100);
-            this.$refs.floorTable.filterTag(data.FloorModelId, precent);
+            // this.$refs.floorTable.filterTag(data.FloorModelId, precent);
+             this.ceshiList.map(item => {
+                if (item.Id == data.FloorModelId) {
+                     item.precent = precent
+                }
+              });
           });
         },
-        res => {
-          if (res.code === "200") {
-            this.$message({
-              message: "文件上传成功",
-              type: "success"
-            });
+         (val) => {
+            if (val.Result.Result === "success") {
+              this.ceshiList = [];
+              this.$message({
+                message: "文件上传成功",
+                type: "success"
+              });
+            }
           }
-        }
       );
     },
     //查看模型日志