From 5f20ec6b4d0869104bcbfc887b92f0e6a3892eac Mon Sep 17 00:00:00 2001 From: panxinyu-YUYwp Date: Mon, 28 Sep 2026 17:22:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=88=E5=90=8C=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD(=E5=AD=98=E6=A1=A3=EF=BC=8C?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E6=94=BE=E5=85=A5=E6=93=8D=E4=BD=9C=E6=A0=8F?= =?UTF-8?q?=E4=B8=AD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/contract/info.vue | 252 ++++++++++++++++------------ 1 file changed, 148 insertions(+), 104 deletions(-) diff --git a/src/views/modules/contract/info.vue b/src/views/modules/contract/info.vue index a39dd69..3fd85fa 100644 --- a/src/views/modules/contract/info.vue +++ b/src/views/modules/contract/info.vue @@ -63,33 +63,47 @@ - + - - - - - - - + @@ -124,6 +138,14 @@ :before-close="beforeCloseContractModal" :close-on-click-modal="false"> + + @@ -309,57 +331,28 @@ 该文件类型不支持预览,请下载后查看 - - - - - - - - - - - - - - - - + + + + + + {{ archiveForm.archivePerson || '-' }} - - + + size="small" style="width: 130px;margin-top: 3px"> + {{ (archiveForm.archiveDate || '').substring(0, 10) || '-' }} - 取消 - 确定 - - - - - -
-
- 存档人 - {{ archiveForm.archivePerson || '-' }} -
-
- 存档日期 - {{ (archiveForm.archiveDate || '').substring(0, 10) || '-' }} -
-
- - 关闭 - + 取消 + 确定 + +
@@ -412,8 +405,6 @@ export default { customerListOptions: [], projectListOptions: [], attachmentList: [], - showAttachmentModal: false, - attachmentDetailList: [], uploadUrl: '', pendingFiles: [], selectedFileNames: '', @@ -426,8 +417,11 @@ export default { previewType: '', previewName: '', showArchiveModal: false, - showArchiveDetail: false, + archiveMode: 'edit', + archiveModalTitle: '', currentArchiveRow: null, + rowAttachmentMap: {}, + rowAttachmentLoading: {}, archiveForm: { archivePerson: '', archiveDate: '' @@ -504,6 +498,7 @@ export default { }, // 查询合同列表 fetchContracts() { + this.rowAttachmentMap = {} this.searchData.page = this.pageIndex this.searchData.limit = this.pageSize contractData(this.searchData).then(({data}) => { @@ -753,6 +748,7 @@ export default { }, closeContractModal() { this.showContractModal = false + this.fetchContracts() this.isEditContract = false this.projectListOptions = [] this.attachmentList = [] @@ -832,25 +828,6 @@ export default { } } }, - // 列表"详情":打开附件详情弹窗并加载该合同附件 - openAttachmentDetail(row) { - this.attachmentDetailList = [] - this.showAttachmentModal = true - this.$http({ - url: this.$http.adornUrl('/sys/oss/list'), - method: 'get', - params: this.$http.adornParams({ - page: 1, - limit: 999, - orderRef1: row.id, - fileType: 'contract' - }) - }).then(({data}) => { - if (data && data.code === 0) { - this.attachmentDetailList = data.page.list - } - }) - }, // 查询该合同的附件列表(每次重新拼 URL,确保带最新的合同ID) fetchAttachments(contractId) { if (!contractId) { @@ -1095,21 +1072,12 @@ export default { } else { this.$message.error((data && data.msg) || '删除失败') } + }).catch(err => { + console.error(err) + this.$message.error('删除失败') }) - }).catch(err => { - console.error(err) - this.$message.error('删除失败') - }) - }, - // 时间格式化显示 - formatDateTime(val) { - if (!val) return '' - let d = new Date(val) - let pad = n => n < 10 ? '0' + n : n - return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate()) + - ' ' + pad(d.getHours()) + ':' + pad(d.getMinutes()) + }).catch(() => {}) }, - // 勾选/取消 存档 handleArchiveChange(checked, row) { if (checked) { this.currentArchiveRow = row @@ -1119,6 +1087,8 @@ export default { archivePerson: this.$store.state.user.userDisplay, archiveDate: d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate()) } + this.archiveMode = 'edit' + this.archiveModalTitle = '存档' this.showArchiveModal = true } else { this.$confirm('确定取消存档吗?', '提示', { type: 'warning' }).then(() => { @@ -1130,6 +1100,7 @@ export default { }).then(({data}) => { if (data && data.code === 0) { this.$message.success('取消存档成功') + this.showArchiveModal = false this.fetchContracts() } else { this.$message.error((data && data.msg) || '操作失败') @@ -1169,11 +1140,53 @@ export default { // 查看存档详情 viewArchiveDetail(row) { + this.archiveMode = 'view' + this.currentArchiveRow = row + this.archiveModalTitle = '存档详情' this.archiveForm = { archivePerson: row.archivePerson || '', archiveDate: row.archiveDate || '' } - this.showArchiveDetail = true + this.showArchiveModal = true + }, + // 操作列"取消存档"入口:复用原有取消逻辑(带二次确认) + cancelArchive(row) { + this.handleArchiveChange(false, row) + }, + // 操作列"存档"入口:复用原有存档逻辑(默认带出登录人+今天,且两项都可改) + openArchiveModal(row) { + this.handleArchiveChange(true, row) + }, + + // 操作列附件下拉:首次悬浮时按合同ID加载附件列表,结果缓存 + loadRowAttachments(row) { + if (!row || !row.id) return + if (this.rowAttachmentMap[row.id] || this.rowAttachmentLoading[row.id]) return + this.$set(this.rowAttachmentLoading, row.id, true) + this.$http({ + url: this.$http.adornUrl('/sys/oss/list'), + method: 'get', + params: this.$http.adornParams({ + page: 1, + limit: 999, + orderRef1: row.id, + fileType: 'contract' + }) + }).then(({data}) => { + this.$set(this.rowAttachmentMap, row.id, + (data && data.code === 0 && data.page.list) ? data.page.list : []) + this.$set(this.rowAttachmentLoading, row.id, false) + }).catch(err => { + console.error(err) + this.$set(this.rowAttachmentMap, row.id, []) + this.$set(this.rowAttachmentLoading, row.id, false) + }) + }, + getRowAttachments(row) { + return (row && this.rowAttachmentMap[row.id]) || [] + }, + isRowAttachmentLoading(row) { + return !!(row && this.rowAttachmentLoading[row.id]) } } } @@ -1220,4 +1233,35 @@ export default { margin-bottom: 10px; vertical-align: middle; } +/* ===== 存档弹窗(存档 / 存档详情共用)===== */ +/* 1) 输入框/日期框缩小到 150px:否则被上面的 170px!important 撑出 250px 的弹窗 */ +.contract-maintenance .el-dialog .el-form.archive-form .el-form-item .el-input, +.contract-maintenance .el-dialog .el-form.archive-form .el-form-item .el-select { + width: 130px !important; +} +/* 2) 解除 180px 的弹窗等宽规则,字段宽度交回弹窗(否则内容区只有 108px,装不下输入框) */ +.contract-maintenance .el-dialog .el-form.archive-form .el-form-item { + width: auto; + margin-right: 0; +} +/* 3) 标签与取值统一字号+行高(都 14px / 32px,与 32px 的小号输入框等高),基线才能完全重合 */ +.contract-maintenance .el-dialog .el-form.archive-form .el-form-item__label, +.contract-maintenance .el-dialog .el-form.archive-form .el-form-item__content { + font-size: 14px; + line-height: 32px; + height: auto; +} +/* 操作列:固定第3、4槽宽度,让整组总宽恒定,各行"编辑"起点才一致 */ +.contract-maintenance td.op-col .cell > a:nth-child(3), +.contract-maintenance td.op-col .cell > span:nth-child(4), +.contract-maintenance td.op-col .cell > .el-dropdown:nth-child(4) { + display: inline-block; + width: 50px; + text-align: center; +} +/* 第4槽改左对齐:无附件/附件 左边缘才重合(居中会把宽度差摊到左边) */ +.contract-maintenance td.op-col .cell > span:nth-child(4), +.contract-maintenance td.op-col .cell > .el-dropdown:nth-child(4) { + text-align: left; +}