From ec0523cbeadf38c554efeac16b50b3dcb1c625da Mon Sep 17 00:00:00 2001 From: chenhao Date: Fri, 14 Nov 2025 10:25:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(order):=E4=BC=98=E5=8C=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E8=AF=A6=E6=83=85=E5=90=88=E5=90=8C=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E9=80=BB=E8=BE=91-=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=A8=A1=E6=9D=BF=E6=8C=89=E9=92=AE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=B8=8E=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91-=20?= =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=90=88=E5=90=8C=E6=96=87=E4=BB=B6=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E9=A1=B5=E5=B1=95=E7=A4=BA=E6=96=B9=E5=BC=8F=20-=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BD=93=E5=89=8D=E5=90=88=E5=90=8C=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8E=E5=A4=87=E4=BB=BD=E6=96=87=E4=BB=B6=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=B1=9E=E6=80=A7=20-=20=E5=AE=8C=E5=96=84=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E7=89=88=E6=9C=AC=E5=8F=B7=E5=A7=8B=E7=BB=88?= =?UTF-8?q?=E4=B8=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=B1=BB=E5=9E=8B=20-=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0canUpdate=E3=80=81uploadFinalFile=E3=80=81upd?= =?UTF-8?q?ateFile=E7=8A=B6=E6=80=81=E6=8E=A7=E5=88=B6=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=20-=20=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9D=83=E9=99=90=E5=88=A4=E6=96=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20-=20=E5=85=BC=E5=AE=B9=E5=A4=84=E7=90=86=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=83=85=E5=86=B5?= =?UTF-8?q?=EF=BC=8C=E9=BB=98=E8=AE=A4=E8=AE=BE=E7=BD=AE=E4=B8=BA1-?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E5=88=97=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=91=E5=AE=9A=E9=97=AE=E9=A2=98=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E5=93=8D=E5=BA=94=E5=BC=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/project/order/OrderDetail.vue | 194 +++++++++++------- 1 file changed, 124 insertions(+), 70 deletions(-) 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, {