feat(receiving): 新增批量审核、批量驳回功能及审核状态列

This commit is contained in:
liufumingren 2026-04-30 06:55:00 +08:00
parent 42bf6c7bfa
commit c32d6effb4
3 changed files with 129 additions and 0 deletions

View File

@ -55,6 +55,32 @@ export function batchCancelReceiving(data: any): Promise<any> {
})
}
export function reviewReceiving(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.reviewReceiving',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function rejectReceiving(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.rejectReceiving',
v,
timestamp: new Date().getTime()
},
data: data
})
}
// export function exportReceiving(data: any): Promise<any> {
// return request({
// url: '/system',

View File

@ -19,6 +19,8 @@
完成收货
</el-button>
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
<el-button type="warning" size="small" :disabled="!hasSelection" @click="handleRejectReceiving">批量驳回</el-button>
<el-button type="primary" size="small" :disabled="!hasSelection" :loading="reviewLoading" @click="handleReviewReceiving">批量审核</el-button>
<el-button type="success" size="small" :disabled="selectionRows.length !== 1" :loading="quickPutawayLoading" @click="handleQuickPutaway">快捷入库</el-button>
<el-button type="info" size="small" icon="el-icon-printer" @click="handleOpenPrintDialog" title="打印收货单"
:disabled="!hasSelection" class="toolbar-btn">
@ -65,6 +67,12 @@
</el-tag>
</template>
<template #column-is_review="{ row }">
<el-tag :type="row.is_review === 1 || row.is_review === true ? 'success' : 'info'" size="small">
{{ row.is_review === 1 || row.is_review === true ? '已审核' : '未审核' }}
</el-tag>
</template>
<template #column-delivery_method="{ row }">
<el-tag v-if="row.delivery_method"
:type="deliveryMethodConfig[row.delivery_method as keyof typeof deliveryMethodConfig]?.tagType || 'info'"
@ -256,6 +264,24 @@
<el-button size="small" type="primary" :loading="createLoading" @click="submitCreateReceiving">确定</el-button>
</template>
</el-dialog>
<!-- 驳回收货单对话框 -->
<el-dialog v-model="rejectDialogVisible" title="批量驳回收货单" width="480px" align-center>
<el-form label-width="80px" size="small">
<el-form-item label="驳回理由">
<el-input
v-model="rejectRemark"
type="textarea"
:rows="3"
placeholder="请输入驳回理由(选填,将覆盖原备注)"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button size="small" @click="rejectDialogVisible = false">取消</el-button>
<el-button size="small" type="warning" :loading="rejectLoading" @click="submitRejectReceiving">确认驳回</el-button>
</template>
</el-dialog>
</div>
</template>
@ -1113,6 +1139,82 @@ async function confirmBatchCancel() {
}
}
// 审核收货单相关
const reviewLoading = ref(false)
async function handleReviewReceiving() {
if (!selectionRows.value.length) {
ElMessage.warning('请先选择要审核的收货单')
return
}
try {
await ElMessageBox.confirm(
`确定要批量审核 ${selectionRows.value.length} 个收货单吗?`,
'确认审核',
{ type: 'warning' }
)
} catch {
return
}
reviewLoading.value = true
try {
const ids = selectionRows.value.map(row => row.id)
const res: any = await receivingApi.reviewReceiving({ ids })
if (res && res.code === 200) {
ElMessage.success(`已成功审核 ${res.data?.count ?? ids.length} 个收货单`)
selectionRows.value = []
loadData()
} else {
ElMessage.error(res?.message || '批量审核失败')
}
} catch (e) {
console.error('批量审核出错:', e)
ElMessage.error('审核操作执行失败')
} finally {
reviewLoading.value = false
}
}
// 驳回收货单相关
const rejectDialogVisible = ref(false)
const rejectLoading = ref(false)
const rejectRemark = ref('')
function handleRejectReceiving() {
if (!selectionRows.value.length) {
ElMessage.warning('请先选择要驳回的收货单')
return
}
rejectRemark.value = ''
rejectDialogVisible.value = true
}
async function submitRejectReceiving() {
rejectLoading.value = true
try {
const ids = selectionRows.value.map(row => row.id)
const payload: any = { ids }
if (rejectRemark.value) payload.remark = rejectRemark.value
const res: any = await receivingApi.rejectReceiving(payload)
if (res && res.code === 200) {
ElMessage.success(`已成功驳回 ${res.data?.count ?? ids.length} 个收货单`)
rejectDialogVisible.value = false
selectionRows.value = []
loadData()
} else {
ElMessage.error(res?.message || '驳回失败')
}
} catch (e) {
console.error('驳回收货单出错:', e)
ElMessage.error('驳回操作执行失败')
} finally {
rejectLoading.value = false
}
}
function printReceiving() {
if (!selectionRows.value.length) {
ElMessage.warning('请选择要打印的收货单')

View File

@ -102,6 +102,7 @@ export const receivingColumns = [
{ prop: 'status', label: '收货状态', width: '90', align: 'center' },
{ prop: 'detail_status', label: '匹配状态', width: '90', align: 'center' },
{ prop: 'storage_status', label: '入库状态', width: '90', align: 'center' },
{ prop: 'is_review', label: '审核状态', width: '90', align: 'center' },
{ prop: 'store_name', label: '货主', width: '100' },
{ prop: 'total_items', label: '商品种类', width: '90', align: 'right', sortable: true },
{ prop: 'total_quantity', label: '总数量', width: '90', align: 'right', sortable: true },