import "./home.scss"; import {Avatar, Menu, Popconfirm} from 'antd'; import {useEffect, useState} from "react"; import {AreaChartOutlined, DesktopOutlined, FileDoneOutlined, SettingOutlined, UserOutlined} from '@ant-design/icons'; import {Outlet, useLocation, useNavigate} from 'react-router-dom'; import axios from "@/utils/axios.js"; import {useDispatch} from 'react-redux'; import {setDictData} from '@/store/reducer.js'; export default function Home() { const navagate = useNavigate() const [current, setCurrent] = useState('mail') // 菜单数据 const items = [{ label: '首页配置', key: 'basicInfomation', icon: , children: [{ label: '汇总统计数据', key: 'statisticsData', icon: , }, { label: '消费占比', key: 'consumptionProportion', icon: , }, { label: '客流排名', key: 'flowRanking', icon: , }, { label: '线路客流排名', key: 'lineFlowRanking', icon: , }, { label: '舆情统计数据', key: 'publicOpinion', icon: , }, { label: '站场设备统计', key: 'stationEquipment', icon: , }, { label: '客运量数据', key: 'passengerVolumeData', icon: , }, { label: '班次完成率', key: 'classCompletionRate', icon: , }, { label: '班次准点率', key: 'classPunctualitRate', icon: , }, { label: '发车准点率', key: 'carCompletionRate', icon: , }] }, { label: '线路运营配置', key: 'lineConfiguration', icon: , children: [{ label: '线路基本情况', key: 'basicInfomationOfTheLine', icon: , }, { label: '线路发班情况', key: 'lineDispatch', icon: , }, { label: '乘客类型', key: 'passengerType', icon: , }, { label: '汇总数据', key: 'summaryData', icon: , }, { label: '驾驶员数量', key: 'numberOfDrivers', icon: , }, { label: '车辆数量占比', key: 'numberOfTransit', icon: , }, { label: '车辆监控', key: 'vehicleMonitoring', icon: , }, { label: '车辆状态', key: 'vehicleStatus', icon: , }] }, { label: '客流分析', key: 'passengerFlowAnalysis', icon: , children: [{ label: '底部信息', key: 'passengerInfomation', icon: , }, { label: '区域客流', key: 'regionalPassengerFlow', icon: , }, { label: '通勤时间', key: 'commutingTime', icon: , }, { label: '消费类型', key: 'consumptionType', icon: , }, { label: '乘距分布', key: 'distribution', icon: , }, { label: '换乘次数', key: 'replacementFrequency', icon: , }, { label: '客流线路分布', key: 'passengerFlowRoutes', icon: , }, { label: '客运量排名', key: 'rankingOfPassengerVolume', icon: , }] }, { label: '维保动态', key: 'maintenanceDynamics', icon: , children: [{ label: '体检问题情况', key: 'physicalExaminationIssues', icon: , }, { label: '维修保养统计', key: 'maintenanceStatistics', icon: , }, { label: '乘距分布', key: 'distance', icon: , }, { label: '客流线路分布', key: 'distributionOfPassengerFlowRoutes', icon: , }, { label: '维保基本信息', key: 'basicMaintenanceInfomation', icon: , }, { label: '维保执行占比', key: 'maintenanceExecution', icon: , }, { label: '车辆运营状态', key: 'statusClassification', icon: , }, { label: '车辆维保状态', key: 'maintenanceStatus', icon: , }, { label: '消费类型', key: 'mainConsumPtionType', icon: , }, { label: '维保明细', key: 'maintenanceDetails', icon: , },] }, { label: '设施管理', key: 'facilityManagementChild', icon: , children: [{ label: '车载部件', key: 'vehiclesComponents', icon: , }, { label: '充电站', key: 'chargingStation', icon: , }, { label: '区域设施统计', key: 'informationOfFacilities', icon: , }, { label: '电子站牌', key: 'electronicLicensePlate', icon: , }, { label: '车型展示', key: 'vehiclesModelDisplay', icon: , }, { label: '洗车机', key: 'carWasher', icon: , },] }, { label: '站场管理信息', key: 'stationManagementInformation', icon: , children: [{ label: '站场基本信息', key: 'stationBasicInformation', icon: , }, { label: '面积分布', key: 'areaDistrbution', icon: , }, { label: '场地建设时间', key: 'siteConstructionTime', icon: , }, { label: '场地权属情况', key: 'siteOwnership', icon: , }, { label: '区域分布', key: 'regionalDistribution', icon: , }, { label: '类型分布', key: 'typeDistribution', icon: , }, { label: '使用情况', key: 'usage', icon: , }, { label: '站场装机容量', key: 'installedCapacity', icon: , }, { label: '运营保障', key: 'stationOperate', icon: , }, { label: '充电趋势', key: 'chageTrends', icon: , }, { label: '充电桩服务情况', key: 'chageService', icon: , }, { label: '今日充电统计', key: 'nowChargeStatistics', icon: , }, { label: '资源使用率', key: 'resourceUsage', icon: , },] }, { label: '线路分析', key: 'lineAnalysis', icon: , children: [{ label: '区域里程', key: 'regionalMileage', icon: , }, { label: '线路运行速度', key: 'lineSpeed', icon: , }, { label: '站点客流排名', key: 'stationPassengerFlow', icon: , }, { label: '近期线路调整', key: 'lineAdjustment', icon: , }, { label: '线路长度分布', key: 'lineLength', icon: , }, { label: '线路站距分布', key: 'stationSpacingDistribution', icon: , }, { label: '线路类型', key: 'lineType', icon: , }, { label: '线路基本信息', key: 'lineAnalysisDetails', icon: , },] }, { label: '基础信息配置', key: 'setting', icon: , children: [{ label: '用户管理', key: 'user', icon: , }, { label: '字典管理', key: 'dict', icon: , }] }] /** * 电机左边弹框跳转页面 * @param e 电机的数据 */ const onClick = (e) => { setCurrent(e.key); navagate("/" + e.key) }; /** * 退出登录 * @returns {Promise} */ async function logOut() { let {code} = await axios.post('/sys/logout') if (code === 200) { localStorage.removeItem('user') navagate('/login') } } // reduce状态 const dispatch = useDispatch(); /** * 全局存储字典 * @returns {Promise} */ async function getDict() { let {data} = await axios.get("/dict/selectKey"); dispatch(setDictData(data)) } const location = useLocation(); // 让页面无法跳转 function jumpToPage() { if (location.pathname === '/') { navagate('/statisticsData') } } useEffect(() => { jumpToPage() getDict() }, []) return ( 车站管理系统 }> {JSON.parse(localStorage.getItem('user'))?.name} ); }
{JSON.parse(localStorage.getItem('user'))?.name}