From 49d8f1b359640bc6f4e54855a418b91a206c3b30 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Thu, 18 Jun 2026 13:21:04 +0800 Subject: [PATCH] =?UTF-8?q?2026-06-18=20=E6=89=93=E6=A0=B7=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=A2=9E=E5=8A=A0=E2=80=9C=E6=89=B9=E6=AC=A1=E5=8F=B7?= =?UTF-8?q?=E2=80=9D=E5=92=8C=E3=80=90=E6=89=B9=E9=87=8F=E4=B8=8B=E8=BE=BE?= =?UTF-8?q?=E3=80=91=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/proofing/requestForProofing.vue | 149 +++++++++++++++--- 1 file changed, 123 insertions(+), 26 deletions(-) diff --git a/src/views/modules/proofing/requestForProofing.vue b/src/views/modules/proofing/requestForProofing.vue index cd38531..e2e4120 100644 --- a/src/views/modules/proofing/requestForProofing.vue +++ b/src/views/modules/proofing/requestForProofing.vue @@ -8,6 +8,9 @@ + + + @@ -107,6 +110,14 @@ 搜索 流程关闭 + + 批量下达 + @@ -956,7 +967,10 @@ export default { } }, "searchData.proofingNo"(newVal, oldVal) { - this.searchData.proofingNo = newVal.toUpperCase() + this.searchData.proofingNo = (newVal || '').toUpperCase() + }, + "searchData.proofingBatchNo"(newVal, oldVal) { + this.searchData.proofingBatchNo = (newVal || '').toUpperCase() }, 'modalFlag'(newVal, oldVal){ if (newVal === false){ @@ -1071,6 +1085,7 @@ export default { approverName: '', priorityLevel: '', proofingNo: '', + proofingBatchNo: '', customerPartNo: '', finalPartNo: '', page: 1, @@ -1276,6 +1291,24 @@ export default { fixed: '', columnWidth: 120 }, + { + userId: this.$store.state.user.name, + functionId: 103001, + serialNumber: '103001Table1ProofingBatchNo', + tableId: '103001Table1', + tableName: '打样信息表', + columnProp: 'proofingBatchNo', + headerAlign: 'center', + align: 'center', + columnLabel: '批次号', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 140 + }, { userId: this.$store.state.user.name, functionId: 103001, @@ -2279,6 +2312,7 @@ export default { rejectVisible: false, rejectOpinion: '', submitLoading: false, + batchIssuingLoading: false, detailVisible: false, no: 1, size: 20, @@ -2364,6 +2398,7 @@ export default { this.dataListLoading = false }) } else if (this.$route.params.proofingNo) { + this.searchData.proofingBatchNo = '' this.searchData.proofingNo = this.$route.params.proofingNo this.getDataList(); setTimeout(() => { @@ -2484,6 +2519,7 @@ export default { if (localStorage.getItem('proofingData') !== undefined) { let data = JSON.parse(localStorage.getItem('proofingData')); if (data) { + this.searchData.proofingBatchNo = '' this.searchData.proofingNo = data.proofingNo } localStorage.removeItem('proofingData'); @@ -2819,7 +2855,14 @@ export default { saveProofing() { proofingInformationSave(this.modalData).then(({data}) => { if (data && data.code === 0) { - this.searchData.proofingNo = data.proofingNo + if (data.proofingBatchNo) { + this.searchData.proofingBatchNo = data.proofingBatchNo + this.searchData.proofingNo = '' + } else { + this.searchData.proofingNo = data.proofingNo + this.searchData.proofingBatchNo = '' + } + this.pageIndex = 1 this.getDataList() this.modalFlag = false this.$message.success('操作成功') @@ -2965,6 +3008,46 @@ export default { }) }).catch(() => {}) }, + batchIssueModal() { + const draftRows = this.proofingSelections.filter(row => row.proofingStatus === '草稿') + if (draftRows.length === 0) { + this.$message.warning('请勾选状态为"草稿"的单据!') + return + } + this.$confirm(`确定下达这 ${draftRows.length} 条打样单?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(async () => { + this.batchIssuingLoading = true + let successCount = 0 + const failNos = [] + try { + for (let i = 0; i < draftRows.length; i++) { + const row = draftRows[i] + const success = await this.issueSingleProofing(row, 'C', false) + if (success) { + successCount++ + } else { + failNos.push(row.proofingNo) + } + } + this.getDataList() + this.modalFlag = false + if (failNos.length === 0) { + this.$message.success(`打样单已下达(${successCount}条)`) + } else if (successCount === 0) { + this.$message.error('批量下达失败,请重试') + } else { + const failPreview = failNos.slice(0, 5).join('、') + const extraMsg = failNos.length > 5 ? ' 等' : '' + this.$message.warning(`已下达${successCount}条,失败${failNos.length}条(${failPreview}${extraMsg})`) + } + } finally { + this.batchIssuingLoading = false + } + }).catch(() => {}) + }, selectionProofing(val) { this.proofingSelections = val @@ -3689,22 +3772,34 @@ export default { } }, updateModalStatus(row, status) { - if (this.issuingSet[row.proofingNo]) return - this.$set(this.issuingSet, row.proofingNo, true) this.$confirm(`是否确认下达?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(async () => { - if (!row.proofingAmount||row.proofingAmount===0){ - if (row.finalPartNo){ + const success = await this.issueSingleProofing(row, status, true) + if (success) { + this.getDataList() + this.modalFlag = false + this.$message.success('打样单已下达') + } + }).catch(() => {}) + }, + async issueSingleProofing(row, status, showErrorAlert = true) { + if (this.issuingSet[row.proofingNo]) { + return false + } + this.$set(this.issuingSet, row.proofingNo, true) + try { + if (!row.proofingAmount || row.proofingAmount === 0) { + if (row.finalPartNo) { let params = { configurationId: '*', userName: this.$store.state.user.name, partNo: row.finalPartNo, site: this.$store.state.user.site } - const {data} = await queryPartUnitCostList(params); + const {data} = await queryPartUnitCostList(params) if (data && data.code === 0 && data.rows.length > 0) { let unitPrice = +data.rows[0].inventoryValue row.proofingAmount = unitPrice * this.modalData.proofingNumber @@ -3718,8 +3813,8 @@ export default { limit: 5, page: 1, } - const {data} = await partInformationSearch(params); - if (data && data.code === 0 && data.page.list.length > 0){ + const {data} = await partInformationSearch(params) + if (data && data.code === 0 && data.page.list.length > 0) { row.proofingAmount = data.page.list[0].estimatedMaterialCost * this.modalData.proofingNumber } else { row.proofingAmount = 0 @@ -3727,26 +3822,28 @@ export default { } } let params = JSON.parse(JSON.stringify(row)) - params.proofingResultStatus = status; - params.proofingStatus = '下达'; + params.proofingResultStatus = status + params.proofingStatus = '下达' params.userName = this.$store.state.user.name params.menuId = this.$route.meta.menuId - proofingInformationEditStatus(params).then(({data}) => { - if (data && data.code === 0) { - this.getDataList() - this.modalFlag = false - this.$message.success('打样单已下达') - } else { - this.$alert(data.msg, '错误', { - confirmButtonText: '确定' - }) - } - }).finally(() => { - this.$set(this.issuingSet, row.proofingNo, false) - }) - }).catch(() => { + const {data} = await proofingInformationEditStatus(params) + if (data && data.code === 0) { + return true + } + if (showErrorAlert) { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + return false + } catch (error) { + if (showErrorAlert) { + this.$message.error(error.message || '下达失败') + } + return false + } finally { this.$set(this.issuingSet, row.proofingNo, false) - }) + } }, searchDelegateAccessByUser() { // 角色 ROO7 的用户