浏览代码

签章流程发起时附件上传问题

lizhenhao 2 年之前
父节点
当前提交
dcf9f0ec1f

+ 11 - 5
src/views/common/UpLoadComponent.vue

@@ -94,7 +94,8 @@
         delFlag: false,
         createBy: '',
         showDivider: true,
-        loading: false
+        loading: false,
+        dataListLength: ''
       }
     },
     watch: {
@@ -155,6 +156,11 @@
        */
       async newUpload (auth, fileList, directory, maxValue, dividerName, uploadFlag, delFlag, showDivider) {
         await this.fileLoadingFalse()
+        if (this.commonJS.isEmpty(fileList)) {
+          this.fileLoading = true
+        } else {
+          this.dataListLength = fileList.length
+        }
         if (this.commonJS.isEmpty(dividerName)) {
           this.dividerName = '附件'
         } else {
@@ -190,16 +196,13 @@
             this.delFlag = delFlag
           }
         }
-        if (this.commonJS.isEmpty(fileList)) {
-          this.fileLoading = true
-        }
         for await (let item of fileList) {
           await this.ossService.getFileSizeByUrl(item.url).then((data) => {
             item.lsUrl = data.data.url
             item.size = data.data.size
             this.dataList.push(item)
             this.dataListNew.push(item)
-            if (this.dataList.length === fileList.length) {
+            if (this.dataListNew.length === fileList.length) {
               this.fileLoading = true
             }
           })
@@ -339,6 +342,9 @@
         }
         if (this.fileLoading === false) {
           this.$message.warning('请等待附件加载完成再进行操作')
+          if (this.dataListLength === this.dataListNew.length) {
+            this.fileLoading = true
+          }
           return true
         }
         return false

+ 11 - 5
src/views/common/UpLoadComponentV2.1.vue

@@ -140,7 +140,8 @@
         sealType: '',
         remarks: '',
         showSign: false,
-        loading: false
+        loading: false,
+        dataListLength: ''
       }
     },
     watch: {
@@ -366,6 +367,11 @@
           }
         }
         await this.fileLoadingFalse()
+        if (this.commonJS.isEmpty(fileList)) {
+          this.fileLoading = true
+        } else {
+          this.dataListLength = fileList.length
+        }
         if (this.commonJS.isEmpty(dividerName)) {
           this.dividerName = '附件'
         } else {
@@ -401,9 +407,6 @@
             this.delFlag = delFlag
           }
         }
