Browse Source

调试上传管理器

zhangyu 5 years ago
parent
commit
1ca9a52f19

+ 2 - 2
config/index.js

@@ -89,8 +89,8 @@ module.exports = {
                 changeOrigin: false
             },
             '/modelapi': {
-                // target: 'http://192.168.20.225:8082',
-                target: 'http://192.168.20.218:8082',//景灏
+                target: 'http://192.168.20.225:8082',
+                // target: 'http://192.168.20.218:8082',//景灏
                 changeOrigin: true,
                 pathRewrite: {
                     "^/modelapi": "/"

+ 148 - 138
src/api/model/file.js

@@ -102,87 +102,87 @@ let api = {
         return httputils.postJson(`${baseUrl}/model-floor/query`, params, success)
     },
     // 创建楼层
-    createFloor(params) {
-        // 判断该楼层是否存在
+    // createFloor(params) {
+    //     // 判断该楼层是否存在
 
-        let data = {
-            Content: [{
-                FolderId: params.FolderId,
-                FloorName: params.FloorName,
-                ProjectId: params.ProjectId,      //项目id
-            }]
-        };
-        return new Promise((resolve, preject) => {
-            this.queryFloorItem(params, (res) => {
-                if (res.Total == 0) {
-                    // 创建楼层
-                    httputils.postJson(`${baseUrl}/model-floor/create`, data, (res) => {
-                        let modelFile = {
-                            Content: [{
-                                // ProjectId: params.ProjectId,      //项目id
-                                FloorModelId: res.EntityList[0].Id, //模型所属楼层(FloorModel外键)
-                                ModelName: params.Form.file.name,        //模型文件名
-                                UserName: params.userName,
-                                UserId: params.userId,
-                                Note: params.Form.desc
-                                // ReplaceReason: 0
-                            }]
-                        }
-                        //创建模型文件
-                        this.createModelFile(modelFile, (createModelRes) => {
-                            // 与此楼文件进行绑定
-                            let upDateModelData = {
-                                Content: [{
-                                    Id: res.EntityList[0].Id, //id
-                                    CurrentModelId: createModelRes.EntityList[0].Id //该楼层当前的模型id
-                                }]
-                            }
-                            this.updateFloorName(upDateModelData, (upDateModelSucess) => {
-                                if (upDateModelSucess.Result == "success") {
-                                    resolve({
-                                        Result: 'success',
-                                        FloorModelId: res.EntityList[0].Id,   //楼层模型文件
-                                        CurrentModelId: createModelRes.EntityList[0].Id //模型文件id
-                                    })
-                                }
-                            })
-                        })
-                    })
-                } else {
-                    let modelFile = {
-                        Content: [{
-                            // ProjectId: params.ProjectId,      //项目id
-                            FloorModelId: res.Content[0].Id, //模型所属楼层(FloorModel外键)
-                            ModelName: params.Form.file.name,        //模型文件名
-                            UserName: params.userName,
-                            UserId: params.userId,
-                            Note: params.Form.desc
-                            // ReplaceReason: 0
-                        }]
-                    }
-                    //创建模型文件
-                    this.createModelFile(modelFile, (createModelRes) => {
-                        // 与此楼文件进行绑定
-                        let upDateModelData = {
-                            Content: [{
-                                Id: res.Content[0].Id, //id
-                                CurrentModelId: createModelRes.EntityList[0].Id //该楼层当前的模型id
-                            }]
-                        }
-                        this.updateFloorName(upDateModelData, (upDateModelSucess) => {
-                            if (upDateModelSucess.Result == "success") {
-                                resolve({
-                                    Result: 'success',
-                                    FloorModelId: res.Content[0].Id,   //楼层模型文件
-                                    CurrentModelId: createModelRes.EntityList[0].Id //模型文件id
-                                })
-                            }
-                        })
-                    })
-                }
-            })
-        })
-    },
+    //     let data = {
+    //         Content: [{
+    //             FolderId: params.FolderId,
+    //             FloorName: params.FloorName,
+    //             ProjectId: params.ProjectId,      //项目id
+    //         }]
+    //     };
+    //     return new Promise((resolve, preject) => {
+    //         this.queryFloorItem(params, (res) => {
+    //             if (res.Total == 0) {
+    //                 // 创建楼层
+    //                 httputils.postJson(`${baseUrl}/model-floor/create`, data, (res) => {
+    //                     let modelFile = {
+    //                         Content: [{
+    //                             // ProjectId: params.ProjectId,      //项目id
+    //                             FloorModelId: res.EntityList[0].Id, //模型所属楼层(FloorModel外键)
+    //                             ModelName: params.Form.file.name,        //模型文件名
+    //                             UserName: params.userName,
+    //                             UserId: params.userId,
+    //                             Note: params.Form.desc
+    //                             // ReplaceReason: 0
+    //                         }]
+    //                     }
+    //                     //创建模型文件
+    //                     this.createModelFile(modelFile, (createModelRes) => {
+    //                         // 与此楼文件进行绑定
+    //                         let upDateModelData = {
+    //                             Content: [{
+    //                                 Id: res.EntityList[0].Id, //id
+    //                                 CurrentModelId: createModelRes.EntityList[0].Id //该楼层当前的模型id
+    //                             }]
+    //                         }
+    //                         this.updateFloorName(upDateModelData, (upDateModelSucess) => {
+    //                             if (upDateModelSucess.Result == "success") {
+    //                                 resolve({
+    //                                     Result: 'success',
+    //                                     FloorModelId: res.EntityList[0].Id,   //楼层模型文件
+    //                                     CurrentModelId: createModelRes.EntityList[0].Id //模型文件id
+    //                                 })
+    //                             }
+    //                         })
+    //                     })
+    //                 })
+    //             } else {
+    //                 let modelFile = {
+    //                     Content: [{
+    //                         // ProjectId: params.ProjectId,      //项目id
+    //                         FloorModelId: res.Content[0].Id, //模型所属楼层(FloorModel外键)
+    //                         ModelName: params.Form.file.name,        //模型文件名
+    //                         UserName: params.userName,
+    //                         UserId: params.userId,
+    //                         Note: params.Form.desc
+    //                         // ReplaceReason: 0
+    //                     }]
+    //                 }
+    //                 //创建模型文件
+    //                 this.createModelFile(modelFile, (createModelRes) => {
+    //                     // 与此楼文件进行绑定
+    //                     let upDateModelData = {
+    //                         Content: [{
+    //                             Id: res.Content[0].Id, //id
+    //                             CurrentModelId: createModelRes.EntityList[0].Id //该楼层当前的模型id
+    //                         }]
+    //                     }
+    //                     this.updateFloorName(upDateModelData, (upDateModelSucess) => {
+    //                         if (upDateModelSucess.Result == "success") {
+    //                             resolve({
+    //                                 Result: 'success',
+    //                                 FloorModelId: res.Content[0].Id,   //楼层模型文件
+    //                                 CurrentModelId: createModelRes.EntityList[0].Id //模型文件id
+    //                             })
+    //                         }
+    //                     })
+    //                 })
+    //             }
+    //         })
+    //     })
+    // },
     // 删除楼层文件
     deleteFloor(data) {
         return httputils.postJson(`${baseUrl}/model-floor/delete`, data)
@@ -223,67 +223,77 @@ let api = {
         return httputils.postJson(`${baseUrl}/model-file/query`, params, success)
     },
     // 上传模型文件
-    uploadModelFile(payload, ProjectId,callback1, callback2) {
-        axios({
-            url: baseUrl + '/model-file/upload',
-            method: 'post',
-            headers: {
-                ProjectId: ProjectId
-            },
-            onUploadProgress: function (progressEvent) { //原生获取上传进度的事件
-                if (progressEvent.lengthComputable) {
-                    //属性lengthComputable主要表明总共需要完成的工作量和已经完成的工作是否可以被测量
-                    //如果lengthComputable为false,就获取不到progressEvent.total和progressEvent.loaded
-                    callback1(progressEvent);
-                }
-            },
-            data: payload
-        }).then(res => {
-            callback2(res);
-        }).catch(error => {
-            console.log('this is a catch')
-            console.log(error)
-        })
+    // uploadModelFile(payload, ProjectId,callback1, callback2) {
+    //     axios({
+    //         url: baseUrl + '/model-file/upload',
+    //         method: 'post',
+    //         headers: {
+    //             ProjectId: ProjectId
+    //         },
+    //         onUploadProgress: function (progressEvent) { //原生获取上传进度的事件
+    //             if (progressEvent.lengthComputable) {
+    //                 //属性lengthComputable主要表明总共需要完成的工作量和已经完成的工作是否可以被测量
+    //                 //如果lengthComputable为false,就获取不到progressEvent.total和progressEvent.loaded
+    //                 callback1(progressEvent);
+    //             }
+    //         },
+    //         data: payload
+    //     }).then(res => {
+    //         callback2(res);
+    //     }).catch(error => {
+    //         console.log('this is a catch')
+    //         console.log(error)
+    //     })
+    // },
+
+    //准备分片上传模型文件接口
+    modelFileUpload(data, success) {
+        return httputils.postJson(`${baseUrl}/model-file/upload`, data, success)
     },
-    // 更新模型文件
-    upDateModelFile(data, ProjectId, UserName, UserId, callback1, callback2) {
-        let modelFile = {
-            Content: [{
-                FloorModelId:data.replaceModelItem.Id, //模型id
-                ModelName: data.Form.file.name,        //模型名字
-                UserName: UserName,
-                UserId: UserId,
-                Note: data.replaceModelItem.Note,
-                ReplaceReason: data.Form.ReplaceReason
-            }]
-        }
-        // //创建模型文件
-        this.createModelFile(modelFile, (createModelRes) => {
-            // 与此楼文件进行绑定
-            let upDateModelData = {
-                Content: [{
-                    Id:data.replaceModelItem.Id, //楼层
-                    CurrentModelId: createModelRes.EntityList[0].Id
-                }]
-            }
-            this.updateFloorName(upDateModelData, (upDateModelSucess) => {
-                if (upDateModelSucess.Result == "success") {
-                    // 处理数据
-                    let formData = new FormData();
-                    formData.append(
-                      "model",
-                      JSON.stringify({
-                        FloorModelId: data.replaceModelItem.Id,
-                        Id:createModelRes.EntityList[0].Id
-                      })
-                    );
-                    formData.append("file", data.Form.file.raw);
-                    this.uploadModelFile(formData,ProjectId,callback1,callback2)
-                }
-            })
-        })
+
+    mergeModelFile(data, success) {
+        return httputils.postJson(`${baseUrl}/model-file/merge`, data, success)
     }
 
+    // 更新模型文件
+    // upDateModelFile(data, ProjectId, UserName, UserId, callback1, callback2) {
+    //     let modelFile = {
+    //         Content: [{
+    //             FloorModelId:data.replaceModelItem.Id, //模型id
+    //             ModelName: data.Form.file.name,        //模型名字
+    //             UserName: UserName,
+    //             UserId: UserId,
+    //             Note: data.replaceModelItem.Note,
+    //             ReplaceReason: data.Form.ReplaceReason
+    //         }]
+    //     }
+    //     // //创建模型文件
+    //     this.createModelFile(modelFile, (createModelRes) => {
+    //         // 与此楼文件进行绑定
+    //         let upDateModelData = {
+    //             Content: [{
+    //                 Id:data.replaceModelItem.Id, //楼层
+    //                 CurrentModelId: createModelRes.EntityList[0].Id
+    //             }]
+    //         }
+    //         this.updateFloorName(upDateModelData, (upDateModelSucess) => {
+    //             if (upDateModelSucess.Result == "success") {
+    //                 // 处理数据
+    //                 let formData = new FormData();
+    //                 formData.append(
+    //                   "model",
+    //                   JSON.stringify({
+    //                     FloorModelId: data.replaceModelItem.Id,
+    //                     Id:createModelRes.EntityList[0].Id
+    //                   })
+    //                 );
+    //                 formData.append("file", data.Form.file.raw);
+    //                 this.uploadModelFile(formData,ProjectId,callback1,callback2)
+    //             }
+    //         })
+    //     })
+    // }
+
 }
 export default api
 

+ 23 - 11
src/components/globaluploader/index.vue

@@ -2,7 +2,7 @@
  * @Author: zhangyu
  * @Date: 2019-11-28 10:05:28
  * @Info: 
- * @LastEditTime: 2019-11-29 19:22:55
+ * @LastEditTime: 2019-11-30 18:28:18
  -->
 <template>
   <div id="global-uploader">
@@ -62,6 +62,7 @@
 import Bus from '@/utils/bus.js';
 import SparkMD5 from 'spark-md5';
 import { getUploadId, mergeMultipart } from '@/api/uploader';
+import request from "@/api/model/file.js";
 
 export default {
   data() {
@@ -98,6 +99,7 @@ export default {
       if(query.uploadId){
         // this.params = query || {};
         file.uploadId = query.uploadId
+        file.modelId = query.modelId? query.modelId: ''
         this.uploader.addFile(file)
       } else {
         getUploadId({
@@ -157,16 +159,25 @@ export default {
       if (parseInt(res.TotalCount) >= file.chunks.length) {
         // 文件状态设为“合并中”
         this.statusSet(file.id, 'merging');
-        mergeMultipart({
-          systemId: file.file.systemId?file.file.systemId:'revit', 
-          secret: file.file.secret?file.file.secret:'63afbef6906c342b', 
-          uploadId: file.file.uploadId
-        }, res => {
-          // 文件合并成功
-          Bus.$emit('fileSuccess');
-
-          this.statusRemove(file.id);
-        })
+        if(file.file.modelId){
+          //模型文件合并专用接口
+          request.mergeModelFile({ ModelId: file.file.modelId, UploadId: file.file.uploadId }, res => {
+            Bus.$emit('modelStatusChange')
+            // 文件合并成功
+            Bus.$emit('fileSuccess');
+            this.statusRemove(file.id);
+          })
+        } else {
+          mergeMultipart({
+            systemId: file.file.systemId?file.file.systemId:'revit', 
+            secret: file.file.secret?file.file.secret:'63afbef6906c342b', 
+            uploadId: file.file.uploadId
+          }, res => {
+            // 文件合并成功
+            Bus.$emit('fileSuccess');
+            this.statusRemove(file.id);
+          })
+        }
 
       // 不需要合并
       } else {
@@ -286,6 +297,7 @@ export default {
               if (action == "confirm") {
                 this.uploader.cancel();
                 this.panelShow = false;
+                Bus.$emit('modelStatusChange')
               } else { }
             }
           }

+ 17 - 21
src/components/model/file/addFloorDialog.vue

@@ -66,7 +66,6 @@
         <el-form-item>
           <el-button type="primary" @click="onSubmit">确认</el-button>
           <el-button @click="handleClose">取消</el-button>
-          <el-button @click="addDemo">测试上传按钮</el-button>
         </el-form-item>
       </el-form>
     </el-dialog>
@@ -75,7 +74,6 @@
 <script>
 import request from "@/api/model/file.js";
 import { mapGetters } from "vuex";
-import Bus from '@/utils/bus.js'
 export default {
   props: {
     addFloorFileVisible: Boolean,
@@ -135,9 +133,6 @@ export default {
     };
   },
   methods: {
-    addDemo(){
-      Bus.$emit('openUploader', {}, this.form.file.raw)
-    },
     onSubmit() {
       let FloorName = null;
       if (this.form.file == null) {
@@ -163,24 +158,25 @@ export default {
           this.$message.error('该楼层名称已存在,请勿重复创建!');
         } else {
           let data = {
-            ProjectId: this.projectId,
-            FolderId: this.FolderId,
+            FileName: this.form.file.name,
             FloorName: FloorName,
-            Form: this.form,
-            userName: this.userInfo.userName,
-            userId: this.userInfo.userId
+            FolderId: this.FolderId,
+            Note: this.form.desc,
+            ProjectId: this.projectId,
+            ReplaceReason: null,
+            Size: this.form.file.size,
+            UserName: this.userInfo.userName,
+            UserId: this.userInfo.userId
           };
-          request.createFloor(data).then(res => {
-            if (res.Result == "success") {
-              //  创建成功
-              this.$emit("finishCreateFloor", {
-                FloorModelId: res.FloorModelId,
-                CurrentModelId:res.CurrentModelId,
-                Form: this.form
-              });
-              this.handleClose();
-              // this.submitUpload(res.FloorModelId);
-            }
+          request.modelFileUpload(data, res => {
+            //  创建成功
+            this.$emit("finishCreateFloor", {
+              modelId: res.ModelId,
+              uploadId: res.UploadId,
+              floorId: res.floorId, 
+              file: this.form.file
+            });
+            this.handleClose();
           });
         }
       }

+ 0 - 7
src/components/model/file/floorTable.vue

@@ -28,13 +28,6 @@
                 :color="scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11?'#909399':'#67C23A'"></el-progress>
             </div>
             <div class="progress-right">
-              <!-- <el-button
-              v-show="!scope.row.Status"
-              type="danger"
-              class="iconfont icon-termination"
-              @click="closeUpdate(scope.row)"
-              circle
-            ></el-button>-->
               <span v-show="!scope.row.Status && scope.row.precent == 100">上传中</span>
               <span v-show="scope.row.Status == 1">等待检查...</span>
               <span v-show="scope.row.Status == 10">模型检查中</span>

+ 1 - 1
src/components/model/file/replaceModelDialog.vue

@@ -72,7 +72,7 @@ export default {
         this.$message.error("模型文件不能为空!");
       } else {
         this.$emit("updataModel", {
-          Form: this.form,
+          file: this.form.file,
           replaceModelItem: this.replaceModelItem
         });
         this.handleClose();

+ 51 - 257
src/views/model/file/index.vue

@@ -46,7 +46,7 @@
         </div>
         <!-- 列表 -->
         <floorTable ref="floorTable" :tableData="tableData" :modelFolderName="currentFolderName" @openModelLog="queryModelLog"
-          @replaceModel="repliaceModel" @closeUpdateFile="removePersentList" @percentFinish="queryFloorFile(currentFolderId)"
+          @replaceModel="repliaceModel" @percentFinish="queryFloorFile(currentFolderId)"
           :persentList="persentList"></floorTable>
       </el-card>
     </el-col>
@@ -82,29 +82,6 @@ import addFolder from "@/components/model/file/addFolder"; //新增文件夹
 import changeFolderName from "@/components/model/file/changeFolderName"; //编辑名字
 import floorTable from "@/components/model/file/floorTable"; //右侧list表
 export default {
-  // 离开此页面前要判断是是否有下载
-  beforeRouteLeave: function (to, from, next) {
-    console.log(this.uploadClassList);
-    if (this.uploadClassList.length) {
-      this.$alert(
-        "您有正在上传的模型文件,切换菜单会中断上传,是否继续?",
-        "提示",
-        {
-          confirmButtonText: "确定",
-          callback: action => {
-            console.log(action);
-            if (action == "confirm") {
-              next();
-            } else {
-              next(false);
-            }
-          }
-        }
-      );
-    } else {
-      next();
-    }
-  },
   computed: {
     ...mapGetters("layout", ["projectId", "userInfo", "userId", "secret"])
   },
@@ -147,29 +124,22 @@ export default {
         model: {}
       },
       persentList: [], //请求进度列表
-      uploadClassList: [], //请求list 用与缓存多个请求问题
       isJump: true //是否可以调整页面
     };
   },
   mounted() {
-  //   window.addEventListener('beforeunload', e => {
-  //     if (this.uploadClassList.length) {
-  //       window.localStorage.removeItem("当前页有下载内容,关闭或刷新页面下载将会失败。您确定要继续吗?")
-  //     }
-  //   })
-
-    // 文件选择后的回调
-    Bus.$on('fileAdded', () => {
-      console.log('文件已选择')
-    });
-    // 文件上传成功的回调
-    Bus.$on('fileSuccess', () => {
-      console.log('文件上传成功')
-    });
+    // // 文件选择后的回调
+    // Bus.$on('fileAdded', () => {
+    //   console.log('文件已选择')
+    // });
+    // // 文件上传成功的回调
+    // Bus.$on('fileSuccess', () => {
+    //   console.log('文件上传成功')
+    // });
   },
   destroyed() {
-    Bus.$off('fileAdded');
-    Bus.$off('fileSuccess');
+    // Bus.$off('fileAdded');
+    // Bus.$off('fileSuccess');
   },
   methods: {
     // 以下是模型文件夹
@@ -294,202 +264,54 @@ export default {
     },
     // 上传模型文件
     uploadModelFIle(data) {
+      Bus.$emit('openUploader', { 
+        uploadId: data.uploadId, 
+        modelId: data.modelId,
+        systemId: 'revit', //系统名称
+        secret: '63afbef6906c342b', //系统密码
+      }, data.file.raw)
       // 在列表中添加
       this.persentList.push({
-        Id: data.FloorModelId,
+        Id: data.floorId,
         precent: 0
       });
-      let uploadClass = this.uploadClass();
-      this.uploadClassList.push({
-        obj: new uploadClass(data),
-        Id: data.FloorModelId
-      });
-    },
-    // 上传文件的类
-    uploadClass() {
-      let that = this;
-      return class {
-        constructor(data) {
-          this.upload(data);
-        }
-        upload(data) {
-          that.queryFloorFile(that.currentFolderId).then(() => {
-            // 开始上传文件
-            // 开始处理数据
-            let formData = new FormData();
-            formData.append(
-              "model",
-              JSON.stringify({
-                FloorModelId: data.FloorModelId,
-                Id: data.CurrentModelId
-              })
-            );
-            formData.append("file", data.Form.file.raw);
-            // 处理数据结束
-
-            // 修改isdown得值
-            that.tableData.map(item => {
-              if (item.Id == data.FloorModelId) {
-                item.isDown = true;
-                item.precent = 0;
-              }
-            });
-
-            // 开始上传
-            request.uploadModelFile(
-              formData,
-              that.projectId,
-              res => {
-                let loaded = res.loaded, //加载量
-                  total = res.total; //文件大小
-                that.$nextTick(() => {
-                  let precent = Math.round((loaded / total) * 100);
-                  // this.$refs.floorTable.filterTag(data.FloorModelId, precent);
-                  if (that.persentList.length != 0) {
-                    that.persentList.map(item => {
-                      if (item.Id == data.FloorModelId) {
-                        item.precent = precent;
-                      }
-                    });
-                  }
-                });
-              },
-              val => {
-                if (val.data.Result === "success") {
-                  if (that.persentList.length != 0) {
-                    //深拷贝
-                    let persentListCopy = JSON.parse(JSON.stringify(that.persentList))
-                    persentListCopy.forEach((item, index) => {
-                      if (item.Id == data.FloorModelId) {
-                        // item.precent = 101;
-                        that.persentList.splice(index, 1);
-                        that.uploadClassList.splice(index, 1);
-                        return;
-                      }
-                    });
-                  }
-                  that.$message({ message: "文件上传成功", type: "success" });
-                  //  刷新list列表
-                  that.queryFloorFile(that.currentFolderId);
-                } else {
-                  if (that.persentList.length != 0) {
-                    //深拷贝
-                    let persentListCopy = JSON.parse(JSON.stringify(that.persentList))
-                    persentListCopy.forEach((item, index) => {
-                      if (item.Id == data.FloorModelId) {
-                        // item.precent = 101;
-                        that.persentList.splice(index, 1);
-                        that.uploadClassList.splice(index, 1);
-                        return;
-                      }
-                    });
-                  }
-                  that.$message({
-                    message: val.data.Message,
-                    type: "error"
-                  });
-                  //  刷新list列表
-                  that.queryFloorFile(that.currentFolderId);
-                }
-              }
-            );
-          });
-        }
-      };
+      this.queryFloorFile(this.currentFolderId);
     },
     //更新模型文件;
     updateModelFile(data) {
-      this.persentList.push({
-        Id: data.replaceModelItem.Id,
-        precent: 0
-      });
-      // 修改isdown得值
-      this.tableData.map(item => {
-        if (item.Id == data.replaceModelItem.Id) {
-          item.isDown = true;
-          item.precent = 0;
-        }
-      });
-      // 开始上传
-      let updataclass = this.updateModelClass();
-      this.uploadClassList.push({
-        obj: new updataclass(data),
-        Id: data.replaceModelItem.Id
-      });
-    },
-    // 更新文件的类
-    updateModelClass() {
-      let that = this;
-      // 开始上传
-      return class {
-        constructor(data) {
-          this.upDateModel(data);
-        }
-        upDateModel(data) {
-          request.upDateModelFile(
-            data,
-            that.projectId,
-            that.userInfo.userName,
-            that.userInfo.userId,
-            res => {
-              let loaded = res.loaded, //加载量
-                total = res.total; //文件大小
-              that.$nextTick(() => {
-                let precent = Math.round((loaded / total) * 100);
-                // this.$refs.floorTable.filterTag(data.FloorModelId, precent);
-                if (that.persentList.length != 0) {
-                  that.persentList.map(item => {
-                    if (item.Id == data.replaceModelItem.Id) {
-                      item.precent = precent;
-                    }
-                  });
-                }
-              });
-            },
-            val => {
-              if (val.data.Result === "success") {
-                if (that.persentList.length != 0) {
-                  //深拷贝
-                  let persentListCopy = JSON.parse(JSON.stringify(that.persentList))
-                  persentListCopy.forEach((item, index) => {
-                    if (item.Id == data.replaceModelItem.Id) {
-                      // item.precent = 101;
-                      that.persentList.splice(index, 1);
-                      that.uploadClassList.splice(index, 1);
-                      return;
-                    }
-                  });
-                }
-                that.$message({
-                  message: "文件上传成功",
-                  type: "success"
-                });
-                //  刷新list列表
-                that.queryFloorFile(that.currentFolderId);
-              } else {
-                if (that.persentList.length != 0) {
-                  //深拷贝
-                  let persentListCopy = JSON.parse(JSON.stringify(that.persentList))
-                  persentListCopy.forEach((item, index) => {
-                    if (item.Id == data.FloorModelId) {
-                      // item.precent = 101;
-                      that.persentList.splice(index, 1);
-                      that.uploadClassList.splice(index, 1);
-                      return;
-                    }
-                  });
-                }
-                that.$message({
-                  message: val.data.Message,
-                  type: "error"
-                });
-                //  刷新list列表
-                that.queryFloorFile(that.currentFolderId);
-              }
-            }
-          );
-        }
+      let params = {
+        FileName: data.file.name,
+        FloorName: data.replaceModelItem.FloorName,
+        FolderId: data.replaceModelItem.FolderId,
+        Note: data.replaceModelItem.Note,
+        ProjectId: this.projectId,
+        ReplaceReason: 0,
+        Size: data.file.size,
+        UserName: this.userInfo.userName,
+        UserId: this.userInfo.userId
       };
+      //  替换模型文件
+      request.modelFileUpload(params, res => {
+        //  上传
+        this.persentList.push({
+          Id: data.replaceModelItem.Id,
+          precent: 0
+        });
+        // 修改isdown得值
+        this.tableData.map(item => {
+          if (item.Id == data.replaceModelItem.Id) {
+            item.isDown = true;
+            item.precent = 0;
+          }
+        });
+        this.queryFloorFile(this.currentFolderId);
+        Bus.$emit('openUploader', { 
+          uploadId: res.uploadId, 
+          modelId: res.modelId,
+          systemId: 'revit', //系统名称
+          secret: '63afbef6906c342b', //系统密码
+        }, data.file.raw)
+      });
     },
     //查看模型日志
     queryModelLog(item) {
@@ -505,36 +327,8 @@ export default {
         this.logData = res.Content;
       });
     },
-    // 删除上传列表item
-    removePersentList(item) {
-      this.uploadClassList.forEach((i, index) => {
-        if (item.Id == i.Id) {
-          // this.$delete(this.uploadClassList, index);
-          this.uploadClassList.splice(index, 1);
-          return;
-        }
-      });
-      this.persentList.forEach((i, index) => {
-        if (item.Id == i.Id) {
-          this.$delete(this.persentList, index);
-          return;
-        }
-      });
-      this.$message({
-        message: "中止上传!",
-        type: "success"
-      });
-      //  刷新list列表
-      that.queryFloorFile(that.currentFolderId);
-    }
   },
   watch: {
-    uploadClassList: {
-      deep: true,
-      handler: function (val) {
-        console.log(val);
-      }
-    },
     projectId() {
       this.queryModel()
     }