feat: 新增产品工艺管理与工序审核功能
- 新增产品工艺(product_process)及明细(product_process_item)数据模型 - 新增工序审核开关(need_audit)与审核角色(audit_role)字段 - 新增待审核签字页面与路由 - 优化 WMS/MES 接口交互,增加业务错误处理与友好提示 - 补充库存过滤逻辑,避免返回已出库 SN 数据 - 调整默认查询时间范围为近一个月,优化用户体验
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-alert type="info" :closable="false" style="margin-bottom:12px"
|
||||
title="待审核签字:列出已满足前置签字(操作工已签;若需检验则检验员已 OK)的工艺步骤,由审核人按工艺配置的审核角色(如班组长/工艺员)复核。审核通过=放行;审核不通过=退回操作工重做(撤销该步骤已有的操作工/检验员签字,进入新一轮)。" />
|
||||
|
||||
<el-form inline>
|
||||
<el-form-item label="工单号"><el-input v-model="orderNo" placeholder="可空=全部" clearable style="width:200px" @keyup.enter="load" /></el-form-item>
|
||||
<el-form-item label="工件SN"><el-input v-model="sn" placeholder="可空=全部" clearable style="width:200px" @keyup.enter="load" /></el-form-item>
|
||||
<el-form-item><el-button type="primary" :loading="loading" @click="load">查询</el-button></el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin-top:12px">
|
||||
<template #header><div class="hd"><span class="t">待审核任务</span><span class="sub">共 {{ total }} 条</span></div></template>
|
||||
<el-table :data="list" border size="small" v-loading="loading" empty-text="暂无待审核任务">
|
||||
<el-table-column prop="sn" label="工件SN" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="orderNo" label="工单号" min-width="170" show-overflow-tooltip />
|
||||
<el-table-column prop="stationNo" label="工位" width="80" align="center" />
|
||||
<el-table-column prop="stepName" label="工序" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="操作工" min-width="120">
|
||||
<template #default="{ row }">{{ row.operatorSigner || row.signedBy || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作工签字时间" min-width="160">
|
||||
<template #default="{ row }">{{ row.operatorSignedAt || row.signedAt || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="200" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="success" size="small" :loading="row._doing" @click="approve(row)">审核通过</el-button>
|
||||
<el-button type="danger" size="small" :loading="row._doing" @click="reject(row)">退回重做</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination v-if="total > pageSize" style="margin-top:12px;justify-content:flex-end"
|
||||
layout="prev,pager,next,total" :total="total" :page-size="pageSize"
|
||||
:current-page="page" @current-change="onPage" />
|
||||
</el-card>
|
||||
</div>
|
||||
<PageHelp :data="helpAudit" page="AuditPending" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import request from '../utils/request'
|
||||
import PageHelp from '../components/PageHelp.vue'
|
||||
import { helpAudit } from '../help'
|
||||
|
||||
const list = ref([])
|
||||
const total = ref(0)
|
||||
const page = ref(1)
|
||||
const pageSize = ref(50)
|
||||
const loading = ref(false)
|
||||
const orderNo = ref('')
|
||||
const sn = ref('')
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await request.get('/signs/audit-pending', {
|
||||
params: { orderNo: orderNo.value, sn: sn.value, page: page.value, pageSize: pageSize.value }
|
||||
})
|
||||
list.value = (data.list || []).map((r) => Object.assign({}, r, { _doing: false }))
|
||||
total.value = data.total || 0
|
||||
} catch {
|
||||
list.value = []
|
||||
total.value = 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onPage(p) {
|
||||
page.value = p
|
||||
load()
|
||||
}
|
||||
|
||||
async function approve(row) {
|
||||
row._doing = true
|
||||
try {
|
||||
await request.post('/signs/auditor', {
|
||||
sn: row.sn, orderNo: row.orderNo, stationNo: row.stationNo, stepId: row.stepId, result: 'OK', remark: ''
|
||||
})
|
||||
ElMessage.success('审核通过')
|
||||
load()
|
||||
} catch {
|
||||
/* 拦截器已提示 */
|
||||
} finally {
|
||||
row._doing = false
|
||||
}
|
||||
}
|
||||
|
||||
async function reject(row) {
|
||||
let remark = ''
|
||||
try {
|
||||
const { value } = await ElMessageBox.prompt('退回原因(将记录并退回操作工重做)', '退回重做', {
|
||||
confirmButtonText: '确认退回', cancelButtonText: '取消', inputType: 'textarea',
|
||||
inputValidator: (v) => (v && v.trim() ? true : '请填写退回原因')
|
||||
})
|
||||
remark = v.trim()
|
||||
} catch {
|
||||
return // 取消
|
||||
}
|
||||
row._doing = true
|
||||
try {
|
||||
await request.post('/signs/auditor', {
|
||||
sn: row.sn, orderNo: row.orderNo, stationNo: row.stationNo, stepId: row.stepId, result: 'NG', remark
|
||||
})
|
||||
ElMessage.success('已退回重做')
|
||||
load()
|
||||
} catch {
|
||||
/* 拦截器已提示 */
|
||||
} finally {
|
||||
row._doing = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.hd { display: flex; align-items: baseline; gap: 12px; }
|
||||
.hd .t { font-size: 16px; font-weight: 600; }
|
||||
.hd .sub { color: #6b7280; font-size: 13px; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user