2
0

fix:任务管理界面搜索栏重置功能修复

This commit is contained in:
zhongzm
2025-02-14 17:28:27 +08:00
parent f13dcac7db
commit e6a5d91b5e
2 changed files with 29 additions and 8 deletions

View File

@@ -104,7 +104,7 @@ const scrollConfig = computed(() => {
};
});
const { columns, data, loading, getData, mobilePagination, searchParams, resetSearchParams } = useTable({
const { columns, data, loading, getData, mobilePagination, searchParams } = useTable({
apiFn: doGetjobList,
apiParams: {
pageNum: 1,
@@ -427,6 +427,20 @@ onMounted(() => {
});
})
const handleReset = () => {
// 保存当前的 pageSize
const currentPageSize = searchParams.pageSize;
// 重置搜索参数
searchParams.jobName = '';
searchParams.jobGroup = '';
searchParams.status = '';
searchParams.pageNum = 1;
searchParams.pageSize = currentPageSize;
// 重新获取数据
getData();
};
</script>
@@ -469,7 +483,7 @@ onMounted(() => {
<AFormItem class="m-0">
<div class="w-full flex-y-center justify-end gap-8px">
<a-space :size="8">
<a-button @click="resetSearchParams">
<a-button @click="handleReset">
<template #icon>
<SyncOutlined />
</template>

View File

@@ -2,6 +2,7 @@
import { $t } from '@/locales';
import { enableStatusOptions } from '@/constants/business';
import { SyncOutlined, SearchOutlined } from '@ant-design/icons-vue';
import { computed } from 'vue';
defineOptions({
name: 'logSearch'
@@ -20,6 +21,12 @@ const emit = defineEmits<Emits>();
const model = defineModel<any>('model', { required: true });
// 使用计算属性来处理双向绑定
const formModel = computed({
get: () => model.value,
set: (val) => model.value = val
});
/**记录开始结束时间 */
let queryRangePicker = ref<[string, string]>(['', '']);
@@ -53,24 +60,24 @@ function search() {
<template>
<ACard :title="$t('common.search')" :bordered="false" class="card-wrapper">
<AForm :model="model" :label-width="80">
<AForm :model="formModel" :label-width="80">
<ARow :gutter="[16, 16]" wrap>
<ACol :lg="6" :md="12" :xs="24">
<AFormItem label="Name" name="operIp" class="m-0">
<AInput v-model:value="model.operIp" />
<AFormItem label="Name" name="jobName" class="m-0">
<AInput v-model:value="formModel.jobName" />
</AFormItem>
</ACol>
<ACol :lg="6" :md="12" :xs="24">
<AFormItem label="Group" name="title" class="m-0">
<AInput v-model:value="model.title" />
<AFormItem label="Group" name="jobGroup" class="m-0">
<AInput v-model:value="formModel.jobGroup" />
</AFormItem>
</ACol>
<ACol :lg="6" :md="12" :xs="24">
<AFormItem :label="$t('page.manage.user.status')" name="status" class="m-0">
<ASelect v-model:value="model.status" :placeholder="$t('page.manage.user.form.status')" allow-clear>
<ASelect v-model:value="formModel.status" :placeholder="$t('page.manage.user.form.status')" allow-clear>
<ASelectOption v-for="option in enableStatusOptions" :key="option.value" :value="option.value">
{{ $t(option.label) }}
</ASelectOption>