|
|
|
@ -1,5 +1,5 @@ |
|
|
|
import { toReactive } from "@vueuse/core"; |
|
|
|
import { toReactive } from "@vueuse/core"; |
|
|
|
import { reactive, ref, shallowRef, watchEffect } from "vue"; |
|
|
|
import { reactive, ref, shallowRef, toRaw, watchEffect } from "vue"; |
|
|
|
import * as Element from "../element"; |
|
|
|
import * as Element from "../element"; |
|
|
|
import { useI18n } from "vue3-i18n"; |
|
|
|
import { useI18n } from "vue3-i18n"; |
|
|
|
import { PageResponse } from "../http"; |
|
|
|
import { PageResponse } from "../http"; |
|
|
|
@ -73,14 +73,15 @@ export function useListTable(options: Options) { |
|
|
|
const example = reactive<any>(defaultExample()); |
|
|
|
const example = reactive<any>(defaultExample()); |
|
|
|
|
|
|
|
|
|
|
|
const setExample = (params: Record<string, any>) => { |
|
|
|
const setExample = (params: Record<string, any>) => { |
|
|
|
clearAndAssign(params, { ...defaultExample(), ...params }); |
|
|
|
clearAndAssign(example, { ...defaultExample(), ...params }); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const query = async () => { |
|
|
|
const query = async () => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const resp = await options.query(deepCopy(example)); |
|
|
|
const resp = await options.query(deepCopy(toRaw(example))); |
|
|
|
setRows(resp); |
|
|
|
setRows(resp); |
|
|
|
} catch (error) { |
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
console.error(error); |
|
|
|
showMessage("error", t("common.errors.listTableQueryError")); |
|
|
|
showMessage("error", t("common.errors.listTableQueryError")); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|