Kaynağa Gözat

解决上传管理器不能上传同名文件的问题

zhangyu 4 yıl önce
ebeveyn
işleme
adc746cdc5

+ 32 - 35
src/components/globaluploader/index.vue

@@ -81,6 +81,7 @@ export default {
         target: '/image-service/common/multipart_upload',
         target: '/image-service/common/multipart_upload',
         chunkSize: 1*1024*1024,
         chunkSize: 1*1024*1024,
         fileParameterName: 'file',
         fileParameterName: 'file',
+        allowDuplicateUploads: true, //允许重复上传
         maxChunkRetries: 3,
         maxChunkRetries: 3,
         testChunks: false,   //是否开启服务器分片校验
         testChunks: false,   //是否开启服务器分片校验
         // 服务器分片校验函数,秒传及断点续传基础
         // 服务器分片校验函数,秒传及断点续传基础
@@ -119,41 +120,37 @@ export default {
     });
     });
 
 
     Bus.$on('openUploader', (query, file) => {
     Bus.$on('openUploader', (query, file) => {
-      if(!this.uploaderList.some(item => {return item.name === file.name})){
-        if(query.uploadId){
-        // this.params = query || {};
-          file.uploadId = query.uploadId
-          file.modelId = query.modelId? query.modelId: ''
-          this.uploader.addFile(file)
-          this.setUploaderList(this.uploader.files.map(item => {
-            item.modelId = item.file.modelId?item.file.modelId:''
-            return item
-          }))
-        } else {
-          getUploadId({
-            systemId: query.systemId?query.systemId:'revit', 
-            secret: query.secret?query.secret:'63afbef6906c342b', 
-            overwrite: query.overwrite? query.overwrite: false,
-            key: file.name
-          }, res => {
-            if(res.UploadId){
-              // this.params = Object.assign(query, { uploadId: res.UploadId }) || {};
-              file = Object.assign(file, {
-                ...query,
-                uploadId: res.UploadId 
-              })
-              this.uploader.addFile(file)
-              this.setUploaderList(this.uploader.files.map(item => {
-                item.modelId = item.file.modelId?item.file.modelId:'';
-                return item
-              }))
-            } else {
-              this.$message.error(`请求分片上传接口失败!`);
-            }
-          })
-        }
-      }else {
-        this.$message.error(`该文件在上传列表中已存在!`);
+      if(query.uploadId){
+      // this.params = query || {};
+        file.uploadId = query.uploadId
+        file.modelId = query.modelId? query.modelId: ''
+        this.uploader.addFile(file)
+        this.setUploaderList(this.uploader.files.map(item => {
+          item.modelId = item.file.modelId?item.file.modelId:''
+          return item
+        }))
+      } else {
+        getUploadId({
+          systemId: query.systemId?query.systemId:'revit', 
+          secret: query.secret?query.secret:'63afbef6906c342b', 
+          overwrite: query.overwrite? query.overwrite: false,
+          key: file.name
+        }, res => {
+          if(res.UploadId){
+            // this.params = Object.assign(query, { uploadId: res.UploadId }) || {};
+            file = Object.assign(file, {
+              ...query,
+              uploadId: res.UploadId 
+            })
+            this.uploader.addFile(file)
+            this.setUploaderList(this.uploader.files.map(item => {
+              item.modelId = item.file.modelId?item.file.modelId:'';
+              return item
+            }))
+          } else {
+            this.$message.error(`请求分片上传接口失败!`);
+          }
+        })
       }
       }
 
 
       // if (this.$refs.uploadBtn) {
       // if (this.$refs.uploadBtn) {

+ 0 - 2
src/components/model/file/addFloorDialog.vue

@@ -137,8 +137,6 @@ export default {
       let FloorName = null;
       let FloorName = null;
       if (this.form.file == null) {
       if (this.form.file == null) {
         this.$message.error("模型文件不能为空!");
         this.$message.error("模型文件不能为空!");
-      } else if (this.uploaderList.some(item => {return item.name === this.form.file.name})) {
-        this.$message.error("该文件在上传列表中已存在!");
       } else {
       } else {
         let FloorName = null;
         let FloorName = null;
         // 根据是否有夹层拼接楼层名
         // 根据是否有夹层拼接楼层名

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

@@ -90,7 +90,7 @@ export default {
     },
     },
     // 替换日志
     // 替换日志
     repliaceModel(item) {
     repliaceModel(item) {
-      if (item.Status != 4 && item.Status != 21) {
+      if (item.Status != 4) {
         this.$alert("正在识别模型对象,请稍后再替换。", "替换模型", {
         this.$alert("正在识别模型对象,请稍后再替换。", "替换模型", {
           confirmButtonText: "确定",
           confirmButtonText: "确定",
           callback: action => {
           callback: action => {

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

@@ -94,7 +94,7 @@ export default {
      */
      */
     deleteModel(item) {
     deleteModel(item) {
       this.$confirm(
       this.$confirm(
-        "此操作只可删除楼层模型文件已经识别的对象及关系等,暂不可删除。确定删除?",
+        "此操作只可删除楼层模型文件已经识别的对象及关系等,暂不可删除。确定删除?",
         "提示",
         "提示",
         {
         {
           confirmButtonText: "确定",
           confirmButtonText: "确定",

+ 0 - 2
src/components/model/file/replaceModelDialog.vue

@@ -74,8 +74,6 @@ export default {
     onSubmit() {
     onSubmit() {
       if (this.form.file == null) {
       if (this.form.file == null) {
         this.$message.error("模型文件不能为空!");
         this.$message.error("模型文件不能为空!");
-      } else if (this.uploaderList.some(item => {return item.name === this.form.file.name})) {
-        this.$message.error("该文件在上传列表中已存在!");
       } else {
       } else {
         this.$emit("updataModel", {
         this.$emit("updataModel", {
           file: this.form.file,
           file: this.form.file,