Browse Source

检验方案失去焦点

hella_online_20240829
zhang_li 4 months ago
parent
commit
162a6173eb
  1. 339
      src/views/qms/inspectionScheme/addForm.vue
  2. 25
      src/views/qms/inspectionTemplate/addForm.vue

339
src/views/qms/inspectionScheme/addForm.vue

@ -8,7 +8,7 @@
:vLoading="formLoading" :vLoading="formLoading"
> >
<div style="max-height: 80vh; overflow-y: auto; padding: 0px 20px"> <div style="max-height: 80vh; overflow-y: auto; padding: 0px 20px">
<el-form :model="data" label-width="auto" :rules="rules" ref="formMainRef"> <el-form :model="data" label-width="auto" :rules="rules" ref="formMainRef">
<el-row gutter="20"> <el-row gutter="20">
<el-col :span="12" v-if="data.code"> <el-col :span="12" v-if="data.code">
<el-form-item label="编码" prop="code"> <el-form-item label="编码" prop="code">
@ -18,7 +18,12 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="物料编码" prop="itemCode"> <el-form-item label="物料编码" prop="itemCode">
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input v-model="data.itemCode" disabled placeholder="请选择物料编码" /> <el-input
v-model="data.itemCode"
placeholder="请选择物料编码"
@blur="onBlur('item', ItemBasicApi.getItembasicPage)"
@focus="onFocus"
/>
<el-button <el-button
type="info" type="info"
plain plain
@ -41,6 +46,13 @@
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="物料名称" prop="itemName">
<div style="display: flex; width: 100%">
<el-input v-model="data.itemName" placeholder="请选择物料" disabled />
</div>
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="描述" prop="description"> <el-form-item label="描述" prop="description">
<el-input v-model="data.description" placeholder="请填写描述" /> <el-input v-model="data.description" placeholder="请填写描述" />
@ -53,28 +65,6 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="检验类型" prop="inspectionType"> <el-form-item label="检验类型" prop="inspectionType">
<!-- <div style="display: flex; width: 100%">
<el-input v-model="data.testTypeName" disabled placeholder="请选择检验类型" />
<el-button
type="info"
plain
style="width: 40px"
@click="
opensearchTable(
'testTypeCode',
null,
'检验类型',
SamplingProcess.allSchemas,
SamplingProcessApi.getSamplingProcessPage,
null,
false,
'main',
null
)
"
><Icon icon="ep:search" />
</el-button>
</div> -->
<el-select v-model="data.inspectionType" placeholder="请选择检验类型"> <el-select v-model="data.inspectionType" placeholder="请选择检验类型">
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_TYPE)" v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_TYPE)"
@ -89,9 +79,12 @@
<el-form-item label="检验模板" prop="programmeTemplateCode"> <el-form-item label="检验模板" prop="programmeTemplateCode">
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input <el-input
v-model="data.programmeTemplateName" v-model="data.programmeTemplateCode"
disabled
placeholder="请选择检验模板" placeholder="请选择检验模板"
@blur="
onBlur('programmeTemplateCode', InspectionTemplateApi.inspectionTemplatePage)
"
@focus="onFocus"
/> />
<el-button <el-button
type="info" type="info"
@ -122,12 +115,24 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="动态修改规则" prop="dynamicUpdateCode"> <el-form-item label="检验模板描述" prop="programmeTemplateName">
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input <el-input
v-model="data.dynamicUpdateName" v-model="data.programmeTemplateName"
placeholder="请选择检验模板"
disabled disabled
/>
</div>
</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="请选择动态修改规则" placeholder="请选择动态修改规则"
@blur="onBlur('dynamicUpdate', DynamicRuleApi.getDynamicRulePage)"
@focus="onFocus"
/> />
<el-button <el-button
type="info" type="info"
@ -157,6 +162,17 @@
</div> </div>
</el-form-item> </el-form-item>
</el-col> </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-col :span="12"> <!-- <el-col :span="12">
<el-form-item label="拆分规则" prop="splitRule"> <el-form-item label="拆分规则" prop="splitRule">
<el-select v-model="data.splitRule" placeholder="请选择拆分规则"> <el-select v-model="data.splitRule" placeholder="请选择拆分规则">
@ -344,9 +360,16 @@
> >
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodName" v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode"
disabled
placeholder="请选择检验方法" placeholder="请选择检验方法"
@blur="
onBlur(
'inspectionMethod',
InspectionMethodApi.getInspectionMethodPage,
item
)
"
@focus="onFocus"
/> />
<el-button <el-button
type="info" type="info"
@ -376,6 +399,20 @@
</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="采样过程"
@ -383,9 +420,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="
onBlur('samplingProcess', SamplingProcessApi.getSamplingProcessPage, item)
"
@focus="onFocus"
/> />
<el-button <el-button
type="info" type="info"
@ -415,6 +455,20 @@
</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="是否允许修改特征值"
@ -586,8 +640,9 @@
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode" v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
disabled
placeholder="请选择选定集" placeholder="请选择选定集"
@blur="onBlur('quantifyQuantify', SelectedSetApi.getSelectedSetPage, item)"
@focus="onFocus"
/> />
<el-button <el-button
type="info" type="info"
@ -618,13 +673,27 @@
</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 <Dialog
@ -820,51 +889,51 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
if (row) { if (row) {
data.value = JSON.parse(JSON.stringify(row)) data.value = JSON.parse(JSON.stringify(row))
// //
if(formType.value == 'create'){ if (formType.value == 'create') {
data.value.id = '' data.value.id = ''
data.value.code = '' data.value.code = ''
data.value.itemCode = '' data.value.itemCode = ''
data.value.process= [] data.value.process = []
let list =[] let list = []
if (row.content) { if (row.content) {
list = JSON.parse(row.content) list = JSON.parse(row.content)
} else { } else {
list = await InspectionProcessPageApi.getListByTempleteCode(row.programmeTemplateCode) list = await InspectionProcessPageApi.getListByTempleteCode(row.programmeTemplateCode)
} }
editableTabsValue.value = '1' editableTabsValue.value = '1'
let arr = [] let arr = []
list.forEach((item, index) => { list.forEach((item, index) => {
let obj = { let obj = {
inspectionCode:item.inspectionCode, inspectionCode: item.inspectionCode,
description:item.description, description: item.description,
inspectionCharCode:item.inspectionCharCode, inspectionCharCode: item.inspectionCharCode,
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,
samplingProcessCode:item.inspectionCharacteristicsBaseVO.samplingProcessCode, samplingProcessCode: item.inspectionCharacteristicsBaseVO.samplingProcessCode,
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
@ -885,49 +954,46 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
}) })
data.value.process = arr data.value.process = arr
console.log(111, data.value) console.log(111, data.value)
}else{
let list = []
if (row.content) {
list = JSON.parse(row.content)
} else { } else {
list = await InspectionProcessPageApi.getListByTempleteCode(row.programmeTemplateCode) let list = []
} if (row.content) {
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false list = JSON.parse(row.content)
rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false } else {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false list = await InspectionProcessPageApi.getListByTempleteCode(row.programmeTemplateCode)
editableTabsValue.value = '1'
list.forEach((item, index) => {
item.name = String(index + 1)
//
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
} }
if (item.inspectionCharacteristicsBaseVO.sampleType == 4) { rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
isShowField.value += 1 //isShowField > 0aql rules.value['inspectionCharacteristicsBaseVO.quantifyLowlimit'][0].required = false
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
editableTabsValue.value = '1'
list.forEach((item, index) => {
item.name = String(index + 1)
//
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
}
if (item.inspectionCharacteristicsBaseVO.sampleType == 4) {
isShowField.value += 1 //isShowField > 0aql
}
})
// aql
if (isShowField.value > 0) {
rules.value.aql[0].required = true
rules.value.aql[0].required = true
} else {
rules.value.aql[0].required = false
rules.value.aql[0].required = false
} }
}) data.value.process = list
// aql
if (isShowField.value > 0) {
rules.value.aql[0].required = true
rules.value.aql[0].required = true
} else {
rules.value.aql[0].required = false
rules.value.aql[0].required = false
}
data.value.process = list
} }
} else { } else {
data.value = { data.value = {
code: '', code: '',
@ -1382,6 +1448,59 @@ const changeIsTarget = (e, item) => {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
} }
} }
//
const onBlur = 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'] = ''
}
} else {
dataObj[field + 'Name'] = ''
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
count.value++
}
}
const count = ref(0)
//
const onFocus = () => {
Butttondata = [
defaultButtons.formSaveBtn({ disabled: true }), //
defaultButtons.formCloseBtn(null) //
]
count.value++
}
</script> </script>
<style scoped> <style scoped>
.small-title { .small-title {
@ -1393,8 +1512,8 @@ const changeIsTarget = (e, item) => {
</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 {

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

@ -31,8 +31,8 @@
<el-input <el-input
v-model="data.dynamicUpdateCode" v-model="data.dynamicUpdateCode"
placeholder="请选择动态修改规则编码" placeholder="请选择动态修改规则编码"
@blur="mainblur('dynamicUpdate', DynamicRuleApi.getDynamicRulePage)" @blur="onBlur('dynamicUpdate', DynamicRuleApi.getDynamicRulePage)"
@focus="mainFocus" @focus="onFocus"
/> />
<el-button <el-button
type="info" type="info"
@ -173,13 +173,13 @@
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode" v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode"
placeholder="请选择检验方法编码" placeholder="请选择检验方法编码"
@blur=" @blur="
mainblur( onBlur(
'inspectionMethod', 'inspectionMethod',
InspectionMethodApi.getInspectionMethodPage, InspectionMethodApi.getInspectionMethodPage,
item item
) )
" "
@focus="mainFocus" @focus="onFocus"
/> />
<el-button <el-button
type="info" type="info"
@ -233,9 +233,9 @@
v-model="item.inspectionCharacteristicsBaseVO.samplingProcessCode" v-model="item.inspectionCharacteristicsBaseVO.samplingProcessCode"
placeholder="请选择采样过程" placeholder="请选择采样过程"
@blur=" @blur="
mainblur('samplingProcess', SamplingProcessApi.getSamplingProcessPage, item) onBlur('samplingProcess', SamplingProcessApi.getSamplingProcessPage, item)
" "
@focus="mainFocus" @focus="onFocus"
/> />
<el-button <el-button
type="info" type="info"
@ -446,8 +446,8 @@
<el-input <el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode" v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
placeholder="请选择选定集" placeholder="请选择选定集"
@blur="mainblur('quantifyQuantify', SelectedSetApi.getSelectedSetPage, item)" @blur="onBlur('quantifyQuantify', SelectedSetApi.getSelectedSetPage, item)"
@focus="mainFocus" @focus="onFocus"
/> />
<el-button <el-button
type="info" type="info"
@ -477,7 +477,7 @@
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 1"> <el-col :span="12" v-if="item.inspectionCharacteristicsBaseVO.featureType == 1">
<el-form-item <el-form-item
label="选定集描述" label="选定集描述"
prop="inspectionCharacteristicsBaseVO.quantifyQuantifyName" prop="inspectionCharacteristicsBaseVO.quantifyQuantifyName"
@ -1152,8 +1152,8 @@ const copy = (item) => {
data.value.process.push(newItem) data.value.process.push(newItem)
editableTabsValue.value = newItem.name editableTabsValue.value = newItem.name
} }
// //
const mainblur = async (field, pageApi, item) => { const onBlur = async (field, pageApi, item) => {
const dataObj = item ? item.inspectionCharacteristicsBaseVO : data.value const dataObj = item ? item.inspectionCharacteristicsBaseVO : data.value
if (dataObj[field + 'Code']) { if (dataObj[field + 'Code']) {
const _searchCondition = {} const _searchCondition = {}
@ -1197,7 +1197,8 @@ const mainblur = async (field, pageApi, item) => {
} }
} }
const count = ref(0) const count = ref(0)
const mainFocus = () => { //
const onFocus = () => {
Butttondata = [ Butttondata = [
defaultButtons.formSaveBtn({ disabled: true }), // defaultButtons.formSaveBtn({ disabled: true }), //
defaultButtons.formCloseBtn(null) // defaultButtons.formCloseBtn(null) //

Loading…
Cancel
Save