微调
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user