Browse Source

首件记录新增失去焦点

hella_online_20240829
zhang_li 4 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-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 type="info" plain style="width: 40px" @click="opensearchItemsTable()" <el-button type="info" plain style="width: 40px" @click="opensearchItemsTable()"
><Icon icon="ep:search" /> ><Icon icon="ep:search" />
</el-button> </el-button>
@ -56,9 +58,9 @@
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
<el-input <el-input
v-model="data.inspectionSchemeCode" v-model="data.inspectionSchemeCode"
disabled
placeholder="请选择检验方案" placeholder="请选择检验方案"
/> @blur="onBlur('inspectionScheme', InspectionSchemeApi.InspectionSchemePage)"
@focus="onFocus"/>
<el-button <el-button
type="info" type="info"
plain plain
@ -545,7 +547,7 @@
</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
@ -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> </script>
<style scoped> <style scoped>
.small-title { .small-title {

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

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

Loading…
Cancel
Save