Explorar o código

chore: 菜单弹框优化

lujialiang hai 1 semana
pai
achega
ae51867289
Modificáronse 1 ficheiros con 12 adicións e 8 borrados
  1. 12 8
      src/views/admin/sys-menu/modules/menu-operate-modal.vue

+ 12 - 8
src/views/admin/sys-menu/modules/menu-operate-modal.vue

@@ -7,6 +7,7 @@ import { fetchAddMenu, fetchGetMenuDetail, fetchGetMenuList, fetchGetSysApiList,
 import { getLocalIcons } from '@/utils/icon';
 import { SimpleScrollbar } from '@sa/materials';
 import { computed, nextTick, reactive, ref, watch } from 'vue';
+import { useRouteStore } from '@/store/modules/route';
 // import {
 //   getLayoutAndPage,
 //   getPathParamFromRoutePath,
@@ -23,6 +24,7 @@ defineOptions({
 });
 const menuOptions = ref([])
 const sysapiList = ref([])
+const routeStore = useRouteStore();
 export type OperateType = AntDesign.TableOperateType | 'addChild';
 interface Option {
   label: string;
@@ -105,10 +107,11 @@ function createDefaultModel(): Model {
   };
 }
 
-type RuleKey = Extract<keyof Model, 'title' >;
+type RuleKey = Extract<keyof Model, 'title' | 'path' >;
 
 const rules: Record<RuleKey, App.Global.FormRule> = {
-  title: defaultRequiredRule
+  title: defaultRequiredRule,
+  path: defaultRequiredRule
 };
 
 const isEdit = computed(() => props.operateType === 'edit');
@@ -254,6 +257,7 @@ async function handleSubmit() {
   } else {
     window.$message?.error(res.msg || '更新失败!');
   }
+  await routeStore.initAuthRoute();
 
   closeDrawer();
   emit('submitted');
@@ -352,7 +356,7 @@ watch(visible, () => {
               </AFormItem>
             </ACol>
 
-            <ACol :lg="12" :xs="24" v-if="model.menuType == 'M' || model.menuType == 'C'">
+            <!-- <ACol :lg="12" :xs="24" v-if="model.menuType == 'M' || model.menuType == 'C'">
               <AFormItem  name="menuName" >
                 <template #label>
                   <span class="marginRight5">{{ $t('page.manage.menu.routeName') }}</span>
@@ -375,14 +379,14 @@ watch(visible, () => {
                 </template>
                 <AInput v-model:value="model.component"  :placeholder="$t('page.manage.menu.form.routePath')" allowClear/>
               </AFormItem>
-            </ACol>
+            </ACol> -->
 
             <ACol :lg="12" :xs="24"  v-if="model.menuType != 'F'">
               <AFormItem label="路由地址" name="path">
                 <AInput v-model:value="model.path" placeholder="请输入路由地址" allowClear/>
               </AFormItem>
             </ACol>
-            <ACol :lg="12" :xs="24"  v-if="showLayout">
+            <!-- <ACol :lg="12" :xs="24"  v-if="showLayout">
               <AFormItem :label="$t('page.manage.menu.layout')" name="layout">
                 <ASelect
                   v-model:value="model.layout"
@@ -391,7 +395,7 @@ watch(visible, () => {
                   allowClear
                 />
               </AFormItem>
-            </ACol>
+            </ACol> -->
 
             <!-- <ACol :lg="12" :xs="24">
               <AFormItem :label="$t('page.manage.menu.i18nKey')" name="i18nKey">
@@ -441,7 +445,7 @@ watch(visible, () => {
                 </ARadioGroup>
               </AFormItem>
             </ACol>
-            <ACol :lg="12" :xs="24"  v-if="model.menuType == 'M' || model.menuType == 'C'">
+            <!-- <ACol :lg="12" :xs="24"  v-if="model.menuType == 'M' || model.menuType == 'C'">
               <AFormItem  name="isFrame">
                 <template #label>
                   <span class="marginRight5">{{ $t('page.manage.menu.href') }}</span>
@@ -455,7 +459,7 @@ watch(visible, () => {
                   <ARadio value="1">{{ $t('common.yesOrNo.no') }}</ARadio>
                 </ARadioGroup>
               </AFormItem>
-            </ACol>
+            </ACol> -->
 
             <ACol :lg="12" :xs="24" v-if="model.menuType == 'F' || model.menuType == 'C'" >
               <AFormItem name="component">