🔱: [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-crud ref="crudRef" v-bind="crudBinding">
<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-option value="excel">Excel</a-select-option>
<a-select-option value="csv">CSV</a-select-option>
</a-select>
</span>
<span class="ml-5">
数据来源
</fs-label>
<fs-label v-if="exportType === 'local'" class="ml-5" label="数据来源">
<a-select v-model:value="dataFrom">
<a-select-option value="search">查询</a-select-option>
<a-select-option value="local">本页数据</a-select-option>
</a-select>
</span>
</fs-label>
</template>
</fs-crud>
</fs-page>
</template>
<script lang="ts">
import { defineComponent, onMounted, ref } from "vue";
import { useFs } from "@fast-crud/fast-crud";
import { defineComponent, onMounted, ref, watch } from "vue";
import { useFs, UserPageQuery, useUi } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
export default defineComponent({
@ -31,15 +35,33 @@ export default defineComponent({
setup() {
const fileType = ref("excel");
const dataFrom = ref("search");
const exportType = ref("local");
const context = {
fileType,
dataFrom
dataFrom,
exportType
};
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
//
onMounted(() => {
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 {
crudBinding,