sen
1 天以前 7ed2a032d0724e68aec8af940f2ce0023a9f0eb7
ui/admin-ui3/src/hooks/usePagePlus.ts
@@ -43,6 +43,7 @@
            params = opts.getBeginListFunc!(params)
        }
        pageF.loading = true;
        const queryParams = filterEmptyParams(opts.queryParams.value);
        opts.getListApi!({ 
            pageNum: page.currentPage, 
            pageSize: page.pageSize, 
@@ -61,6 +62,7 @@
     * 2. 新增:手动触发搜索逻辑 (用于回车搜索)
     */
    const manualSearch = () => {
        if (!opts.queryParams || !opts.queryParams.value) return; // 容错处理
        opts.page.currentPage = 1; // 回车搜索默认切回第一页
        if (opts.handleQueryFunc) {
            opts.handleQueryFunc();
@@ -95,7 +97,15 @@
    /** 清空搜索回调方法 */
    const searchReset = () => {
        opts.queryParams = {}; // 修改为操作 .value
     //   opts.queryParams = {}; // 修改为操作 .value
     // ✅ 正确写法:清空 ref 内部的值
    if (opts.queryParams && opts.queryParams.value) {
        // 方案 A:直接清空对象内部属性
        Object.keys(opts.queryParams.value).forEach(key => {
            delete opts.queryParams.value[key];
        });
      }
        if (opts.handleQueryFunc) {
            opts.handleQueryFunc();
        }
@@ -167,8 +177,8 @@
     * 导出
     */
    const handleExport =()=>{
        console.log(opts.queryParams.value)
        opts.exportApi!(opts.queryParams.value);
        const queryParams = filterEmptyParams(opts.queryParams.value);
        opts.exportApi!( opts.queryParams.value);
    }
    const handleDelete  = () =>{
        if ( !(pageF?.ids)|| pageF?.ids?.length === 0) {
@@ -201,6 +211,20 @@
        }
    }
    /**
 * 过滤空字符串参数
 */
const filterEmptyParams = (params: any) => {
    const result: any = {};
    for (const key in params) {
        const val = params[key];
        // 过滤空字符串、null、undefined
        if (val !== '' && val !== null && val !== undefined) {
            result[key] = val;
        }
    }
    return result;
};
    return {
        pageF,
        tableData,