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

build: publish success
perf: antdv 异步加载,加快首页打开速度
perf: 精简lodash
chore: 兼容手机版
This commit is contained in:
GitHub Actions Bot
2025-03-04 19:24:24 +00:00
parent 335d175d57
commit 140606744b
26 changed files with 245 additions and 70 deletions
@@ -1,6 +1,5 @@
// @ts-ignore
import mockUtil from "/src/mock/base";
import _ from "lodash-es";
const options: any = {
name: "AdvancedCard",
idGenerator: 0
@@ -1,7 +1,7 @@
import * as api from "./api";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes, dict } from "@fast-crud/fast-crud";
import { GetCrud } from "./api";
import _ from "lodash-es";
import { merge } from "lodash-es";
/**
* 异步创建options
@@ -43,7 +43,7 @@ export default async function (props: CreateCrudOptionsProps): Promise<CreateCru
// 本示例返回的是一个方法字符串,所以要先执行这个方法,获取options
const remoteCrudOptions = crudBackend({ crudExpose, dict });
// 与本地options合并
const crudOptions = _.merge(localCrudOptions, remoteCrudOptions);
const crudOptions = merge(localCrudOptions, remoteCrudOptions);
return {
crudOptions
@@ -1,6 +1,6 @@
// @ts-ignore
import mockUtil from "/src/mock/base";
import _ from "lodash-es";
import { omit } from "lodash-es";
const options: any = {
name: "FormLinkage",
idGenerator: 0
@@ -71,7 +71,7 @@ const mock = mockUtil.buildMock(options);
function omitChildren(originalList: any) {
const list: any = [];
originalList.forEach((item: any) => {
list.push(_.omit(item, "children"));
list.push(omit(item, "children"));
});
return list;
}
@@ -1,5 +1,5 @@
import * as api from "./api.js";
import _ from "lodash-es";
import { merge } from "lodash-es";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
@@ -45,7 +45,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const tableData = localDataRef.value;
for (const item of tableData) {
if (item.id === form.id) {
_.merge(item, form);
merge(item, form);
}
}
};
@@ -13,7 +13,7 @@
<script lang="ts" setup>
import { onMounted } from "vue";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, useFsAsync, useFsRef, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import _ from "lodash-es";
import { cloneDeep, find, merge, remove, maxBy } from "lodash-es";
//此处为crudOptions配置
const createCrudOptions = async function ({}: CreateCrudOptionsProps): Promise<CreateCrudOptionsRet> {
@@ -21,26 +21,26 @@ const createCrudOptions = async function ({}: CreateCrudOptionsProps): Promise<C
const records = [{ id: 1, name: "Hello World", type: 1 }];
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return {
records: _.cloneDeep(records),
records: cloneDeep(records),
offset: 0, //后续transformRes会计算为currentPage
limit: 20, //后续transformRes会计算为pageSize
total: records.length
};
};
const editRequest = async ({ form, row }: EditReq) => {
const target = _.find(records, (item) => {
const target = find(records, (item) => {
return row.id === item.id;
});
_.merge(target, form);
merge(target, form);
return target;
};
const delRequest = async ({ row }: DelReq) => {
_.remove(records, (item) => {
remove(records, (item) => {
return item.id === row.id;
});
};
const addRequest = async ({ form }: AddReq) => {
const maxRecord = _.maxBy(records, (item) => {
const maxRecord = maxBy(records, (item: any) => {
return item.id;
});
form.id = (maxRecord?.id || 0) + 1;
@@ -15,17 +15,18 @@
<script lang="ts">
import { defineComponent, onMounted } from "vue";
import { CrudOptions, DynamicType, useFs, UseFsProps, useFsRef } from "@fast-crud/fast-crud";
import { CrudOptions, DynamicType, useFs, UseFsProps, useFsRef, useMerge } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud.js";
import _ from "lodash-es";
export default defineComponent({
name: "BasisReset",
setup() {
const { crudBinding, crudRef, crudExpose, context, crudOptions, resetCrudOptions, appendBindingOptions } = useFs({ createCrudOptions, context: { text: 111 } });
debugger;
const { merge } = useMerge();
setTimeout(() => {
//合并新的crudOptions
const newOptions: DynamicType<CrudOptions> = _.merge(crudOptions, {
const newOptions: DynamicType<CrudOptions> = merge(crudOptions, {
columns: {
text: {
title: "追加字段",
@@ -2,7 +2,7 @@ import * as api from "./api";
import { requestForMock } from "/src/api/service";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, DictOnReadyContext, EditReq, UserPageQuery, UserPageRes, useUi, utils } from "@fast-crud/fast-crud";
import { ref } from "vue";
import _ from "lodash-es";
import { debounce } from "lodash-es";
function useSearchRemote() {
let lastFetchId = 0;
@@ -10,7 +10,7 @@ function useSearchRemote() {
data: ref([]),
fetching: ref(false)
};
const fetchUser = _.debounce((value) => {
const fetchUser = debounce((value) => {
utils.logger.info("fetching user", value);
lastFetchId += 1;
@@ -19,7 +19,7 @@ import { useFsRef, utils, useFsAsync } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
import * as api from "./api";
import { message } from "ant-design-vue";
import { usePageStore } from "/@/store/modules/page";
import { useTabbarStore } from "/@/vben/stores/modules/tabbar";
export default defineComponent({
name: "FormNewPageEdit",
@@ -27,7 +27,7 @@ export default defineComponent({
const { crudRef, crudBinding, crudExpose, context } = useFsRef();
const formRef = ref();
const formOptions = ref();
const pageStore = usePageStore();
const tabbarStore = useTabbarStore();
const route = useRoute();
// 页面打开后获取列表数据
onMounted(async () => {
@@ -48,7 +48,7 @@ export default defineComponent({
doSubmit(context);
//提交成功后,关闭本页面
message.success("保存成功");
pageStore.close({ tagName: route.fullPath });
tabbarStore.getTabByPath(route.fullPath);
};
if (id) {
@@ -26,7 +26,7 @@
<script lang="ts">
import { utils } from "@fast-crud/fast-crud";
import _ from "lodash-es";
import { cloneDeep } from "lodash-es";
import { computed, defineComponent, ref } from "vue";
export default defineComponent({
@@ -53,7 +53,7 @@ export default defineComponent({
if (props.tree == null) {
return null;
}
const clone = _.cloneDeep(props.tree);
const clone = cloneDeep(props.tree);
utils.deepdash.forEachDeep(clone, (value: any, key: any, pNode: any, context: any) => {
if (value == null) {
return;