|
|
@ -522,6 +522,10 @@ const buttonBaseClick =async(val) => { |
|
|
|
// await InspectionJobMainApi.abandonInspectionJobMain(data.value.id) |
|
|
|
dialogVisible.value = false |
|
|
|
} |
|
|
|
// 暂存 |
|
|
|
else if (val == 'staging') { |
|
|
|
staging() |
|
|
|
} |
|
|
|
} |
|
|
|
// 传递给父类 |
|
|
|
const emit = defineEmits(['submitForm', 'searchTableSuccess']) |
|
|
@ -661,12 +665,136 @@ const submitForm = async () => { |
|
|
|
console.log(111) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const staging = async () => { |
|
|
|
try { |
|
|
|
console.log(data.value.subList) |
|
|
|
const elForm = unref(formMainRef)?.getElFormRef() |
|
|
|
// 校验表单 |
|
|
|
if (!elForm) return |
|
|
|
const valid = await elForm.validate() |
|
|
|
if (!valid) return |
|
|
|
// 校验包装列表 |
|
|
|
|
|
|
|
console.log(11,data.value.packageList) |
|
|
|
if(data.value.packageList?.length>0){ |
|
|
|
const validateForm1 = await tableFormRef.value.validateForm() |
|
|
|
if (!validateForm1) return |
|
|
|
let isPass = data.value.packageList.some(cur=>parseFloat(cur.sampleAmount)>parseFloat(cur.amount)) |
|
|
|
if(isPass){ |
|
|
|
message.error(`采样数量不能大于数量`) |
|
|
|
return |
|
|
|
} |
|
|
|
// let number = 0 |
|
|
|
// data.value.packageList.forEach(cur=>{ |
|
|
|
// number += parseFloat(cur.sampleAmount) |
|
|
|
// }) |
|
|
|
// number = number.toFixed('2') |
|
|
|
// if(number != data.value.sampleTotalAmount){ |
|
|
|
// message.error(`采样数量之和必须等于采样总数量`) |
|
|
|
// return |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
const bol2 = await validateForm(formFeaturesRef.value) |
|
|
|
if (!bol2) { |
|
|
|
message.error(`模板中有检验工序和检验特性未填写完全`) |
|
|
|
return |
|
|
|
} |
|
|
|
// 判断数组是否有未填的选项 |
|
|
|
let arrBol = [] |
|
|
|
let isOutweigh = []//结束时间是否大于开始时间 |
|
|
|
let numberList = []//判断合格数量和不合格数量之和是否等于主表数量 |
|
|
|
let parseFloatList = []//判断合格数量和不合格数量是否是整数 |
|
|
|
data.value.subList.forEach((item, index) => { |
|
|
|
if (item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 1) { |
|
|
|
arrBol.push( |
|
|
|
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some( |
|
|
|
(cur, key) => { |
|
|
|
return !cur.qualifiedQuantity || !cur.unqualifiedQuantity |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
if (item.inspectionJobCharacteristicsUpdateReqVO.featureType == 0) { |
|
|
|
arrBol.push( |
|
|
|
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some( |
|
|
|
(cur, key) => { |
|
|
|
return !cur.inspectionValue |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
if (item.inspectionJobCharacteristicsUpdateReqVO.featureType == 1) { |
|
|
|
arrBol.push( |
|
|
|
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some( |
|
|
|
(cur, key) => { |
|
|
|
return !cur.qualitativeCode |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
// 开始时间大于结束时间放入数组中 |
|
|
|
if (item.inspectionJobCharacteristicsUpdateReqVO.inspectionStartTime >item.inspectionJobCharacteristicsUpdateReqVO.inspectionEndTime) { |
|
|
|
isOutweigh.push(item.inspectionJobCharacteristicsUpdateReqVO.inspectionStartTime) |
|
|
|
} |
|
|
|
// 合格数量和不合格数量之和不能是小数 |
|
|
|
if (item.inspectionJobCharacteristicsUpdateReqVO.resultEntryMethod == 1) { |
|
|
|
parseFloatList.push( |
|
|
|
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some( |
|
|
|
(cur, key) => { |
|
|
|
return String(cur.qualifiedQuantity).indexOf('.')>-1 || String(cur.unqualifiedQuantity).indexOf('.')>-1 |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
// 合格数量和不合格数量之和不等于总数量 |
|
|
|
numberList.push( |
|
|
|
item.inspectionJobCharacteristicsUpdateReqVO.recordInspectionQuantifyList.some( |
|
|
|
(cur, key) => { |
|
|
|
console.log(12,cur.qualifiedQuantity) |
|
|
|
console.log(13,cur.unqualifiedQuantity) |
|
|
|
console.log(14,item.inspectionJobCharacteristicsUpdateReqVO.sampleQty) |
|
|
|
return parseFloat(cur.qualifiedQuantity) + parseFloat(cur.unqualifiedQuantity) != parseFloat(item.inspectionJobCharacteristicsUpdateReqVO.sampleQty) |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
}) |
|
|
|
let isEmpty1 = arrBol.some(item=>item == true) |
|
|
|
let isEmptyNumberList = numberList.some(item=>item == true) |
|
|
|
let isParseFloat = parseFloatList.some(item=>item == true) |
|
|
|
if(isEmpty1){ |
|
|
|
message.error('检验工序和检验特性有字段未填写完全') |
|
|
|
return; |
|
|
|
} |
|
|
|
if(isOutweigh?.length>0){ |
|
|
|
message.error('检验特性中有开始时间大于结束时间') |
|
|
|
return; |
|
|
|
} |
|
|
|
if(isParseFloat){ |
|
|
|
message.error('合格数量和不合格数量之和不可以是小数') |
|
|
|
return; |
|
|
|
} |
|
|
|
if(isEmptyNumberList){ |
|
|
|
message.error('合格数量和不合格数量之和必须等于样品份数') |
|
|
|
return; |
|
|
|
} |
|
|
|
await InspectionJobMainApi.stagingInspectionJobMain(data.value) |
|
|
|
message.success('暂存成功!') |
|
|
|
} catch { |
|
|
|
console.log(111) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 弹窗按钮 */ |
|
|
|
let Butttondata: any = [] |
|
|
|
if (props.footButttondata) { |
|
|
|
Butttondata = props.footButttondata |
|
|
|
} else { |
|
|
|
Butttondata = [ |
|
|
|
defaultButtons.formStagingBtn(null), // 暂存 |
|
|
|
defaultButtons.formSaveBtn(null), // 保存 |
|
|
|
defaultButtons.formCloseBtn(null) // 关闭 |
|
|
|
] |
|
|
|