Explorar el Código

中审项目报销管理员修改报错,报销发票上传调整

huangguoce hace 2 semanas
padre
commit
c787dcb410

+ 252 - 203
src/views/common/NewDigitalInvoiceUploadComponentTest.vue

@@ -3,8 +3,7 @@
 	<div :key="uploadKey">
 		<!-- <el-divider v-if="showDivider" content-position="left"><i class="el-icon-document"></i> {{ dividerName }} -->
 		<el-upload ref="upload" style="display: inline-block; " :show-header="'status'" action="" :limit="50"
-			:on-success="handleSuccessUpload" :on-error="handleFileError" :http-request="httpRequest" multiple
-			:on-exceed="(files, fileList) => {
+			:on-success="handleSuccessUpload" :http-request="httpRequest" multiple :on-exceed="(files, fileList) => {
 				$message.warning(`当前限制选择 50 个文件,本次选择了 ${files.length} 个文件`)
 			}" :show-file-list="false" :before-upload="beforeUpload" :on-change="changes" :on-progress="uploadVideoProcess"
 			:file-list="fileList">
@@ -167,9 +166,8 @@ import Sortable from 'sortablejs';
 export default {
 	data() {
 		return {
-			fileCount: 0, //被阻止的文件数量
-			fileChangeCount: 0, // 所有待上传文件数量
-			messageList: [], // 收集错误消息
+			fileCount: 0,
+			fileChangeCount: 0,
 			isConfirm: 0,//1:为主任审批,需要确认发票。2:为财务审批,无需确认
 			uploadKey: '',
 			progressFlag: false,
@@ -249,8 +247,11 @@ export default {
 			],
 			uniqueId: "",
 			allFiles: [],
-			hasUploading: false,
+			messageList: [],
 			invoiceNoSet: new Set(), // 已存在的发票号
+			totalFiles: 0,        // 总文件数
+			processedFiles: 0,    // 已处理的文件数
+			pendingFiles: new Set(), // 正在处理的文件集合
 		}
 	},
 	watch: {
@@ -326,6 +327,7 @@ export default {
 		 */
 		async newUpload(auth, fileList, directory, maxValue, dividerName, uploadFlag, delFlag, showDivider, toCompany, uniqueId) {
 			this.loading = true
+			this.$emit('changeLoading', true)
 			this.uploadKey = Math.random()
 			await this.fileLoadingFalse()
 			if (this.commonJS.isEmpty(fileList)) {
@@ -398,8 +400,8 @@ export default {
 			this.dataListNew = [...filtered]
 			this.fileLoading = true
 			// 防止数据未更新完成,用户操作上传
-
 			this.loading = false
+			this.$emit('changeLoading', false)
 			// this.dataList = JSON.parse(JSON.stringify(fileList))
 			// this.dataListNew = JSON.parse(JSON.stringify(fileList))
 			if (this.commonJS.isEmpty(showDivider)) {
@@ -459,143 +461,69 @@ export default {
 		handleSuccessUpload(response, file, fileList) {
 
 		},
-		handleFileError(err, file, fileList) {
-		},
+
 		async beforeUpload(file) {
 			this.changeLoading(true)
+
+			// 记录正在处理的文件
+			const fileId = file.uid || Date.now() + Math.random()
+			this.pendingFiles.add(fileId)
+			this.totalFiles = this.pendingFiles.size
+
 			if (this.uploadDelFlag) {
-				this.$message.warning('该文件已上传,请勿重复上传');
+				// 改为收集错误而不是直接提示
+				this.messageList.push('该文件已上传,请勿重复上传');
 				this.uploadKey = Math.random()
+				this.pendingFiles.delete(fileId)
+				this.processedFiles++
+				this.checkAndShowMessages()
 				return false; // 取消上传
 			} else {
-				// 文件大小检查
-				if (!beforeAvatarUpload(file, this.dataListNew, this.maxValue)) {
-					this.messageList.push(`文件${file.name}大小不能超过 ${this.maxValue} MB!`)
-					this.fileCount++
-					return false;
-				}
 				// 对文件进行判定
 				const isXml = file.type === 'text/xml'; // 假设只接受 XML 文件
 				if (!isXml) {
-					this.messageList.push(`文件${file.name}格式错误,只能上传 XML 文件`)
-					this.fileCount++
-					return false; // 取消上传
+					this.messageList.push('只能上传 XML 文件');
+					this.pendingFiles.delete(fileId)
+					this.processedFiles++
+					this.checkAndShowMessages()
+					return false;
 				}
 
 				const formBody = new FormData()
 				formBody.append('file', file)
-				let fileData
+				let res
 				try {
 					// 后端解析
-					fileData = await this.ossService.disposeXmlFile(formBody)
+					res = await this.ossService.disposeXmlFile(formBody)
 				} catch (e) {
-					this.messageList.push(`数电发票:${file.name}解析失败`)
-					this.fileCount++
+					this.messageList.push('发票文件解析失败')
+					this.pendingFiles.delete(fileId)
+					this.processedFiles++
+					this.checkAndShowMessages()
 					return false
 				}
 
-				//判断文件是否重复
-				let fileIndex = this.dataList.findIndex(fileItem => {
-					return fileItem.number == fileData.InvoiceNumber
-				})
-				if (fileIndex != -1) {
-					if (JSON.stringify(fileData) === "{}") {
-						this.messageList.push(`数电发票:${file.name}格式错误`)
-						this.fileCount++
-						return false
-					}
-
-					if (this.commonJS.isNotEmpty(fileData.InvoiceNumber)) {
-						this.messageList.push(`数电发票:${file.name + "<br/>发票号:" + fileData.InvoiceNumber}已经上传,请勿重复上传`)
-						this.fileCount++
-						return false
-					}
+				// 取发票号
+				const invoiceNo = res?.InvoiceNumber
+				if (!invoiceNo) {
+					this.messageList.push('发票文件解析失败')
+					this.pendingFiles.delete(fileId)
+					this.processedFiles++
+					this.checkAndShowMessages()
+					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.messageList.push(`数电发票:${file.name}获取失败,上传失败。`)
-							this.fileCount++
-							return false
-						} else {
-							// 如果临时 URL 有效,继续添加文件到有效文件列表
-							file.lsUrl = temporaryUrl;
-						}
-					} catch (error) {
-						// 如果临时 URL 获取失败,也标记该文件为无效
-						this.messageList.push(`数电发票:${file.name}获取失败,上传失败。`)
-						this.fileCount++
-						return false
-					}
+				// 去重
+				if (this.invoiceNoSet.has(invoiceNo)) {
+					this.messageList.push(`数电发票:${file.name + "<br/>发票号:" + invoiceNo}<br/>已经上传,请勿重复上传`);
+					this.pendingFiles.delete(fileId)
+					this.processedFiles++
+					this.checkAndShowMessages()
+					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.messageList.push(`数电发票:${file.name}格式错误`)
-							this.fileCount++
-							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.messageList.push(`仅可上传${this.toCompany}的报销数电发票:<br/>${"文件名: " + file.name + "—— 发票号:" + fileData.InvoiceNumber}上传失败 `)
-								this.fileCount++
-								return false
-							}
-							if (this.commonJS.isNotEmpty(fileData.InvoiceNumber)) {
-								var flag = this.invoiceReimbursementDispose(fileData)
-								if (flag) {
-									this.messageList.push(`数电发票:${file.name + "-" + fileData.InvoiceNumber}已经上传,请勿重复上传`)
-									this.fileCount++
-									return false
-								}
-								//查询当前发票号是否已经被报销
-								let isUsed = await this.ossService.isUsedByInvoiceNumber(fileData.InvoiceNumber);
-								if (isUsed) {
-									this.messageList.push(`数电发票:${file.name + "<br/> 发票号:" + fileData.InvoiceNumber}已经发起或已完成报销,无法重复报销`)
-									this.fileCount++
-									return false
-								}
-								let inDate = this.formatDate(fileData.IssueTime)
-								if (inDate.indexOf("NaN") != -1 && this.commonJS.isNotEmpty(inDate)) {
-									this.messageList.push(`数电发票:${file.name + "<br/> 发票号:" + fileData.InvoiceNumber}日期格式错误,上传失败。`)
-									this.fileCount++
-									return false
-								}
-							}
-
-						}
-					}
-				}
-				file.fileData = fileData;
+				// 将文件ID存储到file对象中,以便在changes中跟踪
+				file._fileId = fileId
 				return true
 			}
 		},
@@ -689,102 +617,188 @@ export default {
 			}
 		},
 		async changes(file, fileList) {
-			// 如果文件在beforeupload中被拦截,就通过ready状态判断
-			if (file.status == "ready") {
-				this.fileChangeCount++
-				setTimeout(() => {
-					if (this.fileChangeCount == this.fileCount) {
-						console.log(this.messageList.length);
+			// 防止上传多次触发changes
+			if (file.status == 'ready') return //阻止上传多次触发changes
 
-						this.messageList.forEach(msg => {
-							this.$message.warning({ message: msg, dangerouslyUseHTMLString: true });
-						});
-						this.messageList = []
-						this.fileCount = 0
-						this.fileChangeCount = 0
-						this.changeLoading(false)
+			const fileId = file._fileId || file.uid || Date.now() + Math.random()
+
+			try {
+				this.uploadKey = Math.random();
+				// 2. 文件大小检查
+				if (!beforeAvatarUpload(file, fileList, this.maxValue)) {
+					// this.$message.error('文件大小不能超过 ' + this.maxValue + ' MB!');
+					this.messageList.push('文件大小不能超过 ' + this.maxValue + ' MB!');
+					this.pendingFiles.delete(fileId)
+					this.processedFiles++
+					this.checkAndShowMessages()
+					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}格式错误` });
+						this.messageList.push(`数电发票:${file.raw.name}格式错误`);
+						this.pendingFiles.delete(fileId)
+						this.processedFiles++
+						this.checkAndShowMessages()
+						return
 					}
-				}, 1000);
-			}
 
-			// 防止上传多次触发changes
-			if (file.status == 'ready' || file.status == 'uploading') return //阻止上传多次触发changes
-
-			// 检查是否有文件正在上传
-			this.hasUploading = fileList.some(f =>
-				f.status === 'ready' || f.status === 'uploading'
-			)
-			if (!this.hasUploading) {
-				this.messageList.forEach(msg => {
-					this.$message.warning({ message: msg, dangerouslyUseHTMLString: true });
-				});
-				this.messageList = []
-				this.fileCount = 0
-				this.fileChangeCount = 0
-				this.changeLoading(false)
+					if (this.commonJS.isNotEmpty(fileData.InvoiceNumber)) {
+						// this.$message.warning({ message: `数电发票:${fileName + "<br/>发票号:" + fileData.InvoiceNumber}<br/>已经上传,请勿重复上传`, dangerouslyUseHTMLString: true });
+						this.messageList.push(`数电发票:${fileName + "<br/>发票号:" + fileData.InvoiceNumber}<br/>已经上传,请勿重复上传`);
+						this.pendingFiles.delete(fileId)
+						this.processedFiles++
+						this.checkAndShowMessages()
+						return
+					}
+				}
 
-			}
+				const fileUrl = file.raw ? file.raw.url : file.url;
+				// 检查临时 URL 是否有效
+				if (fileUrl && fileUrl.trim() !== '') {
+					try {
+						const temporaryUrl = await this.ossService.getTemporaryUrl(fileUrl);
 
-			try {
+						if (!temporaryUrl || temporaryUrl.trim() === '') {
+							// 如果临时 URL 无效,则标记该文件为无效并删除
+							// this.$message.warning({ message: `数电发票:${file.name}获取失败,上传失败。` });
+							this.messageList.push(`数电发票:${file.name}获取失败,上传失败。`);
+							this.pendingFiles.delete(fileId)
+							this.processedFiles++
+							this.checkAndShowMessages()
+							return
+						} else {
+							// 如果临时 URL 有效,继续添加文件到有效文件列表
+							file.lsUrl = temporaryUrl;
+						}
+					} catch (error) {
+						// 如果临时 URL 获取失败,也标记该文件为无效
+						// this.$message.warning({ message: `数电发票:${file.name}获取失败,上传失败。` });
+						this.messageList.push(`数电发票:${file.name}获取失败,上传失败。`);
+						this.pendingFiles.delete(fileId)
+						this.processedFiles++
+						this.checkAndShowMessages()
+						return
+					}
+				}
 
-				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}格式错误` });
+							this.messageList.push(`数电发票:${file.raw.name}格式错误`);
+							this.pendingFiles.delete(fileId)
+							this.processedFiles++
+							this.checkAndShowMessages()
+							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 });
+								this.messageList.push(`仅可上传${this.toCompany}的报销数电发票:<br/>${"文件名: " + file.raw.name + "—— 发票号:" + fileData.InvoiceNumber}<br>上传失败 `);
+								this.pendingFiles.delete(fileId)
+								this.processedFiles++
+								this.checkAndShowMessages()
+								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 });
+									this.messageList.push(`数电发票:${file.raw.name + "-" + fileData.InvoiceNumber}<br/>已经上传,请勿重复上传`);
+									this.pendingFiles.delete(fileId)
+									this.processedFiles++
+									this.checkAndShowMessages()
+									return
+								}
+								//查询当前发票号是否已经被报销
+								let isUsed = await this.ossService.isUsedByInvoiceNumber(fileData.InvoiceNumber);
+								if (isUsed) {
+									// this.$message.warning({ message: `数电发票:${file.raw.name + "<br/> 发票号:" + fileData.InvoiceNumber}<br/>已经发起或已完成报销,无法重复报销`, dangerouslyUseHTMLString: true });
+									this.messageList.push(`数电发票:${file.raw.name + "<br/> 发票号:" + fileData.InvoiceNumber}<br/>已经发起或已完成报销,无法重复报销`);
+									this.pendingFiles.delete(fileId)
+									this.processedFiles++
+									this.checkAndShowMessages()
+									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 });
+									this.messageList.push(`数电发票:${file.raw.name + "<br/> 发票号:" + fileData.InvoiceNumber}<br/>日期格式错误,上传失败。`);
+									this.pendingFiles.delete(fileId)
+									this.processedFiles++
+									this.checkAndShowMessages()
+									return
+								}
+							}
+
+						}
+					}
+				}
 				let obj = this.dataList.find(tempFile => {
 					return tempFile.number == fileData.InvoiceNumber
 				})
 				if (obj) {
-					this.$message.warning({ message: `数电发票:${file.name}<br/>已经上传,请勿重复上传`, dangerouslyUseHTMLString: true });
+					// this.$message.warning({ message: `数电发票:${file.name}<br/>已经上传,请勿重复上传`, dangerouslyUseHTMLString: true });
+					this.messageList.push(`数电发票:${file.name}<br/>已经上传,请勿重复上传`);
+					this.pendingFiles.delete(fileId)
+					this.processedFiles++
+					this.checkAndShowMessages()
 					return
 				}
 
 				// 发票号赋值给文件
 				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);
