Browse Source

检验模板失去焦点校验

hella_online_20240829
zhang_li 4 months ago
parent
commit
b0f2776f21
  1. 576
      src/views/qms/inspectionTemplate/addForm.vue

576
src/views/qms/inspectionTemplate/addForm.vue

@ -22,62 +22,57 @@
</el-col>
<el-col :span="12">
<el-form-item label="版本" prop="version">
<el-input v-model="data.version" placeholder="请填写版本" type="number"/>
<el-input v-model="data.version" placeholder="请填写版本" type="number" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="动态修改规则编码"
prop="dynamicUpdateCode"
>
<div style="display: flex; width: 100%">
<el-input
v-model="data.dynamicUpdateCode"
placeholder="请选择动态修改规则编码"
@blur='dynamicUpdateCodeBlur'
/>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'dynamicUpdateCode',
null,
'动态修改规则',
DynamicRule.allSchemas,
DynamicRuleApi.getDynamicRulePage,
[
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
],
false,
null,
data
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="动态修改规则描述"
prop="dynamicUpdateName"
>
<div style="display: flex; width: 100%">
<el-input
v-model="data.dynamicUpdateName"
placeholder="请选择动态修改规则描述"
disabled
/>
</div>
</el-form-item>
</el-col>
<el-form-item label="动态修改规则编码" prop="dynamicUpdateCode">
<div style="display: flex; width: 100%">
<el-input
v-model="data.dynamicUpdateCode"
placeholder="请选择动态修改规则编码"
@blur="mainblur('dynamicUpdate', DynamicRuleApi.getDynamicRulePage)"
@focus="mainFocus"
/>
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'dynamicUpdateCode',
null,
'动态修改规则',
DynamicRule.allSchemas,
DynamicRuleApi.getDynamicRulePage,
[
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
],
false,
null,
data
)
"
><Icon icon="ep:search"
/></el-button>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="动态修改规则描述" prop="dynamicUpdateName">
<div style="display: flex; width: 100%">
<el-input
v-model="data.dynamicUpdateName"
placeholder="请选择动态修改规则描述"
disabled
/>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs
@ -95,18 +90,17 @@
:label="item.description"
:name="item.name"
>
<template #label>
<span class="custom-tabs-label" style="display: flex; align-items: center">
<span>{{ item.description }}</span>
<Icon
icon="ep:document-copy"
color="#67C23A"
style="margin-left: 10px"
@click.stop="copy(item)"
/>
</span>
</template>
<template #label>
<span class="custom-tabs-label" style="display: flex; align-items: center">
<span>{{ item.description }}</span>
<Icon
icon="ep:document-copy"
color="#67C23A"
style="margin-left: 10px"
@click.stop="copy(item)"
/>
</span>
</template>
<div class="small-title">检验工序</div>
<!-- <Form
:ref="`formRefProcess`+index"
@ -138,7 +132,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="顺序号" prop="sequenceCode">
<el-input v-model="item.sequenceCode" type="number"/>
<el-input v-model="item.sequenceCode" type="number" />
</el-form-item>
</el-col>
<!-- <el-col :span="12">
@ -150,7 +144,6 @@
/>
</el-form-item>
</el-col> -->
</el-row>
</el-form>
<div class="small-title">检验特性</div>
@ -179,8 +172,14 @@
<el-input
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode"
placeholder="请选择检验方法编码"
disabled
@blur='inspectionMethodCodeBlur(item)'
@blur="
mainblur(
'inspectionMethod',
InspectionMethodApi.getInspectionMethodPage,
item
)
"
@focus="mainFocus"
/>
<el-button
type="info"
@ -219,7 +218,7 @@
<el-input
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodName"
disabled
placeholder="请选择检验方法编码"
placeholder="请选择检验方法"
/>
</div>
</el-form-item>
@ -231,9 +230,12 @@
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.samplingProcessName"
disabled
v-model="item.inspectionCharacteristicsBaseVO.samplingProcessCode"
placeholder="请选择采样过程"
@blur="
mainblur('samplingProcess', SamplingProcessApi.getSamplingProcessPage, item)
"
@focus="mainFocus"
/>
<el-button
type="info"
@ -263,13 +265,26 @@
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="采样过程描述"
prop="inspectionCharacteristicsBaseVO.inspectionMethodName"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodName"
disabled
placeholder="请选择采样过程描述"
/>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="是否允许修改特征值"
prop="inspectionCharacteristicsBaseVO.isCanUpdate"
>
<el-switch v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate"/>
<el-switch v-model="item.inspectionCharacteristicsBaseVO.isCanUpdate" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -298,7 +313,7 @@
<el-select
v-model="item.inspectionCharacteristicsBaseVO.featureType"
placeholder="请选择特征类型"
@change="changeFeatureType($event,item)"
@change="changeFeatureType($event, item)"
>
<el-option
v-for="dict in getStrDictOptions(
@ -322,9 +337,7 @@
placeholder="请选择结果录入方式"
>
<el-option
v-for="dict in getStrDictOptions(
DICT_TYPE.UOM
)"
v-for="dict in getStrDictOptions(DICT_TYPE.UOM)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -338,8 +351,10 @@
prop="inspectionCharacteristicsBaseVO.quantifyDecimal"
v-if="item.inspectionCharacteristicsBaseVO.featureType == 0"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal"
type="number"/>
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyDecimal"
type="number"
/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0">
@ -347,7 +362,10 @@
label="是否设定上限"
prop="inspectionCharacteristicsBaseVO.quantifyIsCapping"
>
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping" @change="changeIsCapping($event,item)"/>
<el-switch
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsCapping"
@change="changeIsCapping($event, item)"
/>
</el-form-item>
</el-col>
@ -356,56 +374,80 @@
prop="inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
label="是否设定下限"
>
<el-switch v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit" @change="changeLowlimit($event,item)"/>
<el-switch
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit"
@change="changeLowlimit($event, item)"
/>
</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($event,item)" />
<el-switch
v-model="item.inspectionCharacteristicsBaseVO.quantifyIsTarget"
@change="changeIsTarget($event, item)"
/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO. quantifyIsCapping">
<el-form-item
label="上限值"
prop="inspectionCharacteristicsBaseVO.quantifyCapping"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping" type="number"/>
<el-col
:span="12"
v-if="
item.inspectionCharacteristicsBaseVO.featureType == 0 &&
item.inspectionCharacteristicsBaseVO.quantifyIsCapping
"
>
<el-form-item label="上限值" prop="inspectionCharacteristicsBaseVO.quantifyCapping">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyCapping"
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"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit" type="number"/>
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyLowlimit"
type="number"
/>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 0 && item.inspectionCharacteristicsBaseVO.quantifyIsTarget">
<el-form-item
label="目标值"
prop="inspectionCharacteristicsBaseVO.quantifyTarget"
>
<el-input v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget" type="number"/>
<el-col
:span="12"
v-if="
item.inspectionCharacteristicsBaseVO.featureType == 0 &&
item.inspectionCharacteristicsBaseVO.quantifyIsTarget
"
>
<el-form-item label="目标值" prop="inspectionCharacteristicsBaseVO.quantifyTarget">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyTarget"
type="number"
/>
</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
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyName"
disabled
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
placeholder="请选择选定集"
@blur="mainblur('quantifyQuantify', SelectedSetApi.getSelectedSetPage, item)"
@focus="mainFocus"
/>
<el-button
type="info"
@ -435,13 +477,31 @@
</div>
</el-form-item>
</el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 1">
<el-form-item
label="选定集描述"
prop="inspectionCharacteristicsBaseVO.quantifyQuantifyName"
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyName"
disabled
placeholder="请选择选定集描述"
/>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
</el-tabs>
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
<ButtonBase
:Butttondata="Butttondata"
@button-base-click="buttonBaseClick"
:key="count"
/>
</template>
</Dialog>
<Dialog title="修改名称" v-model="dialogVisibleName" width="500px" :close-on-click-modal="false">
@ -476,7 +536,12 @@ 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 { validateInteger,validateTwoNum,validateMaxNumber5,validateNumSix } from '@/utils/validator'
import {
validateInteger,
validateTwoNum,
validateMaxNumber5,
validateNumSix
} from '@/utils/validator'
const message = useMessage() //
const props = defineProps({
@ -525,7 +590,7 @@ const data = ref({
code: '',
description: '',
version: '',
dynamicUpdateCode:'',
dynamicUpdateCode: '',
process: []
})
@ -543,13 +608,13 @@ const rules = ref({
description: [{ required: true, message: '请填写描述', trigger: 'blur' }],
version: [
{ required: true, message: '请填写版本', trigger: 'blur' },
{ validator:validateNumSix, message: '版本号小数点前位数不得大于6', trigger: 'blur'},
{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}
{ validator: validateNumSix, message: '版本号小数点前位数不得大于6', trigger: 'blur' },
{ validator: validateTwoNum, message: '小数点后最多2位', trigger: 'blur' }
],
inspectionCode: [{ required: true, message: '请选择检验方案模板', trigger: 'blur' }],
sequenceCode: [
{ required: true, message: '请填写顺序号', trigger: 'blur' },
{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}
{ validator: validateInteger, message: '请输入正确的整数', trigger: 'blur' }
],
inspectionCharCode: [{ required: true, message: '请选择检验特性', trigger: 'blur' }],
'inspectionCharacteristicsBaseVO.description': [
@ -571,28 +636,27 @@ 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' },
{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'},
{ validator:validateMaxNumber5, message: '不能大于5', 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) => {
@ -606,13 +670,13 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
if (row) {
console.log(row)
//
if(formType.value == 'create'){
data.value ={
if (formType.value == 'create') {
data.value = {
code: '',
description:row.description,
version:String(row.version),
dynamicUpdateCode:row.dynamicUpdateCode,
dynamicUpdateName:row.dynamicUpdateName,
description: row.description,
version: String(row.version),
dynamicUpdateCode: row.dynamicUpdateCode,
dynamicUpdateName: row.dynamicUpdateName,
process: []
}
let list = await InspectionProcessPageApi.getListByTempleteCode(row.code)
@ -620,31 +684,31 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
let arr = []
list.forEach((item, index) => {
let obj = {
description:item.description,
inspectionCharCode:item.inspectionCharCode,
inspectionCode:item.inspectionCode,
sequenceCode:item.sequenceCode,
name :String(index + 1),
inspectionCharacteristicsBaseVO:{
description:item.inspectionCharacteristicsBaseVO.description,
featureType:item.inspectionCharacteristicsBaseVO.featureType,
inspectionMethodCode:item.inspectionCharacteristicsBaseVO.inspectionMethodCode,
inspectionMethodName:item.inspectionCharacteristicsBaseVO.inspectionMethodName,
isCanUpdate:item.inspectionCharacteristicsBaseVO.isCanUpdate,
isDestructionInspection:item.inspectionCharacteristicsBaseVO.isDestructionInspection,
quantifyCapping:item.inspectionCharacteristicsBaseVO.quantifyCapping,
quantifyDecimal:item.inspectionCharacteristicsBaseVO.quantifyDecimal,
quantifyIsCapping:item.inspectionCharacteristicsBaseVO.quantifyIsCapping,
quantifyIsLowlimit:item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit,
quantifyIsTarget:item.inspectionCharacteristicsBaseVO.quantifyIsTarget,
quantifyLowlimit:item.inspectionCharacteristicsBaseVO.quantifyLowlimit,
quantifyQuantifyCode:item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode,
quantifyQuantifyName:item.inspectionCharacteristicsBaseVO.quantifyQuantifyName,
quantifyTarget:item.inspectionCharacteristicsBaseVO.quantifyTarget,
quantifyUom:item.inspectionCharacteristicsBaseVO.quantifyUom,
resultEntryMethod:item.inspectionCharacteristicsBaseVO.resultEntryMethod,
samplingProcessCode:item.inspectionCharacteristicsBaseVO.samplingProcessCode,
samplingProcessName:item.inspectionCharacteristicsBaseVO.samplingProcessName,
description: item.description,
inspectionCharCode: item.inspectionCharCode,
inspectionCode: item.inspectionCode,
sequenceCode: item.sequenceCode,
name: String(index + 1),
inspectionCharacteristicsBaseVO: {
description: item.inspectionCharacteristicsBaseVO.description,
featureType: item.inspectionCharacteristicsBaseVO.featureType,
inspectionMethodCode: item.inspectionCharacteristicsBaseVO.inspectionMethodCode,
inspectionMethodName: item.inspectionCharacteristicsBaseVO.inspectionMethodName,
isCanUpdate: item.inspectionCharacteristicsBaseVO.isCanUpdate,
isDestructionInspection: item.inspectionCharacteristicsBaseVO.isDestructionInspection,
quantifyCapping: item.inspectionCharacteristicsBaseVO.quantifyCapping,
quantifyDecimal: item.inspectionCharacteristicsBaseVO.quantifyDecimal,
quantifyIsCapping: item.inspectionCharacteristicsBaseVO.quantifyIsCapping,
quantifyIsLowlimit: item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit,
quantifyIsTarget: item.inspectionCharacteristicsBaseVO.quantifyIsTarget,
quantifyLowlimit: item.inspectionCharacteristicsBaseVO.quantifyLowlimit,
quantifyQuantifyCode: item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode,
quantifyQuantifyName: item.inspectionCharacteristicsBaseVO.quantifyQuantifyName,
quantifyTarget: item.inspectionCharacteristicsBaseVO.quantifyTarget,
quantifyUom: item.inspectionCharacteristicsBaseVO.quantifyUom,
resultEntryMethod: item.inspectionCharacteristicsBaseVO.resultEntryMethod,
samplingProcessCode: item.inspectionCharacteristicsBaseVO.samplingProcessCode,
samplingProcessName: item.inspectionCharacteristicsBaseVO.samplingProcessName
}
}
@ -667,8 +731,7 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
arr.push(obj)
})
data.value.process = arr
}else{
} else {
data.value = JSON.parse(JSON.stringify(row))
data.value.version = String(data.value.version)
let list = await InspectionProcessPageApi.getListByTempleteCode(row.code)
@ -694,7 +757,6 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
})
data.value.process = list
}
} else {
data.value = {
code: '',
@ -703,8 +765,8 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
process: []
}
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
}
tabIndex = data.value.process.length + 1
@ -748,7 +810,7 @@ const buttonBaseClick1 = (val) => {
description: nameForm.value.name,
name: newTabName,
inspectionCode: '',
dynamicUpdateCode:'',
dynamicUpdateCode: '',
sequenceCode: '',
inspectionCharCode: '',
inspectionCharacteristicsBaseVO: {
@ -786,6 +848,7 @@ const buttonBaseClick1 = (val) => {
}
}
const buttonBaseClick = (val) => {
console.log(val)
//
if (val == 'save') {
submitForm()
@ -808,23 +871,19 @@ 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
)
})
}
// 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 {
//
await validateForm(formProcessRef.value)
await formMainRef.value.validate()
@ -833,7 +892,7 @@ const submitForm = async () => {
message.error(`请添加工序`)
return
}
if(hasDuplicates(data.value.process)){
if (hasDuplicates(data.value.process)) {
message.error(`检验工序顺序号不能相同`)
return
}
@ -862,10 +921,16 @@ const submitForm = async () => {
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
((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(',')
@ -873,20 +938,39 @@ const submitForm = async () => {
return
}
//
const arr2 = data.value.process.filter(
(item) =>
{
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))))
}
)
console.log(99,arr2)
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)))
)
})
console.log(99, arr2)
if (arr2 && arr2.length > 0) {
const str = arr2.map((item) => item.description).join(',')
message.error(`${str}工序上限值应大于目标值大于下限值`)
@ -914,15 +998,15 @@ if (props.footButttondata) {
]
}
//
const changeFeatureType = (e,item) => {
const changeFeatureType = (e, item) => {
item.inspectionCharacteristicsBaseVO.quantifyIsCapping = false
item.inspectionCharacteristicsBaseVO.quantifyIsLowlimit = false
item.inspectionCharacteristicsBaseVO.quantifyIsTarget = false
item.inspectionCharacteristicsBaseVO.quantifyCapping = ''
item.inspectionCharacteristicsBaseVO.quantifyLowlimit = ''
item.inspectionCharacteristicsBaseVO.quantifyTarget= ''
item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode= ''
item.inspectionCharacteristicsBaseVO.quantifyQuantifyName= ''
item.inspectionCharacteristicsBaseVO.quantifyTarget = ''
item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode = ''
item.inspectionCharacteristicsBaseVO.quantifyQuantifyName = ''
console.log(e)
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyQuantifyCode'][0].required = true
@ -1010,35 +1094,33 @@ const opensearchTable = (
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {
console.log(row)
if(type == 'features'){
if (type == 'features') {
row.inspectionCharacteristicsBaseVO[formField] = val[0].code
if(formField == 'inspectionMethodCode'){
if (formField == 'inspectionMethodCode') {
row.inspectionCharacteristicsBaseVO.inspectionMethodName = val[0].description
}else if(formField == 'samplingProcessCode'){
} else if (formField == 'samplingProcessCode') {
row.inspectionCharacteristicsBaseVO.samplingProcessName = val[0].description
}else if(formField == 'quantifyQuantifyCode'){
} else if (formField == 'quantifyQuantifyCode') {
row.inspectionCharacteristicsBaseVO.quantifyQuantifyName = val[0].description
}
}else{
if(formField == 'dynamicUpdateCode'){
} else {
if (formField == 'dynamicUpdateCode') {
data.value[formField] = val[0].code
data.value.dynamicUpdateName = val[0].description
}
}
}
//
const changeIsCapping = (e,item) => {
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,item) => {
const changeLowlimit = (e, item) => {
item.inspectionCharacteristicsBaseVO.quantifyLowlimit = ''
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = true
@ -1047,7 +1129,7 @@ const changeLowlimit = (e,item) => {
}
}
//
const changeIsTarget = (e,item) => {
const changeIsTarget = (e, item) => {
item.inspectionCharacteristicsBaseVO.quantifyTarget = ''
if (e) {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = true
@ -1056,52 +1138,72 @@ const changeIsTarget = (e,item) => {
}
}
//
const copy = (item)=>{
const copy = (item) => {
const newItem = JSON.parse(JSON.stringify(item))
newItem.name = data.value.process[data.value.process.length-1].name + 1
newItem.name = data.value.process[data.value.process.length - 1].name + 1
newItem.code = ''
newItem.id = ''
newItem.sequenceCode =data.value?.process[data.value?.process?.length-1]?.sequenceCode? parseInt(data.value.process[data.value.process.length-1].sequenceCode) + 1 : ''
newItem.sequenceCode = data.value?.process[data.value?.process?.length - 1]?.sequenceCode
? parseInt(data.value.process[data.value.process.length - 1].sequenceCode) + 1
: ''
newItem.inspectionCharacteristicsBaseVO.code = ''
newItem.inspectionCharacteristicsBaseVO. id = ''
newItem.inspectionCharacteristicsBaseVO.id = ''
newItem.inspectionCharacteristicsBaseVO.concurrencyStamp = 1
data.value.process.push(newItem)
editableTabsValue.value = newItem.name
editableTabsValue.value = newItem.name
}
//
const dynamicUpdateCodeBlur = async () => {
const _searchCondition = {}
const filters: any[] = []
filters.push(
{
action: '==',
column: 'available',
value: 'TRUE'
},
{
column: 'code',
action: '==',
value: data.value?.dynamicUpdateCode?.trim()
const mainblur = async (field, pageApi, item) => {
const dataObj = item ? item.inspectionCharacteristicsBaseVO : data.value
if (dataObj[field + 'Code']) {
const _searchCondition = {}
const filters: any[] = []
filters.push(
{
action: '==',
column: 'available',
value: 'TRUE'
},
{
column: 'code',
action: '==',
value: dataObj[field + 'Code']?.trim()
}
)
//
_searchCondition.isSearch = true
_searchCondition.filters = filters
const array = await pageApi(_searchCondition)
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
count.value++
const obj = array.list[0]
if (obj) {
dataObj[field + 'Name'] = obj.description
} else {
message.alert('暂无数据')
dataObj[field + 'Code'] = ''
dataObj[field + 'Name'] = ''
}
)
//
_searchCondition.isSearch = true
_searchCondition.filters = filters
const array = await DynamicRuleApi.getDynamicRulePage(_searchCondition)
const obj = array.list[0]
if (obj) {
data.value.dynamicUpdateName = obj.description
} else {
message.alert('暂无数据')
data.value.dynamicUpdateCode =''
data.value.dynamicUpdateName =''
}
dataObj[field + 'Name'] = ''
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
count.value++
}
}
//
const inspectionMethodCodeBlur = async () => {
const count = ref(0)
const mainFocus = () => {
Butttondata = [
defaultButtons.formSaveBtn({ disabled: true }), //
defaultButtons.formCloseBtn(null) //
]
count.value++
}
</script>
<style scoped>
.small-title {
@ -1113,8 +1215,8 @@ const inspectionMethodCodeBlur = async () => {
</style>
<style>
.el-tabs--left .el-tabs__header.is-left {
padding-bottom: 5000px;
margin-bottom: -5000px;
padding-bottom: 5000px;
margin-bottom: -5000px;
min-width: 150px !important;
}
.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left {

Loading…
Cancel
Save