Browse Source

HL-5395 WMS,SCP,QMS在所有列表页上面的查询框中输入信息后按【回车】,可以直接查询,相当于点击了【查询按钮】

hella_online_20240821
wangyufei 3 months ago
parent
commit
2b0f6b770f
  1. 6
      src/components/Form/src/Form.vue
  2. 16
      src/components/Search/src/Search.vue

6
src/components/Form/src/Form.vue

@ -400,6 +400,12 @@ export default defineComponent({
onBlur={(e) => { onBlur(item.field, e) }} onBlur={(e) => { onBlur(item.field, e) }}
onFocus={(e) => { onFocus(item.field) }} onFocus={(e) => { onFocus(item.field) }}
onInput={(value)=>{onInput(item.field,value)}} onInput={(value)=>{onInput(item.field,value)}}
onKeyup={(event)=>{
if(event.keyCode === 13){
//
emit('onEnter',item.field,formModel.value[item.field],event)
}
}}
{...(notRenderOptions.includes(item?.component as string) && {...(notRenderOptions.includes(item?.component as string) &&
item?.componentProps?.options item?.componentProps?.options
? { options: item?.componentProps?.options || [] } ? { options: item?.componentProps?.options || [] }

16
src/components/Search/src/Search.vue

@ -63,9 +63,15 @@ const props = defineProps({
required: false, required: false,
default: [] default: []
}, },
//true
enterSearch:{
type: Boolean,
required: false,
default: true
},
}) })
const emit = defineEmits(['search', 'reset','onInput','onChange','searchTableSuccess']) const emit = defineEmits(['search', 'reset','onInput','onChange','onEnter','searchTableSuccess'])
const visible = ref(true) const visible = ref(true)
@ -116,6 +122,13 @@ const onInput = (field,value) => {
const onChange = (field, value)=>{ const onChange = (field, value)=>{
emit('onChange', field,value) emit('onChange', field,value)
} }
const onEnter = async (field, value, e) => {
if(props.enterSearch){
search()
}else{
emit('onEnter', field, value, e)
}
}
const searchTableRef = ref() const searchTableRef = ref()
const opensearchTable = ( const opensearchTable = (
formField, formField,
@ -291,6 +304,7 @@ defineExpose({setFormValues,search}) // 提供 open 方法,用于打开弹窗
@onInput="onInput" @onInput="onInput"
@opensearchTable="opensearchTable" @opensearchTable="opensearchTable"
@onChange="onChange" @onChange="onChange"
@onEnter="onEnter"
> >
<template #action> <template #action>
<div v-if="layout === 'inline'"> <div v-if="layout === 'inline'">

Loading…
Cancel
Save