|
|
@ -22,7 +22,7 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="版本" prop="version"> |
|
|
|
<el-input v-model="data.version" placeholder="请填写版本" /> |
|
|
|
<el-input v-model="data.version" placeholder="请填写版本" type="number"/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
@ -112,7 +112,7 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="顺序号" prop="sequenceCode"> |
|
|
|
<el-input v-model="item.sequenceCode" /> |
|
|
|
<el-input v-model="item.sequenceCode" type="number"/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- <el-col :span="12"> |
|
|
@ -270,45 +270,43 @@ |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
|
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item |
|
|
|
label="是否设定上限" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyIsCapping" |
|
|
|
label="计量单位" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyUom" |
|
|
|
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" |
|
|
|
> |
|
|
|
|
|
|
|
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" @change="changeIsCapping"/> |
|
|
|
|
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item |
|
|
|
label="上限值" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyCapping" |
|
|
|
label="小数位" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyDecimal" |
|
|
|
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" |
|
|
|
> |
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" /> |
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"> |
|
|
|
<el-form-item |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyIsLowlimit" |
|
|
|
label="是否设定下限" |
|
|
|
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" |
|
|
|
label="是否设定上限" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyIsCapping" |
|
|
|
> |
|
|
|
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" @change="changeLowlimit"/> |
|
|
|
|
|
|
|
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" @change="changeIsCapping"/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
|
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"> |
|
|
|
<el-form-item |
|
|
|
label="下限值" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyLowlimit" |
|
|
|
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyIsLowlimit" |
|
|
|
label="是否设定下限" |
|
|
|
> |
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" /> |
|
|
|
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" @change="changeLowlimit"/> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
|
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyIsTarget" |
|
|
@ -319,32 +317,28 @@ |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO. quantifyIsCapping"> |
|
|
|
<el-form-item |
|
|
|
label="目标值" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyTarget" |
|
|
|
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" |
|
|
|
label="上限值" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyCapping" |
|
|
|
> |
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" /> |
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" type="number"/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
|
|
|
|
<el-col :span="12"> |
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit"> |
|
|
|
<el-form-item |
|
|
|
label="计量单位" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyUom" |
|
|
|
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" |
|
|
|
label="下限值" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyLowlimit" |
|
|
|
> |
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyUom" /> |
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" type="number"/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO. quantifyIsTarget"> |
|
|
|
<el-form-item |
|
|
|
label="小数位" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyDecimal" |
|
|
|
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0" |
|
|
|
label="目标值" |
|
|
|
prop="inspectionCharacteristicsBaseVO.quantifyTarget" |
|
|
|
> |
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal" /> |
|
|
|
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" type="number"/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
@ -428,6 +422,7 @@ import * as DynamicRuleApi from '@/api/qms/dynamicRule' //动态修改规则 |
|
|
|
import { DynamicRule } from '@/views/qms/basicDataManage/dynamicRule/dynamicRule.data' //动态修改规则 |
|
|
|
import * as SelectedSetApi from '@/api/qms/selectedSet' //选择集 |
|
|
|
import { SelectedSet } from '@/views/qms/basicDataManage/selectedSet/selectedSet.data' //选择集 |
|
|
|
import { validateInteger,validateTwoNum,validateMaxNumber5 } from '@/utils/validator' |
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
|
|
|
|
const props = defineProps({ |
|
|
@ -492,9 +487,15 @@ if (props.basicFormWidth) { |
|
|
|
} |
|
|
|
const rules = ref({ |
|
|
|
description: [{ required: true, message: '请填写描述', trigger: 'blur' }], |
|
|
|
version: [{ required: true, message: '请填写版本', trigger: 'blur' }], |
|
|
|
version: [ |
|
|
|
{ required: true, message: '请填写版本', trigger: 'blur' }, |
|
|
|
{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'} |
|
|
|
], |
|
|
|
inspectionCode: [{ required: true, message: '请选择检验方案模板', trigger: 'blur' }], |
|
|
|
sequenceCode: [{ required: true, message: '请填写顺序号', trigger: 'blur' }], |
|
|
|
sequenceCode: [ |
|
|
|
{ required: true, message: '请填写顺序号', trigger: 'blur' }, |
|
|
|
{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'} |
|
|
|
], |
|
|
|
inspectionCharCode: [{ required: true, message: '请选择检验特性', trigger: 'blur' }], |
|
|
|
'inspectionCharacteristicsBaseVO.description': [ |
|
|
|
{ required: true, message: '请填写描述', trigger: ['blur', 'change'] } |
|
|
@ -515,24 +516,28 @@ const rules = ref({ |
|
|
|
{ required: true, message: '请选择特征类型', trigger: ['blur', 'change'] } |
|
|
|
], |
|
|
|
'inspectionCharacteristicsBaseVO.quantifyTarget': [ |
|
|
|
{ required: true, message: '请输入目标值', trigger: 'blur' } |
|
|
|
{ required: true, message: '请输入目标值', trigger: 'blur' }, |
|
|
|
], |
|
|
|
'inspectionCharacteristicsBaseVO.quantifyCapping': [ |
|
|
|
{ required: true, message: '请输入上限值', trigger: 'blur' } |
|
|
|
{ required: true, message: '请输入上限值', trigger: 'blur' }, |
|
|
|
], |
|
|
|
'inspectionCharacteristicsBaseVO.quantifyLowlimit': [ |
|
|
|
{ required: true, message: '请输入下限值', trigger: 'blur' } |
|
|
|
{ required: true, message: '请输入下限值', trigger: 'blur' }, |
|
|
|
], |
|
|
|
'inspectionCharacteristicsBaseVO.quantifyUom': [ |
|
|
|
{ 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' } |
|
|
|
] |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
/** 打开弹窗 */ |
|
|
|
let tabIndex = 1 |
|
|
|
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => { |
|
|
@ -681,22 +686,44 @@ const validateForm = (formRef) => { |
|
|
|
return false |
|
|
|
}) |
|
|
|
} |
|
|
|
// 判断对象数组是否有相同属性 相同:true \ 不相同:false |
|
|
|
const hasDuplicates =(array)=>{ |
|
|
|
return array.some((item, index) => { |
|
|
|
return ( |
|
|
|
array.findIndex((v, i) => { |
|
|
|
return ( |
|
|
|
i !== index && |
|
|
|
JSON.stringify(v.sequenceCode) === JSON.stringify(item.sequenceCode) |
|
|
|
) |
|
|
|
}) !== -1 |
|
|
|
) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const submitForm = async () => { |
|
|
|
try { |
|
|
|
const validateForm1 = await validateForm(formProcessRef.value) |
|
|
|
console.log(validateForm1) |
|
|
|
|
|
|
|
// 检验主表字段 |
|
|
|
await validateForm(formProcessRef.value) |
|
|
|
await formMainRef.value.validate() |
|
|
|
// 检验是否添加工序 |
|
|
|
if (!data.value.process || data.value.process.length == 0) { |
|
|
|
message.error(`请添加工序`) |
|
|
|
return |
|
|
|
} |
|
|
|
if(hasDuplicates(data.value.process)){ |
|
|
|
message.error(`检验工序顺序号不能相同`) |
|
|
|
return |
|
|
|
} |
|
|
|
// 检验模板中有检验工序和检验特性未填写完全 |
|
|
|
const bol1 = await validateForm(formProcessRef.value) |
|
|
|
const bol2 = await validateForm(formFeaturesRef.value) |
|
|
|
if (!bol1 || !bol2) { |
|
|
|
message.error(`模板中有检验工序和检验特性未填写完全`) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 是否设定上线,是否设定下限,是否是定目标值至少一项为是 |
|
|
|
const arr = data.value.process.filter( |
|
|
|
(item) => |
|
|
|
!item.inspectionCharacteristicsBaseVO.quantifyIsCapping && |
|
|
@ -704,10 +731,39 @@ const submitForm = async () => { |
|
|
|
!item.inspectionCharacteristicsBaseVO.quantifyIsTarget && |
|
|
|
item.inspectionCharacteristicsBaseVO.featureType == 0 |
|
|
|
) |
|
|
|
console.log(arr) |
|
|
|
if (arr && arr.length > 0) { |
|
|
|
const str = arr.map((item) => item.description).join(',') |
|
|
|
message.error(`${str}是否设定上线,是否设定下限,是否是定目标值至少一项为是`) |
|
|
|
message.error(`${str}是否设定上线,是否设定下限,是否设定目标值至少一项为是`) |
|
|
|
return |
|
|
|
} |
|
|
|
// 检验上限值,下限值,目标值小数位数不可以大于小数位 |
|
|
|
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) => |
|
|
|
// 上限值存在并且下限值存在时,上限值应大于下限值 |
|
|
|
(item.inspectionCharacteristicsBaseVO.quantifyIsCapping && item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && (item.inspectionCharacteristicsBaseVO.quantifyCapping <=item.inspectionCharacteristicsBaseVO.quantifyLowlimit))|| |
|
|
|
// 上限值存在并且目标值存在时,上限值应大于目标值 |
|
|
|
(item.inspectionCharacteristicsBaseVO.quantifyIsCapping && item.inspectionCharacteristicsBaseVO.quantifyIsTarget && (item.inspectionCharacteristicsBaseVO.quantifyCapping <=item.inspectionCharacteristicsBaseVO.quantifyTarget))|| |
|
|
|
// 下限值存在并且目标值存在时,下限值应小于目标值 |
|
|
|
( item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && item.inspectionCharacteristicsBaseVO.quantifyIsTarget && (item.inspectionCharacteristicsBaseVO.quantifyLowlimit >= item.inspectionCharacteristicsBaseVO.quantifyTarget))|| |
|
|
|
// 上限值,下限值,目标值都存在时,上限值应大于目标值大于下限值 |
|
|
|
(item.inspectionCharacteristicsBaseVO.quantifyIsCapping && item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit && item.inspectionCharacteristicsBaseVO.quantifyIsTarget && ((item.inspectionCharacteristicsBaseVO.quantifyCapping <=item.inspectionCharacteristicsBaseVO.quantifyLowlimit)||(item.inspectionCharacteristicsBaseVO.quantifyCapping <=item.inspectionCharacteristicsBaseVO.quantifyTarget)||(item.inspectionCharacteristicsBaseVO.quantifyLowlimit >= item.inspectionCharacteristicsBaseVO.quantifyTarget))) |
|
|
|
) |
|
|
|
if (arr2 && arr2.length > 0) { |
|
|
|
const str = arr2.map((item) => item.description).join(',') |
|
|
|
message.error(`${str}上限值应大目标值大于下限值`) |
|
|
|
return |
|
|
|
} |
|
|
|
if (formType.value == 'create') { |
|
|
|