import { Button,Spin} from 'antd';
import {WeaDialog,WeaTab,WeaNewScroll,WeaRightMenu,WeaLocaleProvider } from 'ecCom';
import {inject, observer} from "mobx-react";
import {toJS} from 'mobx';
import PrjTaskListTable from '../comp/prjTaskListTable'
import ProjectCondition from '../list/projectCondition'
import StageList from '../common/stageList';
const getLabel = WeaLocaleProvider.getLabel;
@observer
class AddProjectDialog extends React.Component {
constructor(props) {
super(props);
this.state={
width:1020,
height:650,
}
}
componentDidMount(){
}
componentWillReceiveProps(nextProps){
}
render() {
const {addProjectStore} = this.props.contentStore;
const {title,selectedKey,visible,conditionDatas:{userid,taskinfo,fieldinfo,taskViewAttr},saveListDatas,saveRowKeys,selectedRowKey,spinning} = addProjectStore;
const {form,setFormFields,setValidate,isTimeShow} = addProjectStore;
const tabs = [{key:"prjinfo",title:getLabel(16290,"项目信息")},{key:"sublist",title:getLabel(18505,"任务列表")}, { key: "stagelist", title: getLabel('387407',"阶段设置") },{ key: "rolelist", title: "角色管理" }];
const { width} = this.state;
const formParams = form.getFormParams() || {};
const {roleIframeUrl} = addProjectStore;
let dialogHeight = window.innerHeight - 150;
if (dialogHeight > 600) dialogHeight = 600;
return (
addProjectStore.handleShareDialog(false)}
buttons={this.getDialogButtons()}
>
{setFormFields(v)}} setValidate={(v)=>{setValidate(v)}} />
{saveListDatas(datas)}}
onRowSelect={(rowkeys)=>{saveRowKeys(rowkeys)}}
stageOptions={this.getStageOptions()}
isTimeShow={isTimeShow}
/>
{ this.StageList = el }} contentStore={addProjectStore} />
)
}
getButtons(){
const {addProjectStore} = this.props.contentStore;
const {selectedKey,addNewListDatas,deleListDatas,selectedRowKey,conditionDatas:{userid,taskinfo,fieldinfo,taskViewAttr},stageInfo} = addProjectStore;
const isDisabled = !(selectedRowKey.length>0 && `${toJS(selectedRowKey)}`);
const stageDisabled = !(stageInfo.selectedRowKeys.length > 0)
let btn = [];
if(taskViewAttr==2){
if(selectedKey == "sublist"){
btn = [
(),
];
} else if (selectedKey == "stagelist") {
btn = [
(),
];
}
}
return btn
}
getDialogButtons(){
const {isreflesh} = this.props;
const {addProjectStore} = this.props.contentStore;
const {saveAddProject,conditionDatas:{taskViewAttr}} = addProjectStore;
let btn = [];
if(taskViewAttr==2){
btn.push();
btn.push();
}else{
btn.push();
}
return btn
}
getRightMenu(){
const {isreflesh} = this.props;
const {addProjectStore} = this.props.contentStore;
const {conditionDatas:{rightMenu}} = addProjectStore;
const {selectedKey,saveAddProject,addNewListDatas,deleListDatas,selectedRowKey,conditionDatas:{userid,taskinfo,fieldinfo,taskViewAttr},stageInfo} = addProjectStore;
const isDisabled = !(selectedRowKey.length>0 && `${toJS(selectedRowKey)}`);
const stageDisabled = !(stageInfo.selectedRowKeys.length > 0)
let btn = [];
if(taskViewAttr==2){
if(selectedKey == "prjinfo"){
btn.push({
key: '1',
icon: ,
content: getLabel(86,"保存"),
onClick:(key)=>{
const checkProps = this.StageList.tableEdit.refs.edit.doRequiredCheck();
saveAddProject({ isreflesh: isreflesh, checkProps: checkProps });
}
});
}
if(selectedKey == "sublist"){
btn.push({
key: '1',
icon: ,
content: getLabel(611,"添加"),
onClick:(key)=>{
addNewListDatas();
}
});
btn.push({
key: '2',
icon: ,
content: getLabel(91,"删除"),
disabled:isDisabled,
onClick:(key)=>{
deleListDatas();
}
});
btn.push({
key: '3',
icon: ,
content: getLabel(86,"保存"),
onClick:(key)=>{
this.refs.PrjTaskListTable.showErrors();
const checkProps = this.StageList.tableEdit.refs.edit.doRequiredCheck();
saveAddProject({ isreflesh: isreflesh, checkProps: checkProps });
}
});
}
if (selectedKey == "stagelist") {
btn.push({
key: '1',
icon: ,
content: getLabel(611, "添加"),
onClick: (key) => {
this.StageList.tableEdit.refs.edit.doAdd()
}
});
btn.push({
key: '2',
icon: ,
content: getLabel(91, "删除"),
disabled: stageDisabled,
onClick: (key) => {
this.StageList.tableEdit.refs.edit.doDelete()
}
});
btn.push({
key: '3',
icon: ,
content: getLabel(86, "保存"),
onClick: (key) => {
const checkProps = this.StageList.tableEdit.refs.edit.doRequiredCheck();
saveAddProject({ isreflesh: isreflesh, checkProps: checkProps });
}
});
}
}
return btn
}
changeTab(key){
const {addProjectStore} = this.props.contentStore;
addProjectStore.changeTab(key)
}
getStageOptions = () => {
const { addProjectStore: { stageInfo: { stageColumns, stageColumnDatas, selectedRowKeys, selectedDatas } } } = this.props.contentStore;
let options = [];
options.push({ disabled: false, selected: false, showname: " ", key:"", visible: true })
stageColumnDatas && stageColumnDatas.length > 0 && stageColumnDatas.map(item => {
options.push({ disabled: false, key: item.id, selected: false, showname: item.name, visible: true })
})
return options;
}
}
export default AddProjectDialog;