-							}
-						}
-					}
-				}
-
+				this.fileChangeCount++
 
 				// 清空 fileList,如果 fileList 不为空
 				if (fileList && fileList.length > 0) {
@@ -809,12 +823,39 @@ export default {
 				}
 				// 👇 初始化时主动触发一次
 				this.setNodeSort(null, null, 'init');
-				// await this.handleUploadSuccess(null, fileData, this.fileList);  // 传入空参数或实际参数
+				// 在 changes 完成后,手动调用 handleUploadSuccess
+				await this.handleUploadSuccess(null, fileData, this.fileList);  // 传入空参数或实际参数
 
+				// 文件处理成功,标记为已处理
+				this.pendingFiles.delete(fileId)
+				this.processedFiles++
+				this.checkAndShowMessages()
 			} catch (error) {
-				this.$message.error({
-					message: `上传出错,${error.message}`
-				})
+				this.messageList.push(`上传出错,${error.message}`)
+				this.pendingFiles.delete(fileId)
+				this.processedFiles++
+				this.checkAndShowMessages()
+			}
+		},
+		checkAndShowMessages() {
+			// 检查是否所有文件都已处理完成
+			if (this.pendingFiles.size === 0 && this.processedFiles > 0) {
+				// 所有文件处理完成,统一显示错误信息
+				if (this.messageList.length > 0) {
+					this.messageList.forEach(msg => {
+						this.$message.warning({
+							message: msg,
+							dangerouslyUseHTMLString: true,
+						});
+					});
+
+					// 清空错误列表
+					this.messageList = [];
+				}
+				// 重置计数器
+				this.processedFiles = 0;
+				this.totalFiles = 0;
+				this.changeLoading(false);
 			}
 		},
 		// 处理返回结果字段大小写问题
