增加了permission对左侧菜单显示的控制 #14
13
.umirc.ts
13
.umirc.ts
|
|
@ -26,7 +26,7 @@ export default defineConfig({
|
||||||
{
|
{
|
||||||
name: '组织架构',
|
name: '组织架构',
|
||||||
path: '/organiza',
|
path: '/organiza',
|
||||||
access: 'canSeeSuper',
|
access: 'canSeeOrganiza',
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
name: '用户管理',
|
name: '用户管理',
|
||||||
|
|
@ -38,6 +38,7 @@ export default defineConfig({
|
||||||
{
|
{
|
||||||
name: '商品管理',
|
name: '商品管理',
|
||||||
path: '/product',
|
path: '/product',
|
||||||
|
access: 'canSeeProduct',
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
name: '商品分类',
|
name: '商品分类',
|
||||||
|
|
@ -69,6 +70,7 @@ export default defineConfig({
|
||||||
{
|
{
|
||||||
name: '库存管理',
|
name: '库存管理',
|
||||||
path: '/stock',
|
path: '/stock',
|
||||||
|
access: 'canSeeStock',
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
name: '库存列表',
|
name: '库存列表',
|
||||||
|
|
@ -100,7 +102,7 @@ export default defineConfig({
|
||||||
{
|
{
|
||||||
name: '订单管理',
|
name: '订单管理',
|
||||||
path: '/order',
|
path: '/order',
|
||||||
access: 'canSeeAdmin',
|
access: 'canSeeOrder',
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
name: '订单列表',
|
name: '订单列表',
|
||||||
|
|
@ -117,6 +119,7 @@ export default defineConfig({
|
||||||
{
|
{
|
||||||
name: '客户管理',
|
name: '客户管理',
|
||||||
path: '/customer',
|
path: '/customer',
|
||||||
|
access: 'canSeeCustomer',
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
name: '客户列表',
|
name: '客户列表',
|
||||||
|
|
@ -128,6 +131,7 @@ export default defineConfig({
|
||||||
{
|
{
|
||||||
name: '物流管理',
|
name: '物流管理',
|
||||||
path: '/logistics',
|
path: '/logistics',
|
||||||
|
access: 'canSeeLogistics',
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
name: '服务商',
|
name: '服务商',
|
||||||
|
|
@ -149,30 +153,27 @@ export default defineConfig({
|
||||||
{
|
{
|
||||||
name: '数据统计',
|
name: '数据统计',
|
||||||
path: '/statistics',
|
path: '/statistics',
|
||||||
|
access: 'canSeeStatistics',
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
name: '销售统计',
|
name: '销售统计',
|
||||||
path: '/statistics/sales',
|
path: '/statistics/sales',
|
||||||
component: './Statistics/Sales',
|
component: './Statistics/Sales',
|
||||||
access: 'canSeeSuper',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '订单统计',
|
name: '订单统计',
|
||||||
path: '/statistics/order',
|
path: '/statistics/order',
|
||||||
component: './Statistics/Order',
|
component: './Statistics/Order',
|
||||||
access: 'canSeeSuper',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '订单来源',
|
name: '订单来源',
|
||||||
path: '/statistics/orderSource',
|
path: '/statistics/orderSource',
|
||||||
component: './Statistics/OrderSource',
|
component: './Statistics/OrderSource',
|
||||||
access: 'canSeeSuper',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '客户统计',
|
name: '客户统计',
|
||||||
path: '/statistics/customer',
|
path: '/statistics/customer',
|
||||||
component: './Statistics/Customer',
|
component: './Statistics/Customer',
|
||||||
access: 'canSeeSuper',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '库存预测',
|
name: '库存预测',
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,22 @@
|
||||||
export default (initialState: any) => {
|
export default (initialState: any) => {
|
||||||
const canSeeSuper = initialState?.user?.isSuper;
|
const isSuper = initialState?.user?.isSuper ?? false;
|
||||||
const canSeeAdmin =
|
const isAdmin = initialState?.user?.Admin ?? false;
|
||||||
initialState?.user?.isSuper || initialState?.user?.isAdmin;
|
const canSeeOrganiza = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('organiza') ?? false);
|
||||||
|
const canSeeProduct = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('product') ?? false);
|
||||||
|
const canSeeStock = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('stock') ?? false);
|
||||||
|
const canSeeOrder = (isSuper || isAdmin) ||
|
||||||
|
((initialState?.user?.permissions?.includes('order') ?? false) || (initialState?.user?.permissions?.includes('order-10-days') ?? false));
|
||||||
|
const canSeeCustomer = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('customer') ?? false);
|
||||||
|
const canSeeLogistics = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('logistics') ?? false);
|
||||||
|
const canSeeStatistics = (isSuper || isAdmin) || (initialState?.user?.permissions?.includes('statistics') ?? false);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
canSeeSuper,
|
canSeeOrganiza,
|
||||||
canSeeAdmin,
|
canSeeProduct,
|
||||||
|
canSeeStock,
|
||||||
|
canSeeOrder,
|
||||||
|
canSeeCustomer,
|
||||||
|
canSeeLogistics,
|
||||||
|
canSeeStatistics,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue