Browse Source

🎨 修复菜单授权bug

master
wangxiang 3 years ago
parent
commit
4d577b2473
  1. 1
      src/components/Form/src/components/RadioButtonGroup.vue
  2. 19
      src/views/system/menu/MenuModal.vue

1
src/components/Form/src/components/RadioButtonGroup.vue

@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
},
setup(props) {
const attrs = useAttrs();
console.log('村上春树', attrs);
// Embedded in the form, just use the hook binding to perform form verification
const [state] = useRuleFormItem(props);

19
src/views/system/menu/MenuModal.vue

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved.
* author entfrm开发团队-王翔
*/
import { ref, unref, reactive, toRaw } from 'vue';
import { reactive, toRaw } from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from './menu.data';
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal';
@ -26,8 +26,6 @@ @@ -26,8 +26,6 @@
tag: '',
menuTree: []
});
const tag = ref<Nullable<string>>('');
const menuTree = ref<Recordable[]>([]);
/** https://v3.cn.vuejs.org/api/options-data.html#emits */
const emit = defineEmits(['success', 'register']);
const [registerForm, { resetFields, setFieldsValue, updateSchema, validate, clearValidate }] = useForm({
@ -41,20 +39,25 @@ @@ -41,20 +39,25 @@
await resetFields();
await clearValidate();
//
tag.value = data._tag;
state.tag = data._tag;
const topMenu = { id: '0', name: '顶级菜单', children: [] };
state.menuTree = listToTree(await listMenu());
topMenu.children = state.menuTree;
await updateSchema({
await updateSchema([{
field: 'parentId',
componentProps: {
treeData: [topMenu]
}
});
}, {
field: 'type',
componentProps: {
disabled: state.tag == 'edit'
}
}]);
const menuId = data.record?.id;
const props: Partial<ModalProps> = { confirmLoading: false };
// tag
switch (unref(tag)) {
switch (state.tag) {
case 'add':
props.title = '新增菜单';
menuId && await setFieldsValue({ parentId: menuId });
@ -76,7 +79,7 @@ @@ -76,7 +79,7 @@
//
setModalProps({ confirmLoading: true });
// tag
switch (unref(tag)) {
switch (state.tag) {
case 'add':
//
const superMenus = findPath(toRaw(state.menuTree),(node) => node.id == formData?.parentId);

Loading…
Cancel
Save