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