|
|
@@ -88,9 +88,41 @@
|
|
|
<el-button type="primary" :loading="flowActing" @click="doSubmitInspection">提交检验结果</el-button>
|
|
|
</el-form>
|
|
|
<div v-if="flowState.canSupervisorApprove || flowState.canSupervisorReturn" class="flow-form">
|
|
|
- <el-button type="success" :loading="flowActing" @click="doApprove">审核通过</el-button>
|
|
|
+ <span class="flow-meta">整批判定 jgpd(可空):</span>
|
|
|
+ <el-input-number v-model="supervisorForm.jgpd" :controls="false" placeholder="可空" style="width: 110px; margin-right: 12px" />
|
|
|
+ <el-button type="success" :loading="flowActing" @click="doApprove(true)">整批合格·通过</el-button>
|
|
|
+ <el-button type="danger" :loading="flowActing" @click="doApprove(false)">整批不合格·转处置</el-button>
|
|
|
<el-button type="warning" :loading="flowActing" @click="doReturn">退回</el-button>
|
|
|
</div>
|
|
|
+ <el-form v-if="flowState.canSubmitDisposition" :inline="true" :model="dispForm" class="flow-form" @submit.prevent>
|
|
|
+ <el-form-item label="处置类型">
|
|
|
+ <el-select v-model="dispForm.dispositionType" placeholder="必选" style="width: 140px">
|
|
|
+ <el-option label="返工 REWORK" value="REWORK" />
|
|
|
+ <el-option label="让步 CONCESSION" value="CONCESSION" />
|
|
|
+ <el-option label="报废 SCRAP" value="SCRAP" />
|
|
|
+ <el-option label="其它 OTHER" value="OTHER" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="处置数量"><el-input-number v-model="dispForm.dispositionQty" :min="0" :controls="false" style="width: 100px" /></el-form-item>
|
|
|
+ <el-form-item label="返工"><el-input-number v-model="dispForm.reworkQty" :min="0" :controls="false" style="width: 90px" /></el-form-item>
|
|
|
+ <el-form-item label="让步"><el-input-number v-model="dispForm.concessionQty" :min="0" :controls="false" style="width: 90px" /></el-form-item>
|
|
|
+ <el-form-item label="报废"><el-input-number v-model="dispForm.scrapQty" :min="0" :controls="false" style="width: 90px" /></el-form-item>
|
|
|
+ <el-form-item label="责任部门"><el-input v-model="dispForm.responsibilityDept" clearable style="width: 130px" /></el-form-item>
|
|
|
+ <el-form-item label="责任人"><el-input v-model="dispForm.responsibleUser" clearable style="width: 110px" /></el-form-item>
|
|
|
+ <el-form-item label="处置意见"><el-input v-model="dispForm.dispositionOpinion" type="textarea" :rows="1" style="width: 220px" /></el-form-item>
|
|
|
+ <el-button type="primary" :loading="flowActing" @click="doSubmitDisposition">提交处置</el-button>
|
|
|
+ </el-form>
|
|
|
+ <div v-if="disposition && disposition.id" class="flow-form">
|
|
|
+ <el-descriptions :column="3" border size="small">
|
|
|
+ <el-descriptions-item label="处置类型">{{ dispTypeText(disposition.dispositionType) }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="处置数量">{{ disposition.dispositionQty ?? '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="返工/让步/报废">{{ disposition.reworkQty ?? 0 }} / {{ disposition.concessionQty ?? 0 }} / {{ disposition.scrapQty ?? 0 }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="责任部门">{{ disposition.responsibilityDept || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="责任人">{{ disposition.responsibleUser || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="处置人">{{ disposition.submittedByName || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="处置意见" :span="3">{{ disposition.dispositionOpinion || '-' }}</el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<el-descriptions :column="3" border size="small">
|
|
|
@@ -164,6 +196,7 @@ import {
|
|
|
returnIpqcInspection,
|
|
|
type IpqcFlowState,
|
|
|
} from '../api/ipqcInspectionFlow';
|
|
|
+import { fetchIpqcDisposition, submitIpqcDisposition, type IpqcDisposition } from '../api/ipqcInspectionDisposition';
|
|
|
|
|
|
const route = useRoute();
|
|
|
const pageTitle = computed(() => (route.meta?.title as string) || '过程检验单列表');
|
|
|
@@ -246,6 +279,8 @@ async function openDetail(row: IpqcInspectionRow) {
|
|
|
detail.value = {};
|
|
|
detailLines.value = [];
|
|
|
flowState.value = {};
|
|
|
+ disposition.value = {};
|
|
|
+ supervisorForm.jgpd = null;
|
|
|
try {
|
|
|
const data = await fetchIpqcInspectionDetail(row.id);
|
|
|
detail.value = data || {};
|
|
|
@@ -260,6 +295,7 @@ async function openDetail(row: IpqcInspectionRow) {
|
|
|
}
|
|
|
if (currentFlowBizId.value != null) {
|
|
|
await loadFlowState(currentFlowBizId.value);
|
|
|
+ await loadDisposition(currentFlowBizId.value);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -278,12 +314,48 @@ const submitForm = reactive<{ jgpd: number | null; jyhgsl: number; jybhgsl: numb
|
|
|
const flowStatusText = computed(() => flowState.value.businessStatus || flowState.value.flowStatus || '未发起');
|
|
|
const flowTagType = computed(() => {
|
|
|
const s = flowState.value.businessStatus;
|
|
|
- if (s === 'APPROVED') return 'success';
|
|
|
+ if (s === 'APPROVED' || s === 'DISPOSED') return 'success';
|
|
|
if (s === 'RETURNED') return 'warning';
|
|
|
+ if (s === 'PENDING_DISPOSITION') return 'danger';
|
|
|
if (s === 'PENDING_REVIEW') return 'primary';
|
|
|
return 'info';
|
|
|
});
|
|
|
|
|
|
+// 主管整批判定表单 + N3 质量处置表单 + 已有处置
|
|
|
+const supervisorForm = reactive<{ jgpd: number | null }>({ jgpd: null });
|
|
|
+const disposition = ref<IpqcDisposition>({});
|
|
|
+const dispForm = reactive<{
|
|
|
+ dispositionType: string;
|
|
|
+ dispositionQty: number | null;
|
|
|
+ reworkQty: number | null;
|
|
|
+ concessionQty: number | null;
|
|
|
+ scrapQty: number | null;
|
|
|
+ responsibilityDept: string;
|
|
|
+ responsibleUser: string;
|
|
|
+ dispositionOpinion: string;
|
|
|
+}>({
|
|
|
+ dispositionType: '',
|
|
|
+ dispositionQty: null,
|
|
|
+ reworkQty: null,
|
|
|
+ concessionQty: null,
|
|
|
+ scrapQty: null,
|
|
|
+ responsibilityDept: '',
|
|
|
+ responsibleUser: '',
|
|
|
+ dispositionOpinion: '',
|
|
|
+});
|
|
|
+
|
|
|
+function dispTypeText(t?: string) {
|
|
|
+ return { REWORK: '返工', CONCESSION: '让步', SCRAP: '报废', OTHER: '其它' }[t || ''] || t || '-';
|
|
|
+}
|
|
|
+
|
|
|
+async function loadDisposition(id: number) {
|
|
|
+ try {
|
|
|
+ disposition.value = (await fetchIpqcDisposition(id)) || {};
|
|
|
+ } catch {
|
|
|
+ disposition.value = {};
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
async function loadFlowState(id: number) {
|
|
|
flowLoading.value = true;
|
|
|
try {
|
|
|
@@ -298,6 +370,7 @@ async function loadFlowState(id: number) {
|
|
|
|
|
|
async function refreshAfterFlow(id: number) {
|
|
|
await loadFlowState(id);
|
|
|
+ await loadDisposition(id);
|
|
|
await loadList();
|
|
|
}
|
|
|
|
|
|
@@ -336,21 +409,65 @@ async function doSubmitInspection() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-async function doApprove() {
|
|
|
+async function doApprove(qualified: boolean) {
|
|
|
+ const id = currentFlowBizId.value;
|
|
|
+ if (!id) return;
|
|
|
+ const tip = qualified ? '确认整批合格并结束流程?' : '确认整批不合格并转质量处置?';
|
|
|
+ try {
|
|
|
+ await ElMessageBox.confirm(tip, '整批判定', { type: 'warning' });
|
|
|
+ } catch {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ flowActing.value = true;
|
|
|
+ try {
|
|
|
+ await approveIpqcInspection(id, qualified, supervisorForm.jgpd);
|
|
|
+ ElMessage.success(qualified ? '整批合格,流程完成' : '整批不合格,已转质量处置');
|
|
|
+ await refreshAfterFlow(id);
|
|
|
+ } catch (e: any) {
|
|
|
+ ElMessage.error(e?.message || '审核失败');
|
|
|
+ } finally {
|
|
|
+ flowActing.value = false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+async function doSubmitDisposition() {
|
|
|
const id = currentFlowBizId.value;
|
|
|
if (!id) return;
|
|
|
+ if (!dispForm.dispositionType) {
|
|
|
+ ElMessage.warning('请选择处置类型');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!dispForm.dispositionOpinion || !dispForm.dispositionOpinion.trim()) {
|
|
|
+ ElMessage.warning('处置意见必填');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const sub = (dispForm.reworkQty ?? 0) + (dispForm.concessionQty ?? 0) + (dispForm.scrapQty ?? 0);
|
|
|
+ if (dispForm.dispositionQty != null && sub > dispForm.dispositionQty) {
|
|
|
+ ElMessage.warning('返工+让步+报废之和不能大于处置数量');
|
|
|
+ return;
|
|
|
+ }
|
|
|
try {
|
|
|
- await ElMessageBox.confirm('确认审核通过并结束流程?', '审核通过', { type: 'warning' });
|
|
|
+ await ElMessageBox.confirm('确认提交质量处置并结束流程?', '提交处置', { type: 'warning' });
|
|
|
} catch {
|
|
|
return;
|
|
|
}
|
|
|
flowActing.value = true;
|
|
|
try {
|
|
|
- await approveIpqcInspection(id);
|
|
|
- ElMessage.success('审核通过,流程完成');
|
|
|
+ await submitIpqcDisposition({
|
|
|
+ id,
|
|
|
+ dispositionType: dispForm.dispositionType,
|
|
|
+ dispositionQty: dispForm.dispositionQty,
|
|
|
+ reworkQty: dispForm.reworkQty,
|
|
|
+ concessionQty: dispForm.concessionQty,
|
|
|
+ scrapQty: dispForm.scrapQty,
|
|
|
+ dispositionOpinion: dispForm.dispositionOpinion,
|
|
|
+ responsibilityDept: dispForm.responsibilityDept || undefined,
|
|
|
+ responsibleUser: dispForm.responsibleUser || undefined,
|
|
|
+ });
|
|
|
+ ElMessage.success('处置已提交,流程完成');
|
|
|
await refreshAfterFlow(id);
|
|
|
} catch (e: any) {
|
|
|
- ElMessage.error(e?.message || '审核通过失败');
|
|
|
+ ElMessage.error(e?.message || '提交处置失败');
|
|
|
} finally {
|
|
|
flowActing.value = false;
|
|
|
}
|