weaver_trunk_cli/pc4mobx/prj/components/dialog/taskListDialog.js

117 lines
5.0 KiB
JavaScript

import React from 'react';
import { inject, observer } from 'mobx-react';
import {WeaDialog,WeaRightMenu,WeaNewScroll,WeaFormItem,WeaSearchGroup,WeaLocaleProvider} from "ecCom"
import {Button,Modal} from "antd"
import {WeaTableNew,WeaSwitch} from 'comsMobx';
const WeaTable = WeaTableNew.WeaTable;
const getLabel = WeaLocaleProvider.getLabel;
import {toJS} from "mobx"
import equal from 'deep-equal'
import TaskList from "../common/TaskList"
@observer
export default class TaskListDialog extends React.Component{
componentWillReceiveProps(nextProps){
}
shouldComponentUpdate(){
return true;
}
render(){
const {contentStore} = this.props;
const {listVisible,showTaskLiskModal} = contentStore;
return (
<WeaDialog
title={getLabel(18505,"任务列表")}
visible={listVisible}
buttons={this.getBottomButtons()}
icon="icon-coms-project"
iconBgcolor="#217346"
onCancel={()=>{showTaskLiskModal(false)}}
style={{width:1100,height:700}}>
<WeaRightMenu datas={this.getRightMenu()} onClick={this.onRightMenuClick.bind(this)} >
<WeaNewScroll height={"100%"}>
<TaskList contentStore={contentStore} />
</WeaNewScroll>
</WeaRightMenu>
</WeaDialog>
)
}
getBottomButtons(){
const {contentStore }= this.props;
const {rightMenu,taskInfoStore,prjid,prjCardStore} = contentStore;
let btnArr = [];
rightMenu && rightMenu.length>0 && rightMenu.map(m=>{
m.isTop == '1' && btnArr.length < 4 && btnArr.push(
<Button type="primary"
onClick={()=>{
if(m.type == "BTN_ADDTASK"){ //添加任务
taskInfoStore.handleDialog(true,"add",'',{prjid:prjid,parentid:""});
}else if(m.type == 'BTN_EDIT'){ //编辑
}else if(m.type == 'BTN_DOSUBMIT'){ //提交执行
prjCardStore.doPlanOpt_task({method:'approveplan',prjid:prjid});
}else if(m.type == 'BTN_APPSUBMIT'){ //提交执行(审批)
prjCardStore.doPlanOpt_task({method:'submitplan',prjid:prjid});
}
}}>
{m.menuName}
</Button>
);
});
btnArr.push(<Button type="primary" onClick={()=>{showTaskLiskModal(false)}}>{getLabel(309,"关闭")}</Button>)
return btnArr;
}
getRightMenu(){
const {contentStore }= this.props;
const {rightMenu} = contentStore;
let btnArr = [];
rightMenu && rightMenu.length>0 && rightMenu.map(m=>{
btnArr.push({
icon: <i className={m.menuIcon} />,
content: m.menuName
})
});
return btnArr
}
onRightMenuClick(key){
let that = this;
const {contentStore }= this.props;
const {rightMenu,prjid,taskInfoStore,relateListStore,prjCardStore} = contentStore;
rightMenu && rightMenu.length>0 && rightMenu.map((m,i)=>{
if(Number(key) == i){
if(m.type == "BTN_ADDTASK"){ //添加任务
taskInfoStore.handleDialog(true,"add",'',{prjid:prjid,parentid:""});
}else if(m.type == 'BTN_EDIT'){ //编辑
}else if(m.type == 'BTN_DOSUBMIT'){ //提交执行
prjCardStore.doPlanOpt_task({method:'approveplan',prjid:prjid});
}else if(m.type == 'BTN_APPSUBMIT'){ //提交执行(审批)
prjCardStore.doPlanOpt_task({method:'submitplan',prjid:prjid});
}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)
}else if(m.type == 'BTN_LOG'){ //日志
relateListStore.handleRelateDialog(true,"log",prjid)
}
if(m.type == "BTN_COLUMN"){ //显示定制
prjCardStore.onShowColumn();
}
}
});
}
}