routes.js 9.6 KB
import Login from './views/Login.vue'
import NotFound from './views/404.vue'
import Home from './views/Home.vue'
import Main from './views/Main.vue'
// import Table from './views/nav1/Table.vue'
import Role from './views/nav1/role.vue'
import Perm from './views/nav1/perm.vue'
import LOG from './views/nav1/Log.vue'
import PreManifest from './views/agent/PreManifest.vue'
import Company from './views/nav1/company.vue'
import Department from './views/nav1/department.vue'
import Group from './views/nav1/groupcompany.vue'
import Process from './views/hqpt/Process.vue'
import Job from './views/hqpt/Job.vue'
// import Form from './views/nav1/Form.vue'


import OrgManifest from './views/nmms/orgManifest.vue'
import ExitFlight from './views/nmms/ExitFlight.vue'
import ExitPre from './views/nmms/ExitPre.vue'
import ExitTidy from './views/nmms/ExitTidy.vue'
import ExitArrive from './views/nmms/ExitArrive.vue'
import ExitManifest from './views/nmms/ExitManifest.vue'
import ExitLoading from './views/nmms/ExitLoading.vue'
import ExitFlightDesc from './views/nmms/ExitFlightDesc.vue'
import LostLoad from './views/lostLoadChange/lostLoading.vue'
import LostLoadChange from './views/lostLoadChange/lostLoadChange.vue'

import OrigFlightList from './views/nmms_import/OrigFlightList.vue'
import EnterFlightInfo from './views/nmms_import/EnterFlightInfo.vue'
import OrigMaster from './views/nmms_import/OrigMaster.vue'
import EnterTally from './views/nmms_import/EnterFlightTally.vue'
import TallyMster from './views/nmms_import/TallyMster.vue'
import Waybill from './views/nmms_import/Waybill.vue'
import AllocateSearch from './views/nmms_import/AllocateSearch.vue'
import Importallocation from './views/nmms_import/Importallocation.vue'
import Allocatearrive from './views/nmms_import/Allocatearrive.vue'

import User from './views/nav1/user.vue'
import Page4 from './views/nav2/Page4.vue'
import Page5 from './views/nav2/Page5.vue'
import Page6 from './views/nav3/Page6.vue'
import echarts from './views/charts/echarts.vue'
import SecrityInspection from './views/staff/security_inspection.vue'
import Key from './views/staff/key.vue'
import Maintain from './views/staff/maintain.vue'
import ComeCar from './views/staff/come_car.vue'
import OnDuty from './views/staff/on_duty.vue'
import WaterStationsPatrol from './views/water/water_stations_patrol.vue'
import Location from './views/empt/Location.vue'
import AgentExcelExport from './views/excel/exportExcel-agent'
import NMMSExcelExport from './views/excel/exportExcel-NMMS'
import ExitAnalysis from './views/dataAnalysis/ExitAnalysis'
import ArrivalAnalysis from './views/dataAnalysis/ArrivalAnalysis'


