|
|
@ -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' }] |
|
|
|
}) |
|
|
@ -364,14 +381,16 @@ const changeSupplierType = (e) => { |
|
|
|
} |
|
|
|
getFormSupplierList() |
|
|
|
// 改变检验方式的时候 |
|
|
|
function changeInspectType(e){ |
|
|
|
function changeInspectType(e) { |
|
|
|
if (e == 'SAMPLING') { |
|
|
|
formData.value.configuration.SampleMethod='QTY' |
|
|
|
formData.value.configuration.AqlList=[{ |
|
|
|
FloorQty: 1, |
|
|
|
CeilingQty: 2, |
|
|
|
SampleValue: 1 |
|
|
|
}] |
|
|
|
formData.value.configuration.SampleMethod = 'QTY' |
|
|
|
formData.value.configuration.AqlList = [ |
|
|
|
{ |
|
|
|
FloorQty: 1, |
|
|
|
CeilingQty: 2, |
|
|
|
SampleValue: 1 |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
// 改变抽检方式的时候 |
|
|
@ -404,7 +423,7 @@ const open = async (type: string, strategyCode: string, id?: number) => { |
|
|
|
formData.value.status = data.status == 0 ? true : false |
|
|
|
if (formData.value.priority == 0) { |
|
|
|
Butttondata.value = [ |
|
|
|
defaultButtons.formSaveBtn({disabled:true}), // 保存 |
|
|
|
defaultButtons.formSaveBtn({ disabled: true }), // 保存 |
|
|
|
defaultButtons.formCloseBtn(null) // 关闭 |
|
|
|
] |
|
|
|
} else { |
|
|
@ -436,21 +455,35 @@ 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() |
|
|
|
if (!formRef) return |
|
|
|
const valid = await formRef.value.validate() |
|
|
|
if (!valid) return |
|
|
|
if(formData.value.priority == 0){ |
|
|
|
if (formData.value.priority == 0) { |
|
|
|
message.error('优先级不可以为0') |
|
|
|
return |
|
|
|
} |
|
|
|
if (hasSameData(formData.value.configuration.AqlList)) { |
|
|
|
message.error('抽检规则数据范围重叠,请重新填写') |
|
|
|
return |
|
|
|
} |
|
|
|
// 提交请求 |
|
|
|
formLoading.value = true |
|
|
|
if(formData.value.configuration.InspectType != 'SAMPLING'){ |
|
|
|
formData.value.configuration.SampleMethod= '' |
|
|
|
formData.value.configuration.AqlList=[] |
|
|
|
if (formData.value.configuration.InspectType != 'SAMPLING') { |
|
|
|
formData.value.configuration.SampleMethod = '' |
|
|
|
formData.value.configuration.AqlList = [] |
|
|
|
} |
|
|
|
try { |
|
|
|
let data = { |
|
|
|