feat: 采购申请被驳回单支持「修改重提」——预填原单内容改后重新提交
This commit is contained in:
@ -54,6 +54,7 @@
|
||||
<el-table-column label="操作" width="110" align="center">
|
||||
<template #default="{ row: it }">
|
||||
<el-button type="primary" link size="small" @click="openDetailDialog(it)">详情</el-button>
|
||||
<el-button v-if="it.status === 2" type="warning" link size="small" @click="handleReapply(it)">修改重提</el-button>
|
||||
<template v-if="it.status === 0 && canApprove">
|
||||
<el-button type="success" link size="small" @click="handleApprove(it)">通过</el-button>
|
||||
<el-button type="danger" link size="small" @click="openRejectDialog(it)">驳回</el-button>
|
||||
@ -860,6 +861,38 @@ const openCreateDialog = (prefill?: { materialId?: number; name?: string; spec?:
|
||||
}
|
||||
|
||||
// 获取当前用户上一次采购申请的审批人作为默认值
|
||||
// ★ 被驳回单"修改重提":预填原单内容到新建弹窗,改后重新提交(生成新单,原驳回单保留)
|
||||
const handleReapply = (row: any) => {
|
||||
dialogTitle.value = `重新申请(驳回单 ${row.request_no})`
|
||||
form.value = {
|
||||
approver_id: row.approver_id ?? undefined,
|
||||
remark: ''
|
||||
}
|
||||
|
||||
let imgList: string[] = []
|
||||
if (Array.isArray(row.images)) imgList = row.images
|
||||
else if (row.images) { try { imgList = JSON.parse(row.images) } catch (e) { imgList = [] } }
|
||||
|
||||
const firstRow = createEmptyFormItem()
|
||||
firstRow.materialBaseId = row.base_id ?? null
|
||||
firstRow.name = row.name || ''
|
||||
firstRow.spec_model = row.spec_model || ''
|
||||
firstRow.quantity = Number(row.quantity || 1)
|
||||
firstRow.purchase_date = row.purchase_date || new Date().toISOString().split('T')[0]
|
||||
firstRow.unit_price = row.unit_price != null ? row.unit_price : undefined
|
||||
firstRow.total_price = row.total_price != null ? row.total_price : undefined
|
||||
firstRow.tax_rate = row.tax_rate ?? 0
|
||||
firstRow.supplier_link = row.supplier_link || ''
|
||||
firstRow.remark = row.remark || ''
|
||||
firstRow.images = imgList
|
||||
firstRow.fileList = imgList.map((u: string) => ({ name: (u.split('/').pop() || '图片'), url: u }))
|
||||
materialOptions.value = row.base_id
|
||||
? [{ id: row.base_id, name: row.name || '', spec_model: row.spec_model || '' }]
|
||||
: []
|
||||
formItems.value = [firstRow]
|
||||
formDialogVisible.value = true
|
||||
}
|
||||
|
||||
const fetchDefaultApprover = async () => {
|
||||
try {
|
||||
const res: any = await getPurchaseList({ page: 1, limit: 1, status: undefined })
|
||||
|
||||
Reference in New Issue
Block a user