Browse Source

检验模板失去焦点校验

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

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

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

Loading…
Cancel
Save