diff --git a/src/components/Form/src/components/RadioButtonGroup.vue b/src/components/Form/src/components/RadioButtonGroup.vue index 0c98988..42bf835 100644 --- a/src/components/Form/src/components/RadioButtonGroup.vue +++ b/src/components/Form/src/components/RadioButtonGroup.vue @@ -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); diff --git a/src/views/system/menu/MenuModal.vue b/src/views/system/menu/MenuModal.vue index 8479107..e7d9266 100644 --- a/src/views/system/menu/MenuModal.vue +++ b/src/views/system/menu/MenuModal.vue @@ -14,7 +14,7 @@ * Copyright © 2020-2022 entfrm 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 @@ tag: '', menuTree: [] }); - const tag = ref>(''); - const menuTree = ref([]); /** 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 @@ 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 = { confirmLoading: false }; // 采用tag标签区分操作 - switch (unref(tag)) { + switch (state.tag) { case 'add': props.title = '新增菜单'; menuId && await setFieldsValue({ parentId: menuId }); @@ -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);