@@ -878,8 +919,13 @@ 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);
 										// 验证是否有效,并进行替换操作
@@ -893,9 +939,16 @@ export default {
 
 									if (Object.keys(fileData).length > 0) {
 										// 解析成功,更新数据行
-										await this.invoiceReimbursementDisposeData(fileData, item);
+										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);
@@ -1020,10 +1073,6 @@ 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) {
@@ -1050,8 +1099,8 @@ export default {
 		},
 		// 开启/关闭页面的加载中状态
 		changeLoading(loading) {
-			this.$emit('changeLoading', loading)
-			this.loading = loading
+			this.$emit("changeLoading", loading)
+			// this.loading = loading
 		},
 		getSummaries(param) {
 			const { columns, data } = param;

+ 3 - 1
src/views/common/reimbursement/ReimbursementComponentTest.vue

@@ -3142,6 +3142,8 @@ export default {
                 this.tableData = this.inputForm.detailInfoOthers
             } else if (value == "8") {
                 this.tableRef = this.$refs.detailTableProject
+                console.log(JSON.parse(JSON.stringify(this.inputForm)));
+
                 this.tableData = this.inputForm.detailInfoProject
             }
         },
@@ -3214,7 +3216,7 @@ export default {
         handleDefaultExpand() {
             this.handleTableInfo(this.inputForm.sourceType)
             let arr = []
-
+            console.log(this.tableData)
             this.tableData.forEach((item, index) => {
                 let tempIndex = this.inputForm.invoiceReimbursementFiles.findIndex(temp => {
                     return temp.remarks == item.uniqueId

+ 23 - 0
src/views/zs/reimbursement/info/NewInfoUpdateForm.vue

@@ -245,6 +245,7 @@ export default {
         detailInfoReports: [],
         detailInfoOthers: [],
         detailInfoProcured: [],
+        detailInfoProject: [],
         amountInfos: [],
         invoiceReimbursements: [],
         invoiceReimbursementFiles: [], // 电子发票附件信息
@@ -367,6 +368,7 @@ export default {
         detailInfoReports: [],
         detailInfoOthers: [],
         detailInfoProcured: [],
+        detailInfoProject: [],
         amountInfos: [],
         invoiceReimbursements: [],
         invoiceReimbursementFiles: [], // 电子发票附件信息
@@ -574,6 +576,7 @@ export default {
       this.inputForm.detailInfoReports = []
       this.inputForm.detailInfoOthers = []
       this.inputForm.detailInfoProcured = []
+      this.inputForm.detailInfoProject = []
       this.inputForm.purchaseNo = ''
       this.inputForm.preList = ''
       this.inputForm.purchaseId = ''
@@ -621,6 +624,11 @@ export default {
         this.$refs.detailTableProcured.remove(row)
         this.inputForm.detailInfoProcured.splice(rowIndex, 1)
       }
+      if (type === 'zs_project_detail') {
+        this.$refs.detailTableProject.remove(row)
+        this.inputForm.detailInfoProject.splice(rowIndex, 1)
+      }
+
     },
     generateRandomId() {
       let id = '';
@@ -722,6 +730,21 @@ export default {
         this.inputForm.detailInfoProcured.push(d)
         this.detailKeyProcured = Math.random()
       }
+      if (type === 'zs_project_detail') {
+        let d = {
+          uniqueId: this.generateRandomId(),
+          userName: this.$store.state.user.name,
+          deptName: this.$store.state.user.office.name,
+          userId: this.$store.state.user.id,
+          deptId: this.$store.state.user.office.id
+        }
+        if (this.commonJS.isEmpty(this.inputForm.detailInfoProject)) {
+          this.inputForm.detailInfoProject = []
+        }
+        this.$refs.detailTableProject.insertAt(d)
+        this.inputForm.detailInfoProject.push(d)
+        this.detailKeyProject = Math.random()
+      }
     },
     insertInvoiceReimbursementEvent(type, value) {
       if (type === 'invoiceReimbursement') {