import React from 'react';
import { inject, observer } from 'mobx-react';
import {WeaDialog,WeaRightMenu,WeaNewScroll,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 CptInfo from './cptInfo'
@observer
export default class CptEdit extends React.Component{
componentWillReceiveProps(nextProps){
}
shouldComponentUpdate(){
return true;
}
render(){
const {contentStore,isdata} = this.props;
const {showEditDialog,cptForm,cptInfo} = this.props.contentStore;
return (
{contentStore.showCptInfo(false)}}
style={{width:1000,height:700}}>
{showEditDialog && }
)
}
getBottomButtons(){
const {contentStore} = this.props;
const {cptInfo,saveCptInfo,capitalid,showCptInfo} = this.props.contentStore;
let btnArr = [];
let rightMenu = toJS(cptInfo.rightMenus) || [];
rightMenu && rightMenu.length>0 && rightMenu.map(m=>{
m.isTop == '1' && btnArr.length < 4 && btnArr.push(
);
});
btnArr.push()
return btnArr;
}
getRightMenu(){
const {contentStore} = this.props;
const {cptInfo,} = this.props.contentStore;
let btnArr = [];
let rightMenu = toJS(cptInfo.rightMenus) || [];
rightMenu && rightMenu.length>0 && rightMenu.map(m=>{
btnArr.push({
icon: ,
content: m.menuName
})
});
return btnArr
}
onRightMenuClick(key){
const {contentStore} = this.props;
const {cptInfo,saveCptInfo,capitalid,showCptInfo,onCptDel,doMend,onGiveback} = this.props.contentStore;
let rightMenu = toJS(cptInfo.rightMenus) || [];
let that = this;
rightMenu && rightMenu.length>0 && rightMenu.map((m,i)=>{
if(Number(key) == i){
if(m.type == "BTN_SUBMIT"){ //验收
saveCptInfo();
}else if(m.type == 'BTN_BACK'){ //返回
showCptInfo(true,{capitalid:capitalid,viewtype:'edit'});
}else if(m.type == "BTN_EDIT"){
showCptInfo(true,{capitalid:capitalid,viewtype:'edit'});
}else if(m.type == "BTN_DELETE"){
Modal.confirm({
title: '您确认要删除吗?',
content: '',
onOk() {
onCptDel({capitalid:capitalid,viewtype:'cptdel'});
showCptInfo(false);
},
onCancel() {},
});
}else if(m.type == "BTN_GIVEBACK"){ //归还
let params = {viewtype:'cptbackone',capitalid:capitalid}
Modal.confirm({
title: '您确认要归还吗?',
content: '',
onOk() {
onGiveback(params);
},
onCancel() {},
});
}else if(m.type == "BTN_MEND"){ //送修
doMend(true,{capitalid:capitalid})
}
}
});
}
}