Showing
3 changed files
with
6 additions
and
10 deletions
... | ... | @@ -51,14 +51,6 @@ |
51 | 51 | 'update:searchValue', |
52 | 52 | ], |
53 | 53 | setup(props, { attrs, slots, emit, expose }) { |
54 | - // /** | |
55 | - // * 作者自带Tree组件 | |
56 | - // * 新增显示隐藏 | |
57 | - // * ft | |
58 | - // */ | |
59 | - // //ft | |
60 | - // const isFlod = ref(false); | |
61 | - //ft | |
62 | 54 | const state = reactive<State>({ |
63 | 55 | checkStrictly: props.checkStrictly, |
64 | 56 | expandedKeys: props.expandedKeys || [], | ... | ... |
... | ... | @@ -152,12 +152,14 @@ |
152 | 152 | const { createMessage } = useMessage(); |
153 | 153 | try { |
154 | 154 | const values = await validate(); |
155 | + const treeCheckedKeys: string[] = (unref(treeRef)?.getCheckedKeys() as string[]) || []; | |
156 | + const menu = [...new Set([...unref(checkedKeysWithHalfChecked), ...treeCheckedKeys])]; | |
155 | 157 | const req = { |
156 | 158 | id: roleId.value, |
157 | 159 | name: values.name, |
158 | 160 | remark: values.remark, |
159 | 161 | status: values.status, |
160 | - menu: unref(checkedKeysWithHalfChecked), | |
162 | + menu, | |
161 | 163 | }; |
162 | 164 | if (req.menu == undefined) return createMessage.error('请勾选权限菜单'); |
163 | 165 | saveOrUpdateRoleInfoWithMenu(req).then(() => { | ... | ... |
... | ... | @@ -131,6 +131,8 @@ |
131 | 131 | async function handleSubmit() { |
132 | 132 | setDrawerProps({ loading: true, confirmLoading: true }); |
133 | 133 | const { createMessage } = useMessage(); |
134 | + const treeCheckedKeys: string[] = (unref(treeRef)?.getCheckedKeys() as string[]) || []; | |
135 | + const menu = [...new Set([...unref(checkedKeysWithHalfChecked), ...treeCheckedKeys])]; | |
134 | 136 | try { |
135 | 137 | const values = await validate(); |
136 | 138 | const req = { |
... | ... | @@ -139,7 +141,7 @@ |
139 | 141 | remark: values.remark, |
140 | 142 | status: values.status, |
141 | 143 | roleType: RoleEnum.TENANT_ADMIN, |
142 | - menu: unref(checkedKeysWithHalfChecked), | |
144 | + menu, | |
143 | 145 | }; |
144 | 146 | if (req.menu == undefined) return createMessage.error('请勾选权限菜单'); |
145 | 147 | const res = await saveOrUpdateRoleInfoWithMenu(req); | ... | ... |