diff --git a/oms_web/oms_vue/src/views/project/order/OrderDetail.vue b/oms_web/oms_vue/src/views/project/order/OrderDetail.vue index cc4f830a..92a16915 100644 --- a/oms_web/oms_vue/src/views/project/order/OrderDetail.vue +++ b/oms_web/oms_vue/src/views/project/order/OrderDetail.vue @@ -260,7 +260,9 @@
- 下载模板 + + 下载模板 +
- -
-

历史订单记录

- - {{ form.projectName + 'Rev.' + version }} - -
- -
-

附件信息

- - - - - - - - - - - - - - -
+ +
+
+

历史订单记录

+ + {{ form.projectName + 'Rev.' + activeContractVersionTab }} + +
+ +
+

附件信息

+ + + + + + + + + + + + + + +
+
暂无合同信息数据。
@@ -411,6 +420,9 @@ export default { selectCustomerVisible: false, selectPartnerVisible: false, selectUserVisible: false, + canUpdate: false, // 新增 canUpdate 属性 + uploadFinalFile: false, // 新增 uploadFinalFile 属性 + updateFile: false, // 新增 updateFile 属性 // 当前激活的Tab activeTab: 'basic', // 字典数据 @@ -477,12 +489,20 @@ export default { uniqueContractVersions() { const versions = new Set(); if (this.form.contractTableData) { - Object.keys(this.form.contractTableData).forEach(version => versions.add(version)); + Object.keys(this.form.contractTableData).forEach(version => { + if (version) versions.add(String(version)); + }); } if (this.orderBakFile) { - Object.keys(this.orderBakFile).forEach(version => versions.add(version)); + Object.keys(this.orderBakFile).forEach(version => { + if (version) versions.add(String(version)); + }); } - return Array.from(versions).sort((a, b) => b - a); // 降序排列版本号 + // 确保当前版本号始终存在 + if (this.form.versionCode) { + versions.add(String(this.form.versionCode)); + } + return Array.from(versions).sort((a, b) => Number(b) - Number(a)); // 降序排列版本号 }, groupedContractFiles() { const grouped = {}; @@ -503,6 +523,18 @@ export default { } } return grouped; + }, + currentContractFiles() { + if (!this.activeContractVersionTab || !this.groupedContractFiles[this.activeContractVersionTab]) { + return []; + } + return this.groupedContractFiles[this.activeContractVersionTab].files; + }, + currentContractBakFile() { + if (!this.activeContractVersionTab || !this.groupedContractFiles[this.activeContractVersionTab]) { + return null; + } + return this.groupedContractFiles[this.activeContractVersionTab].bakFile; } }, watch: { @@ -563,15 +595,37 @@ export default { if (this.isEdit) { getOrder(this.orderId).then(response => { this.form = response.data.projectOrderInfo; + // 兼容版本号为空的情况 + if (!this.form.versionCode) { + this.form.versionCode = 1; + } this.approveLogList=response.data.approveLog; this.orderBakFile = response.data.orderBakFile || {}; this.showFileFlag = response.data.showFileFlag || false; + this.canUpdate = response.data.canUpdate || false; // 从 response.data 获取 + this.uploadFinalFile = response.data.uploadFinalFile || false; // 从 response.data 获取 + this.updateFile = response.data.updateFile || false; // 从 response.data 获取 + + // 如果合同信息为空,则手动构造一个空的结构 + if (!this.form.contractTableData) { + this.form.contractTableData = { + [this.form.versionCode]: [] + }; + const files = this.form.contractTableData[this.form.versionCode]; + const placeholders = ['商务折扣审批', '合同', '补充附件']; + if (this.form.uploadFinalFile) { + placeholders.push('已盖章合同'); + } + placeholders.forEach((_, index) => { + files.push({id: -1, fileSort: index}); + }); + } if (this.uniqueVersions.length > 0) { - this.activeVersionTab = this.uniqueVersions[0]; // 默认显示最新版本 + this.activeVersionTab = String(this.uniqueVersions[0]); // 默认显示最新版本 } if (this.uniqueContractVersions.length > 0) { - this.activeContractVersionTab = this.uniqueContractVersions[0]; // 默认显示最新合同版本 + this.activeContractVersionTab = String(this.uniqueContractVersions[0]); // 默认显示最新合同版本 } // 手动触发联动 this.handleBgChange(this.form.bgProperty); @@ -807,10 +861,10 @@ export default { }, addFile(data) { const sortNum = data.fileSort; - if (!this.groupedContractFiles[this.form.versionCode]) { - this.$set(this.groupedContractFiles, this.form.versionCode, { files: [], bakFile: null }); + if (!this.groupedContractFiles[String(this.form.versionCode)]) { + this.$set(this.groupedContractFiles, String(this.form.versionCode), {files: [], bakFile: null}); } - const currentVersionFiles = this.groupedContractFiles[this.form.versionCode].files; + const currentVersionFiles = this.groupedContractFiles[String(this.form.versionCode)].files; const fileIndex = currentVersionFiles.findIndex(file => file.fileSort === sortNum); if (fileIndex !== -1) { @@ -824,7 +878,7 @@ export default { delContractFile(id).then(() => { this.$modal.msgSuccess("删除成功"); // 找到当前版本的文件列表并更新 - const currentVersionFiles = this.groupedContractFiles[this.activeContractVersionTab].files; + const currentVersionFiles = this.groupedContractFiles[String(this.activeContractVersionTab)].files; const fileIndex = currentVersionFiles.findIndex(file => file.id === id); if (fileIndex !== -1) { this.$set(currentVersionFiles, fileIndex, {