Browse Source

检验模板和方案校验修改

master_hella_20240701
zhang_li 8 months ago
parent
commit
e59ff3024d
  1. 156
      src/views/qms/basicDataManage/inspectionScheme/addForm.vue
  2. 27
      src/views/qms/basicDataManage/inspectionTemplate/addForm.vue

156
src/views/qms/basicDataManage/inspectionScheme/addForm.vue

@ -450,111 +450,106 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-form-item
label="是否设定上限"
prop="inspectionCharacteristicsBaseVO.quantifyIsCapping"
label="计量单位"
prop="inspectionCharacteristicsBaseVO.quantifyUom"
>
<el-switch
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping"
@change="changeIsCapping"
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyUom"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</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.quantifyCapping"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
label="小数位"
prop="inspectionCharacteristicsBaseVO.quantifyDecimal"
>
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping"
v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</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"
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping"
@change="changeIsCapping($event,item)"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</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($event,item)"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
<el-form-item
prop="inspectionCharacteristicsBaseVO.quantifyIsTarget"
label="是否设定目标值"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-switch
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget"
@change="changeIsTarget"
@change="changeIsTarget($event,item)"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</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"
v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</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"
v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</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"
v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget"
:disabled="!item.inspectionCharacteristicsBaseVO.isCanUpdate"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 1">
<el-form-item
label="选择集"
prop="inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 1"
>
<div style="display: flex; width: 100%">
<el-input
@ -751,7 +746,7 @@ const rules = ref({
{ required: true, message: '请输入目标值', trigger: 'blur' }
],
'inspectionCharacteristicsBaseVO.quantifyCapping': [
{ required: true, message: '请输入上限值', trigger: 'blur' }
{ required: true, message: '请输入上限值', trigger: ['blur','change'] }
],
'inspectionCharacteristicsBaseVO.quantifyLowlimit': [
{ required: true, message: '请输入下限值', trigger: 'blur' }
@ -785,26 +780,24 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
list = await InspectionProcessPageApi.getListByTempleteCode(row.programmeTemplateCode)
}
list.forEach((item, index) => {
editableTabsValue.value = index + 1
item.name = index + 1
//
if (item.inspectionCharacteristicsBaseVO.quantifyIsCapping) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
}
if (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
}
if (item.inspectionCharacteristicsBaseVO.quantifyIsTarget) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
}
})
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
list.forEach((item, index) => {
editableTabsValue.value = index+1
item.name = index + 1
// rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
//
if (item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsCapping) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
}
if (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
}
if (item.inspectionCharacteristicsBaseVO.quantifyIsTarget) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
}
})
data.value.process = list
} else {
data.value = {
@ -1090,26 +1083,25 @@ const searchTableSuccess = async (formField, searchField, val, type, row) => {
}
if (formField == 'programmeTemplateCode') {
let list = await InspectionProcessPageApi.getListByTempleteCode(val[0].code)
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
list.forEach((item, index) => {
editableTabsValue.value = index + 1
editableTabsValue.value = index+1
item.name = index + 1
// rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
//
if (item.inspectionCharacteristicsBaseVO.quantifyIsCapping) {
if (item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsCapping) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
}
}
if (item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
}
}
if (item.inspectionCharacteristicsBaseVO.quantifyIsTarget) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
}
}
})
data.value.process = list
}
@ -1123,15 +1115,18 @@ const searchTableSuccess = async (formField, searchField, val, type, row) => {
// emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
//
const changeIsCapping = (e) => {
const changeIsCapping = (e,item) => {
item.inspectionCharacteristicsBaseVO.quantifyCapping = ''
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
}
}
//
const changeLowlimit = (e) => {
const changeLowlimit = (e,item) => {
item.inspectionCharacteristicsBaseVO.quantifyLowlimit = ''
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
} else {
@ -1139,7 +1134,8 @@ const changeLowlimit = (e) => {
}
}
//
const changeIsTarget = (e) => {
const changeIsTarget = (e,item) => {
item.inspectionCharacteristicsBaseVO.quantifyTarget = ''
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} else {

27
src/views/qms/basicDataManage/inspectionTemplate/addForm.vue

@ -293,7 +293,7 @@
label="是否设定上限"
prop="inspectionCharacteristicsBaseVO.quantifyIsCapping"
>
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" @change="changeIsCapping"/>
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" @change="changeIsCapping($event,item)"/>
</el-form-item>
</el-col>
@ -302,7 +302,7 @@
prop="inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
label="是否设定下限"
>
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" @change="changeLowlimit"/>
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" @change="changeLowlimit($event,item)"/>
</el-form-item>
</el-col>
@ -313,7 +313,7 @@
label="是否设定目标值"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget" @change="changeIsTarget" />
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget" @change="changeIsTarget($event,item)" />
</el-form-item>
</el-col>
@ -737,11 +737,16 @@ const submitForm = async () => {
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)))) &&
// {
// console.log(String(item.inspectionCharacteristicsBaseVO.quantifyCapping).split('.')[1]?.length)
// console.log(Number(item.inspectionCharacteristicsBaseVO.quantifyDecimal))
// }
((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) {
@ -894,15 +899,18 @@ const searchTableSuccess = (formField, searchField, val, type, row) => {
}
//
const changeIsCapping = (e) => {
const changeIsCapping = (e,item) => {
item.inspectionCharacteristicsBaseVO.quantifyCapping = ''
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = true
} else {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
}
}
//
const changeLowlimit = (e) => {
const changeLowlimit = (e,item) => {
item.inspectionCharacteristicsBaseVO.quantifyLowlimit = ''
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
} else {
@ -910,7 +918,8 @@ const changeLowlimit = (e) => {
}
}
//
const changeIsTarget = (e) => {
const changeIsTarget = (e,item) => {
item.inspectionCharacteristicsBaseVO.quantifyTarget = ''
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
} else {

Loading…
Cancel
Save