Browse Source

查询弹窗组件修改查询条件方式为筛选

master
陈薪名 1 year ago
parent
commit
3c7a2dd84b
  1. 64
      src/components/SearchTable/src/SearchTable.vue

64
src/components/SearchTable/src/SearchTable.vue

@ -1,20 +1,30 @@
<template> <template>
<Dialog :title="dialogTitle" v-model="searchDialogVisible" :width="'80%'"> <Dialog :title="dialogTitle" v-model="searchDialogVisible" :width="'80%'">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="searchSchema" @search="setSearchParamsRef" @reset="setSearchParamsRef" /> <!-- <Search :schema="searchSchema" @search="setSearchParamsRef" @reset="setSearchParamsRef" /> -->
<Table
ref="searchTableRef" <!-- 列表头部 -->
:columns="tableColumns" <TableHead
:data="tableObjectRef.tableList" :HeadButttondata="HeadButttondata"
:loading="tableObjectRef.loading" :routeName="routeName"
:pagination="{ @searchFormClick="searchFormClick"
total: tableObjectRef.total :allSchemas="allSchemasRef"
}"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
:selection="true"
/> />
<ContentWrap>
<Table
ref="searchTableRef"
:columns="tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"
:pagination="{
total: tableObjectRef.total
}"
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
:selection="true"
/>
</ContentWrap>
<template #footer> <template #footer>
<div class="flex items-center"> <div class="flex items-center">
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button> <el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
@ -24,14 +34,26 @@
</Dialog> </Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
// const { t } = useI18n() // // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const searchDialogVisible = ref(false) // const searchDialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
//
const HeadButttondata = [
defaultButtons.defaultFilterBtn(null), //
]
/** 打开弹窗 */ /** 打开弹窗 */
const getListRef = ref()
const setSearchParamsRef = ref() const setSearchParamsRef = ref()
const tableObjectRef = ref() const tableObjectRef = ref()
const getPage:any = ref() const getPage:any = ref()
@ -41,12 +63,14 @@ const formFieldRef = ref()
const searchFieldRef = ref() const searchFieldRef = ref()
const typeRef = ref() const typeRef = ref()
const rowRef = ref() const rowRef = ref()
const allSchemasRef = ref()
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any, type: any, row: any ) => { const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any, type: any, row: any ) => {
searchDialogVisible.value = true searchDialogVisible.value = true
formFieldRef.value = formField formFieldRef.value = formField
searchFieldRef.value = searchField searchFieldRef.value = searchField
allSchemasRef.value = allSchemas
searchSchema.value = allSchemas.searchSchema searchSchema.value = allSchemas.searchSchema
tableColumns.value = allSchemas.tableColumns tableColumns.value = allSchemas.tableColumns.filter(item => (item.field !== 'action'))
getPage.value = getApiPage getPage.value = getApiPage
typeRef.value = type typeRef.value = type
rowRef.value = row rowRef.value = row
@ -59,9 +83,19 @@ const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, s
// //
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
setSearchParamsRef.value = setSearchParams setSearchParamsRef.value = setSearchParams
getListRef.value = getList
getList() getList()
} }
//
const searchFormClick = (searchData) => {
tableObjectRef.value.params = {
isSearch: true,
filters: searchData.filters
}
getListRef.value() //
}
defineExpose({ open }) // open defineExpose({ open }) // open
// Table ref // Table ref

Loading…
Cancel
Save