update 优化 重构抽出一些常用hooks组件简化页面编码

This commit is contained in:
疯狂的狮子Li
2026-04-17 15:46:41 +08:00
parent 6a3394bdc5
commit c7bcf52f03
16 changed files with 202 additions and 154 deletions

View File

@@ -191,13 +191,14 @@ import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache
import { ConfigForm, ConfigQuery, ConfigVO } from '@/api/system/config/types';
import { useLoading } from '@/hooks/async/useLoading';
import { useFormDialog } from '@/hooks/dialog/useFormDialog';
import { useDateRangeQuery } from '@/hooks/form/useDateRangeQuery';
import { useSearchReset } from '@/hooks/form/useSearchReset';
import { useSearchToggle } from '@/hooks/form/useSearchToggle';
import { useTableSelection } from '@/hooks/table/useTableSelection';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime, addDateRange } from '@/utils/ruoyi';
import { parseTime } from '@/utils/ruoyi';
const { sys_yes_no } = toRefs<any>(useDict('sys_yes_no'));
@@ -206,7 +207,7 @@ const { loading, withLoading } = useLoading(true);
const { showSearch } = useSearchToggle();
const { ids, single, multiple, handleSelectionChange } = useTableSelection<ConfigVO>(item => item.configId);
const total = ref(0);
const dateRange = ref<any>(['', '']);
const { dateRange, applyDateRange, resetDateRange } = useDateRangeQuery();
const queryFormRef = ref<ElFormInstance>();
const configFormRef = ref<ElFormInstance>();
@@ -245,7 +246,7 @@ const { resetQuery } = useSearchReset({
queryParams,
pageNumKey: 'pageNum',
resetExtras: () => {
dateRange.value = ['', ''];
resetDateRange();
},
afterReset: () => {
handleQuery();
@@ -255,7 +256,7 @@ const { resetQuery } = useSearchReset({
/** 查询参数列表 */
const getList = async () => {
await withLoading(async () => {
const res = await listConfig(addDateRange(queryParams.value, dateRange.value));
const res = await listConfig(applyDateRange(queryParams.value));
configList.value = res.data?.rows;
total.value = res.data?.total;
});