🔱: [client] sync upgrade with 2 commits [trident-sync]

perf: 优化文档搜索
pull/14/head
GitHub Actions Bot 2023-10-24 19:24:06 +00:00
parent 2ffc7d19f1
commit 31384fbce5
1 changed files with 31 additions and 9 deletions

View File

@ -2,28 +2,32 @@
<fs-page> <fs-page>
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<template #toolbar-left> <template #toolbar-left>
<span class="ml-5"> <fs-label lass="ml-5" label="导出方式">
导出文件类型 <a-select v-model:value="exportType">
<a-select-option value="local">本地</a-select-option>
<a-select-option value="server">服务端</a-select-option>
</a-select>
</fs-label>
<fs-label v-if="exportType === 'local'" lass="ml-5" label="导出文件类型">
<a-select v-model:value="fileType"> <a-select v-model:value="fileType">
<a-select-option value="excel">Excel</a-select-option> <a-select-option value="excel">Excel</a-select-option>
<a-select-option value="csv">CSV</a-select-option> <a-select-option value="csv">CSV</a-select-option>
</a-select> </a-select>
</span> </fs-label>
<span class="ml-5"> <fs-label v-if="exportType === 'local'" class="ml-5" label="数据来源">
数据来源
<a-select v-model:value="dataFrom"> <a-select v-model:value="dataFrom">
<a-select-option value="search">查询</a-select-option> <a-select-option value="search">查询</a-select-option>
<a-select-option value="local">本页数据</a-select-option> <a-select-option value="local">本页数据</a-select-option>
</a-select> </a-select>
</span> </fs-label>
</template> </template>
</fs-crud> </fs-crud>
</fs-page> </fs-page>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, onMounted, ref } from "vue"; import { defineComponent, onMounted, ref, watch } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs, UserPageQuery, useUi } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
export default defineComponent({ export default defineComponent({
@ -31,15 +35,33 @@ export default defineComponent({
setup() { setup() {
const fileType = ref("excel"); const fileType = ref("excel");
const dataFrom = ref("search"); const dataFrom = ref("search");
const exportType = ref("local");
const context = { const context = {
fileType, fileType,
dataFrom dataFrom,
exportType
}; };
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context }); const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
// //
onMounted(() => { onMounted(() => {
crudExpose.doRefresh(); crudExpose.doRefresh();
}); });
const { ui } = useUi();
watch(
() => {
return exportType.value;
},
(value) => {
if (value === "server") {
crudBinding.value.toolbar.export.server = async (userPageQuery: UserPageQuery) => {
ui.message.info("请在此处请求后端导出,查询条件:" + JSON.stringify(userPageQuery));
};
} else {
crudBinding.value.toolbar.export.server = null;
}
}
);
return { return {
crudBinding, crudBinding,