检测脚本
This commit is contained in:
@@ -98,15 +98,20 @@ const close = () => {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (formContent.value.id) {
|
||||
// 获取勾选的节点 ID
|
||||
// 获取半选中的节点 ID
|
||||
const halfCheckedKeys = treeRef.value?.getHalfCheckedKeys() || [];
|
||||
// 获取全选中的节点 ID
|
||||
const checkedKeys = treeRef.value?.getCheckedKeys() || [];
|
||||
|
||||
// 将两个数组合并
|
||||
const allCheckedKeys = [...halfCheckedKeys, ...checkedKeys];
|
||||
|
||||
// 将 checkedKeys 转换为字符串数组
|
||||
const checkedKeysAsString: string[] = checkedKeys.map(key => String(key));
|
||||
const checkedKeysAsString: string[] = allCheckedKeys.map(key => String(key));
|
||||
// 假设 RoleFunctionId 是一个对象,且需要 id 属性
|
||||
const roleFunctionIdObject: Role.RoleFunctionId = {
|
||||
id: checkedKeysAsString
|
||||
};
|
||||
|
||||
const result = await assignFunction(formContent.value,roleFunctionIdObject);
|
||||
if(result.code != 'A0000'){
|
||||
ElMessage.error({ message: result.message})
|
||||
@@ -128,6 +133,8 @@ const close = () => {
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (sign: string, data: Role.RoleBO, AllFunction: Function.ResFunction[]) => {
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
// 重置树状结构
|
||||
functionList.value = []
|
||||
checkedKeysRef.value = []
|
||||
|
||||
Reference in New Issue
Block a user