1
0
Эх сурвалжийг харах

fix(mock): menu list api loss `type` field

无木 3 жил өмнө
parent
commit
41854121f3
1 өөрчлөгдсөн 30 нэмэгдсэн , 2 устгасан
  1. 30 2
      mock/demo/system.ts

+ 30 - 2
mock/demo/system.ts

@@ -22,7 +22,7 @@ const roleList = (() => {
   const result: any[] = [];
   for (let index = 0; index < 4; index++) {
     result.push({
-      id: `${index}`,
+      id: index + 1,
       orderNo: `${index + 1}`,
       roleName: ['超级管理员', '管理员', '文章管理员', '普通用户'][index],
       roleValue: '@first',
@@ -72,6 +72,7 @@ const menuList = (() => {
       id: `${index}`,
       icon: ['ion:layers-outline', 'ion:git-compare-outline', 'ion:tv-outline'][index],
       component: 'LAYOUT',
+      type: '0',
       menuName: ['Dashboard', '权限管理', '功能'][index],
       permission: '',
       orderNo: index + 1,
@@ -82,6 +83,7 @@ const menuList = (() => {
         for (let j = 0; j < 4; j++) {
           children.push({
             id: `${index}-${j}`,
+            type: '1',
             menuName: ['菜单1', '菜单2', '菜单3', '菜单4'][j],
             icon: 'ion:document',
             permission: ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index],
@@ -95,7 +97,33 @@ const menuList = (() => {
             createTime: '@datetime',
             'status|1': ['0', '1'],
             parentMenu: `${index}`,
-            children: undefined,
+            children: (() => {
+              const children: any[] = [];
+              for (let k = 0; k < 4; k++) {
+                children.push({
+                  id: `${index}-${j}-${k}`,
+                  type: '2',
+                  menuName: '按钮' + (j + 1) + '-' + (k + 1),
+                  icon: '',
+                  permission:
+                    ['menu1:view', 'menu2:add', 'menu3:update', 'menu4:del'][index] +
+                    ':btn' +
+                    (k + 1),
+                  component: [
+                    '/dashboard/welcome/index',
+                    '/dashboard/analysis/index',
+                    '/dashboard/workbench/index',
+                    '/dashboard/test/index',
+                  ][j],
+                  orderNo: j + 1,
+                  createTime: '@datetime',
+                  'status|1': ['0', '1'],
+                  parentMenu: `${index}-${j}`,
+                  children: undefined,
+                });
+              }
+              return children;
+            })(),
           });
         }
         return children;