From 5384e515ac97e8a85b2625ae7fd3e12f1028be1d Mon Sep 17 00:00:00 2001 From: wood chen Date: Tue, 18 Mar 2025 03:47:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=B7=E6=A0=BC=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 Prices.vue 中的状态更新按钮,增加对已拒绝状态的处理,允许重新审核。 - 更新批量状态更新功能,支持同时处理待审核和已拒绝的价格。 - 调整确认提示信息,确保用户清晰了解操作的价格数量和状态。 --- frontend/src/views/Prices.vue | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/frontend/src/views/Prices.vue b/frontend/src/views/Prices.vue index 4fc7671..d6931a7 100644 --- a/frontend/src/views/Prices.vue +++ b/frontend/src/views/Prices.vue @@ -214,16 +214,16 @@ - - + + - @@ -964,17 +964,26 @@ const batchUpdateStatus = async (status) => { return } - // 过滤出待审核的价格 - const pendingPrices = selectedPrices.value.filter(price => price.status === 'pending') - if (!pendingPrices.length) { - ElMessage.warning('选中的价格中没有待审核的项目') + let statusFilter = ['pending'] + let statusLabel = '待审核' + + // 如果是通过状态,也可以选择已拒绝的价格 + if (status === 'approved') { + statusFilter = ['pending', 'rejected'] + statusLabel = '待审核或已拒绝' + } + + // 过滤出符合条件的价格 + const filteredPrices = selectedPrices.value.filter(price => statusFilter.includes(price.status)) + if (!filteredPrices.length) { + ElMessage.warning(`选中的价格中没有${statusLabel}的项目`) return } try { // 确认操作 await ElMessageBox.confirm( - `确定要${status === 'approved' ? '通过' : '拒绝'}选中的 ${pendingPrices.length} 条待审核价格吗?`, + `确定要${status === 'approved' ? '通过' : '拒绝'}选中的 ${filteredPrices.length} 条${statusLabel}价格吗?`, '提示', { confirmButtonText: '确定', @@ -984,7 +993,7 @@ const batchUpdateStatus = async (status) => { ) // 批量更新状态 - for (const price of pendingPrices) { + for (const price of filteredPrices) { await axios.put(`/api/prices/${price.id}/status`, { status }) } @@ -1083,7 +1092,7 @@ const approveAllPending = async () => { ) // 批量更新所有待审核价格的状态 - const response = await axios.put('/api/prices/approve-all', { status: 'approved' }) + const response = await axios.put('/api/prices/approve-all', { action: 'approve' }) await loadPrices() // 使用后端返回的实际审核数量