Update TableProMax.vue

This commit is contained in:
TimSpan 2025-06-27 15:34:11 +08:00
parent 76b1105337
commit f40878eb22
1 changed files with 33 additions and 49 deletions

View File

@ -1,8 +1,7 @@
<template> <template>
<div class="table-pro-content"> <div class="table-pro-content">
<div class="card padding" v-if="props.searchFormOptions"> <div class="card padding" v-if="props.searchFormOptions">
<FormProMax ref="searchFormRef" :form-item-options="props.searchFormOptions" v-model:value="searchParams" <FormProMax ref="searchFormRef" :form-item-options="props.searchFormOptions" v-model:value="searchParams" v-bind="props.searchFormProps">
v-bind="props.searchFormProps">
<template v-slot:formOperation> <template v-slot:formOperation>
<a-space class="margin-right flex-end"> <a-space class="margin-right flex-end">
<a-button type="primary" @click="search"> <a-button type="primary" @click="search">
@ -75,12 +74,7 @@ import {computed, onMounted, Ref, ref} from 'vue'
import { FormInstance } from 'ant-design-vue' import { FormInstance } from 'ant-design-vue'
import useTableProMax from '@/hooks/useTableProMax.ts' import useTableProMax from '@/hooks/useTableProMax.ts'
import { includes, isEmpty } from 'lodash-es' import { includes, isEmpty } from 'lodash-es'
import { import { BaseTableRowRecord, TableProMaxProps, TableProMaxRowSelect, TableProMaxSlots } from '@/types/components/table/index.ts'
BaseTableRowRecord,
TableProMaxProps,
TableProMaxRowSelect,
TableProMaxSlots
} from '@/types/components/table/index.ts'
// //
const selectKeys = ref<string[]>([]) const selectKeys = ref<string[]>([])
@ -172,16 +166,7 @@ const searchFormRef = ref<FormInstance>() as Ref<FormInstance>
*/ */
const searchParams = ref<P | Record<string, any>>(props.defaultSearchParams || {}) as Ref<P> const searchParams = ref<P | Record<string, any>>(props.defaultSearchParams || {}) as Ref<P>
const { const { loading, dataSource, pageParams, search, requestGetTableData, handleSizeChange, handleCurrentChange, resetState } = useTableProMax(
loading,
dataSource,
pageParams,
search,
requestGetTableData,
handleSizeChange,
handleCurrentChange,
resetState
} = useTableProMax(
props.requestApi, props.requestApi,
searchFormRef, searchFormRef,
searchParams, searchParams,
@ -189,7 +174,6 @@ const {
props.dataCallback, props.dataCallback,
props.requestError props.requestError
) )
// console.log('pageParams', pageParams)
onMounted(() => props.requestAuto && requestGetTableData(true)) onMounted(() => props.requestAuto && requestGetTableData(true))