import React, { Component } from 'react'; import '../content.less'; import LeftTab from '../leftTab'; import {getMenu} from '../publicMenu.js' class Content extends Component { constructor() { super(); this.state = { loading: false, component:
, }; } componentWillMount() { var ids=window.location.href.indexOf('rid='); var idk=window.location.href.substr(ids+4); var rid=idk.split('#'); let menu=getMenu(rid); let curry; if(menu[0].subMenus.length>0){ curry=menu[0].subMenus[0].url.split('#'); }else{ curry=menu[0].url.split('#'); }; if (window.location.hash) { this.getKey(window.location.hash.substr(1)); } else { this.getKey(curry[1]); }; } getKey(key) { switch (key) { //项目派单 case "projectAssignment": require.ensure([], () => { const ProjectAssignment = require("./project/projectAssignment") .default; this.setState({ component: }); }); break; //项目查询 case "projectQuery": require.ensure([], () => { const ProjectQuery = require("./project/projectQuery") .default; this.setState({ component: }); }); break; //项目汇总表 case "highTech": require.ensure([], () => { const ProjectQuery = require("./summary/highTech") .default; this.setState({ component: }); }); break; //项目统计 case "projecCount": require.ensure([], () => { const ProjectQuery = require("./summary/projecCount") .default; this.setState({ component: }); }); break; //外包派单 // case "zxsglyOutSourcingPaiDan": // require.ensure([], () => { // const ZxsglyOutSourcingPaiDan = require("./project/zxsglyOutSourcingPaiDan") // .default; // this.setState({ // component: // }); // }); // break; //外包任务派单 // case "outsourceTaskAssignment": // require.ensure([], () => { // const OutsourceTaskAssignment = require("./project/outsourceTaskAssignment") // .default; // this.setState({ // component: // }); // }); // break; //企业项目查询 case "enterpriseProjectQuery": require.ensure([], () => { const EnterpriseProjectQuery = require("./project/enterpriseProjectQuery") .default; this.setState({ component: }); }); break; //任务查询 case "taskQuery": require.ensure([], () => { const TaskQuery = require("./task/taskQuery").default; this.setState({ component: }); }); break; case "taskQueryZxs": require.ensure([], () => { const TaskQuery = require("./task/taskQueryZxs").default; this.setState({ component: }); }); break; //任务派单 case "taskAssignment": require.ensure([], () => { const TaskAssignment = require("./task/taskAssignment") .default; this.setState({ component: }); }); break; //我的任务 case "myTask": require.ensure([], () => { const MyTask = require("./task/myTask").default; this.setState({ component: }); }); break; //我的任务 case "myTaskZxs": require.ensure([], () => { const MyTask = require("./task/myTaskZxs").default; this.setState({ component: }); }); break; //我的外包任务 // case "myTaskOutsource": // require.ensure([], () => { // const MyTaskOutsource = require("./task/myTaskOutsource") // .default; // this.setState({ // component: // }); // }); // break; //我的外包任务 // case "myTaskOutsourceZxs": // require.ensure([], () => { // const MyTaskOutsource = require("./task/myTaskOutsourceZxs") // .default; // this.setState({ // component: // }); // }); // break; //合同变更审核列表 // case "contractChangeJsy": // require.ensure([], () => { // const ContractChangeJsy = require("./task/contractChangeJsy") // .default; // this.setState({ // component: // }); // }); // break; //合同变更审核列表 // case "contractChangeJsjl": // require.ensure([], () => { // const ContractChangeJsjl = require("./task/contractChangeJsjl") // .default; // this.setState({ // component: // }); // }); // break; //合同变更审核列表 // case "contractChangeJszj": // require.ensure([], () => { // const ContractChangeJszj = require("./task/contractChangeJszj") // .default; // this.setState({ // component: // }); // }); // break; //付款申请驳回列表 case "payApplyReject": require.ensure([], () => { const PayApplyReject = require("./task/payApplyReject/index") .default; this.setState({ component: }); }); break; //任务统计 case "taskCount": require.ensure([], () => { const TaskCount = require("./task/taskCount").default; this.setState({ component: }); }); break; //我的任务统计 case "myTaskCount": require.ensure([], () => { const MyTaskCount = require("./task/myTaskCount").default; this.setState({ component: }); }); break; default: require.ensure([], () => { const Module = require("../module").default; this.setState({ component: }); }); }; window.location.hash = key; } render() { return (
{this.state.component}
) } } export default Content;