|
|
@@ -55,7 +55,7 @@ export function useDataTable<T>(options: DataTableOptions = {}) {
|
|
|
}
|
|
|
|
|
|
export function useDataFilter<T>() {
|
|
|
- const filterOptons: FilterOptions<T> = reactive({
|
|
|
+ const filterOptions: FilterOptions<T> = reactive({
|
|
|
selectList: [],
|
|
|
inputList: [],
|
|
|
buttonList: [],
|
|
|
@@ -63,13 +63,13 @@ export function useDataFilter<T>() {
|
|
|
|
|
|
// 清空所有过滤条件
|
|
|
const clearAll = () => {
|
|
|
- filterOptons.selectList.forEach((e) => {
|
|
|
+ filterOptions.selectList.forEach((e) => {
|
|
|
if (!e.locked) {
|
|
|
e.selectedValue = undefined
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- filterOptons.inputList.forEach((e) => {
|
|
|
+ filterOptions.inputList.forEach((e) => {
|
|
|
if (!e.locked) {
|
|
|
e.value = undefined
|
|
|
}
|
|
|
@@ -81,7 +81,7 @@ export function useDataFilter<T>() {
|
|
|
clear && clearAll()
|
|
|
const options: FilterValue<T>[] = []
|
|
|
|
|
|
- filterOptons.selectList.forEach((e) => {
|
|
|
+ filterOptions.selectList.forEach((e) => {
|
|
|
const { key, selectedValue } = e
|
|
|
if (selectedValue !== undefined) {
|
|
|
options.push({
|
|
|
@@ -91,7 +91,7 @@ export function useDataFilter<T>() {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- filterOptons.inputList.forEach((e) => {
|
|
|
+ filterOptions.inputList.forEach((e) => {
|
|
|
const { keys, value } = e
|
|
|
if (value) {
|
|
|
options.push({
|
|
|
@@ -109,13 +109,13 @@ export function useDataFilter<T>() {
|
|
|
clear && clearAll()
|
|
|
const params: T = Object.create({})
|
|
|
|
|
|
- filterOptons.selectList.forEach((e) => {
|
|
|
+ filterOptions.selectList.forEach((e) => {
|
|
|
if (e.selectedValue !== undefined) {
|
|
|
params[e.key] = e.selectedValue
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- filterOptons.inputList.forEach((e) => {
|
|
|
+ filterOptions.inputList.forEach((e) => {
|
|
|
e.keys.forEach((key) => {
|
|
|
if (e.value) {
|
|
|
params[key] = e.value
|
|
|
@@ -127,7 +127,7 @@ export function useDataFilter<T>() {
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
- filterOptons,
|
|
|
+ filterOptions,
|
|
|
getFilterParams,
|
|
|
getQueryParams,
|
|
|
}
|