更新
This commit is contained in:
parent
bd5a4c4ee7
commit
0146a3c6c2
@ -5,7 +5,7 @@ import { http } from '@/utils/http/axios';
|
|||||||
*/
|
*/
|
||||||
export function adminMenus() {
|
export function adminMenus() {
|
||||||
return http.request({
|
return http.request({
|
||||||
url: '/menus',
|
url: '/index/getMenus',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -10,3 +10,10 @@ export function getRoleList(params?) {
|
|||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
export function getRoleAllList(params?) {
|
||||||
|
return http.request({
|
||||||
|
url: '/role/list',
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -102,11 +102,12 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
<div class="flex justify-end s-table-pagination" v-if="pagination && isObject(pagination)">
|
<div class="flex justify-end s-table-pagination" v-if="pagination && isObject(pagination)">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
v-bind="pagination"
|
v-model:current-page="pagination.currentPage"
|
||||||
v-model:currentPage="pagination.currentPage"
|
:page-size="pagination.pageSize"
|
||||||
v-model:pageSize="pagination.pageSize"
|
:layout="pagination.layout"
|
||||||
@current-change="updatePage"
|
:total="pagination.total"
|
||||||
@size-change="updatePageSize"
|
@size-change="updatePageSize"
|
||||||
|
@current-change="updatePage"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<h2
|
<h2
|
||||||
v-show="!isCollapsed || navMode === 'horizontal' || (navMode === 'horizontal-mix' && mixMenu)"
|
v-show="!isCollapsed || navMode === 'horizontal' || (navMode === 'horizontal-mix' && mixMenu)"
|
||||||
class="mt-0 title"
|
class="mt-0 title"
|
||||||
>NaiveElement</h2
|
>云恒WMS</h2
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -3,6 +3,8 @@ import { constantRouterIcon } from './router-icons';
|
|||||||
import { RouteRecordRaw } from 'vue-router';
|
import { RouteRecordRaw } from 'vue-router';
|
||||||
import { Layout, ParentLayout } from '@/router/constant';
|
import { Layout, ParentLayout } from '@/router/constant';
|
||||||
import type { AppRouteRecordRaw } from '@/router/types';
|
import type { AppRouteRecordRaw } from '@/router/types';
|
||||||
|
import { DashboardOutlined, TableOutlined } from '@vicons/antd';
|
||||||
|
import { renderIcon } from '@/utils/index';
|
||||||
|
|
||||||
const Iframe = () => import('@/views/iframe/index.vue');
|
const Iframe = () => import('@/views/iframe/index.vue');
|
||||||
const LayoutMap = new Map<string, () => Promise<typeof import('*.vue')>>();
|
const LayoutMap = new Map<string, () => Promise<typeof import('*.vue')>>();
|
||||||
@ -18,9 +20,16 @@ LayoutMap.set('IFRAME', Iframe);
|
|||||||
*/
|
*/
|
||||||
export const routerGenerator = (routerMap, parent?): any[] => {
|
export const routerGenerator = (routerMap, parent?): any[] => {
|
||||||
return routerMap.map((item) => {
|
return routerMap.map((item) => {
|
||||||
|
item.meta = {
|
||||||
|
title:item.name,
|
||||||
|
icon:renderIcon(DashboardOutlined),
|
||||||
|
sort:item.sort,
|
||||||
|
permissions:item.permission
|
||||||
|
}
|
||||||
|
const components =''
|
||||||
const currentRouter: any = {
|
const currentRouter: any = {
|
||||||
// 路由地址 动态拼接生成如 /dashboard/workplace
|
// 路由地址 动态拼接生成如 /dashboard/workplace
|
||||||
path: `${(parent && parent.path) || ''}/${item.path}`,
|
path: `${item.path}`,
|
||||||
// 路由名称,建议唯一
|
// 路由名称,建议唯一
|
||||||
name: item.name || '',
|
name: item.name || '',
|
||||||
// 该路由对应页面的 组件
|
// 该路由对应页面的 组件
|
||||||
@ -29,7 +38,7 @@ export const routerGenerator = (routerMap, parent?): any[] => {
|
|||||||
meta: {
|
meta: {
|
||||||
...item.meta,
|
...item.meta,
|
||||||
label: item.meta.title,
|
label: item.meta.title,
|
||||||
icon: constantRouterIcon[item.meta.icon] || null,
|
icon: renderIcon(DashboardOutlined) || null,
|
||||||
permissions: item.meta.permissions || null,
|
permissions: item.meta.permissions || null,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -41,7 +50,7 @@ export const routerGenerator = (routerMap, parent?): any[] => {
|
|||||||
// 是否有子菜单,并递归处理
|
// 是否有子菜单,并递归处理
|
||||||
if (item.children && item.children.length > 0) {
|
if (item.children && item.children.length > 0) {
|
||||||
//如果未定义 redirect 默认第一个子路由为 redirect
|
//如果未定义 redirect 默认第一个子路由为 redirect
|
||||||
!item.redirect && (currentRouter.redirect = `${item.path}/${item.children[0].path}`);
|
!item.redirect && (currentRouter.redirect = `${item.children[0].path}`);
|
||||||
// Recursion
|
// Recursion
|
||||||
currentRouter.children = routerGenerator(item.children, currentRouter);
|
currentRouter.children = routerGenerator(item.children, currentRouter);
|
||||||
}
|
}
|
||||||
@ -88,7 +97,7 @@ export const asyncImportRoute = (routes: AppRouteRecordRaw[] | undefined): void
|
|||||||
item.component = dynamicImport(viewsModules, component as string);
|
item.component = dynamicImport(viewsModules, component as string);
|
||||||
}
|
}
|
||||||
} else if (name) {
|
} else if (name) {
|
||||||
item.component = ParentLayout;
|
item.component = Layout;
|
||||||
}
|
}
|
||||||
children && asyncImportRoute(children);
|
children && asyncImportRoute(children);
|
||||||
});
|
});
|
||||||
|
@ -48,7 +48,7 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: '角色管理',
|
title: '角色管理',
|
||||||
},
|
},
|
||||||
component: () => import('@/views/system/role/role.vue'),
|
component: () => import('@/views/system/role/index.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'dictionary',
|
path: 'dictionary',
|
||||||
|
@ -2,9 +2,9 @@ export default {
|
|||||||
table: {
|
table: {
|
||||||
apiSetting: {
|
apiSetting: {
|
||||||
// 当前页的字段名
|
// 当前页的字段名
|
||||||
pageField: 'pageNo',
|
pageField: 'current',
|
||||||
// 每页数量字段名
|
// 每页数量字段名
|
||||||
sizeField: 'pageSize',
|
sizeField: 'size',
|
||||||
// 接口返回的数据字段名
|
// 接口返回的数据字段名
|
||||||
listField: 'records',
|
listField: 'records',
|
||||||
// 接口返回总页数字段名
|
// 接口返回总页数字段名
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<PageWrapper title="菜单权限管理" content="页面数据为 Mock 示例数据,非真实数据。">
|
<PageWrapper title="菜单权限管理">
|
||||||
<el-row :gutter="10" class="mt-3">
|
<el-row :gutter="10" class="mt-3">
|
||||||
<el-col :xs="24" :sm="24" :md="12" :lg="6" :xl="6">
|
<el-col :xs="24" :sm="24" :md="12" :lg="6" :xl="6">
|
||||||
<el-card shadow="hover" class="border-0" size="small">
|
<el-card shadow="hover" class="border-0" size="small">
|
||||||
@ -250,9 +250,9 @@
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const treeMenuList = await getMenuList();
|
const treeMenuList = await getMenuList();
|
||||||
const keys = treeMenuList.list.map((item) => item.key);
|
const keys = treeMenuList.map((item) => item.key);
|
||||||
Object.assign(formParams, keys);
|
Object.assign(formParams, keys);
|
||||||
treeData.value = treeMenuList.list;
|
treeData.value = treeMenuList;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
@ -238,11 +238,12 @@
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const treeMenuList = await getMenuList();
|
const treeMenuList = await getMenuList();
|
||||||
treeMenuList.list.forEach((item) => {
|
console.log(treeMenuList)
|
||||||
|
treeMenuList.forEach((item) => {
|
||||||
item.expanded = false;
|
item.expanded = false;
|
||||||
});
|
});
|
||||||
expandedKeys.value = treeMenuList.list.map((item) => item.key);
|
expandedKeys.value = treeMenuList.map((item) => item.key);
|
||||||
treeData.value = treeMenuList.list;
|
treeData.value = treeMenuList;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -53,7 +53,7 @@ export const columns = [
|
|||||||
ElTag,
|
ElTag,
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
default: () => record.row.role,
|
default: () => record.row.roles[0].name,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<PageWrapper>
|
<PageWrapper>
|
||||||
<el-card :bordered="false" class="pt-3 mb-3 proCard">
|
<el-card :bordered="false" class="pt-3 mb-3 proCard">
|
||||||
<BasicForm @register="register" @submit="handleSubmit" @reset="handleReset">
|
<BasicForm @register="register" @submit="handleSubmit" @reset="handleReset"></BasicForm>
|
||||||
<template #statusSlot="{ model, field }">
|
|
||||||
<el-input v-model="model[field]" />
|
|
||||||
</template>
|
|
||||||
</BasicForm>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card :bordered="false" class="proCard">
|
<el-card :bordered="false" class="proCard">
|
||||||
<BasicTable
|
<BasicTable
|
||||||
@ -84,9 +80,11 @@
|
|||||||
|
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
const formParams = reactive({
|
const formParams = reactive({
|
||||||
name: '',
|
username: '',
|
||||||
address: '',
|
mobile: '',
|
||||||
date: null,
|
role:'',
|
||||||
|
email: '',
|
||||||
|
status:'',
|
||||||
});
|
});
|
||||||
|
|
||||||
const params = ref({
|
const params = ref({
|
||||||
@ -176,19 +174,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleSubmit(values: Recordable) {
|
function handleSubmit(values: Recordable) {
|
||||||
console.log(values);
|
for (const key in formParams) {
|
||||||
|
if (values[key] != null && values[key] != undefined) {
|
||||||
|
formParams[key] = values[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleReset(values: Recordable) {
|
function handleReset(values: Recordable) {
|
||||||
console.log(values);
|
for (const key in formParams) {
|
||||||
|
formParams[key] ='';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const [register, {}] = useForm({
|
const [register, {}] = useForm({
|
||||||
labelWidth: 80,
|
labelWidth: 80,
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
colProps: { span: 6 } as ColProps,
|
colProps: { span: 6 } as ColProps,
|
||||||
schemas,
|
submitOnReset:true,
|
||||||
|
schemas
|
||||||
});
|
});
|
||||||
|
|
||||||
const [
|
const [
|
@ -1,4 +1,16 @@
|
|||||||
import { FormSchema } from '@/components/Modal';
|
import { FormSchema } from '@/components/Form/index';
|
||||||
|
import { getRoleAllList } from '@/api/system/role';
|
||||||
|
export const loadSelectData = async(res)=> {
|
||||||
|
//这里可以进行数据转换处理
|
||||||
|
return (await getRoleAllList({ ...res })).map((item, index) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
label:item.name,
|
||||||
|
value:item.id,
|
||||||
|
index,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
export const schemas: FormSchema[] = [
|
export const schemas: FormSchema[] = [
|
||||||
{
|
{
|
||||||
field: 'username',
|
field: 'username',
|
||||||
@ -56,39 +68,26 @@ export const schemas: FormSchema[] = [
|
|||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: '正常',
|
label: '正常',
|
||||||
value: 'normal',
|
value: "1",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '禁用',
|
label: '禁用',
|
||||||
value: 'disable',
|
value: "2",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'role',
|
field: 'role',
|
||||||
component: 'Select',
|
component: 'BasicSelect',
|
||||||
label: '角色',
|
label: '角色',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择角色',
|
placeholder: '请选择角色',
|
||||||
options: [
|
block:true,
|
||||||
{
|
request: loadSelectData,
|
||||||
label: '普通用户',
|
onChange: (e: any) => {
|
||||||
value: 1,
|
console.log(e);
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: '推广管理员',
|
|
||||||
value: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '发货管理员',
|
|
||||||
value: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '财务管理员',
|
|
||||||
value: 4,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,16 @@
|
|||||||
import { FormSchema } from '@/components/Modal';
|
import { FormSchema } from '@/components/Form/index';
|
||||||
|
import { getRoleAllList } from '@/api/system/role';
|
||||||
|
export const loadSelectData = async(res)=> {
|
||||||
|
//这里可以进行数据转换处理
|
||||||
|
return (await getRoleAllList({ ...res })).map((item, index) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
label:item.name,
|
||||||
|
value:item.id,
|
||||||
|
index,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
export const schemas: FormSchema[] = [
|
export const schemas: FormSchema[] = [
|
||||||
{
|
{
|
||||||
field: 'username',
|
field: 'username',
|
||||||
@ -19,28 +31,15 @@ export const schemas: FormSchema[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'role',
|
field: 'role',
|
||||||
component: 'Select',
|
component: 'BasicSelect',
|
||||||
label: '角色',
|
label: '角色',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择角色',
|
placeholder: '请选择角色',
|
||||||
options: [
|
block:true,
|
||||||
{
|
request: loadSelectData,
|
||||||
label: '普通用户',
|
onChange: (e: any) => {
|
||||||
value: 1,
|
console.log(e);
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: '推广管理员',
|
|
||||||
value: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '发货管理员',
|
|
||||||
value: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '财务管理员',
|
|
||||||
value: 4,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user