快检标准新增
This commit is contained in:
@@ -13,7 +13,13 @@ export const columns: BasicColumn[] = [
|
||||
{ title: '班组', align: 'center', dataIndex: 'workTeam_dictText', width: 80 },
|
||||
{ title: '检验次数', align: 'center', dataIndex: 'inspectTimes', width: 90 },
|
||||
{ title: '检验时间', align: 'center', dataIndex: 'inspectTime', width: 165 },
|
||||
{ title: '检验人', align: 'center', dataIndex: 'inspectorRealname', width: 100 },
|
||||
{
|
||||
title: '检验人',
|
||||
align: 'center',
|
||||
dataIndex: 'inspectorRealname',
|
||||
width: 100,
|
||||
customRender: ({ record }) => record?.inspectorRealname || record?.inspectorUserId_dictText || '',
|
||||
},
|
||||
{ title: '检验类型', align: 'center', dataIndex: 'quickTestTypeName', width: 120 },
|
||||
{ title: '检验结果', align: 'center', dataIndex: 'inspectResult_dictText', width: 90 },
|
||||
{ title: '生产计划号', align: 'center', dataIndex: 'productionPlanNo', width: 120 },
|
||||
|
||||
@@ -48,12 +48,14 @@
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import type { JVxeTableInstance } from '/@/components/jeecg/JVxeTable/types';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { formSchema, lineJVxeColumns } from '../MesXslRubberQuickTestRecord.data';
|
||||
import { saveOrUpdate, queryById, queryLineListByRecordId } from '../MesXslRubberQuickTestRecord.api';
|
||||
import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const { createMessage } = useMessage();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const isDetail = ref(false);
|
||||
const tableReady = ref(false);
|
||||
@@ -86,7 +88,14 @@
|
||||
const m = (mainRaw as any)?.id != null ? mainRaw : (mainRaw as any)?.result ?? mainRaw;
|
||||
const linesRaw = await queryLineListByRecordId({ id: data.record.id });
|
||||
const list = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
|
||||
await setFieldsValue({ ...m });
|
||||
const patch: Recordable = { ...m };
|
||||
if (data?.showFooter && !patch.inspectorRealname && !patch.inspectorUserId) {
|
||||
const user = userStore.getUserInfo || {};
|
||||
patch.inspectorUserId = user.id;
|
||||
patch.inspectorUsername = user.username;
|
||||
patch.inspectorRealname = user.realname;
|
||||
}
|
||||
await setFieldsValue(patch);
|
||||
lineDataSource.value = list || [];
|
||||
} finally {
|
||||
lineLoading.value = false;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
|
||||
import { checkStdName } from './MesXslRubberQuickTestStd.api';
|
||||
|
||||
const numProps = { style: { width: '100%' }, precision: 6 };
|
||||
|
||||
@@ -72,27 +71,8 @@ export const formSchema: FormSchema[] = [
|
||||
label: '实验标准名称',
|
||||
field: 'stdName',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
componentProps: { placeholder: '同租户内不可重复' },
|
||||
dynamicRules: ({ model }) => [
|
||||
{ required: true, message: '请输入实验标准名称' },
|
||||
{
|
||||
validator: async (_rule, value) => {
|
||||
const v = value == null ? '' : String(value).trim();
|
||||
if (!v) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
try {
|
||||
await checkStdName({ stdName: v, dataId: model?.id });
|
||||
return Promise.resolve();
|
||||
} catch (e: any) {
|
||||
const msg = e?.response?.data?.message || e?.message || '实验标准名称已存在';
|
||||
return Promise.reject(msg);
|
||||
}
|
||||
},
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
],
|
||||
slot: 'stdNameDisplay',
|
||||
dynamicDisabled: true,
|
||||
},
|
||||
{
|
||||
label: '实验方法',
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
@ok="handleSubmit"
|
||||
>
|
||||
<BasicForm @register="registerForm">
|
||||
<template #stdNameDisplay="{ model }">
|
||||
<a-input :value="formatStdName(model)" disabled placeholder="选择实验方法和胶料后自动生成" />
|
||||
</template>
|
||||
<template #testMethodPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择实验方法" style="flex: 1" />
|
||||
@@ -129,6 +132,13 @@
|
||||
!unref(isUpdate) ? '新增胶料快检实验标准' : unref(isDetail) ? '实验标准详情' : '编辑胶料快检实验标准',
|
||||
);
|
||||
|
||||
/** 标准名称 = 实验方法名称 + _ + 胶料名称 */
|
||||
function formatStdName(model?: Recordable) {
|
||||
const methodName = String(model?.testMethodName ?? '').trim();
|
||||
const materialName = String(model?.rubberMaterialName ?? '').trim();
|
||||
return methodName && materialName ? `${methodName}_${materialName}` : '';
|
||||
}
|
||||
|
||||
function methodLineToStdRow(ml: Recordable, existing?: Recordable): Recordable {
|
||||
return {
|
||||
dataPointId: ml.dataPointId,
|
||||
@@ -257,11 +267,17 @@
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
if (!values?.testMethodId) {
|
||||
const formVals = getFieldsValue();
|
||||
const stdName = formatStdName(formVals);
|
||||
if (!formVals?.testMethodId) {
|
||||
createMessage.warning('请选择实验方法');
|
||||
return;
|
||||
}
|
||||
if (!stdName) {
|
||||
createMessage.warning('请先选择实验方法和胶料以生成实验标准名称');
|
||||
return;
|
||||
}
|
||||
const values = await validate();
|
||||
const lineRef = lineTableRef.value as any;
|
||||
const tableData = (lineRef?.getTableData?.() || lineDataSource.value || []) as Recordable[];
|
||||
const lineList = tableData
|
||||
@@ -280,7 +296,7 @@
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate({ ...values, lineList }, unref(isUpdate));
|
||||
await saveOrUpdate({ ...values, stdName, lineList }, unref(isUpdate));
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user