|
|
@ -132,7 +132,12 @@ |
|
|
|
:key="cur.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-input v-model="item.Value" placeholder="请输入物品,多个物品以逗号分隔" clearable style="flex: 1" /> |
|
|
|
<el-input |
|
|
|
v-model="item.Value" |
|
|
|
placeholder="请输入物品,多个物品以逗号分隔" |
|
|
|
clearable |
|
|
|
style="flex: 1" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@ -146,7 +151,10 @@ |
|
|
|
<!-- 检验方式 --> |
|
|
|
<el-form-item label="检验方式" class="flex-top"> |
|
|
|
<div class="checkbox"> |
|
|
|
<el-radio-group v-model="formData.configuration.InspectType" @change="changeInspectType"> |
|
|
|
<el-radio-group |
|
|
|
v-model="formData.configuration.InspectType" |
|
|
|
@change="changeInspectType" |
|
|
|
> |
|
|
|
<el-radio |
|
|
|
:label="cur.value" |
|
|
|
v-for="cur in getStrDictOptions(DICT_TYPE.INSPECT_TYPE)" |
|
|
@ -292,9 +300,18 @@ const formData = ref({ |
|
|
|
|
|
|
|
// 验证规则 |
|
|
|
const rules = ref({ |
|
|
|
strategyCode: [{ required: true, message: '请输入代码', trigger: 'blur' },{ max: 50, message: '不得超过50个字符', trigger: 'blur' }], |
|
|
|
name: [{ required: true, message: '请输入名字', trigger: 'blur' },{ max: 50, message: '不得超过50个字符', trigger: 'blur' }], |
|
|
|
description: [{ required: true, message: '请输入描述', trigger: 'blur' },{ max: 50, message: '不得超过50个字符', trigger: 'blur' }], |
|
|
|
strategyCode: [ |
|
|
|
{ required: true, message: '请输入代码', trigger: 'blur' }, |
|
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|
|
|
], |
|
|
|
name: [ |
|
|
|
{ required: true, message: '请输入名字', trigger: 'blur' }, |
|
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|
|
|
], |
|
|
|
description: [ |
|
|
|
{ required: true, message: '请输入描述', trigger: 'blur' }, |
|
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
|
|
|
], |
|
|
|
priority: [{ required: true, message: '请输入优先级', trigger: 'blur' }], |
|
|
|
configurationRules: [{ required: true, message: '抽奖规则请填写完全', trigger: 'blur' }] |
|
|
|
}) |
|
|
@ -367,11 +384,13 @@ getFormSupplierList() |
|
|
|
function changeInspectType(e) { |
|
|
|
if (e == 'SAMPLING') { |
|
|
|
formData.value.configuration.SampleMethod = 'QTY' |
|
|
|
formData.value.configuration.AqlList=[{ |
|
|
|
formData.value.configuration.AqlList = [ |
|
|
|
{ |
|
|
|
FloorQty: 1, |
|
|
|
CeilingQty: 2, |
|
|
|
SampleValue: 1 |
|
|
|
}] |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
// 改变抽检方式的时候 |
|
|
@ -436,6 +455,16 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|
|
|
|
|
|
|
/** 提交表单 */ |
|
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|
|
|
const hasSameData = (array) => { |
|
|
|
for (let k = 0; k < array.length; k++) { |
|
|
|
for (let n = k + 1; n < array.length; n++) { |
|
|
|
if(array[k].FloorQty <= array[n].FloorQty && array[n].FloorQty<=array[k].CeilingQty){ |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|
const submitForm = async () => { |
|
|
|
// 校验表单 |
|
|
|
inputNumberBlur() |
|
|
@ -446,6 +475,10 @@ const submitForm = async () => { |
|
|
|
message.error('优先级不可以为0') |
|
|
|
return |
|
|
|
} |
|
|
|
if (hasSameData(formData.value.configuration.AqlList)) { |
|
|
|
message.error('抽检规则数据范围重叠,请重新填写') |
|
|
|
return |
|
|
|
} |
|
|
|
// 提交请求 |
|
|
|
formLoading.value = true |
|
|
|
if (formData.value.configuration.InspectType != 'SAMPLING') { |
|
|
|