Browse Source

检验方案失去焦点

hella_online_20240829
zhang_li 3 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"
>
<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-col :span="12" v-if="data.code">
<el-form-item label="编码" prop="code">
@ -18,7 +18,12 @@
<el-col :span="12">
<el-form-item label="物料编码" prop="itemCode">
<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
type="info"
plain
@ -41,6 +46,13 @@
</div>
</el-form-item>
</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-form-item label="描述" prop="description">
<el-input v-model="data.description" placeholder="请填写描述" />
@ -53,28 +65,6 @@
</el-col>
<el-col :span="12">
<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-option
v-for="dict in getStrDictOptions(DICT_TYPE.INSPECTION_TYPE)"
@ -89,9 +79,12 @@
<el-form-item label="检验模板" prop="programmeTemplateCode">
<div style="display: flex; width: 100%">
<el-input
v-model="data.programmeTemplateName"
disabled
v-model="data.programmeTemplateCode"
placeholder="请选择检验模板"
@blur="
onBlur('programmeTemplateCode', InspectionTemplateApi.inspectionTemplatePage)
"
@focus="onFocus"
/>
<el-button
type="info"
@ -122,12 +115,24 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="动态修改规则" prop="dynamicUpdateCode">
<el-form-item label="检验模板描述" prop="programmeTemplateName">
<div style="display: flex; width: 100%">
<el-input
v-model="data.dynamicUpdateName"
v-model="data.programmeTemplateName"
placeholder="请选择检验模板"
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="请选择动态修改规则"
@blur="onBlur('dynamicUpdate', DynamicRuleApi.getDynamicRulePage)"
@focus="onFocus"
/>
<el-button
type="info"
@ -157,6 +162,17 @@
</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-col :span="12">
<el-form-item label="拆分规则" prop="splitRule">
<el-select v-model="data.splitRule" placeholder="请选择拆分规则">
@ -344,9 +360,16 @@
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodName"
disabled
v-model="item.inspectionCharacteristicsBaseVO.inspectionMethodCode"
placeholder="请选择检验方法"
@blur="
onBlur(
'inspectionMethod',
InspectionMethodApi.getInspectionMethodPage,
item
)
"
@focus="onFocus"
/>
<el-button
type="info"
@ -376,6 +399,20 @@
</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="采样过程"
@ -383,9 +420,12 @@
>
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.samplingProcessName"
disabled
v-model="item.inspectionCharacteristicsBaseVO.samplingProcessCode"
placeholder="请选择采样过程"
@blur="
onBlur('samplingProcess', SamplingProcessApi.getSamplingProcessPage, item)
"
@focus="onFocus"
/>
<el-button
type="info"
@ -415,6 +455,20 @@
</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="是否允许修改特征值"
@ -586,8 +640,9 @@
<div style="display: flex; width: 100%">
<el-input
v-model="item.inspectionCharacteristicsBaseVO.quantifyQuantifyCode"
disabled
placeholder="请选择选定集"
@blur="onBlur('quantifyQuantify', SelectedSetApi.getSelectedSetPage, item)"
@focus="onFocus"
/>
<el-button
type="info"
@ -618,13 +673,27 @@
</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
@ -820,51 +889,51 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
if (row) {
data.value = JSON.parse(JSON.stringify(row))
//
if(formType.value == 'create'){
if (formType.value == 'create') {
data.value.id = ''
data.value.code = ''
data.value.itemCode = ''
data.value.process= []
let list =[]
data.value.process = []
let list = []
if (row.content) {
list = JSON.parse(row.content)
} else {
list = await InspectionProcessPageApi.getListByTempleteCode(row.programmeTemplateCode)
}
list = JSON.parse(row.content)
} else {
list = await InspectionProcessPageApi.getListByTempleteCode(row.programmeTemplateCode)
}
editableTabsValue.value = '1'
let arr = []
list.forEach((item, index) => {
let obj = {
inspectionCode:item.inspectionCode,
description:item.description,
inspectionCharCode:item.inspectionCharCode,
sequenceCode:item.sequenceCode,
name :String(index + 1),
inspectionCharacteristicsBaseVO:{
description:item.inspectionCharacteristicsBaseVO.description,
featureType:item.inspectionCharacteristicsBaseVO.featureType,
inspectionMethodCode:item.inspectionCharacteristicsBaseVO.inspectionMethodCode,
inspectionMethodName:item.inspectionCharacteristicsBaseVO.inspectionMethodName,
samplingProcessCode:item.inspectionCharacteristicsBaseVO.samplingProcessCode,
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,
inspectionCode: item.inspectionCode,
description: item.description,
inspectionCharCode: item.inspectionCharCode,
sequenceCode: item.sequenceCode,
name: String(index + 1),
inspectionCharacteristicsBaseVO: {
description: item.inspectionCharacteristicsBaseVO.description,
featureType: item.inspectionCharacteristicsBaseVO.featureType,
inspectionMethodCode: item.inspectionCharacteristicsBaseVO.inspectionMethodCode,
inspectionMethodName: item.inspectionCharacteristicsBaseVO.inspectionMethodName,
samplingProcessCode: item.inspectionCharacteristicsBaseVO.samplingProcessCode,
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
}
}
//
if (item.inspectionCharacteristicsBaseVO.quantifyIsCapping) {
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
console.log(111, data.value)
}else{
let list = []
if (row.content) {
list = JSON.parse(row.content)
} else {
list = await InspectionProcessPageApi.getListByTempleteCode(row.programmeTemplateCode)
}
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
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
let list = []
if (row.content) {
list = JSON.parse(row.content)
} else {
list = await InspectionProcessPageApi.getListByTempleteCode(row.programmeTemplateCode)
}
if (item.inspectionCharacteristicsBaseVO.sampleType == 4) {
isShowField.value += 1 //isShowField > 0aql
rules.value['inspectionCharacteristicsBaseVO.quantifyCapping'][0].required = false
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
}
})
// 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
data.value.process = list
}
} else {
data.value = {
code: '',
@ -1382,6 +1448,59 @@ const changeIsTarget = (e, item) => {
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>
<style scoped>
.small-title {
@ -1393,8 +1512,8 @@ const changeIsTarget = (e, item) => {
</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 {

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

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

Loading…
Cancel
Save