|
@@ -1,16 +1,19 @@
|
|
|
import React, { useState, useEffect, useMemo } from 'react';
|
|
|
import { Card, Table, Empty, Button, Modal, message } from 'antd';
|
|
|
import menuStyle from './index.less';
|
|
|
-import { connect, useNavigate } from 'umi';
|
|
|
+import { connect, useNavigate, useModel } from 'umi';
|
|
|
import { getToken } from '@/utils/utils';
|
|
|
const noIcon = require('@/assets/UnityMenu/noIcon.png');
|
|
|
function HomePage(props) {
|
|
|
+ const { initialState } = useModel('@@initialState');
|
|
|
+ const user = initialState?.user || {};
|
|
|
let navigate = useNavigate();
|
|
|
const curMenu = [
|
|
|
{
|
|
|
id: 1,
|
|
|
name: '项目立项',
|
|
|
active: true,
|
|
|
+ permission: true,
|
|
|
click: () => {
|
|
|
window.open(
|
|
|
` http://120.55.44.4:8899/#/purchase/home/approval/list?JWT-TOKEN=${getToken()}`,
|
|
@@ -22,6 +25,7 @@ function HomePage(props) {
|
|
|
id: 5,
|
|
|
name: '工时管理',
|
|
|
active: true,
|
|
|
+ permission: true,
|
|
|
click: () => {
|
|
|
window.open(
|
|
|
`http://120.55.44.4:8899/#/purchase/home/work-hours?JWT-TOKEN=${getToken()}`,
|
|
@@ -33,6 +37,7 @@ function HomePage(props) {
|
|
|
id: 6,
|
|
|
name: '供应商管理',
|
|
|
active: true,
|
|
|
+ permission: true,
|
|
|
click: () => {
|
|
|
navigate('/manufacturer');
|
|
|
},
|
|
@@ -42,6 +47,7 @@ function HomePage(props) {
|
|
|
id: 2,
|
|
|
name: '合同管理',
|
|
|
active: true,
|
|
|
+ permission: true,
|
|
|
click: () => {
|
|
|
navigate('/contract-manager');
|
|
|
},
|
|
@@ -51,6 +57,7 @@ function HomePage(props) {
|
|
|
id: 4,
|
|
|
name: 'BOM清单',
|
|
|
active: true,
|
|
|
+ permission: true,
|
|
|
click: () => {
|
|
|
window.open(
|
|
|
`http://120.55.44.4:8896/#/bom/home?JWT-TOKEN=${getToken()}`,
|
|
@@ -62,6 +69,7 @@ function HomePage(props) {
|
|
|
id: 3,
|
|
|
name: 'OA审批',
|
|
|
active: true,
|
|
|
+ permission: true,
|
|
|
click: () => {
|
|
|
navigate('/oa');
|
|
|
},
|
|
@@ -71,6 +79,7 @@ function HomePage(props) {
|
|
|
id: 7,
|
|
|
name: '文档管理',
|
|
|
active: true,
|
|
|
+ permission: true,
|
|
|
click: () => {
|
|
|
navigate('/fileManagement');
|
|
|
},
|
|
@@ -80,6 +89,7 @@ function HomePage(props) {
|
|
|
id: 8,
|
|
|
name: 'PSR管理',
|
|
|
active: true,
|
|
|
+ permission: true,
|
|
|
click: () => {
|
|
|
navigate('/psrManage');
|
|
|
},
|
|
@@ -90,6 +100,7 @@ function HomePage(props) {
|
|
|
id: 9,
|
|
|
name: '个人中心',
|
|
|
active: true,
|
|
|
+ permission: true,
|
|
|
click: () => {
|
|
|
navigate('/profile');
|
|
|
},
|
|
@@ -108,6 +119,7 @@ function HomePage(props) {
|
|
|
id: 10,
|
|
|
name: 'Scada功能',
|
|
|
active: true,
|
|
|
+ permission: user?.Permission?.['func-06-platform-scada'] || false,
|
|
|
click: () => {
|
|
|
navigate('/scada');
|
|
|
},
|
|
@@ -126,13 +138,15 @@ function HomePage(props) {
|
|
|
function MenuContent({ list }) {
|
|
|
const row = useMemo(() => {
|
|
|
const result = [];
|
|
|
+ const rightList = list.filter((item) => item.permission);
|
|
|
for (let i = 0; i < list.length; i += 5) {
|
|
|
- result.push(list.slice(i, i + 5));
|
|
|
+ result.push(rightList.slice(i, i + 5));
|
|
|
}
|
|
|
return result;
|
|
|
}, [list]);
|
|
|
- return row.map((rowList) => (
|
|
|
- <div className={menuStyle.wrap}>
|
|
|
+
|
|
|
+ return row.map((rowList, index) => (
|
|
|
+ <div key={index} className={menuStyle.wrap}>
|
|
|
{rowList.map((item) => (
|
|
|
<MenuItem key={item.id} item={item} />
|
|
|
))}
|