feat: 采购申请新增库管'完结'功能(仿出库审批)
- 后端:approve 接口支持 action=close(已通过→已完结 status 1→4),模型 status_text 支持已完结 - 前端:采购申请状态tab加'已完结',已通过单显示'完结'按钮(库管)
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
<el-radio-button :label="1">已通过</el-radio-button>
|
||||
<el-radio-button :label="2">已驳回</el-radio-button>
|
||||
<el-radio-button :label="3">已完成</el-radio-button>
|
||||
<el-radio-button :label="4">已完结</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-button type="primary" :icon="Refresh" @click="fetchData">刷新</el-button>
|
||||
<el-button type="success" :icon="Plus" @click="openCreateDialog">
|
||||
@ -57,6 +58,10 @@
|
||||
<el-button type="success" link size="small" @click="handleApprove(it)">通过</el-button>
|
||||
<el-button type="danger" link size="small" @click="openRejectDialog(it)">驳回</el-button>
|
||||
</template>
|
||||
<!-- ★ 已通过的采购申请:库管可手动完结 -->
|
||||
<template v-else-if="it.status === 1 && canClose">
|
||||
<el-button type="danger" plain link size="small" @click="handleCloseRequest(it)">完结</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -703,10 +708,16 @@ const canApprove = computed(() => {
|
||||
|| userStore.hasPermission('inbound_purchase:operation')
|
||||
})
|
||||
|
||||
// ★ 完结权限:超级管理员 / 库管(采购操作权限)
|
||||
const canClose = computed(() => {
|
||||
return userStore.role === 'SUPER_ADMIN'
|
||||
|| userStore.hasPermission('inbound_purchase:operation')
|
||||
})
|
||||
|
||||
// --- 工具函数 ---
|
||||
const statusTagType = (status: number) => {
|
||||
const map: Record<number, string> = {
|
||||
0: 'warning', 1: 'success', 2: 'danger', 3: 'info'
|
||||
0: 'warning', 1: 'success', 2: 'danger', 3: 'info', 4: 'info'
|
||||
}
|
||||
return map[status] ?? 'info'
|
||||
}
|
||||
@ -1170,6 +1181,26 @@ const handleApprove = async (row: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
// ★ 完结已通过的采购申请(库管)
|
||||
const handleCloseRequest = async (row: any) => {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定强制完结采购申请【${row.request_no}】吗?\n\n` +
|
||||
`此操作将使该单从「已通过」列表中移除,且不可恢复。`,
|
||||
'⚠️ 强制完结确认',
|
||||
{ confirmButtonText: '确认完结', cancelButtonText: '取消', type: 'warning' }
|
||||
)
|
||||
} catch { return }
|
||||
|
||||
try {
|
||||
await approvePurchase(row.id, { action: 'close' })
|
||||
ElMessage.success(`采购申请 ${row.request_no} 已完结`)
|
||||
await fetchData()
|
||||
} catch (err: any) {
|
||||
ElMessage.error(err?.msg || err?.message || '完结失败')
|
||||
}
|
||||
}
|
||||
|
||||
const openRejectDialog = (row: any) => {
|
||||
currentRejectRow.value = row
|
||||
rejectReason.value = ''
|
||||
|
||||
Reference in New Issue
Block a user