diff --git a/src/views/qms/inspection/inspectionJob/addForm.vue b/src/views/qms/inspection/inspectionJob/addForm.vue index bfe5c5543..d1217fd2b 100644 --- a/src/views/qms/inspection/inspectionJob/addForm.vue +++ b/src/views/qms/inspection/inspectionJob/addForm.vue @@ -18,23 +18,19 @@ :is-col="true" @opensearchTable="opensearchTable" /> +
包装列表
- - - - -
+ +
@@ -715,17 +711,26 @@ const validateForm = (formRef) => { return false }) } - +const tableFormRef = ref() const submitForm = async () => { try { console.log(data.value.subList) - // const validateForm1 = await validateForm(formMainRef.value) const elForm = unref(formMainRef)?.getElFormRef() // 校验表单 if (!elForm) return const valid = await elForm.validate() if (!valid) return - // const bol1 = await validateForm(formProcessRef.value) + // 校验包装列表 + const validateForm1 = await tableFormRef.value.validateForm() + if (!validateForm1) return + let number = 0 + data.value.packageVOList.forEach(cur=>{ + number += parseFloat(cur.sampleAmount) + }) + if(number > data.value.sampleTotalAmount){ + message.error(`采样数量之和不可以大于总数量`) + return + } const bol2 = await validateForm(formFeaturesRef.value) if (!bol2) { message.error(`模板中有检验工序和检验特性未填写完全`) @@ -785,7 +790,6 @@ const submitForm = async () => { message.error('检验特性中有开始时间大于结束时间') return; } - return; if (formType.value == 'create') { // 主子表——提交请求 emit('submitForm', formType.value, data.value) diff --git a/src/views/qms/inspection/inspectionJob/detail.vue b/src/views/qms/inspection/inspectionJob/detail.vue index 5c401950d..cb2d9d51c 100644 --- a/src/views/qms/inspection/inspectionJob/detail.vue +++ b/src/views/qms/inspection/inspectionJob/detail.vue @@ -110,11 +110,11 @@
diff --git a/src/views/qms/inspection/inspectionJob/inspectionJobMain.data.ts b/src/views/qms/inspection/inspectionJob/inspectionJobMain.data.ts index 2b3f7af27..cfbacc86e 100644 --- a/src/views/qms/inspection/inspectionJob/inspectionJobMain.data.ts +++ b/src/views/qms/inspection/inspectionJob/inspectionJobMain.data.ts @@ -2,6 +2,7 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter2 } from '@/utils/formatTime' import { validateHanset, validateEmail } from '@/utils/validator' import { dateFormatter } from '@/utils/formatTime' +import { validateTwoNum } from '@/utils/validator' const { t } = useI18n() // 国际化 import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' const resultEntryMethodList = getStrDictOptions(DICT_TYPE.INSPECTION_CHARACTERISTICS_RESULT_ENTRY) @@ -484,11 +485,11 @@ export const InspectionJobDetail = useCrudSchemas(reactive([ sort: 'custom', },{ label: '检验方法', - field: 'inspectionJobCharacteristicsRespVO.inspectionMethodName', + field: 'inspectionJobCharacteristicsRespVO.inspectionMethodCode', sort: 'custom', },{ label: '采样过程编码', - field: 'inspectionJobCharacteristicsRespVO.inspectionMethod', + field: 'inspectionJobCharacteristicsRespVO.samplingProcessCode', sort: 'custom', },{ label: '动态修改规则编码', @@ -587,3 +588,8 @@ export const InspectionJobPackage = useCrudSchemas(reactive([ isSearch: true, }, ])) +//表单校验 +export const InspectionJobPackageRules = reactive({ + sampleAmount: [required, + { validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}] +})