Skip to content

Commit

Permalink
perf: 优化文档搜索
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Oct 24, 2023
1 parent 9a99b6f commit c62637c
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions src/views/crud/feature/export/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,66 @@
<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({
name: "FeatureExport",
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,
Expand Down

0 comments on commit c62637c

Please sign in to comment.