diff --git a/inventory-web/src/api/scrap.ts b/inventory-web/src/api/scrap.ts index d73f864..946c3b5 100644 --- a/inventory-web/src/api/scrap.ts +++ b/inventory-web/src/api/scrap.ts @@ -26,3 +26,78 @@ export function getScrapRecords(params: any) { params }) } + +// ========================================== +// 报废申请/审批/执行(新流程,镜像出/借库) +// ========================================== + +// 4. 提交报废申请 +export function submitScrapRequest(data: { + items: Array<{ + source_table: string + stock_id: number + scrap_qty: number + name?: string + spec_model?: string + sku?: string + location?: string + batch_number?: string + }> + remark?: string + approver_id?: number | null + allowed_approvers?: Array<{ type: string; value: any }> +}) { + return request({ + url: '/v1/scrap/request', + method: 'post', + data + }) +} + +// 5. 提交前预检:所选物料是否需要审批 +export function checkScrapApproval(data: { items: Array<{ name?: string; spec_model?: string; base_id?: number }> }) { + return request({ + url: '/v1/scrap/request/check-approval', + method: 'post', + data + }) +} + +// 6. 报废申请列表(scope: mine | pending | executable | all) +export function getScrapApprovals(params: { + scope?: 'mine' | 'pending' | 'executable' | 'all' + status?: number | '' + page?: number + limit?: number +}) { + return request({ + url: '/v1/scrap/request', + method: 'get', + params + }) +} + +// 7. 报废申请详情 +export function getScrapApprovalDetail(id: number) { + return request({ + url: `/v1/scrap/request/${id}`, + method: 'get' + }) +} + +// 8. 审批(通过/驳回) +export function approveScrapRequest(id: number, data: { action: 'approve' | 'reject'; reject_reason?: string }) { + return request({ + url: `/v1/scrap/request/${id}/approve`, + method: 'patch', + data + }) +} + +// 9. 按单报废执行(扣减库存) +export function executeScrapByRequest(id: number) { + return request({ + url: `/v1/scrap/request/${id}/execute`, + method: 'post' + }) +} diff --git a/inventory-web/src/router/index.ts b/inventory-web/src/router/index.ts index c98cd41..7b60018 100644 --- a/inventory-web/src/router/index.ts +++ b/inventory-web/src/router/index.ts @@ -262,6 +262,18 @@ const routes: Array = [ name: 'ScrapCreate', component: () => import('@/views/operation/scrap/create.vue'), meta: { title: '新建报废' } + }, + { + path: 'apply', + name: 'ScrapApply', + component: () => import('@/views/operation/scrap/apply/index.vue'), + meta: { title: '报废申请' } + }, + { + path: 'approval', + name: 'ScrapApproval', + component: () => import('@/views/operation/scrap/approval/index.vue'), + meta: { title: '报废审批' } } ] }, diff --git a/inventory-web/src/views/operation/scrap/apply/index.vue b/inventory-web/src/views/operation/scrap/apply/index.vue new file mode 100644 index 0000000..eca669e --- /dev/null +++ b/inventory-web/src/views/operation/scrap/apply/index.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/inventory-web/src/views/operation/scrap/approval/index.vue b/inventory-web/src/views/operation/scrap/approval/index.vue new file mode 100644 index 0000000..6bee467 --- /dev/null +++ b/inventory-web/src/views/operation/scrap/approval/index.vue @@ -0,0 +1,342 @@ + + + + +