|
|
@ -195,7 +195,11 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="每份样品量" prop="samplePieceSize"> |
|
|
|
<el-input v-model="data.samplePieceSize" placeholder="请填写每份样品量" :disabled='isSamplePieceSizeDisabled'/> |
|
|
|
<el-input |
|
|
|
v-model="data.samplePieceSize" |
|
|
|
placeholder="请填写每份样品量" |
|
|
|
:disabled="isSamplePieceSizeDisabled" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
@ -229,6 +233,7 @@ |
|
|
|
</el-form> |
|
|
|
<el-tabs |
|
|
|
v-model="editableTabsValue" |
|
|
|
editable |
|
|
|
class="demo-tabs" |
|
|
|
@edit="handleTabsEdit" |
|
|
|
type="border-card" |
|
|
@ -462,10 +467,7 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"> |
|
|
|
<el-form-item |
|
|
|
label="计量单位" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyUom" |
|
|
|
> |
|
|
|
<el-form-item label="计量单位" prop="inspectionCharacteristicsBaseVO.quantifyUom"> |
|
|
|
<el-input |
|
|
|
v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" |
|
|
|
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" |
|
|
@ -519,7 +521,13 @@ |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO. quantifyIsCapping"> |
|
|
|
<el-col |
|
|
|
:span="12" |
|
|
|
v-if=" |
|
|
|
item.inspectionCharacteristicsBaseVO.featureType == 0 && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsCapping |
|
|
|
" |
|
|
|
> |
|
|
|
<el-form-item |
|
|
|
label="上限值" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyCapping" |
|
|
@ -527,11 +535,18 @@ |
|
|
|
<el-input |
|
|
|
v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" |
|
|
|
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" |
|
|
|
type="number" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
|
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit"> |
|
|
|
<el-col |
|
|
|
:span="12" |
|
|
|
v-if=" |
|
|
|
item.inspectionCharacteristicsBaseVO.featureType == 0 && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit |
|
|
|
" |
|
|
|
> |
|
|
|
<el-form-item |
|
|
|
label="下限值" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyLowlimit" |
|
|
@ -539,11 +554,18 @@ |
|
|
|
<el-input |
|
|
|
v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" |
|
|
|
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" |
|
|
|
type="number" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
|
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO. quantifyIsTarget"> |
|
|
|
<el-col |
|
|
|
:span="12" |
|
|
|
v-if=" |
|
|
|
item.inspectionCharacteristicsBaseVO.featureType == 0 && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsTarget |
|
|
|
" |
|
|
|
> |
|
|
|
<el-form-item |
|
|
|
label="目标值" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyTarget" |
|
|
@ -551,16 +573,15 @@ |
|
|
|
<el-input |
|
|
|
v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" |
|
|
|
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate" |
|
|
|
type="number" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 1"> |
|
|
|
<el-form-item |
|
|
|
label="选定集" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyQuantifyCode" |
|
|
|
|
|
|
|
> |
|
|
|
<div style="display: flex; width: 100%"> |
|
|
|
<el-input |
|
|
@ -648,7 +669,7 @@ import * as DynamicRuleApi from '@/api/qms/dynamicRule' //动态修改规则 |
|
|
|
import { DynamicRule } from '@/views/qms/dynamicRule/dynamicRule.data' //动态修改规则 |
|
|
|
import * as SelectedSetApi from '@/api/qms/selectedSet' //选择集 |
|
|
|
import { SelectedSet } from '@/views/qms/selectedSet/selectedSet.data' //选择集 |
|
|
|
import {validateTwoNum} from '@/utils/validator' |
|
|
|
import { validateInteger, validateMaxNumber5, validateTwoNum } from '@/utils/validator' |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
|
|
|
@ -730,20 +751,21 @@ const rules = ref({ |
|
|
|
programmeTemplateCode: [ |
|
|
|
{ required: true, message: '请选择检验模板', trigger: ['blur', 'change'] } |
|
|
|
], |
|
|
|
description: [ |
|
|
|
{ required: true, message: '请选择描述', trigger: 'blur' } |
|
|
|
], |
|
|
|
description: [{ required: true, message: '请选择描述', trigger: 'blur' }], |
|
|
|
// splitRule: [{ required: true, message: '请选择拆分规则', trigger: ['blur', 'change'] }], |
|
|
|
aql: [{ required: true, message: '请选择aql', trigger: ['blur', 'change'] }], |
|
|
|
inspectionLevel: [ |
|
|
|
{ required: true, message: '请选择检验水平', trigger: ['blur', 'change'] }, |
|
|
|
], |
|
|
|
inspectionLevel: [{ required: true, message: '请选择检验水平', trigger: ['blur', 'change'] }], |
|
|
|
samplePieceSize: [ |
|
|
|
{ required: true, message: '请输入每份样品量', trigger: ['blur', 'change'] }, |
|
|
|
{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}, |
|
|
|
{ validator: validateTwoNum, message: '小数点后最多2位', trigger: 'blur' } |
|
|
|
], |
|
|
|
|
|
|
|
effectiveDate: [{ required: true, message: '请选择生效时间', trigger: ['blur', 'change'] }], |
|
|
|
expirationDate: [{ required: true, message: '请选择失效时间', trigger: ['blur', 'change'] }], |
|
|
|
sequenceCode: [ |
|
|
|
{ required: true, message: '请填写顺序号', trigger: 'blur' }, |
|
|
|
{ validator: validateInteger, message: '请输入正确的整数', trigger: 'blur' } |
|
|
|
], |
|
|
|
'inspectionCharacteristicsBaseVO.description': [ |
|
|
|
{ required: true, message: '请填写描述', trigger: ['blur', 'change'] } |
|
|
|
], |
|
|
@ -775,7 +797,9 @@ const rules = ref({ |
|
|
|
{ required: true, message: '请选择计量单位', trigger: 'blur' } |
|
|
|
], |
|
|
|
'inspectionCharacteristicsBaseVO.quantifyDecimal': [ |
|
|
|
{ required: true, message: '请输入小数位', trigger: 'blur' } |
|
|
|
{ required: true, message: '请输入小数位', trigger: 'blur' }, |
|
|
|
{ validator: validateInteger, message: '请输入正确的整数', trigger: 'blur' }, |
|
|
|
{ validator: validateMaxNumber5, message: '不能大于5', trigger: 'blur' } |
|
|
|
], |
|
|
|
'inspectionCharacteristicsBaseVO.quantifyQuantifyCode': [ |
|
|
|
{ required: true, message: '请输入选定集', trigger: 'blur' } |
|
|
@ -809,7 +833,10 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any |
|
|
|
item.name = index + 1 |
|
|
|
// rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true |
|
|
|
// 编辑判断上限下限目标值是否必填 |
|
|
|
if (item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsCapping) { |
|
|
|
if ( |
|
|
|
item.inspectionCharacteristicsBaseVO.featureType == 0 && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsCapping |
|
|
|
) { |
|
|
|
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true |
|
|
|
} |
|
|
|
if (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit) { |
|
|
@ -845,9 +872,9 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any |
|
|
|
expirationDate: '', |
|
|
|
available: 'TRUE', |
|
|
|
dynamicUpdateCode: '', |
|
|
|
description:"", |
|
|
|
samplePieceSize:"", |
|
|
|
uom:"", |
|
|
|
description: '', |
|
|
|
samplePieceSize: '', |
|
|
|
uom: '', |
|
|
|
process: [] |
|
|
|
} |
|
|
|
} |
|
|
@ -901,13 +928,13 @@ const buttonBaseClick1 = (val) => { |
|
|
|
inspectionMethodCode: '', |
|
|
|
dynamicUpdateCode: '', |
|
|
|
inspectionMethod: '', |
|
|
|
isCanUpdate: '', |
|
|
|
isCanUpdate: true, |
|
|
|
isDestructionInspection: '', |
|
|
|
resultEntryMethod: '', |
|
|
|
featureType: '', |
|
|
|
quantifyIsCapping: '', |
|
|
|
quantifyIsLowlimit: '', |
|
|
|
quantifyIsTarget: '', |
|
|
|
quantifyIsCapping: false, |
|
|
|
quantifyIsLowlimit: false, |
|
|
|
quantifyIsTarget: false, |
|
|
|
quantifyTarget: '', |
|
|
|
quantifyCapping: '', |
|
|
|
quantifyLowlimit: '', |
|
|
@ -954,10 +981,29 @@ const validateForm = (formRef) => { |
|
|
|
return false |
|
|
|
}) |
|
|
|
} |
|
|
|
// 判断对象数组是否有相同属性 相同:true \ 不相同:false |
|
|
|
const hasDuplicates = (array) => { |
|
|
|
const seen = new Set() |
|
|
|
const repeatCode = new Set() |
|
|
|
let arr = array.map((item) => parseInt(item.sequenceCode)) |
|
|
|
arr.forEach((item) => { |
|
|
|
if (seen.has(item)) { |
|
|
|
repeatCode.add(item) |
|
|
|
} else { |
|
|
|
seen.add(item) |
|
|
|
} |
|
|
|
}) |
|
|
|
const arr1 = Array.from(repeatCode) |
|
|
|
if (arr1.length > 0) { |
|
|
|
return true |
|
|
|
} else { |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const submitForm = async () => { |
|
|
|
try { |
|
|
|
const aa = await getStrDictOptions(DICT_TYPE.SPLIT_RULES);//拆分规则隐藏默认给第一字典值 |
|
|
|
const aa = await getStrDictOptions(DICT_TYPE.SPLIT_RULES) //拆分规则隐藏默认给第一字典值 |
|
|
|
data.value.splitRule = aa[0].value |
|
|
|
const validateForm1 = await validateForm(formProcessRef.value) |
|
|
|
await formMainRef.value.validate() |
|
|
@ -965,6 +1011,11 @@ const submitForm = async () => { |
|
|
|
message.error(`请添加工序`) |
|
|
|
return |
|
|
|
} |
|
|
|
// debugger |
|
|
|
if (hasDuplicates(data.value.process)) { |
|
|
|
message.error(`检验工序顺序号不能相同`) |
|
|
|
return |
|
|
|
} |
|
|
|
const bol1 = await validateForm(formProcessRef.value) |
|
|
|
const bol2 = await validateForm(formFeaturesRef.value) |
|
|
|
if (!bol1 || !bol2) { |
|
|
@ -984,8 +1035,65 @@ const submitForm = async () => { |
|
|
|
message.error(`${str}是否设定上线,是否设定下限,是否是定目标值至少一项为是`) |
|
|
|
return |
|
|
|
} |
|
|
|
// 检验上限值,下限值,目标值小数位数不可以大于小数位 |
|
|
|
console.log(data.value.process) |
|
|
|
const arr1 = data.value.process.filter( |
|
|
|
(item) => |
|
|
|
((item.inspectionCharacteristicsBaseVO.quantifyIsCapping && |
|
|
|
String(item.inspectionCharacteristicsBaseVO.quantifyCapping).split('.')[1]?.length > |
|
|
|
Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)) || |
|
|
|
(item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && |
|
|
|
String(item.inspectionCharacteristicsBaseVO.quantifyLowlimit).split('.')[1]?.length > |
|
|
|
Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal)) || |
|
|
|
(item.inspectionCharacteristicsBaseVO.quantifyIsTarget && |
|
|
|
String(item.inspectionCharacteristicsBaseVO.quantifyTarget).split('.')[1]?.length > |
|
|
|
Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal))) && |
|
|
|
item.inspectionCharacteristicsBaseVO.featureType == 0 |
|
|
|
) |
|
|
|
if (arr1 && arr1.length > 0) { |
|
|
|
const str = arr1.map((item) => item.description).join(',') |
|
|
|
message.error(`${str}工序上限值,下限值,目标值小数位数不可以大于小数位`) |
|
|
|
return |
|
|
|
} |
|
|
|
// 检验上限值应大目标值大于下限值 |
|
|
|
const arr2 = data.value.process.filter((item) => { |
|
|
|
// 上限值存在并且下限值存在时,目标值不存在,上限值应大于下限值 |
|
|
|
return ( |
|
|
|
(item.inspectionCharacteristicsBaseVO.quantifyIsCapping && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && |
|
|
|
!item.inspectionCharacteristicsBaseVO.quantifyIsTarget && |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyCapping) <= |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyLowlimit)) || |
|
|
|
// 上限值存在并且目标值存在时,下限值不存在,上限值应大于目标值 |
|
|
|
(item.inspectionCharacteristicsBaseVO.quantifyIsCapping && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsTarget && |
|
|
|
!item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyCapping) <= |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget)) || |
|
|
|
// 下限值存在并且目标值存在时,上限值不存在,下限值应小于目标值 |
|
|
|
(item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsTarget && |
|
|
|
!item.inspectionCharacteristicsBaseVO.quantifyIsCapping && |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyLowlimit) >= |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget)) || |
|
|
|
// 上限值,下限值,目标值都存在时,上限值应大于目标值大于下限值 |
|
|
|
(item.inspectionCharacteristicsBaseVO.quantifyIsCapping && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsTarget && |
|
|
|
(parseFloat(item.inspectionCharacteristicsBaseVO.quantifyCapping) <= |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyLowlimit) || |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyCapping) <= |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget) || |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyLowlimit) >= |
|
|
|
parseFloat(item.inspectionCharacteristicsBaseVO.quantifyTarget))) |
|
|
|
) |
|
|
|
}) |
|
|
|
if (arr2 && arr2.length > 0) { |
|
|
|
const str = arr2.map((item) => item.description).join(',') |
|
|
|
message.error(`${str}工序上限值应大于目标值大于下限值`) |
|
|
|
return |
|
|
|
} |
|
|
|
if (formType.value == 'create') { |
|
|
|
|
|
|
|
// 主子表——提交请求 |
|
|
|
emit('submitForm', formType.value, data.value) |
|
|
|
} else { |
|
|
@ -1143,7 +1251,10 @@ const searchTableSuccess = async (formField, searchField, val, type, row) => { |
|
|
|
item.name = index + 1 |
|
|
|
// rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true |
|
|
|
// 编辑判断上限下限目标值是否必填 |
|
|
|
if (item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsCapping) { |
|
|
|
if ( |
|
|
|
item.inspectionCharacteristicsBaseVO.featureType == 0 && |
|
|
|
item.inspectionCharacteristicsBaseVO.quantifyIsCapping |
|
|
|
) { |
|
|
|
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true |
|
|
|
} |
|
|
|
if (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit) { |
|
|
@ -1181,7 +1292,6 @@ const changeIsCapping = (e,item) => { |
|
|
|
} else { |
|
|
|
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// 选择是否设定下限值 |
|
|
|
const changeLowlimit = (e, item) => { |
|
|
|