let routes = [
    {
        path: '/login',
        component: Login,
        name: '登录',
        hidden: true
    },
    {
        path: '/404',
        component: NotFound,
        name: '错误',
        hidden: true
    },
    {
        path: '/',
        component: Home,
        name: '主页',
        leaf: true,
        iconCls: 'el-icon-menu',
        children: [
            {path: '/main', component: Main, name: '首页'},
        ]
    },
    // { path: '/test', component: Main },
    {
        path: '/admin',
        component: Home,
        name: '系统设置',
        iconCls: 'el-icon-setting',//图标样式class
        children: [
            {path: '/user', component: User, name: '用户管理'},
            {path: '/role', component: Role, name: '组织机构'},
            {path: '/perm', component: Perm, name: '权限管理'},
            {path: '/log', component: LOG, name: '系统日志'},
            {path: '/department', component: Department, name: '部门管理'},
            {path: '/company', component: Company, name: '公司管理'},
            {path: '/group', component: Group, name: '集团管理'}
        ]
    },
    {
        path: '/cgonms-provide',
        component: Home,
        name: '业务统计',
        iconCls: 'fa fa-id-card-o',
        children: [
            {path: '/exitAnalysis', component: ExitAnalysis, name: '出港业务统计'},
            {path: '/arrivalAnalysis', component: ArrivalAnalysis, name: '进港业务统计'},
        ]
    },
    {
        path: '/guestService',
        component: Home,
        name: '客服系统',
        iconCls: 'fa fa-id-card-o',
        children: [
            {path: '/process', component: Process, name: '工单管理'},
            {path: '/job', component: Job, name: '任务管理'},
            {path: '/pre1', component: PreManifest, name: '预配'},
        ]
    },
    {
        path: '/analysis',
        component: Home,
        name: '统计分析',
        iconCls: 'fa fa-id-card-o',
        children: [
            {path: '/agentexport', component: AgentExcelExport, name: '出港统计'},
            {path: '/nmmsexport', component: NMMSExcelExport, name: '进港统计'},
        ]
    },
    {
        path: '/output',
        component: Home,
        name: '出港业务申报',
        iconCls: 'el-icon-collection',
        children: [
            {path: '/flight', component: ExitFlight, name: '出港航班申报'},
            {path: '/manifest', component: ExitManifest, name: '出港运单申报'},
            {path: '/pre', component: ExitPre, name: '出港预配舱单'},
            {path: '/arrive', component: ExitArrive, name: '出港运抵'},
            {path: '/loadingView', component: ExitFlightDesc, name: '出港航班信息'},
            {path: '/loading', component: ExitLoading, name: '出港装载'},
            {path: '/tidy', component: ExitTidy, name: '出港理货'}
        ]
    },
    {
        path: '/nmms2',
        component: Home,
        name: '进港业务申报',
        iconCls: 'fa fa-id-card-o',
        children: [
            {path: '/orig', component: OrigFlightList, name: '进港航班申报'},
            {path: '/waybill', component: Waybill, name: '进港运单申报'},
            {path: '/allocateSearch', component: AllocateSearch, name: '运单分拨申报'},
            {path: '/enter', component: EnterFlightInfo, name: '原始舱单'},
            {path: '/origmaster', component: OrigMaster, name: '进港原始舱单'},
            {path: '/entertall', component: EnterTally, name: '进港理货'},
            {path: '/tallymaster', component: TallyMster, name: '进港理货舱单'},
            {path: '/importallocation', component: Importallocation, name: '进港分拨'},
            {path: '/allocatearrive', component: Allocatearrive, name: '分拨运抵'},
        ]
    },
    {
        path: '/lost',
        component: Home,
        name: '落装改配申报',
        iconCls: 'el-icon-goods',
        children: [
            {path: '/lostLoad', component: LostLoad, name: '落装业务申报'},
            {path: '/lostLoadChange', component: LostLoadChange, name: '改配业务申报'}

        ]
    },
    {
        path: '/empt',
        component: Home,
        name: '能源管理',
        iconCls: 'fa fa-id-card-o',
        children: [
            {path: '/location', component: Location, name: '能源缴费'},
        ]
    },
    {
        path: '/satff',
        component: Home,
        name: '生活保障部门',
        iconCls: 'fa fa-id-card-o',
        children: [
            {path: '/security_inspection', component: SecrityInspection, name: '职工公寓安全巡视管理'},
            {path: '/key', component: Key, name: '职工公寓备用钥匙使用登记管理'},
            {path: '/maintain', component: Maintain, name: '职工公寓设施设备维修记录管理'},
            {path: '/come_car', component: ComeCar, name: '职工公寓外来人员车辆登记管理'},
            {path: '/on_duty', component: OnDuty, name: '职工公寓值班巡视记录管理'},
        ]
    },
    {
        path: '/water_heating_chamber',
        component: Home,
        name: '水暖室',
        iconCls: 'fa fa-address-card',
        // leaf: true,//只有一个节点
        children: [
            {path: '/water_stations_patrol', component: WaterStationsPatrol, name: '二水厂-水站巡视记录单管理'},
            // { path: '/page6', component: Page6, name: '水质量检测' },
            // { path: '/page6', component: Page6, name: '污水站' },
            // { path: '/page6', component: Page6, name: '一水厂' },
            // { path: '/page6', component: Page6, name: '综合楼空调站' },
        ]
    },
    {
        path: '/',
        component: Home,
        name: 'Charts',
        iconCls: 'fa fa-bar-chart',
        children: [
            {path: '/echarts', component: echarts, name: 'echarts'}
        ]
    },
    {
        path: '*',
        hidden: true,
        redirect: {path: '/404'}
    }
];
let initRouters = routes.concat();
let setUserMenus = function (list) {
    routes = list;
}
/**
 * 处理登陆后的账号对应的菜单
 * @param menuList
 */
let handleMenuList = function (router, menu) {
    var _self = this;
    var routerName = "";
    router.forEach(function (v_router) {
        routerName = v_router.name;
        menu.forEach(function (v_menu) {
            //查找返回的目录列表是否包含路由名称,有就返回匹配到的元素,没有就移除
            let result = menu.find(item => {
                return item.name === routerName;
            });

            //匹配到继续判断是否子元素,有子元素继续递归
            if (result) {
                if (v_router.children) {
                    _self.handleMenuList(v_router.children, result.children);
                }
                //没有则可以移除
            } else {
                router.splice(router.findIndex(itm => itm.name === routerName), 1);
            }
        })
    });
}
export default {
    routes, setUserMenus, handleMenuList, initRouters
};