From cf2d20014e7b37516d5b62411cfaf9728f403fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=80=95=E7=A2=A7?= Date: Thu, 27 Jun 2024 18:31:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91xn-page-sel?= =?UTF-8?q?ect=E7=BB=84=E4=BB=B6=E6=97=A0=E6=B3=95=E5=8F=8A=E6=97=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=8C=E5=90=91=E7=BB=91=E5=AE=9Avalue?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E5=80=BC=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82=20=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91xn-page-select?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=94=AF=E6=8C=81=E6=90=9C=E7=B4=A2=E6=A1=86?= =?UTF-8?q?=E6=90=9C=E7=B4=A2--=E8=B0=83=E7=94=A8=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=90=9C=E7=B4=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/XnPageSelect/index.vue | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/snowy-admin-web/src/components/XnPageSelect/index.vue b/snowy-admin-web/src/components/XnPageSelect/index.vue index 6f0d275e..ba8ff4a6 100644 --- a/snowy-admin-web/src/components/XnPageSelect/index.vue +++ b/snowy-admin-web/src/components/XnPageSelect/index.vue @@ -8,7 +8,10 @@ :placeholder="props.placeholder" :allow-clear="props.allowClear" :disabled="props.disabled" + :showSearch="props.showSearch" + :filterOption="!props.showSearch" @change="handleChange" + @search="handleSearch" @popupScroll="handlePopupScroll" /> @@ -21,7 +24,7 @@ const initParams = ref({}) const options = ref([]) const spinning = ref(false) - const emit = defineEmits({ change: null, 'update:value': null }) + const emit = defineEmits({ change: null, 'update:value': null, search:null }) const props = defineProps({ value: { type: String, @@ -45,6 +48,14 @@ type: Boolean, default: () => false }, + showSearch: { + type: Boolean, + default: () => false + }, + searchKeyName: { + type: String, + default: () => '' + }, disabled: { type: Boolean, default: () => false @@ -99,10 +110,24 @@ // change const handleChange = (value, array) => { modelValue.value = value - // 触发change事件 - emit('change', value, array) + if (value == null && props.showSearch){ + //被清空,重置查询条件 + initParams.value[props.searchKeyName] = value; + } // 更新数据 emit('update:value', value) + // 触发change事件 + emit('change', value, array) + } + // search + const handleSearch = (searchValue) => { + let _params = {current: 1}; + if (props.searchKeyName && props.searchKeyName !== ''){ + _params[props.searchKeyName] = searchValue; + onPage({ ...initParams.value, ..._params}); + } + // 触发search事件 + emit('search', searchValue) } // 滚动触发 const handlePopupScroll = (e) => {