From af160167f075c7b197c893cfe3e7629312dead01 Mon Sep 17 00:00:00 2001 From: yufei0306 <13417315+yufei0306@user.noreply.gitee.com> Date: Tue, 11 Jun 2024 13:40:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=85=B3=E8=81=94=E7=AE=A1=E7=90=86,=E7=94=A8=E6=88=B7ID?= =?UTF-8?q?=E5=8F=AA=E8=83=BD=E8=BE=93=E5=85=A5=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Form/src/Form.vue | 6 +++++- src/components/Search/src/Search.vue | 15 +++++++++++++-- .../systemSetting/supplierUser/index.vue | 13 ++++++++++++- .../productionMainAssembleSparePart.data.ts | 1 + .../productionMainPredictSparePart.data.ts | 1 + 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/components/Form/src/Form.vue b/src/components/Form/src/Form.vue index f55aed8cc..d9e8fc919 100644 --- a/src/components/Form/src/Form.vue +++ b/src/components/Form/src/Form.vue @@ -55,7 +55,7 @@ export default defineComponent({ vLoading: propTypes.bool.def(false), labelPosition: propTypes.string.def('left'), }, - emits: ['register','opensearchTable','clearSearchInput', 'onChange', 'onBlur','onEnter','hiddenFilterButton','changeDialogWidth'], + emits: ['register','opensearchTable','clearSearchInput', 'onChange', 'onBlur','onEnter','hiddenFilterButton','changeDialogWidth','onInput'], setup(props, { slots, expose, emit }) { // element form 实例 const elFormRef = ref>() @@ -204,6 +204,9 @@ export default defineComponent({ const onBlur = (field, e) => { emit('onBlur', field, e) } + const onInput = (field,value) => { + emit('onInput', field,value) + } // 渲染formItem const renderFormItem = (item: FormSchema) => { // 单独给只有options属性的组件做判断 @@ -382,6 +385,7 @@ export default defineComponent({ style={item.componentProps?.style} onChange={(e)=>{onChange(item.field, e)}} onBlur={(e)=>{onBlur(item.field, e)}} + onInput={(value)=>{onInput(item.field,value)}} {...(notRenderOptions.includes(item?.component as string) && item?.componentProps?.options ? { options: item?.componentProps?.options || [] } diff --git a/src/components/Search/src/Search.vue b/src/components/Search/src/Search.vue index 3dd5b5ff3..8ac7e2a60 100644 --- a/src/components/Search/src/Search.vue +++ b/src/components/Search/src/Search.vue @@ -43,7 +43,7 @@ const props = defineProps({ } }) -const emit = defineEmits(['search', 'reset']) +const emit = defineEmits(['search', 'reset','onInput']) const visible = ref(true) @@ -88,6 +88,14 @@ const { register, elFormRef, methods } = useForm({ model: props.model || {} }) +const onInput = (field,value) => { + emit('onInput', field,value) +} + +const formRef = ref() +const setFormValues = (formData)=>{ + formRef.value.setValues(formData) +} const search = async () => { await unref(elFormRef)?.validate(async (isValid) => { if (isValid) { @@ -118,12 +126,14 @@ const setVisible = () => { } const Search = ref() onMounted(() => {}) +defineExpose({setFormValues}) // 提供 open 方法,用于打开弹窗 +