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

chore: 一些小优化
chore: doc
pull/14/head
GitHub Actions Bot 2023-05-23 19:24:05 +00:00
parent 59f22ab17e
commit 02466ea0bd
7 changed files with 17 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import UiAntdv from "@fast-crud/ui-antdv";
import _ from "lodash-es"; import _ from "lodash-es";
import { useCrudPermission } from "../permission"; import { useCrudPermission } from "../permission";
import { GetSignedUrl } from "/@/views/crud/component/uploader/s3/api"; import { GetSignedUrl } from "/@/views/crud/component/uploader/s3/api";
import { message, notification } from "ant-design-vue";
function install(app: any, options: any = {}) { function install(app: any, options: any = {}) {
app.use(UiAntdv); app.use(UiAntdv);
@ -95,6 +96,13 @@ function install(app: any, options: any = {}) {
width: "120px" width: "120px"
} }
}, },
async afterSubmit({ mode }) {
if (mode === "add") {
notification.success({ message: "添加成功" });
} else if (mode === "edit") {
notification.success({ message: "保存成功" });
}
},
wrapperCol: { wrapperCol: {
span: null span: null
} }

View File

@ -20,6 +20,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
return { return {
output: {}, output: {},
crudOptions: { crudOptions: {
//大量数据的crud配置
request: { request: {
pageRequest, pageRequest,
addRequest, addRequest,

View File

@ -3,6 +3,7 @@ import mockUtil from "/src/mock/base";
const options: any = { const options: any = {
name: "AdvancedBigData", name: "AdvancedBigData",
idGenerator: 0, idGenerator: 0,
//此处copy多次模拟大量数据
copyTimes: 1000 copyTimes: 1000
}; };
const list = [ const list = [

View File

@ -1,3 +1,4 @@
//此处演示从后台获取crudOptions配置字符串
export const crudOptions = ` export const crudOptions = `
({crudExpose,dict}) => { ({crudExpose,dict}) => {
return { return {

View File

@ -29,6 +29,7 @@ export default defineComponent({
// //
onMounted(async () => { onMounted(async () => {
const customValue = {}; const customValue = {};
//fscreateCrudOptions
const { crudExpose, context } = await useFsAsync({ crudRef, crudBinding, createCrudOptions, context: customValue }); const { crudExpose, context } = await useFsAsync({ crudRef, crudBinding, createCrudOptions, context: customValue });
// //
await crudExpose.doRefresh(); await crudExpose.doRefresh();

View File

@ -9,6 +9,7 @@
<a-modal v-model:visible="dialogShow" width="80%" title="fs-crud in dialog"> <a-modal v-model:visible="dialogShow" width="80%" title="fs-crud in dialog">
<div style="height: 400px; position: relative"> <div style="height: 400px; position: relative">
<!-- 在此处显示fs-crud页面 -->
<fs-in-dialog></fs-in-dialog> <fs-in-dialog></fs-in-dialog>
</div> </div>
</a-modal> </a-modal>
@ -17,6 +18,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, ref } from "vue"; import { defineComponent, ref } from "vue";
//fs-crud
import FsInDialog from "./crud/index.vue"; import FsInDialog from "./crud/index.vue";
export default defineComponent({ export default defineComponent({
name: "InDialog", name: "InDialog",

View File

@ -11,17 +11,17 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, ref, onMounted } from "vue"; import { defineComponent, ref, onMounted, reactive } from "vue";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, useCrud, useFs, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud"; import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, useCrud, useFs, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import _ from "lodash-es"; import _ from "lodash-es";
//crudOptions //crudOptions
const createCrudOptions = function ({}: CreateCrudOptionsProps): CreateCrudOptionsRet { const createCrudOptions = function ({}: CreateCrudOptionsProps): CreateCrudOptionsRet {
//crud ---- //crud ----
const records = [{ id: 1, name: "Hello World", type: 1 }]; const records = reactive([{ id: 1, name: "Hello World", type: 1 }]);
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return { return {
records: [...records], records,
currentPage: 1, currentPage: 1,
pageSize: 20, pageSize: 20,
total: records.length total: records.length