Browse Source

检验方案失去焦点bug

linshi20240813
zhang_li 3 months ago
parent
commit
ef22f92b75
  1. 47
      src/views/qms/inspectionScheme/addForm.vue

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

@ -21,7 +21,7 @@
<el-input <el-input
v-model="data.itemCode" v-model="data.itemCode"
placeholder="请选择物料编码" placeholder="请选择物料编码"
@blur="onBlur('item', ItemBasicApi.getItembasicPage)" @blur="onItemBlur('item', ItemBasicApi.getItembasicPage)"
@focus="onFocus" @focus="onFocus"
/> />
<el-button <el-button
@ -1448,6 +1448,51 @@ const changeIsTarget = (e, item) => {
rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false rules.value['inspectionCharacteristicsBaseVO.quantifyTarget'][0].required = false
} }
} }
//
const onItemBlur= 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['itemName'] = obj.name
dataObj['description'] = obj.desc1
} else {
message.alert('暂无数据')
dataObj[field + 'Code'] = ''
dataObj[field + 'Name'] = ''
}
} else {
dataObj[field + 'Name'] = ''
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
count.value++
}
}
// //
const onBlur = async (field, pageApi, item) => { const onBlur = async (field, pageApi, item) => {
const dataObj = item ? item.inspectionCharacteristicsBaseVO : data.value const dataObj = item ? item.inspectionCharacteristicsBaseVO : data.value

Loading…
Cancel
Save