Browse Source

首件记录新增失去焦点

hella_online_20240829
zhang_li 3 months ago
parent
commit
40db928e08
  1. 63
      src/views/qms/inspectionRecordFirst/addForm.vue
  2. 2
      src/views/qms/inspectionScheme/addForm.vue

63
src/views/qms/inspectionRecordFirst/addForm.vue

@ -34,7 +34,9 @@
<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 style="width: 40px" @click="opensearchItemsTable()"
><Icon icon="ep:search" />
</el-button>
@ -56,9 +58,9 @@
<div style="display: flex; width: 100%">
<el-input
v-model="data.inspectionSchemeCode"
disabled
placeholder="请选择检验方案"
/>
@blur="onBlur('inspectionScheme', InspectionSchemeApi.InspectionSchemePage)"
@focus="onFocus"/>
<el-button
type="info"
plain
@ -545,7 +547,7 @@
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" :key="count"/>
</template>
</Dialog>
<Dialog
@ -1465,6 +1467,59 @@ const inspectionValueInput = (item, cur) => {
}
}
}
//
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 {

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

@ -82,7 +82,7 @@
v-model="data.programmeTemplateCode"
placeholder="请选择检验模板"
@blur="
onBlur('programmeTemplateCode', InspectionTemplateApi.inspectionTemplatePage)
onBlur('programmeTemplate', InspectionTemplateApi.inspectionTemplatePage)
"
@focus="onFocus"
/>

Loading…
Cancel
Save