-        if (this.commonJS.isEmpty(fileList)) {
-          this.fileLoading = true
-        }
         for await (let item of fileList) {
           if (item.url) {
             await this.ossService.getFileSizeByUrl(item.url).then((data) => {
@@ -411,7 +414,7 @@
               item.size = data.data.size
               this.dataList.push(item)
               this.dataListNew.push(item)
-              if (this.dataList.length === fileList.length) {
+              if (this.dataListNew.length === fileList.length) {
                 this.fileLoading = true
               }
             })
@@ -571,6 +574,9 @@
         }
         if (this.fileLoading === false) {
           this.$message.warning('请等待附件加载完成再进行操作')
+          if (this.dataListLength === this.dataListNew.length) {
+            this.fileLoading = true
+          }
           return true
         }
         return false

+ 78 - 73
src/views/modules/cw/reportManagement/ReportManagementSignatureForm.vue

@@ -950,88 +950,93 @@
       },
       startFormTrue (callback) {
         this.loading = true
-        let title = `发起流程【会计-报告签章-电子公章】`
-        let describe = `[会计-报告签章-电子公章`
-        // 读取流程表单
-        if (this.inputForm.signatureType) {
-          if (this.inputForm.signatureType === '1') {
-            this.processService.getByName('会计-报告签章-电子公章').then(({data}) => {
-              if (!this.commonJS.isEmpty(data.id)) {
-                this.inputForm.procDefId = data.id
-                this.inputForm.procDefKey = data.key
-              }
-            })
-            title = `发起流程【会计-报告签章-电子公章】`
-            describe = `[会计-报告签章-电子公章]`
-          } else if (this.inputForm.signatureType === '2') {
-            this.processService.getByName('财务-报告签章-公章+执业章').then(({data}) => {
-              if (!this.commonJS.isEmpty(data.id)) {
-                this.inputForm.procDefId = data.id
-                this.inputForm.procDefKey = data.key
-              }
-            })
-            title = `发起流程【会计-报告签章-电子公章+执业章】`
-            describe = `[会计-报告签章-电子公章+执业章]`
-          } else if (this.inputForm.signatureType === '3') {
-            this.processService.getByName('会计-报告签章-实体公章').then(({data}) => {
-              if (!this.commonJS.isEmpty(data.id)) {
-                this.inputForm.procDefId = data.id
-                this.inputForm.procDefKey = data.key
-              }
-            })
-            title = `发起流程【会计-报告签章-实体公章】`
-            describe = `[会计-报告签章-实体公章]`
+        if (this.$refs.archiveFile.checkProgress()) {
+          this.loading = false
+          throw new Error()
+        } else {
+          let title = `发起流程【会计-报告签章-电子公章】`
+          let describe = `[会计-报告签章-电子公章`
+          // 读取流程表单
+          if (this.inputForm.signatureType) {
+            if (this.inputForm.signatureType === '1') {
+              this.processService.getByName('会计-报告签章-电子公章').then(({data}) => {
+                if (!this.commonJS.isEmpty(data.id)) {
+                  this.inputForm.procDefId = data.id
+                  this.inputForm.procDefKey = data.key
+                }
+              })
+              title = `发起流程【会计-报告签章-电子公章】`
+              describe = `[会计-报告签章-电子公章]`
+            } else if (this.inputForm.signatureType === '2') {
+              this.processService.getByName('财务-报告签章-公章+执业章').then(({data}) => {
+                if (!this.commonJS.isEmpty(data.id)) {
+                  this.inputForm.procDefId = data.id
+                  this.inputForm.procDefKey = data.key
+                }
+              })
+              title = `发起流程【会计-报告签章-电子公章+执业章】`
+              describe = `[会计-报告签章-电子公章+执业章]`
+            } else if (this.inputForm.signatureType === '3') {
+              this.processService.getByName('会计-报告签章-实体公章').then(({data}) => {
+                if (!this.commonJS.isEmpty(data.id)) {
+                  this.inputForm.procDefId = data.id
+                  this.inputForm.procDefKey = data.key
+                }
+              })
+              title = `发起流程【会计-报告签章-实体公章】`
+              describe = `[会计-报告签章-实体公章]`
+            }
           }
-        }
-        let processTitle = `${this.userName} 发起了 ${this.inputForm.reportNo} - ${this.inputForm.projectName} ` + describe
-        this.inputForm.formTitle = title
-        this.inputForm.title = processTitle
+          let processTitle = `${this.userName} 发起了 ${this.inputForm.reportNo} - ${this.inputForm.projectName} ` + describe
+          this.inputForm.formTitle = title
+          this.inputForm.title = processTitle
 
-        this.$refs['inputForm'].validate((valid) => {
-          if (valid) {
-            this.loading = true
-            this.$refs.archiveFile.getDataList().then((list) => {
-              if (this.commonJS.isNotEmpty(list)) {
-                list.forEach((item, index) => {
-                  if (this.commonJS.isEmpty(item.fileType)) {
-                    this.loading = false
-                    this.$message.error('第' + (index + 1) + '条附件信息没有填写文件类型')
-                    this.loading = false
-                    throw new Error('第' + (index + 1) + '条附件信息没有填写文件类型')
-                  }
-                  if (this.commonJS.isEmpty(item.sealType)) {
-                    this.loading = false
-                    this.$message.error('第' + (index + 1) + '条附件信息没有填写盖章类型')
-                    this.loading = false
-                    throw new Error('第' + (index + 1) + '条附件信息没有填写盖章类型')
-                  }
-                })
-              }
-              this.inputForm.cwFileInfoList = list
-              this.reportReviewService.save(this.inputForm).then(() => {
-                let da = {cwFileInfoList: this.inputForm.cwFileInfoList, id: this.inputForm.id}
-                this.projectReportService.saveSignFiles(da).then(() => {
-                  this.projectReportService.saveData(this.inputForm).then(({data}) => {
-                    if (this.inputForm.signatureType === '2') {
-                      this.inputForm.assignee = this.inputForm.signatureAnnotator1
+          this.$refs['inputForm'].validate((valid) => {
+            if (valid) {
+              this.loading = true
+              this.$refs.archiveFile.getDataList().then((list) => {
+                if (this.commonJS.isNotEmpty(list)) {
+                  list.forEach((item, index) => {
+                    if (this.commonJS.isEmpty(item.fileType)) {
+                      this.loading = false
+                      this.$message.error('第' + (index + 1) + '条附件信息没有填写文件类型')
+                      this.loading = false
+                      throw new Error('第' + (index + 1) + '条附件信息没有填写文件类型')
                     }
-                    callback(data.businessTable, data.businessId, this.inputForm)
-                    this.loading = false
-                    throw new Error()
+                    if (this.commonJS.isEmpty(item.sealType)) {
+                      this.loading = false
+                      this.$message.error('第' + (index + 1) + '条附件信息没有填写盖章类型')
+                      this.loading = false
+                      throw new Error('第' + (index + 1) + '条附件信息没有填写盖章类型')
+                    }
+                  })
+                }
+                this.inputForm.cwFileInfoList = list
+                this.reportReviewService.save(this.inputForm).then(() => {
+                  let da = {cwFileInfoList: this.inputForm.cwFileInfoList, id: this.inputForm.id}
+                  this.projectReportService.saveSignFiles(da).then(() => {
+                    this.projectReportService.saveData(this.inputForm).then(({data}) => {
+                      if (this.inputForm.signatureType === '2') {
+                        this.inputForm.assignee = this.inputForm.signatureAnnotator1
+                      }
+                      callback(data.businessTable, data.businessId, this.inputForm)
+                      this.loading = false
+                      throw new Error()
+                    }).catch(() => {
+                      this.loading = false
+                      throw new Error('流程发起失败')
+                    })
                   }).catch(() => {
                     this.loading = false
                     throw new Error('流程发起失败')
                   })
-                }).catch(() => {
-                  this.loading = false
-                  throw new Error('流程发起失败')
                 })
               })
-            })
-          } else {
-            this.loading = false
-          }
-        })
+            } else {
+              this.loading = false
+            }
+          })
+        }
       },
       reapplyForm (callback) {
         this.loading = true