This commit is contained in:
sjl
2024-11-14 18:26:34 +08:00
parent 65cb7826d3
commit 87fe66da3e
42 changed files with 188 additions and 204 deletions

View File

@@ -100,14 +100,13 @@ const close = () => {
if (formContent.value.id) {
// 获取勾选的节点 ID
const checkedKeys = treeRef.value?.getCheckedKeys() || [];
console.log('获取勾选的节点 ID',checkedKeys);
// 将 checkedKeys 转换为字符串数组
const checkedKeysAsString: string[] = checkedKeys.map(key => String(key));
// 假设 RoleFunctionId 是一个对象,且需要 id 属性
const roleFunctionIdObject: Role.RoleFunctionId = {
id: checkedKeysAsString
};
console.log('roleFunctionIdObject',roleFunctionIdObject);
const result = await assignFunction(formContent.value,roleFunctionIdObject);
if(result.code != 'A0000'){
ElMessage.error({ message: result.message})
@@ -136,12 +135,10 @@ const open = async (sign: string, data: Role.RoleBO, AllFunction: Function.ResFu
if (result.code === 'A0000') {
// 将 result.data 转换为 Function.ResFunction[] 类型
const roleFunctions = result.data as Function.ResFunction[];
console.log('roleFunctions',roleFunctions)
// 获取 AllFunction 中所有层级的 id
const allIds = getAllIds(AllFunction);
// 匹配 roleFunctions 中的 id 并设置 checkedKeys
const checkedKeys = allIds.filter(id => roleFunctions.some(roleFunc => roleFunc.id === id));
console.log('checkedKeys',checkedKeys)
// 设置 functionList 和 checkedKeys
functionList.value = AllFunction;
checkedKeysRef.value = checkedKeys;