fix:AP设备界面搜索栏重置功能修复
This commit is contained in:
@@ -85,7 +85,6 @@ const {
|
|||||||
getData,
|
getData,
|
||||||
mobilePagination,
|
mobilePagination,
|
||||||
searchParams,
|
searchParams,
|
||||||
resetSearchParams
|
|
||||||
} = useTable({
|
} = useTable({
|
||||||
apiFn: async (params: Api.Device.ApDeviceParams) => {
|
apiFn: async (params: Api.Device.ApDeviceParams) => {
|
||||||
try {
|
try {
|
||||||
@@ -179,9 +178,18 @@ const handleSearch = () => {
|
|||||||
getData();
|
getData();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加重置处理函数
|
// 修改重置处理函数
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
resetSearchParams();
|
// 保存当前的 pageSize
|
||||||
|
const currentPageSize = searchParams.pageSize;
|
||||||
|
|
||||||
|
// 重置搜索参数
|
||||||
|
searchParams.name = '';
|
||||||
|
searchParams.mac = '';
|
||||||
|
searchParams.pageNum = 1;
|
||||||
|
searchParams.pageSize = currentPageSize;
|
||||||
|
|
||||||
|
// 重新获取数据
|
||||||
getData();
|
getData();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<AForm layout="inline">
|
<AForm layout="inline">
|
||||||
<AFormItem :label="t('page.apdevice.apname')">
|
<AFormItem :label="t('page.apdevice.apname')">
|
||||||
<AInput
|
<AInput
|
||||||
v-model:value="model.name"
|
v-model:value="formModel.name"
|
||||||
:placeholder="t('page.apdevice.pledevice')"
|
:placeholder="t('page.apdevice.pledevice')"
|
||||||
allow-clear
|
allow-clear
|
||||||
class="w-200px"
|
class="w-200px"
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
</AFormItem>
|
</AFormItem>
|
||||||
<AFormItem :label="t('page.apdevice.mac')">
|
<AFormItem :label="t('page.apdevice.mac')">
|
||||||
<AInput
|
<AInput
|
||||||
v-model:value="model.mac"
|
v-model:value="formModel.mac"
|
||||||
:placeholder="t('page.apdevice.plemac')"
|
:placeholder="t('page.apdevice.plemac')"
|
||||||
allow-clear
|
allow-clear
|
||||||
class="w-200px"
|
class="w-200px"
|
||||||
@@ -42,7 +42,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Form as AForm, FormItem as AFormItem, Input as AInput, Button as AButton, Space as ASpace, Card as ACard } from 'ant-design-vue';
|
import { Form as AForm, FormItem as AFormItem, Input as AInput, Button as AButton, Space as ASpace, Card as ACard } from 'ant-design-vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
model: {
|
model: {
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -59,17 +62,18 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
|
|
||||||
const emit = defineEmits(['update:model', 'search', 'reset']);
|
const emit = defineEmits(['update:model', 'search', 'reset']);
|
||||||
|
|
||||||
|
// 使用计算属性来处理双向绑定
|
||||||
|
const formModel = computed({
|
||||||
|
get: () => props.model,
|
||||||
|
set: (val) => emit('update:model', val)
|
||||||
|
});
|
||||||
|
|
||||||
const search = () => {
|
const search = () => {
|
||||||
emit('search');
|
emit('search');
|
||||||
};
|
};
|
||||||
|
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
emit('update:model', {
|
// 触发重置事件
|
||||||
...props.model,
|
|
||||||
name: '',
|
|
||||||
mac: '',
|
|
||||||
pageNum: 1
|
|
||||||
});
|
|
||||||
emit('reset');
|
emit('reset');
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user