mirror of
https://github.com/jekip/naive-ui-admin.git
synced 2026-02-04 13:42:27 +08:00
fix Bug or add example
This commit is contained in:
93
mock/system/menu.ts
Normal file
93
mock/system/menu.ts
Normal file
@@ -0,0 +1,93 @@
|
||||
import { resultSuccess } from '../_util'
|
||||
|
||||
const menuList = (() => {
|
||||
const result: any[] = [
|
||||
{
|
||||
label: 'Dashboard',
|
||||
key: 'dashboard',
|
||||
type: 1,
|
||||
subtitle:'dashboard',
|
||||
openType:1,
|
||||
auth:'dashboard',
|
||||
path:'/dashboard',
|
||||
children: [
|
||||
{
|
||||
label: '主控台',
|
||||
key: 'console',
|
||||
type: 1,
|
||||
subtitle:'console',
|
||||
openType:1,
|
||||
auth:'console',
|
||||
path:'/dashboard/console',
|
||||
},
|
||||
{
|
||||
label: '工作台',
|
||||
key: 'workplace',
|
||||
type: 1,
|
||||
subtitle:'workplace',
|
||||
openType:1,
|
||||
auth:'workplace',
|
||||
path:'/dashboard/workplace',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '表单管理',
|
||||
key: 'form',
|
||||
type: 1,
|
||||
subtitle:'form',
|
||||
openType:1,
|
||||
auth:'form',
|
||||
path:'/form',
|
||||
children: [
|
||||
{
|
||||
label: '基础表单',
|
||||
key: 'basic-form',
|
||||
type: 1,
|
||||
subtitle:'basic-form',
|
||||
openType:1,
|
||||
auth:'basic-form',
|
||||
path:'/form/basic-form',
|
||||
},
|
||||
{
|
||||
label: '分步表单',
|
||||
key: 'step-form',
|
||||
type: 1,
|
||||
subtitle:'step-form',
|
||||
openType:1,
|
||||
auth:'step-form',
|
||||
path:'/form/step-form',
|
||||
},
|
||||
{
|
||||
label: '表单详情',
|
||||
key: 'detail',
|
||||
type: 1,
|
||||
subtitle:'detail',
|
||||
openType:1,
|
||||
auth:'detail',
|
||||
path:'/form/detail',
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
return result
|
||||
});
|
||||
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/menu/list',
|
||||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: () => {
|
||||
const list = menuList()
|
||||
return resultSuccess({
|
||||
list
|
||||
}
|
||||
);
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
import { resultSuccess, doCustomTimes } from '../_util'
|
||||
|
||||
|
||||
function getMenuKeys() {
|
||||
let keys = ['dashboard', 'console', 'workplace', 'basic-form', 'step-form', 'detail']
|
||||
let newKeys = []
|
||||
doCustomTimes(parseInt(Math.random()*6), () => {
|
||||
let key = keys[Math.floor(Math.random() * keys.length)];
|
||||
newKeys.push(key)
|
||||
})
|
||||
return Array.from(new Set(newKeys));
|
||||
}
|
||||
|
||||
const roleList = ((pageSize) => {
|
||||
const result:any[] = []
|
||||
doCustomTimes(pageSize,()=> {
|
||||
const result: any[] = []
|
||||
doCustomTimes(pageSize, () => {
|
||||
result.push({
|
||||
id: '@integer(10,100)',
|
||||
name: '@cname()',
|
||||
explain:'@cname()',
|
||||
isDefault:'@boolean()',
|
||||
create_date: `@date('yyyy-MM-dd')`,
|
||||
explain: '@cname()',
|
||||
isDefault: '@boolean()',
|
||||
menu_keys: getMenuKeys(),
|
||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
||||
'status|1': ['normal', 'enable', 'disable'],
|
||||
});
|
||||
})
|
||||
@@ -17,7 +29,6 @@ const roleList = ((pageSize) => {
|
||||
|
||||
|
||||
export default [
|
||||
//表格数据列表
|
||||
{
|
||||
url: '/api/role/list',
|
||||
timeout: 1000,
|
||||
@@ -26,8 +37,8 @@ export default [
|
||||
const { page = 1, pageSize = 10 } = query;
|
||||
const list = roleList(Number(pageSize))
|
||||
return resultSuccess({
|
||||
page:Number(page),
|
||||
pageSize:Number(pageSize),
|
||||
page: Number(page),
|
||||
pageSize: Number(pageSize),
|
||||
pageCount: 60,
|
||||
list
|
||||
}
|
||||
|
||||
@@ -25,6 +25,14 @@ const adminInfo = {
|
||||
{
|
||||
roleName: '工作台',
|
||||
value: 'dashboard_workplace',
|
||||
},
|
||||
{
|
||||
roleName: '基础列表',
|
||||
value: 'basic_list',
|
||||
},
|
||||
{
|
||||
roleName: '基础列表删除',
|
||||
value: 'basic_list_delete',
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user