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