608 lines
37 KiB
JavaScript
608 lines
37 KiB
JavaScript
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 (<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@ak55ts`} >
|
||
<div style={{ color: '#000' }}>
|
||
{getLabel(101, "项目") + getLabel(18967, "已删除")}
|
||
</div>
|
||
</WeaAlertPage>
|
||
)
|
||
}
|
||
|
||
if (verified && !hasRight && !prjisdel) {
|
||
return (<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@khblkr`} >
|
||
<div style={{ color: '#000' }}>
|
||
{getLabel(2012, "对不起,您暂时没有权限!")}
|
||
</div>
|
||
</WeaAlertPage>
|
||
)
|
||
}
|
||
|
||
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 <div style={{height:"100%"}}>
|
||
<ProjectInfo ecId={`${this && this.props && this.props.ecId || ''}_ProjectInfo@w6i1ac`} formStore={prjCardStore} />
|
||
<ProjectLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectLogDialog@34xltm`} ref="projectLogDialog" title={getLabel('33782','项目日志') } tableStore={prjLogTableStore} store={prjCardStore} />
|
||
<ProjectFieldLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectFieldLogDialog@15fzn5`} title={getLabel('82274','字段日志') } tableStore={prjFieldLogTableStore} store={prjCardStore} />
|
||
<ProjectFieldDetailLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectFieldDetailLogDialog@qz4ay7`} title={getLabel('82274','字段日志')+"-"+fieldname } tableStore={prjFieldDetailLogTableStore} store={prjCardStore} />
|
||
<SaveTemplateDialog ecId={`${this && this.props && this.props.ecId || ''}_SaveTemplateDialog@6f86an`} prjCardStore={prjCardStore}/>
|
||
|
||
{
|
||
prjCardStore.isreload && window.weaWorkplan && window.weaWorkplan.com && window.weaWorkplan.com.WorkPlanCreate &&
|
||
(<window.weaWorkplan.com.WorkPlanCreate ecId={`${this && this.props && this.props.ecId || ''}_WorkPlanCreate@9qcr32`}
|
||
type={"create"}//新建为'create',查看为'preview',编辑edit,共享share
|
||
visible={_this.state.workPlanVisible}//显隐受控
|
||
doClose={() => { _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={""}//客户模块需求,支持新建时传入的'基本信息-内容'
|
||
/>)
|
||
}
|
||
|
||
</div>
|
||
} else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "tasklist") {//任务列表
|
||
return <div style={{height:"100%"}}>
|
||
<TaskList ecId={`${this && this.props && this.props.ecId || ''}_TaskList@bz4ety`} contentStore={prjCardStore} account={account} taskBatchEditDialogStore={taskBatchEditDialogStore}/>
|
||
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@4sbd4y`}
|
||
title={getLabel(383858,"任务导入")}
|
||
visible={_this.state.importVisible}
|
||
icon='icon-coms-project'
|
||
iconBgcolor='#217346'
|
||
onCancel={() => { _this.doClose() }}
|
||
style={{ width: 870, height: dialogHeight }}
|
||
buttons={_this.getDialogTopButtons()}
|
||
>
|
||
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@96agus`} datas={_this.getDialogRightMenu()}>
|
||
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@4dnnga`} height={dialogHeight} ref="scrollBar">
|
||
<TaskImport ecId={`${this && this.props && this.props.ecId || ''}_TaskImport@05d1d5`} key={new Date().getTime()}/>
|
||
</WeaNewScroll>
|
||
</WeaRightMenu>
|
||
</WeaDialog >
|
||
</div>
|
||
} else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "childprj") { //子项目
|
||
return [<ProjectSub ecId={`${this && this.props && this.props.ecId || ''}_ProjectSub@a9jxpc`} contentStore={prjCardStore} />, <AddProject ecId={`${this && this.props && this.props.ecId || ''}_AddProject@t04gia`} contentStore={prjCardStore} isreflesh={true} />]
|
||
} else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "prjdiscuss") { //相关交流
|
||
//return <RelateExchange contentStore={prjCardStore} callBack={() => { _this.reloadExchanges() }} key={new Date().getTime()} />
|
||
return <TabDiscuss ecId={`${this && this.props && this.props.ecId || ''}_TabDiscuss@z53gbg`} contentStore={prjCardStore} sortid={prjid}/>
|
||
} else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "prjshare") { //共享设置
|
||
return <ProjectShare ecId={`${this && this.props && this.props.ecId || ''}_ProjectShare@zkc2xx`} contentStore={prjCardStore} shareCondition={shareStore.shareCondition} title={getLabel(83816, "添加项目共享")} />
|
||
} else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "stareport") { //统计报告
|
||
return <ProjectStastics ecId={`${this && this.props && this.props.ecId || ''}_ProjectStastics@pkob8r`} contentStore={prjCardStore} statkey={prjCardStore.statkey} />
|
||
} 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 <StageList ecId={`${this && this.props && this.props.ecId || ''}_StageList@ru7jks`} ref="StageList" contentStore={prjCardStore} />
|
||
} else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "resources") { //相关资源
|
||
return<ResourcePage ecId={`${this && this.props && this.props.ecId || ''}_ResourcePage@ytaksl`} contentStore={prjCardStore} />
|
||
} else if (tabDatas1[i].id == key && tabDatas1[i].shortname == "") {
|
||
if (tabDatas[i].linkurl.indexOf("noright") > -1) {
|
||
return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@3v1uow`} >
|
||
<div style={{ color: '#000' }}>
|
||
{getLabel(2012, "对不起,您暂时没有权限!")}
|
||
</div>
|
||
</WeaAlertPage>
|
||
} else {
|
||
return tabDatas1[i].linkurl;
|
||
}
|
||
}
|
||
}
|
||
return ""
|
||
}
|
||
}(selectTabKey);
|
||
return (
|
||
<div>
|
||
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@pfpt0m`} datas={this.getRightMenu()} onClick={this.onRightMenuClick.bind(this)}>
|
||
<WeaReqTop ecId={`${this && this.props && this.props.ecId || ''}_WeaReqTop@2gm2tk`}
|
||
title={prjname}
|
||
loading={loading}
|
||
icon={<i className='icon-coms-project' />}
|
||
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)}
|
||
>
|
||
<div className="prj-req-content">
|
||
<div className='prj-req-content-inner'>
|
||
{
|
||
typeof tabUrl === "object" ? <WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@4ihajm`} scrollId='prj-req-content-main-scroll' height='100%'>
|
||
{
|
||
tabUrl
|
||
}
|
||
</WeaNewScroll> :
|
||
<iframe src={tabUrl} id="prjtabiframe" name="prjtabiframe" className="flowFrame" frameborder="0" width="100%" height="100%" />
|
||
}
|
||
</div>
|
||
</div>
|
||
</WeaReqTop>
|
||
</WeaRightMenu>
|
||
</div>
|
||
)
|
||
}
|
||
return (<div></div>)
|
||
}
|
||
|
||
zoom = (scale) => {
|
||
const { prjCardStore, params } = this.props;
|
||
prjCardStore.changeScale(parseInt(scale * 10));
|
||
}
|
||
|
||
getButtons() {
|
||
const { prjCardStore, parentStore } = this.props;
|
||
const { rightMenu, prjid,prjname, form, selectTabKey, taskInfoStore, addProjectStore, shareTableStore, tabDatas, approveplanstatus, status, isApprove } = prjCardStore;
|
||
const { saveDefaultInfo } = this.props.prjImportStore;
|
||
let btnArr = [];
|
||
let { selectedRowKeys } = shareTableStore;
|
||
const tabDatas1 = toJS(tabDatas);
|
||
const key = selectTabKey;
|
||
rightMenu && rightMenu.length > 0 && rightMenu.map(m => {
|
||
let disabled = false;
|
||
if (tabDatas1) {
|
||
for (let i = 0; i < tabDatas1.length; i++) {
|
||
if (tabDatas1[i].shortname == "stageset" && tabDatas1[i].key == key && prjCardStore.stageInfo.selectedRowKeys.length == 0) {//项目卡片
|
||
if (m.type == "BTN_COPY" || m.type == "BTN_DELETE") {
|
||
disabled = true;
|
||
}
|
||
}
|
||
if (tabDatas1[i].shortname == "prjshare" && tabDatas1[i].key == key && selectedRowKeys.length == 0) {//项目卡片
|
||
if (m.type == "BTN_COPY" || m.type == "BTN_DELETE" || m.type == "BTN_DELETEBATCH") {
|
||
disabled = true;
|
||
}
|
||
}
|
||
if (tabDatas1[i].shortname == "tasklist" && tabDatas1[i].key == key && approveplanstatus == true) {//项目卡片
|
||
if (m.type == "BTN_DOSUBMIT") {
|
||
disabled = true;
|
||
}
|
||
}
|
||
|
||
if(tabDatas1[i].shortname == "tasklist" && tabDatas1[i].key == key && taskInfoStore.selectedRowKeys.length == 0){
|
||
if(m.type == "BTN_DELETEBATCH"){
|
||
disabled = true;
|
||
}
|
||
}
|
||
|
||
if(tabDatas1[i].shortname == "tasklist" && tabDatas1[i].key == key && taskInfoStore.selectedRowKeys.length == 0){
|
||
if(m.type == "BTN_SUBMITEDIT"){
|
||
disabled = true;
|
||
}
|
||
}
|
||
|
||
if(tabDatas1[i].shortname == "tasklist" && tabDatas1[i].key == key && (status == '-1' || isApprove)){
|
||
if(m.type == "BTN_BREAKDOWN"){
|
||
disabled = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
m.isTop == '1' && btnArr.length < 4 && btnArr.push(
|
||
<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@o42dp5@${m.type}`} type="primary"
|
||
disabled={disabled}
|
||
onClick={() => {
|
||
if (tabDatas1) {
|
||
for (let i = 0; i < tabDatas1.length; i++) {
|
||
if (tabDatas1[i].shortname == "prjinfo" && tabDatas1[i].key == key) {//项目卡片
|
||
if (m.type == "BTN_EDIT") { //编辑
|
||
prjCardStore.getPrjInfo({ viewtype: 'edit', prjid: prjid });
|
||
} else if (m.type == "BTN_SAVE") { //保存
|
||
prjCardStore.savePrjInfo({ prjid: prjid },parentStore);
|
||
} else if (m.type == "BTN_DELETE") { //删除
|
||
prjCardStore.delPrjInfo({ method: "del", prjid: prjid, from: "mymanagerproject" });
|
||
}
|
||
} else if (tabDatas1[i].shortname == "tasklist" && tabDatas1[i].key == key) {//任务列表
|
||
if (m.type == "BTN_ADDTASK") { //添加任务
|
||
taskInfoStore.handleDialog(true, "add", '', { prjid: prjid, parentid: "" });
|
||
} else if (m.type == 'BTN_IMPTASK') { //任务导入
|
||
this.setState({importVisible:true});
|
||
saveDefaultInfo(prjid,prjname);
|
||
} else if (m.type == 'BTN_EDIT') { //编辑
|
||
prjCardStore.showEditTaskModal(true);
|
||
} else if (m.type == 'BTN_DOSUBMIT') { //提交执行
|
||
Modal.confirm({
|
||
title: getLabel(15172, "系统提示"),
|
||
content: getLabel(83919, "你确定要提交执行吗?"),
|
||
onOk() {
|
||
prjCardStore.doPlanOpt_task({ method: 'approveplan', prjid: prjid });
|
||
},
|
||
onCancel() { },
|
||
});
|
||
} else if (m.type == 'BTN_APPSUBMIT') { //提交执行(审批)
|
||
Modal.confirm({
|
||
title: getLabel(15172, "系统提示"),
|
||
content: getLabel(83921, "你确定要提交审批吗?"),
|
||
onOk() {
|
||
prjCardStore.doPlanOpt_task({ method: 'submitplan', prjid: prjid });
|
||
},
|
||
onCancel() { },
|
||
});
|
||
} else if(m.type == "BTN_DELETEBATCH" ){ //批量删除
|
||
prjCardStore.delTaskBatch("delbatch");
|
||
} else if(m.type == "BTN_EDITBATCH" ){ //批量编辑
|
||
prjCardStore.setIsBatchEdit(1);
|
||
prjCardStore.getPrjTaskList();
|
||
prjCardStore.resetTaskInfoStore();
|
||
} else if(m.type == "BTN_BACK" ){ //返回
|
||
prjCardStore.setIsBatchEdit(0);
|
||
prjCardStore.getPrjTaskList();
|
||
prjCardStore.resetTaskInfoStore();
|
||
} else if(m.type == "BTN_SUBMITEDIT" ){ //提交编辑
|
||
taskBatchEditDialogStore.setVisible(true);
|
||
} else if(m.type == "BTN_BREAKDOWN" ){ //任务分解
|
||
prjCardStore.triggerBreakDownWF();
|
||
}
|
||
} else if (tabDatas1[i].shortname == "childprj" && tabDatas1[i].key == key) {//子项目
|
||
if (m.type == "BTN_NEWPRJSUB") { //新建子项目
|
||
addProjectStore.handleShareDialog(true, { viewtype: 'add', prjid: prjid });
|
||
}
|
||
} else if (tabDatas1[i].shortname == "prjshare" && tabDatas1[i].key == key) {//共享设置
|
||
if (m.type == "BTN_APPEND") { //添加
|
||
prjCardStore.showAddShareModal(true);
|
||
} else if (m.type == 'BTN_DELETEBATCH') { //批量删除
|
||
// let { selectedRowKeys } = shareTableStore;
|
||
prjCardStore.delBatchShare(`${toJS(selectedRowKeys)}`);
|
||
}
|
||
} else if (tabDatas1[i].shortname == "stageset" && tabDatas1[i].key == key) { //阶段
|
||
if (m.type == 'BTN_ADD_SHARE') { //新增
|
||
this.refs.StageList.tableEdit.refs.edit.doAdd()
|
||
} else if (m.type == "BTN_DELETE") { //删除
|
||
this.refs.StageList.tableEdit.refs.edit.doDelete()
|
||
} else if (m.type == "BTN_COPY") { //复制
|
||
this.refs.StageList.tableEdit.refs.edit.doCopy()
|
||
} else if (m.type == "BTN_SUBMIT") { //保存
|
||
const checkProps = this.refs.StageList.tableEdit.refs.edit.doRequiredCheck();
|
||
prjCardStore.saveStageSet(checkProps);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}}
|
||
disabled={disabled}
|
||
>
|
||
{m.menuName}
|
||
</Button>
|
||
);
|
||
});
|
||
return btnArr;
|
||
}
|
||
getRightMenu() {
|
||
const { prjCardStore } = this.props;
|
||
const { rightMenu, shareTableStore, selectTabKey, tabDatas, taskInfoStore, isApprove, status } = prjCardStore;
|
||
let { selectedRowKeys } = shareTableStore;
|
||
const key = selectTabKey
|
||
const tabDatas1 = toJS(tabDatas);
|
||
let btnArr = [];
|
||
rightMenu && rightMenu.length > 0 && rightMenu.map(m => {
|
||
let disabled = false;
|
||
if (tabDatas1) {
|
||
for (let i = 0; i < tabDatas1.length; i++) {
|
||
if (tabDatas1[i].shortname == "stageset" && tabDatas1[i].key == key && prjCardStore.stageInfo.selectedRowKeys.length == 0) {//项目卡片
|
||
if (m.type == "BTN_COPY" || m.type == "BTN_DELETE") {
|
||
disabled = true;
|
||
}
|
||
}
|
||
if (tabDatas1[i].shortname == "prjshare" && tabDatas1[i].key == key && selectedRowKeys.length == 0) {//项目卡片
|
||
if (m.type == "BTN_COPY" || m.type == "BTN_DELETE" || m.type == "BTN_DELETEBATCH") {
|
||
disabled = true;
|
||
}
|
||
}
|
||
|
||
if(tabDatas1[i].shortname == "tasklist" && tabDatas1[i].key == key && taskInfoStore.selectedRowKeys.length == 0){
|
||
if(m.type == "BTN_DELETEBATCH"){
|
||
disabled = true;
|
||
}
|
||
}
|
||
|
||
if(tabDatas1[i].shortname == "tasklist" && tabDatas1[i].key == key && taskInfoStore.selectedRowKeys.length == 0){
|
||
if(m.type == "BTN_SUBMITEDIT"){
|
||
disabled = true;
|
||
}
|
||
}
|
||
|
||
if(tabDatas1[i].shortname == "prjinfo" && tabDatas1[i].key == key && isApprove){
|
||
if(m.menuIcon == "icon-coms-Approval"){
|
||
disabled = true;
|
||
}
|
||
}
|
||
|
||
if(tabDatas1[i].shortname == "tasklist" && tabDatas1[i].key == key && (status == '-1' || isApprove)){
|
||
if(m.type == "BTN_BREAKDOWN"){
|
||
disabled = true;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
btnArr.push({
|
||
icon: <i className={m.menuIcon} />,
|
||
content: m.menuName,
|
||
disabled: disabled
|
||
})
|
||
});
|
||
return btnArr
|
||
}
|
||
onRightMenuClick(key) {
|
||
let that = this;
|
||
const { prjCardStore } = this.props;
|
||
const { rightMenu, selectTabKey, prjid, prjname,taskInfoStore, addProjectStore, shareTableStore, relateListStore, tabDatas } = prjCardStore;
|
||
const tabDatas1 = toJS(tabDatas);
|
||
const { saveDefaultInfo } = this.props.prjImportStore;
|
||
rightMenu && rightMenu.length > 0 && rightMenu.map((m, i) => {
|
||
if (Number(key) == i) {
|
||
if (tabDatas1) {
|
||
for (let i = 0; i < tabDatas1.length; i++) {
|
||
if (tabDatas1[i].shortname == "prjinfo" && tabDatas1[i].key == selectTabKey) {//项目卡片
|
||
let fn = m.menuFun.indexOf('this') >= 0 ? `${m.menuFun.split('this')[0]})` : m.menuFun;
|
||
if (fn != "") {
|
||
fn = fn.substring(0, fn.indexOf('('));
|
||
if ('onNormal' == fn) { //正常
|
||
prjCardStore.doPlanOpt({ method: 'normal', prjid: prjid });
|
||
} else if ('onOver' == fn) { //延期
|
||
prjCardStore.doPlanOpt({ method: 'delay', prjid: prjid });
|
||
} else if ('onFinish' == fn) { //完成
|
||
prjCardStore.doPlanOpt({ method: 'complete', prjid: prjid });
|
||
} else if ('onFrozen' == fn) { //冻结
|
||
prjCardStore.doPlanOpt({ method: 'freeze', prjid: prjid });
|
||
} else if ('onToggleStatus' == fn) {
|
||
prjCardStore.doPlanOpt({ method: 'togglestatus', prjid: prjid, statusid: m.params });
|
||
}
|
||
} else {
|
||
if (m.type == "BTN_EDIT") { //编辑
|
||
prjCardStore.getPrjInfo({ viewtype: 'edit', prjid: prjid });
|
||
} else if (m.type == "BTN_SAVE") { //保存
|
||
prjCardStore.savePrjInfo({ prjid: prjid });
|
||
} else if (m.type == "BTN_NEWREQ") { //新建流程
|
||
window.open((window.ecologyContentPath || '')+"/spa/workflow/static/index.html#/main/workflow/add?prjid=" + prjid, "_blank");
|
||
} else if (m.type == "BTN_NEWDOC") { //新建文档
|
||
window.open((window.ecologyContentPath || '')+"/spa/document/static/index.html#/main/document/add?moudleFrom=prj&prjid=" + prjid, "_blank");
|
||
} else if (m.type == "BTN_NEWRQ") { //新建日程
|
||
this.setState({ workPlanVisible: true })
|
||
} else if (m.type == "BTN_NEWMT") { //新建会议
|
||
window.open((window.ecologyContentPath || '')+"/spa/meeting/static/index.html#/main/meeting/dialogsingle?type=create&projectid=" + prjid, "_blank");
|
||
} else if (m.type == "BTN_SAVETEMPLET") { //另存为模板
|
||
prjCardStore.setVisiable(true);
|
||
} else if (m.type == "BTN_BACK") { //返回
|
||
prjCardStore.getPrjInfo({ viewtype: 'view', prjid: prjid });
|
||
} else if (m.type == "BTN_LOG") {
|
||
this.refs.projectLogDialog.setVisible(true);
|
||
prjCardStore.getPrjLogList({ prjid: prjid });
|
||
} else if (m.type == "BTN_DELETE") {
|
||
prjCardStore.delPrjInfo({ method: "del", prjid: prjid, from: "mymanagerproject" });
|
||
}
|
||
|
||
}
|
||
} else if (tabDatas1[i].shortname == "tasklist" && tabDatas1[i].key == selectTabKey) { //任务列表
|
||
if (m.type == "BTN_ADDTASK") { //添加任务
|
||
taskInfoStore.handleDialog(true, "add", '', { prjid: prjid, parentid: "" });
|
||
} else if (m.type == 'BTN_IMPTASK') { //任务导入
|
||
this.setState({importVisible:true});
|
||
saveDefaultInfo(prjid,prjname);
|
||
} else if (m.type == 'BTN_EDIT') { //编辑
|
||
prjCardStore.showEditTaskModal(true);
|
||
} else if (m.type == 'BTN_DOSUBMIT') { //提交执行
|
||
Modal.confirm({
|
||
title: getLabel(15172, "系统提示"),
|
||
content: getLabel(83919, "你确定要提交执行吗?"),
|
||
onOk() {
|
||
prjCardStore.doPlanOpt_task({ method: 'approveplan', prjid: prjid });
|
||
},
|
||
onCancel() { },
|
||
});
|
||
} else if (m.type == 'BTN_APPSUBMIT') { //提交执行(审批)
|
||
Modal.confirm({
|
||
title: getLabel(15172, "系统提示"),
|
||
content: getLabel(83921, "你确定要提交审批吗?"),
|
||
onOk() {
|
||
prjCardStore.doPlanOpt_task({ method: 'submitplan', prjid: prjid });
|
||
},
|
||
onCancel() { },
|
||
});
|
||
} else if (m.type == 'BTN_TASKEXPORT') { //导出任务
|
||
prjCardStore.doTaskExcelExp({ prjid: prjid });
|
||
} else if (m.type == 'BTN_SAVEPLAN') { //存为计划版本
|
||
prjCardStore.saveasplan({ method: 'saveasplan', prjid: prjid });
|
||
} else if (m.type == 'BTN_TASKHISTORY') { //历史版本
|
||
relateListStore.handleRelateDialog(true, "history", prjid)
|
||
} else if (m.type == 'BTN_NOTEMEMBER') { //通知成员
|
||
relateListStore.handleRelateDialog(true, "notice", prjid)
|
||
} else if (m.type == 'BTN_ONREQUEST') { //相关流程
|
||
relateListStore.handleRelateDialog(true, "request", prjid)
|
||
} else if (m.type == 'BTN_ONDOC') { //相关文档
|
||
relateListStore.handleRelateDialog(true, "doc", prjid)
|
||
} else if (m.type == 'BTN_ONCOWORK') { //相关协作
|
||
relateListStore.handleRelateDialog(true, "cowork", prjid)
|
||
// crmInfoRightmenuStore.addCowork(customerId);
|
||
|
||
} else if (m.type == 'BTN_LOG') { //日志
|
||
relateListStore.handleRelateDialog(true, "log", prjid)
|
||
} else if(m.type == "BTN_DELETEBATCH" ){ //批量删除
|
||
prjCardStore.delTaskBatch("delbatch");
|
||
} else if(m.type == "BTN_EDITBATCH" ){ //批量编辑
|
||
prjCardStore.setIsBatchEdit(1);
|
||
prjCardStore.getPrjTaskList();
|
||
prjCardStore.resetTaskInfoStore();
|
||
} else if(m.type == "BTN_BACK" ){ //返回
|
||
prjCardStore.setIsBatchEdit(0);
|
||
prjCardStore.getPrjTaskList();
|
||
prjCardStore.resetTaskInfoStore();
|
||
} else if(m.type == "BTN_SUBMITEDIT" ){ //提交编辑
|
||
taskBatchEditDialogStore.setVisible(true);
|
||
} else if(m.type == "BTN_BREAKDOWN" ){ //任务分解
|
||
prjCardStore.triggerBreakDownWF();
|
||
}
|
||
} else if (tabDatas1[i].shortname == "childprj" && tabDatas1[i].key == selectTabKey) {//子项目
|
||
if (m.type == "BTN_NEWPRJSUB") { //新建子项目
|
||
addProjectStore.handleShareDialog(true, { viewtype: 'add', prjid: prjid });
|
||
}
|
||
} else if (tabDatas1[i].shortname == "prjshare" && tabDatas1[i].key == selectTabKey) {//共享设置
|
||
if (m.type == "BTN_APPEND") { //tianjia
|
||
prjCardStore.showAddShareModal(true);
|
||
} else if (m.type == 'BTN_DELETEBATCH') { //批量删除
|
||
let { selectedRowKeys } = shareTableStore;
|
||
prjCardStore.delBatchShare(`${toJS(selectedRowKeys)}`);
|
||
}
|
||
} else if (tabDatas1[i].shortname == "stageset" && tabDatas1[i].key == selectTabKey) { //阶段
|
||
if (m.type == 'BTN_ADD_SHARE') { //新增
|
||
this.refs.StageList.tableEdit.refs.edit.doAdd()
|
||
} else if (m.type == "BTN_DELETE") { //删除
|
||
this.refs.StageList.tableEdit.refs.edit.doDelete()
|
||
} else if (m.type == "BTN_COPY") { //复制
|
||
this.refs.StageList.tableEdit.refs.edit.doCopy()
|
||
} else if (m.type == "BTN_SUBMIT") { //保存
|
||
const checkProps = this.refs.StageList.tableEdit.refs.edit.doRequiredCheck();
|
||
prjCardStore.saveStageSet(checkProps);
|
||
}
|
||
}
|
||
if (m.type == "BTN_COLUMN") { //显示定制
|
||
prjCardStore.onShowColumn();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
taskCardChangeTab(key) {
|
||
const { prjCardStore } = this.props;
|
||
prjCardStore.changeTab(key);
|
||
}
|
||
reloadExchanges = () => {
|
||
const { prjCardStore } = this.props;
|
||
prjCardStore.getRelateExchangeInfo();
|
||
}
|
||
setWorkPlanVisible = (bool) => {
|
||
this.setState({ workPlanVisible: bool })
|
||
}
|
||
doClose = () => {
|
||
const {prjImportStore} = this.props;
|
||
this.setState({importVisible:!this.state.importVisible});
|
||
prjImportStore.clearStatus();
|
||
}
|
||
getDialogTopButtons() {
|
||
let btns = [];
|
||
const {doImport} = this.props.prjImportStore;
|
||
const { refTaskList } = this.props.prjCardStore;
|
||
btns.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@1y8kd7@submit}`} type="primary" onClick={() => {doImport(refTaskList)}}>{getLabel(615,"提交")}</Button>);
|
||
btns.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@rh4iau@close`} type="primary" onClick={() => { this.doClose() }}>{getLabel(309, "关闭")}</Button>);
|
||
|
||
|
||
return btns;
|
||
}
|
||
getDialogRightMenu(){
|
||
const {doImport} = this.props.prjImportStore;
|
||
const { refTaskList } = this.props.prjCardStore;
|
||
let btnArr = [];
|
||
btnArr.push({
|
||
key: '1',
|
||
icon: <i className={"icon-coms-Approval"} />,
|
||
content: getLabel(615,"提交"),
|
||
onClick:(key)=>{
|
||
doImport(refTaskList);
|
||
}
|
||
});
|
||
return btnArr;
|
||
}
|
||
}
|
||
|
||
export default ProjectCard; |