Jelajahi Sumber

报销发票上传调整至before进行校验,添加全局loading预防用户未完成上传就提交数据

huangguoce 2 minggu lalu
induk
melakukan
9edd239c8c

+ 26 - 14
src/views/ccpm/reimbursement/info/NewReimbursementForm.vue

@@ -113,7 +113,7 @@
         </el-row>
       </div>
 
-      <ReimbursementComponent ref="reimbursementComponent">
+      <ReimbursementComponent ref="reimbursementComponent" @changeLoading="handleChangeLoading">
       </ReimbursementComponent>
       <!-- 报销单图片预览 -->
       <ReimbursementImage ref="reimbursementImage"></ReimbursementImage>
@@ -315,6 +315,8 @@ export default {
       isConfirm: "",
       tableRef: null,
       tableData: [],
+      screenLoading: null
+
     }
   },
   provide() {
@@ -541,10 +543,10 @@ export default {
       this.$refs['inputForm'].validate((valid) => {
         if (valid) {
           this.loading = true
-          // if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-          //   this.loading = false
-          //   return
-          // }
+          if (this.$refs.reimbursementComponent.checkProgress()) {
+            this.loading = false
+            return
+          }
           if (this.$refs.uploadComponent.checkProgress()) {
             this.loading = false
             return
@@ -820,10 +822,10 @@ export default {
     // 暂存
     async saveForm(callback) {
       this.loading = true
-      // if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-      //   this.loading = false
-      //   return
-      // }
+      if (this.$refs.reimbursementComponent.checkProgress()) {
+        this.loading = false
+        return
+      }
       if (this.$refs.uploadComponent.checkProgress()) {
         this.loading = false
         return
@@ -860,6 +862,10 @@ export default {
     // 送审
     async startForm(callback) {
       this.getReimbursementData()
+      if (this.$refs.reimbursementComponent.checkProgress()) {
+        this.loading = false
+        throw new Error('请等待附件上传完成再进行操作')
+      }
       let title = `发起流程【项目-报销审批】`
       let describe = `[项目-报销审批]`
       if (this.inputForm.reimbursementType) {
@@ -972,11 +978,6 @@ export default {
           this.loading = true
           this.submitCheck()
           this.handleCheckAmount()
-
-          // if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-          //   this.loading = false
-          //   return
-          // }
           if (this.$refs.uploadComponent.checkProgress()) {
             this.loading = false
             return
@@ -2056,6 +2057,17 @@ export default {
     //报销单图片预览
     handleShowReimbursementImage() {
       this.$refs.reimbursementImage.visible = true
+    },
+    handleChangeLoading(status) {
+      if (status) {
+        this.screenLoading = this.$loading({
+          lock: true,
+          text: '数据处理中,请稍后...',
+          background: 'rgba(0, 0, 0, 0.7)',
+        })
+      } else {
+        this.screenLoading.close()
+      }
     }
   }
 }

+ 171 - 143
src/views/common/NewDigitalInvoiceUploadComponentTest.vue

@@ -245,6 +245,7 @@ export default {
 			],
 			uniqueId: "",
 			allFiles: [],
+			hasUploading: false,
 			invoiceNoSet: new Set(), // 已存在的发票号
 		}
 	},
@@ -394,6 +395,7 @@ export default {
 			this.dataListNew = [...filtered]
 			this.fileLoading = true
 			// 防止数据未更新完成,用户操作上传
+
 			this.loading = false
 			this.$emit('changeLoading', false)
 			// this.dataList = JSON.parse(JSON.stringify(fileList))
@@ -453,47 +455,142 @@ export default {
 			await httpRequest(file, fileNameInvoice(file), this.directory, this.maxValue)
 		},
 		handleSuccessUpload(response, file, fileList) {
-
 		},
-
 		async beforeUpload(file) {
+			this.changeLoading(true)
 			if (this.uploadDelFlag) {
 				this.$message.warning('该文件已上传,请勿重复上传');
 				this.uploadKey = Math.random()
-
 				return false; // 取消上传
 			} else {
+				// 文件大小检查
+				if (!beforeAvatarUpload(file, this.dataListNew, this.maxValue)) {
+					this.$message.error('文件大小不能超过 ' + this.maxValue + ' MB!');
+					this.changeLoading(false)
+					return false;
+				}
 				// 对文件进行判定
 				const isXml = file.type === 'text/xml'; // 假设只接受 XML 文件
 				if (!isXml) {
 					this.$message.error('只能上传 XML 文件');
+					this.changeLoading(false)
 					return false; // 取消上传
 				}
 
 				const formBody = new FormData()
 				formBody.append('file', file)
-				let res
+				let fileData
 				try {
 					// 后端解析
-					res = await this.ossService.disposeXmlFile(formBody)
+					fileData = await this.ossService.disposeXmlFile(formBody)
 				} catch (e) {
 					this.$message.error('发票文件解析失败')
+					this.changeLoading(false)
 					return false
 				}
 
-				// 取发票号
-				const invoiceNo = res?.InvoiceNumber
-				if (!invoiceNo) {
-					this.$message.warning('发票文件解析失败')
-					return false
+				//判断文件是否重复
+				let fileIndex = this.dataList.findIndex(fileItem => {
+					return fileItem.number == fileData.InvoiceNumber
+				})
+				if (fileIndex != -1) {
+					if (JSON.stringify(fileData) === "{}") {
+						this.$message.warning({ message: `数电发票:${file.name}格式错误` });
+						this.changeLoading(false)
+						return false
+					}
+
+					if (this.commonJS.isNotEmpty(fileData.InvoiceNumber)) {
+						this.$message.warning({ message: `数电发票:${file.name + "<br/>发票号:" + fileData.InvoiceNumber}<br/>已经上传,请勿重复上传`, dangerouslyUseHTMLString: true });
+						this.changeLoading(false)
+						return false
+					}
 				}
 
-				// 去重
-				if (this.invoiceNoSet.has(invoiceNo)) {
-					this.$message.warning({ message: `数电发票:${file.name + "<br/>发票号:" + invoiceNo}<br/>已经上传,请勿重复上传`, dangerouslyUseHTMLString: true });
-					return false
+				this.uploadKey = Math.random();
+
+				const fileUrl = file.url;
+				// 检查临时 URL 是否有效
+				if (fileUrl && fileUrl.trim() !== '') {
+					try {
+						const temporaryUrl = await this.ossService.getTemporaryUrl(fileUrl);
+
+						if (!temporaryUrl || temporaryUrl.trim() === '') {
+							// 如果临时 URL 无效,则标记该文件为无效并删除
+							this.$message.warning({ message: `数电发票:${file.name}获取失败,上传失败。` });
+							this.changeLoading(false)
+							return false
+						} else {
+							// 如果临时 URL 有效,继续添加文件到有效文件列表
+							file.lsUrl = temporaryUrl;
+						}
+					} catch (error) {
+						// 如果临时 URL 获取失败,也标记该文件为无效
+						this.$message.warning({ message: `数电发票:${file.name}获取失败,上传失败。` });
+						this.changeLoading(false)
+						return false
+					}
 				}
 
+				// 6. 给文件添加上传时间和上传人
+				file.createTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss');
+				file.createBy = {
+					id: this.$store.state.user.id,
+					name: this.$store.state.user.name,
+				};
+				if (file !== undefined && file !== null && file !== {}) {
+					// 设置文件的 URL
+					// 仅处理 XML 文件
+					if (file.name && file.name.toLowerCase().endsWith(".xml")) {
+						if (JSON.stringify(fileData) === "{}") {
+							this.$message.warning({ message: `数电发票:${file.name}格式错误` });
+							this.changeLoading(false)
+							return false
+						}
+						if (Object.keys(fileData).length > 0) {
+							this.fieldComparison(fileData, this.fileLabel);
+							// 检查 data 是否包含 BuyerInformationBuyerName 属性
+							if (fileData && 'BuyerInformationBuyerName' in fileData) {
+								// 验证是否有效,并进行替换操作
+								if (typeof fileData.BuyerInformationBuyerName === 'string') {
+									var buyerInformationBuyerName = fileData.BuyerInformationBuyerName
+										.replace(/(/g, '(')
+										.replace(/)/g, ')');
+									fileData.BuyerInformationBuyerName = buyerInformationBuyerName
+								}
+							}
+
+							if (this.toCompany !== fileData.BuyerInformationBuyerName) {
+								this.$message.warning({ message: `仅可上传${this.toCompany}的报销数电发票:<br/>${"文件名: " + file.name + "—— 发票号:" + fileData.InvoiceNumber}<br>上传失败 `, dangerouslyUseHTMLString: true });
+								this.changeLoading(false)
+								return false
+							}
+							if (this.commonJS.isNotEmpty(fileData.InvoiceNumber)) {
+								var flag = this.invoiceReimbursementDispose(fileData)
+								if (flag) {
+									this.$message.warning({ message: `数电发票:${file.name + "-" + fileData.InvoiceNumber}<br/>已经上传,请勿重复上传`, dangerouslyUseHTMLString: true });
+									this.changeLoading(false)
+									return false
+								}
+								//查询当前发票号是否已经被报销
+								let isUsed = await this.ossService.isUsedByInvoiceNumber(fileData.InvoiceNumber);
+								if (isUsed) {
+									this.$message.warning({ message: `数电发票:${file.name + "<br/> 发票号:" + fileData.InvoiceNumber}<br/>已经发起或已完成报销,无法重复报销`, dangerouslyUseHTMLString: true });
+									this.changeLoading(false)
+									return false
+								}
+								let inDate = this.formatDate(fileData.IssueTime)
+								if (inDate.indexOf("NaN") != -1 && this.commonJS.isNotEmpty(inDate)) {
+									this.$message.warning({ message: `数电发票:${file.name + "<br/> 发票号:" + fileData.InvoiceNumber}<br/>日期格式错误,上传失败。`, dangerouslyUseHTMLString: true });
+									this.changeLoading(false)
+									return false
+								}
+							}
+
+						}
+					}
+				}
+				file.fileData = fileData;
 				return true
 			}
 		},
@@ -507,7 +604,7 @@ export default {
 				}, 1000) // 一秒后关闭进度条
 			}
 		},
-		async invoiceReimbursementDisposeData(fileData, file) {
+		invoiceReimbursementDisposeData(fileData, file) {
 			var invoiceReimbursements = this.dataListNew;
 			//创建判断值,若行信息存在相同的发票号,则进行数据检查调整,若不存在发票号,则新增行,并将信息写入
 			var includeFlag = false;
@@ -588,121 +685,29 @@ export default {
 		},
 		async changes(file, fileList) {
 			// 防止上传多次触发changes
-			if (file.status == 'ready') return //阻止上传多次触发changes
-			try {
-				this.uploadKey = Math.random();
-				// 2. 文件大小检查
-				if (!beforeAvatarUpload(file, fileList, this.maxValue)) {
-					this.$message.error('文件大小不能超过 ' + this.maxValue + ' MB!');
-					return;
-				}
-
-				const fileName = file.raw ? file.raw.name : file.name;
-				const fileBody = new FormData();
-				fileBody.append('file', file.raw);
-				const fileData = await this.ossService.disposeXmlFile(fileBody);
-
-				//判断文件是否重复
-				let fileIndex = this.dataList.findIndex(fileItem => {
-					return fileItem.number == fileData.InvoiceNumber
-				})
-				if (fileIndex != -1) {
-					// // 记录重复文件名
-					// const formBody = new FormData();
-					// formBody.append('file', file.raw);
-					// const data1 = await this.ossService.disposeXmlFile(formBody);
-
-					if (JSON.stringify(fileData) === "{}") {
-						this.$message.warning({ message: `数电发票:${file.raw.name}格式错误` });
-						return
-					}
-
-					if (this.commonJS.isNotEmpty(fileData.InvoiceNumber)) {
-						this.$message.warning({ message: `数电发票:${fileName + "<br/>发票号:" + fileData.InvoiceNumber}<br/>已经上传,请勿重复上传`, dangerouslyUseHTMLString: true });
-						return
-					}
-				}
-
-				const fileUrl = file.raw ? file.raw.url : file.url;
-				// 检查临时 URL 是否有效
-				if (fileUrl && fileUrl.trim() !== '') {
-					try {
-						const temporaryUrl = await this.ossService.getTemporaryUrl(fileUrl);
+			if (file.status == 'ready' || file.status == 'uploading') return //阻止上传多次触发changes
+
+			// 检查是否有文件正在上传
+			this.hasUploading = fileList.some(f =>
+				f.status === 'ready' || f.status === 'uploading'
+			)
+			if (!this.hasUploading) {
+				this.$emit('changeLoading', false)
+				this.loading = false
+			} else {
+				this.$emit('changeLoading', this.hasUploading)
+				this.loading = this.hasUploading
+			}
 
-						if (!temporaryUrl || temporaryUrl.trim() === '') {
-							// 如果临时 URL 无效,则标记该文件为无效并删除
-							this.$message.warning({ message: `数电发票:${file.name}获取失败,上传失败。` });
-							return
-						} else {
-							// 如果临时 URL 有效,继续添加文件到有效文件列表
-							file.lsUrl = temporaryUrl;
-						}
-					} catch (error) {
-						// 如果临时 URL 获取失败,也标记该文件为无效
-						this.$message.warning({ message: `数电发票:${file.name}获取失败,上传失败。` });
-						return
-					}
-				}
+			try {
 
+				let fileData = file.raw.fileData
 				// 6. 给文件添加上传时间和上传人
 				file.createTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss');
 				file.createBy = {
 					id: this.$store.state.user.id,
 					name: this.$store.state.user.name,
 				};
-				if (file.raw !== undefined && file.raw !== null && file.raw !== {}) {
-					// 设置文件的 URL
-					file.url = file.raw.url;
-					// 仅处理 XML 文件
-					if (file.raw.name && file.raw.name.toLowerCase().endsWith(".xml")) {
-						// 创建 FormData 对象并发送文件
-						// const formBody = new FormData();
-						// formBody.append('file', file.raw);
-						// 调用后端接口解析 XML 文件
-						// let data2 = await this.ossService.disposeXmlFile(formBody);
-						if (JSON.stringify(fileData) === "{}") {
-							this.$message.warning({ message: `数电发票:${file.raw.name}格式错误` });
-							return
-						}
-						if (Object.keys(fileData).length > 0) {
-							this.fieldComparison(fileData, this.fileLabel);
-							// 检查 data 是否包含 BuyerInformationBuyerName 属性
-							if (fileData && 'BuyerInformationBuyerName' in fileData) {
-								// 验证是否有效,并进行替换操作
-								if (typeof fileData.BuyerInformationBuyerName === 'string') {
-									var buyerInformationBuyerName = fileData.BuyerInformationBuyerName
-										.replace(/(/g, '(')
-										.replace(/)/g, ')');
-									fileData.BuyerInformationBuyerName = buyerInformationBuyerName
-								}
-							}
-
-							if (this.toCompany !== fileData.BuyerInformationBuyerName) {
-								this.$message.warning({ message: `仅可上传${this.toCompany}的报销数电发票:<br/>${"文件名: " + file.raw.name + "—— 发票号:" + fileData.InvoiceNumber}<br>上传失败 `, dangerouslyUseHTMLString: true });
-								return
-							}
-							if (this.commonJS.isNotEmpty(fileData.InvoiceNumber)) {
-								var flag = this.invoiceReimbursementDispose(fileData)
-								if (flag) {
-									this.$message.warning({ message: `数电发票:${file.raw.name + "-" + fileData.InvoiceNumber}<br/>已经上传,请勿重复上传`, dangerouslyUseHTMLString: true });
-									return
-								}
-								//查询当前发票号是否已经被报销
-								let isUsed = await this.ossService.isUsedByInvoiceNumber(fileData.InvoiceNumber);
-								if (isUsed) {
-									this.$message.warning({ message: `数电发票:${file.raw.name + "<br/> 发票号:" + fileData.InvoiceNumber}<br/>已经发起或已完成报销,无法重复报销`, dangerouslyUseHTMLString: true });
-									return
-								}
-								let inDate = this.formatDate(fileData.IssueTime)
-								if (inDate.indexOf("NaN") != -1 && this.commonJS.isNotEmpty(inDate)) {
-									this.$message.warning({ message: `数电发票:${file.raw.name + "<br/> 发票号:" + fileData.InvoiceNumber}<br/>日期格式错误,上传失败。`, dangerouslyUseHTMLString: true });
-									return
-								}
-							}
-
-						}
-					}
-				}
 				let obj = this.dataList.find(tempFile => {
 					return tempFile.number == fileData.InvoiceNumber
 				})
@@ -714,13 +719,46 @@ export default {
 				// 发票号赋值给文件
 				file.remarks = this.uniqueId
 				file.number = fileData.InvoiceNumber
-				// 记录发票号,防止重复上传
-				this.invoiceNoSet.add(fileData.InvoiceNumber)
 				// 将新符合条件的文件追加到原文件列表上
 				this.dataListNew.push(file)
 				this.fileList.push(file)
 				this.dataList = this.dataListNew
 
+				if (fileData.InvoiceNumber == file.number) {
+					// 如果 file.raw 存在且有效
+					if (file.raw !== undefined && file.raw !== null && file.raw !== {}) {
+						// 设置文件的 URL
+						file.url = file.raw.url;
+
+						// 仅处理 XML 文件
+						if (file.raw.name && file.raw.name.toLowerCase().endsWith(".xml")) {
+							// 创建 FormData 对象并发送文件
+							try {
+								// 调用后端接口解析 XML 文件
+								if (fileData && 'BuyerInformationBuyerName' in fileData) {
+									this.fieldComparison(fileData, this.fileLabel);
+									// 验证是否有效,并进行替换操作
+									if (typeof fileData.BuyerInformationBuyerName === 'string') {
+										var buyerInformationBuyerName = fileData.BuyerInformationBuyerName
+											.replace(/(/g, '(')
+											.replace(/)/g, ')');
+										fileData.BuyerInformationBuyerName = buyerInformationBuyerName
+									}
+								}
+
+								if (Object.keys(fileData).length > 0) {
+									// 解析成功,更新数据行
+									this.invoiceReimbursementDisposeData(fileData, file);
+								}
+
+							} catch (error) {
+								this.$message.error('处理 XML 文件失败');
+								console.log('XML 处理失败', error);
+							}
+						}
+					}
+				}
+
 
 				// 清空 fileList,如果 fileList 不为空
 				if (fileList && fileList.length > 0) {
@@ -746,7 +784,8 @@ export default {
 				// 👇 初始化时主动触发一次
 				this.setNodeSort(null, null, 'init');
 				// 在 changes 完成后,手动调用 handleUploadSuccess
-				await this.handleUploadSuccess(null, fileData, this.fileList);  // 传入空参数或实际参数
+				// await this.handleUploadSuccess(null, fileData, this.fileList);  // 传入空参数或实际参数
+
 			} catch (error) {
 				this.$message.error({
 					message: `上传出错,${error.message}`
@@ -814,13 +853,8 @@ export default {
 							// 仅处理 XML 文件
 							if (item.raw.name && item.raw.name.toLowerCase().endsWith(".xml")) {
 								// 创建 FormData 对象并发送文件
-								// const formBody = new FormData();
-								// formBody.append('file', item.raw);
-
 								try {
 									// 调用后端接口解析 XML 文件
-									// let data = await this.ossService.disposeXmlFile(formBody);
-									// 检查 data 是否包含 BuyerInformationBuyerName 属性
 									if (fileData && 'BuyerInformationBuyerName' in fileData) {
 										this.fieldComparison(fileData, this.fileLabel);
 										// 验证是否有效,并进行替换操作
@@ -836,14 +870,7 @@ export default {
 										// 解析成功,更新数据行
 										await this.invoiceReimbursementDisposeData(fileData, item);
 									}
-									// else {
-									// 	// XML 格式错误,删除文件
-									// 	this.$message.warning('上传的数电发票格式错误');
-									// 	const index = this.fileList.findIndex(f => f.name === item.name);
-									// 	if (index !== -1) {
-									// 		this.deleteFileById(this.fileList[index], index, this.fileList);
-									// 	}
-									// }
+
 								} catch (error) {
 									this.$message.error('处理 XML 文件失败');
 									console.log('XML 处理失败', error);
@@ -968,6 +995,10 @@ export default {
 				this.$message.warning('请等待附件上传完成再进行操作')
 				return true
 			}
+			if (this.hasUploading === true) {
+				this.$message.warning('请等待附件上传完成再进行操作')
+				return true
+			}
 			if (this.fileLoading === false) {
 				this.$message.warning('请等待附件加载完成再进行操作')
 				if (this.dataListLength === this.dataListNew.length) {
@@ -994,11 +1025,8 @@ export default {
 		},
 		// 开启/关闭页面的加载中状态
 		changeLoading(loading) {
-			if (this.commonJS.isNotEmpty(loading)) {
-				this.loading = loading
-			} else {
-				this.loading = false
-			}
+			this.$emit('changeLoading', loading)
+			this.loading = loading
 		},
 		getSummaries(param) {
 			const { columns, data } = param;

+ 19 - 8
src/views/common/reimbursement/ReimbursementComponentTest.vue

@@ -171,7 +171,7 @@
                             <template #default="scope">
                                 <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                     :loading="loading" type="primary">新增</el-button>
-                                <el-button size="default" type="danger"
+                                <el-button size="default" type="danger" :loading="loading"
                                     @click="removeEvent(scope.row, scope.$rowIndex, 'detail')">删除</el-button>
                             </template>
                         </vxe-table-column>
@@ -316,7 +316,7 @@
                             <template #default="scope">
                                 <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                     :loading="loading" type="primary">新增</el-button>
-                                <el-button size="default" type="danger"
+                                <el-button size="default" type="danger" :loading="loading"
                                     @click="removeEvent(scope.row, scope.$rowIndex, 'detail')">删除</el-button>
                             </template>
                         </vxe-table-column>
@@ -456,7 +456,7 @@
                             <template #default="scope">
                                 <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                     :loading="loading" type="primary">新增</el-button>
-                                <el-button size="default" type="danger"
+                                <el-button size="default" type="danger" :loading="loading"
                                     @click="removeEvent(scope.row, scope.$rowIndex, 'detail')">删除</el-button>
                             </template>
                         </vxe-table-column>
@@ -580,7 +580,7 @@
                         <template #default="scope">
                             <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                 :loading="loading" type="primary">新增</el-button>
-                            <el-button size="default" type="danger"
+                            <el-button size="default" type="danger" :loading="loading"
                                 @click="removeEvent(scope.row, scope.$rowIndex, 'contract_detail')">删除</el-button>
                         </template>
                     </vxe-table-column>
@@ -725,7 +725,7 @@
                             <template #default="scope">
                                 <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                     :loading="loading" type="primary">新增</el-button>
-                                <el-button size="default" type="danger"
+                                <el-button size="default" type="danger" :loading="loading"
                                     @click="removeEvent(scope.row, scope.$rowIndex, 'report_detail')">删除</el-button>
                             </template>
                         </vxe-table-column>
@@ -864,7 +864,7 @@
                             <template #default="scope">
                                 <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                     :loading="loading" type="primary">新增</el-button>
-                                <el-button size="default" type="danger"
+                                <el-button size="default" type="danger" :loading="loading"
                                     @click="removeEvent(scope.row, scope.$rowIndex, 'report_detail')">删除</el-button>
                             </template>
                         </vxe-table-column>
@@ -1006,7 +1006,7 @@
                             <template #default="scope">
                                 <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                     :loading="loading" type="primary">新增</el-button>
-                                <el-button size="default" type="danger"
+                                <el-button size="default" type="danger" :loading="loading"
                                     @click="removeEvent(scope.row, scope.$rowIndex, 'others')">删除</el-button>
                             </template>
                         </vxe-table-column>
@@ -1287,7 +1287,7 @@
                             <template #default="scope">
                                 <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                     :loading="loading" type="primary">新增</el-button>
-                                <el-button size="default" type="danger"
+                                <el-button size="default" type="danger" :loading="loading"
                                     @click="removeEvent(scope.row, scope.$rowIndex, 'zs_project_detail')">删除</el-button>
                             </template>
                         </vxe-table-column>
@@ -3330,6 +3330,17 @@ export default {
         },
         handleChangeLoading(value) {
             this.loading = value
+            this.$emit('changeLoading', value)
+
+        },
+        // 校验文件上传
+        checkProgress() {
+            this.handleTableInfo(this.inputForm.sourceType)
+            return this.tableData.some(item => {
+                const ref = this.$refs[item.uniqueId + 'Upload']
+                const uploadRef = Array.isArray(ref) ? ref[0] : ref
+                return uploadRef?.checkProgress?.()
+            })
         }
     }
 }

+ 26 - 16
src/views/consultancy/reimbursement/info/NewReimbursementForm.vue

@@ -84,7 +84,7 @@
       </el-row>
 
 
-      <ReimbursementComponent ref="reimbursementComponent">
+      <ReimbursementComponent ref="reimbursementComponent" @changeLoading="handleChangeLoading">
       </ReimbursementComponent>
       <!-- 报销单图片预览 -->
       <ReimbursementImage ref="reimbursementImage"></ReimbursementImage>
@@ -280,7 +280,8 @@ export default {
       isZjbry: false,
       isDgsbxBmzr: false,
       payment: '',
-      isConfirm: ""
+      isConfirm: "",
+      screenLoading: null
 
     }
   },
@@ -498,10 +499,10 @@ export default {
       this.$refs['inputForm'].validate((valid) => {
         if (valid) {
           this.loading = true
-          // if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-          //   this.loading = false
-          //   return
-          // }
+          if (this.$refs.reimbursementComponent.checkProgress()) {
+            this.loading = false
+            return
+          }
           if (this.$refs.uploadComponent.checkProgress()) {
             this.loading = false
             return
@@ -777,10 +778,10 @@ export default {
     // 暂存
     async saveForm(callback) {
       this.loading = true
-      // if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-      //   this.loading = false
-      //   return
-      // }
+      if (this.$refs.reimbursementComponent.checkProgress()) {
+        this.loading = false
+        return
+      }
       if (this.$refs.uploadComponent.checkProgress()) {
         this.loading = false
         return
@@ -817,7 +818,10 @@ export default {
     // 送审
     async startForm(callback) {
       this.getReimbursementData()
-
+      if (this.$refs.reimbursementComponent.checkProgress()) {
+        this.loading = false
+        throw new Error('请等待附件上传完成再进行操作')
+      }
       let title = `发起流程【咨询-报销审批】`
       let describe = `[咨询-报销审批]`
       if (this.inputForm.reimbursementType) {
@@ -889,11 +893,6 @@ export default {
           this.loading = true
           this.submitCheck()
           this.handleCheckAmount()
-
-          // if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-          //   this.loading = false
-          //   return
-          // }
           if (this.$refs.uploadComponent.checkProgress()) {
             this.loading = false
             return
@@ -1963,6 +1962,17 @@ export default {
     //报销单图片预览
     handleShowReimbursementImage() {
       this.$refs.reimbursementImage.visible = true
+    },
+    handleChangeLoading(status) {
+      if (status) {
+        this.screenLoading = this.$loading({
+          lock: true,
+          text: '数据处理中,请稍后...',
+          background: 'rgba(0, 0, 0, 0.7)',
+        })
+      } else {
+        this.screenLoading.close()
+      }
     }
   }
 }

+ 28 - 15
src/views/cw/reimbursementApproval/info/NewReimbursementForm.vue

@@ -84,7 +84,7 @@
 					</el-form-item>
 				</el-col>
 			</el-row>
-			<ReimbursementComponent ref="reimbursementComponent">
+			<ReimbursementComponent ref="reimbursementComponent" @changeLoading="handleChangeLoading">
 			</ReimbursementComponent>
 			<!-- 报销单图片预览 -->
 			<ReimbursementImage ref="reimbursementImage"></ReimbursementImage>
@@ -284,7 +284,8 @@ export default {
 			payment: '',
 			tableRef: null,
 			tableData: [],
-			isConfirm: ""
+			isConfirm: "",
+			screenLoading: null
 		}
 	},
 	provide() {
@@ -512,10 +513,11 @@ export default {
 			this.$refs['inputForm'].validate((valid) => {
 				if (valid) {
 					this.loading = true
-					// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-					// 	this.loading = false
-					// 	return
-					// }
+					if (this.$refs.reimbursementComponent.checkProgress()) {
+						this.loading = false
+						return
+					}
+
 					if (this.$refs.uploadComponent.checkProgress()) {
 						this.loading = false
 						return
@@ -812,10 +814,11 @@ export default {
 		// 暂存
 		async saveForm(callback) {
 			this.loading = true
-			// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-			// 	this.loading = false
-			// 	return
-			// }
+			if (this.$refs.reimbursementComponent.checkProgress()) {
+				this.loading = false
+				return
+			}
+
 			if (this.$refs.uploadComponent.checkProgress()) {
 				this.loading = false
 				return
@@ -899,7 +902,10 @@ export default {
 		// 送审
 		async startFormTrue(callback) {
 			this.getReimbursementData()
-
+			if (this.$refs.reimbursementComponent.checkProgress()) {
+				this.loading = false
+				throw new Error('请等待附件上传完成再进行操作')
+			}
 			let title = `发起流程【会计-报销审批】`
 			let describe = `[会计-报销审批]`
 			if (this.inputForm.reimbursementType) {
@@ -993,10 +999,6 @@ export default {
 					this.submitCheck()
 					this.handleCheckAmount()
 
-					// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-					// 	this.loading = false
-					// 	return
-					// }
 					if (this.$refs.uploadComponent.checkProgress()) {
 						this.loading = false
 						return
@@ -2329,6 +2331,17 @@ export default {
 		//报销单图片预览
 		handleShowReimbursementImage() {
 			this.$refs.reimbursementImage.visible = true
+		},
+		handleChangeLoading(status) {
+			if (status) {
+				this.screenLoading = this.$loading({
+					lock: true,
+					text: '数据处理中,请稍后...',
+					background: 'rgba(0, 0, 0, 0.7)',
+				})
+			} else {
+				this.screenLoading.close()
+			}
 		}
 
 	}

+ 31 - 18
src/views/cw/szfbReimbursementApproval/info/NewReimbursementForm.vue

@@ -84,7 +84,7 @@
 					</el-form-item>
 				</el-col>
 			</el-row>
-			<ReimbursementComponent ref="reimbursementComponent">
+			<ReimbursementComponent ref="reimbursementComponent" @changeLoading="handleChangeLoading">
 			</ReimbursementComponent>
 			<!-- 报销单图片预览 -->
 			<ReimbursementImage ref="reimbursementImage"></ReimbursementImage>
@@ -283,7 +283,8 @@ export default {
 			payment: '',
 			isConfirm: "",
 			tableRef: null,
-			tableData: []
+			tableData: [],
+			screenLoading: null
 		}
 	},
 	provide() {
@@ -522,10 +523,11 @@ export default {
 			this.$refs['inputForm'].validate((valid) => {
 				if (valid) {
 					this.loading = true
-					// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-					// 	this.loading = false
-					// 	return
-					// }
+					if (this.$refs.reimbursementComponent.checkProgress()) {
+						this.loading = false
+						return
+					}
+
 					if (this.$refs.uploadComponent.checkProgress()) {
 						this.loading = false
 						return
@@ -564,10 +566,10 @@ export default {
 			this.$refs['inputForm'].validate((valid) => {
 				if (valid) {
 					this.loading = true
-					// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-					// 	this.loading = false
-					// 	return
-					// }
+					if (this.$refs.reimbursementComponent.checkProgress()) {
+						this.loading = false
+						return
+					}
 					if (this.$refs.uploadComponent.checkProgress()) {
 						this.loading = false
 						return
@@ -847,10 +849,10 @@ export default {
 		// 暂存
 		async saveForm(callback) {
 			this.loading = true
-			// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-			// 	this.loading = false
-			// 	return
-			// }
+			if (this.$refs.reimbursementComponent.checkProgress()) {
+				this.loading = false
+				return
+			}
 			if (this.$refs.uploadComponent.checkProgress()) {
 				this.loading = false
 				return
@@ -933,6 +935,10 @@ export default {
 		},
 		// 送审
 		async startFormTrue(callback) {
+			if (this.$refs.reimbursementComponent.checkProgress()) {
+				this.loading = false
+				throw new Error('请等待附件上传完成再进行操作')
+			}
 			this.getReimbursementData()
 
 			let title = `发起流程【业务操作报销审批】`
@@ -947,10 +953,6 @@ export default {
 				if (valid) {
 					this.loading = true
 					this.submitCheck()
-					// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-					// 	this.loading = false
-					// 	return
-					// }
 					if (this.$refs.uploadComponent.checkProgress()) {
 						this.loading = false
 						return
@@ -2136,6 +2138,17 @@ export default {
 		//报销单图片预览
 		handleShowReimbursementImage() {
 			this.$refs.reimbursementImage.visible = true
+		},
+		handleChangeLoading(status) {
+			if (status) {
+				this.screenLoading = this.$loading({
+					lock: true,
+					text: '数据处理中,请稍后...',
+					background: 'rgba(0, 0, 0, 0.7)',
+				})
+			} else {
+				this.screenLoading.close()
+			}
 		}
 	}
 }

+ 27 - 14
src/views/reimbursement/info/NewReimbursementForm.vue

@@ -91,7 +91,7 @@
 				</el-col>
 			</el-row>
 
-			<ReimbursementComponent ref="reimbursementComponent">
+			<ReimbursementComponent ref="reimbursementComponent" @changeLoading="handleChangeLoading">
 			</ReimbursementComponent>
 			<!-- 报销单图片预览 -->
 			<ReimbursementImage ref="reimbursementImage"></ReimbursementImage>
@@ -271,7 +271,9 @@ export default {
 			isZjbry: false,
 			isKjsz: false,
 			payment: '',
-			isConfirm: ""
+			isConfirm: "",
+			screenLoading: null
+
 		}
 	},
 
@@ -524,10 +526,10 @@ export default {
 			this.$refs['inputForm'].validate((valid) => {
 				if (valid) {
 					this.loading = true
-					// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-					// 	this.loading = false
-					// 	return
-					// }
+					if (this.$refs.reimbursementComponent.checkProgress()) {
+						this.loading = false
+						return
+					}
 					if (this.$refs.uploadComponent.checkProgress()) {
 						this.loading = false
 						return
@@ -793,10 +795,10 @@ export default {
 		// 暂存
 		async saveForm(callback) {
 			this.loading = true
-			// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-			// 	this.loading = false
-			// 	return
-			// }
+			if (this.$refs.reimbursementComponent.checkProgress()) {
+				this.loading = false
+				return
+			}
 			if (this.$refs.uploadComponent.checkProgress()) {
 				this.loading = false
 				return
@@ -838,6 +840,10 @@ export default {
 		},
 		// 送审
 		async startFormTrue(callback) {
+			if (this.$refs.reimbursementComponent.checkProgress()) {
+				this.loading = false
+				throw new Error('请等待附件上传完成再进行操作')
+			}
 			this.getReimbursementData()
 			let title = `发起流程【评估-报销审批】`
 			let describe = `[评估-报销审批]`
@@ -911,10 +917,6 @@ export default {
 					this.submitCheck()
 					this.handleCheckAmount()
 
-					// if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-					// 	this.loading = false
-					// 	return
-					// }
 					if (this.$refs.uploadComponent.checkProgress()) {
 						this.loading = false
 						return
@@ -2004,6 +2006,17 @@ export default {
 		//报销单图片预览
 		handleShowReimbursementImage() {
 			this.$refs.reimbursementImage.visible = true
+		},
+		handleChangeLoading(status) {
+			if (status) {
+				this.screenLoading = this.$loading({
+					lock: true,
+					text: '数据处理中,请稍后...',
+					background: 'rgba(0, 0, 0, 0.7)',
+				})
+			} else {
+				this.screenLoading.close()
+			}
 		}
 	}
 }

+ 32 - 17
src/views/zs/reimbursement/info/NewReimbursementForm.vue

@@ -82,7 +82,7 @@
         </el-col>
       </el-row>
 
-      <ReimbursementComponent ref="reimbursementComponent">
+      <ReimbursementComponent ref="reimbursementComponent" @changeLoading="handleChangeLoading">
       </ReimbursementComponent>
       <!-- 报销单图片预览 -->
       <ReimbursementImage ref="reimbursementImage"></ReimbursementImage>
@@ -245,6 +245,7 @@ import processService from '@/api/flowable/processService'
 import userService from '@/api/sys/UserService'
 import ReimbursementComponent from '@/views/common/reimbursement/ReimbursementComponentTest.vue'
 import ReimbursementImage from '@/views/common/reimbursement/ReimbursementImage.vue'
+
 export default {
   props: {
     businessId: {
@@ -381,7 +382,8 @@ export default {
       isZjbry: false,
       isDgsbxBmzr: false,
       payment: '',
-      isConfirm: ""
+      isConfirm: "",
+      screenLoading: null
     }
   },
   provide() {
@@ -602,10 +604,11 @@ export default {
       this.$refs['inputForm'].validate((valid) => {
         if (valid) {
           this.loading = true
-          // if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-          //   this.loading = false
-          //   return
-          // }
+          if (this.$refs.reimbursementComponent.checkProgress()) {
+            this.loading = false
+            return
+          }
+
           if (this.$refs.uploadComponent.checkProgress()) {
             this.loading = false
             return
@@ -905,10 +908,10 @@ export default {
     // 暂存
     async saveForm(callback) {
       this.loading = true
-      // if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-      //   this.loading = false
-      //   return
-      // }
+      if (this.$refs.reimbursementComponent.checkProgress()) {
+        this.loading = false
+        return
+      }
       if (this.$refs.uploadComponent.checkProgress()) {
         this.loading = false
         return
@@ -944,8 +947,10 @@ export default {
     },
     // 送审
     async startForm(callback) {
-      console.log("提交审批");
-
+      if (this.$refs.reimbursementComponent.checkProgress()) {
+        this.loading = false
+        throw new Error('请等待附件上传完成再进行操作')
+      }
       this.getReimbursementData()
       let title = `发起流程【中审-报销审批】`
       let describe = `[中审-报销审批]`
@@ -1019,11 +1024,10 @@ export default {
           this.loading = true
           this.submitCheck()
           this.handleCheckAmount()
-
-          // if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
-          //   this.loading = false
-          //   return
-          // }
+          if (this.$refs.reimbursementComponent.checkProgress()) {
+            this.loading = false
+            return
+          }
           if (this.$refs.uploadComponent.checkProgress()) {
             this.loading = false
             return
@@ -2160,6 +2164,17 @@ export default {
     //报销单图片预览
     handleShowReimbursementImage() {
       this.$refs.reimbursementImage.visible = true
+    },
+    handleChangeLoading(status) {
+      if (status) {
+        this.screenLoading = this.$loading({
+          lock: true,
+          text: '数据处理中,请稍后...',
+          background: 'rgba(0, 0, 0, 0.7)',
+        })
+      } else {
+        this.screenLoading.close()
+      }
     }
   }
 }