优化价格审核状态更新逻辑

- 修改 Prices.vue 中的状态更新按钮,增加对已拒绝状态的处理,允许重新审核。
- 更新批量状态更新功能,支持同时处理待审核和已拒绝的价格。
- 调整确认提示信息,确保用户清晰了解操作的价格数量和状态。
This commit is contained in:
wood chen 2025-03-18 03:47:22 +08:00
parent b55c521403
commit 5384e515ac

View File

@ -214,16 +214,16 @@
</el-icon> </el-icon>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-tooltip :content="row.status === 'pending' ? '通过审核' : '已审核'" placement="top"> <el-tooltip :content="row.status === 'pending' ? '通过审核' : (row.status === 'rejected' ? '重新审核通过' : '已审核')" placement="top">
<el-button type="success" link @click="updateStatus(row.id, 'approve')" <el-button type="success" link @click="updateStatus(row.id, 'approved')"
:disabled="row.status !== 'pending'"> :disabled="row.status !== 'pending' && row.status !== 'rejected'">
<el-icon> <el-icon>
<Check /> <Check />
</el-icon> </el-icon>
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-tooltip :content="row.status === 'pending' ? '拒绝审核' : '已审核'" placement="top"> <el-tooltip :content="row.status === 'pending' ? '拒绝审核' : '已审核'" placement="top">
<el-button type="danger" link @click="updateStatus(row.id, 'rejecte')" <el-button type="danger" link @click="updateStatus(row.id, 'rejected')"
:disabled="row.status !== 'pending'"> :disabled="row.status !== 'pending'">
<el-icon> <el-icon>
<Close /> <Close />
@ -964,17 +964,26 @@ const batchUpdateStatus = async (status) => {
return return
} }
// let statusFilter = ['pending']
const pendingPrices = selectedPrices.value.filter(price => price.status === 'pending') let statusLabel = '待审核'
if (!pendingPrices.length) {
ElMessage.warning('选中的价格中没有待审核的项目') //
if (status === 'approved') {
statusFilter = ['pending', 'rejected']
statusLabel = '待审核或已拒绝'
}
//
const filteredPrices = selectedPrices.value.filter(price => statusFilter.includes(price.status))
if (!filteredPrices.length) {
ElMessage.warning(`选中的价格中没有${statusLabel}的项目`)
return return
} }
try { try {
// //
await ElMessageBox.confirm( await ElMessageBox.confirm(
`确定要${status === 'approved' ? '通过' : '拒绝'}选中的 ${pendingPrices.length} 条待审核价格吗?`, `确定要${status === 'approved' ? '通过' : '拒绝'}选中的 ${filteredPrices.length}${statusLabel}价格吗?`,
'提示', '提示',
{ {
confirmButtonText: '确定', 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 }) 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() await loadPrices()
// 使 // 使