import React from 'react'; import { Button, Modal } from 'antd'; import { inject, observer } from 'mobx-react'; import { WeaRightMenu, WeaReqTop, WeaNewScroll, WeaTools, WeaAlertPage, WeaLocaleProvider ,WeaDialog} from "ecCom" import { toJS } from "mobx" import ProjectInfo from '../common/projectInfo' import TabDiscuss from '../common/TabDiscuss' import ProjectSub from '../common/projectSub' import AddProject from '../dialog/addProjectDialog' import ProjectShare from '../common/sharePage' import ProjectStastics from '../common/ProjectStastics' import TaskList from '../common/TaskList' import ProjectLogDialog from "../dialog/modifyLogDialog" import ProjectFieldLogDialog from '../dialog/projectFieldLogDialog'; import ProjectFieldDetailLogDialog from '../dialog/ProjectFieldDetailLogDialog'; import SaveTemplateDialog from "../dialog/SaveTemplateDialog" import StageList from '../common/stageList'; import ResourcePage from '../common/resourcePage'; import taskBatchEditDialogStore from '../../stores/taskBatchEditDialogStore'; import TaskImport from '../import/TaskImport' const getLabel = WeaLocaleProvider.getLabel; @inject('prjCardStore') @inject('prjImportStore') @observer class ProjectCard extends React.Component { constructor(props) { super(props); this.state = { isshow: false, workPlanVisible: false, importVisible:false } } componentDidMount() { const { prjCardStore, location, prjid } = this.props; const { getPrjInfo, getPrjTabs} = prjCardStore; if(location && location.query && location.query.prjid){ getPrjTabs(location.query); }else{ getPrjTabs({prjid : prjid}); } if (!window.weaWorkplan) { // 异步加载别模块的静态资源 eventRegister.loadModule('f_workplan', () => { prjCardStore.setLoaded(true) }, () => { // 加载文件失败 的业务处理, 网络超时,没文件之类 }) } else { prjCardStore.setLoaded(true) } } componentWillReceiveProps(nextProps) { let keyOld = ""; let keyNew = ""; if( this.props.location && nextProps.location && this.props.location.query && nextProps.location.query){ keyOld = this.props.location.query.prjid; keyNew = nextProps.location.query.prjid; }else{ keyOld = this.props.prjid; keyNew = nextProps.prjid; } //点击菜单路由刷新组件 if (keyOld !== keyNew) { const { prjCardStore, location: { query } } = nextProps; const { getPrjInfo, getPrjTabs} = prjCardStore; getPrjTabs(query); if (!window.weaWorkplan) { // 异步加载别模块的静态资源 eventRegister.loadModule('f_workplan', () => { prjCardStore.setLoaded(true) }, () => { // 加载文件失败 的业务处理, 网络超时,没文件之类 }) } else { prjCardStore.setLoaded(true) } } } render() { let _this = this; const { prjCardStore } = this.props; const { prjid, tabDatas, selectTabKey, loading, prjname,hasRight, verified, prjisdel, shareStore, prjLogTableStore, prjFieldLogTableStore, prjFieldDetailLogTableStore, fieldname } = prjCardStore; const account = WeaTools.ls.getJSONObj('theme-account'); let dialogHeight = window.innerHeight - 150; if (dialogHeight > 600) dialogHeight = 600; if (prjisdel) { return (
{getLabel(101, "项目") + getLabel(18967, "已删除")}
) } if (verified && !hasRight && !prjisdel) { return (
{getLabel(2012, "对不起,您暂时没有权限!")}
) } if (verified && hasRight && !prjisdel) { const tabDatas1 = toJS(tabDatas); let tabUrl = function (key) { if (tabDatas1) { for (let i = 0; i < tabDatas1.length; i++) { if (tabDatas1[i].id == key && tabDatas1[i].shortname == "prjinfo") { //基本信息 return
{ prjCardStore.isreload && window.weaWorkplan && window.weaWorkplan.com && window.weaWorkplan.com.WorkPlanCreate && ( { _this.setWorkPlanVisible(false); }}//关闭回调 onlyClose={() => { _this.setWorkPlanVisible(false) }}//关闭回调,只做关闭操作 workPlanId={""} //日程id,1查看日程时用到 createConditionParams={[]}//创建的默认值日期和时间,没有传[] activeKey={""} //查看页面显示的面板1是基本信息,7是相关交流 //changeTab={(key) => { }}//查看页面切换面板的回调 selectUser={account && account.userid}//新建日程的创建人id workPlanTypeOptions={"2"}//客户模块的新建日程,普通新建传'',客户新建传3 crmIDs={[]}//通过客户模块新建日程,并自动带出相关客户,[{'id':'','name':''}] projectid={prjid} description={""}//客户模块需求,支持新建时传入的'基本信息-内容' />) }
} else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "tasklist") {//任务列表 return
{ _this.doClose() }} style={{ width: 870, height: dialogHeight }} buttons={_this.getDialogTopButtons()} >
} else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "childprj") { //子项目 return [, ] } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "prjdiscuss") { //相关交流 //return { _this.reloadExchanges() }} key={new Date().getTime()} /> return } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "prjshare") { //共享设置 return } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "stareport") { //统计报告 return } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "gantt") { //甘特图 return tabDatas1[i].linkurl; //"/proj/gantt/gantt.jsp?projectid=8&ProjID=8"; } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "stageset") { //阶段设置 return } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "resources") { //相关资源 return } else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "") { if (tabDatas[i].linkurl.indexOf("noright") > -1) { return
{getLabel(2012, "对不起,您暂时没有权限!")}
} else { return tabDatas1[i].linkurl; } } } return "" } }(selectTabKey); return (
} iconBgcolor='#217346' buttons={this.getButtons()} buttonSpace={10} showDropIcon={true} dropMenuDatas={this.getRightMenu()} onDropMenuClick={this.onRightMenuClick.bind(this)} tabDatas={tabDatas} selectedKey={selectTabKey} onChange={this.taskCardChangeTab.bind(this)} >
{ typeof tabUrl === "object" ? { tabUrl } :