mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
🔱: [client] sync upgrade with 4 commits [trident-sync]
build: publish success fix: 修复cloneable模式下的dict 无法动态修改data的bug chore:
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as api from "./api";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, ValueChangeContext } from "@fast-crud/fast-crud";
|
||||
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, ValueChangeContext } from "@fast-crud/fast-crud";
|
||||
import { createUploaderRules } from "@fast-crud/fast-extends";
|
||||
export default async function createCrudOptions({}: CreateCrudOptionsProps): Promise<CreateCrudOptionsRet> {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
@@ -53,6 +54,20 @@ export default async function createCrudOptions({}: CreateCrudOptionsProps): Pro
|
||||
component: { dict: { cache: false } }
|
||||
}
|
||||
},
|
||||
localSet: {
|
||||
title: "本地修改",
|
||||
search: { show: true },
|
||||
dict: dict({
|
||||
cloneable: true,
|
||||
data: [
|
||||
{
|
||||
value: 1,
|
||||
label: "本地字典"
|
||||
}
|
||||
]
|
||||
}),
|
||||
type: "dict-select"
|
||||
},
|
||||
modifyDict: {
|
||||
title: "动态修改字典",
|
||||
search: { show: false },
|
||||
@@ -65,9 +80,16 @@ export default async function createCrudOptions({}: CreateCrudOptionsProps): Pro
|
||||
valueChange({ row, getComponentRef }: ValueChangeContext) {
|
||||
// 这里不能使用remoteDict,因为在分发时已经clone到form配置中了
|
||||
// 这里dict修改不会影响列里面的数据
|
||||
const targetDict = getComponentRef("remote").dict;
|
||||
const targetDict = getComponentRef("remote").getDict();
|
||||
targetDict.url = row.modifyDict ? "/mock/dicts/moreOpenStatusEnum?remote" : "/mock/dicts/OpenStatusEnum?remote";
|
||||
targetDict.reloadDict();
|
||||
|
||||
const targetDict2 = getComponentRef("localSet").getDict();
|
||||
if (row.modifyDict) {
|
||||
targetDict2.setData([{ value: 1, label: "修改后的字典" }]);
|
||||
} else {
|
||||
targetDict2.setData([{ value: 1, label: "原字典" }]);
|
||||
}
|
||||
}
|
||||
},
|
||||
form: {
|
||||
@@ -78,11 +100,22 @@ export default async function createCrudOptions({}: CreateCrudOptionsProps): Pro
|
||||
valueChange({ form, getComponentRef }: ValueChangeContext) {
|
||||
// 这里不能使用remoteDict,因为在分发时已经clone到form配置中了
|
||||
// 这里dict修改不会影响列里面的数据
|
||||
const targetDict = getComponentRef("remote").dict;
|
||||
const targetDict = getComponentRef("remote").getDict();
|
||||
targetDict.url = form.modifyDict ? "/mock/dicts/moreOpenStatusEnum?remote" : "/mock/dicts/OpenStatusEnum?remote";
|
||||
targetDict.reloadDict();
|
||||
|
||||
const targetDict2 = getComponentRef("localSet").getDict();
|
||||
if (form.modifyDict) {
|
||||
targetDict2.setData([{ value: 1, label: "修改后的字典" }]);
|
||||
} else {
|
||||
targetDict2.setData([{ value: 1, label: "原字典" }]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
pictureCard: {
|
||||
title: "照片墙",
|
||||
type: "image-uploader"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ const list = [
|
||||
{
|
||||
status: "1",
|
||||
remote: "2",
|
||||
modifyDict: true
|
||||
modifyDict: true,
|
||||
localSet: 1
|
||||
},
|
||||
{
|
||||
status: "2",
|
||||
|
||||
@@ -121,6 +121,10 @@ export default async function ({ crudExpose }: CreateCrudOptionsProps): Promise<
|
||||
title: "动态Url",
|
||||
dict: dynamicUrlDict,
|
||||
type: "dict-select"
|
||||
},
|
||||
pictureCard: {
|
||||
title: "照片墙",
|
||||
type: "image-uploader"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +131,10 @@ export default async function ({ crudExpose }: CreateCrudOptionsProps): Promise<
|
||||
cache: true
|
||||
}),
|
||||
type: "dict-select"
|
||||
},
|
||||
pictureCard: {
|
||||
title: "test",
|
||||
type: "image-uploader"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user