weaver_trunk_cli/pc4mobx/prj/components/single/task/TaskCardNew.js

746 lines
45 KiB
JavaScript

import { inject, observer } from "mobx-react";
import { toJS } from "mobx"
import React from 'react';
import { WeaLeftRightLayout, WeaTop, WeaTab, WeaNewScroll, WeaLocaleProvider, WeaBrowser, WeaAlertPage } from 'ecCom';
import { WeaTableNew } from 'comsMobx';
const WeaTable = WeaTableNew.WeaTable;
const getLabel = WeaLocaleProvider.getLabel;
import '../style/taskCardNew.less';
import ListView from "../../comp/task-view-list";
import { Row, Tooltip, Col, Icon, Modal, message } from "antd";
import { TaskDynamic } from "./TaskDynamic";
import TabDiscuss from '../../common/TabDiscuss'
import RelateWorkFlow from '../../common/relateWorkFlow'
import RelateDocument from "../../common/relateDocument"
import TaskSub from '../../common/taskSub';
import { TabComponent as TabSelf } from '../../common/tabComponent';
import TaskShare from '../../common/sharePage'
//import TaskNewInfo from './TaskNewInfo'
import RealteCrmDialog from '../../dialog/relateCrmDialog'
import ProjectLogDialog from "../../dialog/modifyLogDialog"
import ProjectFieldLogDialog from '../../dialog/projectFieldLogDialog';
import ProjectFieldDetailLogDialog from '../../dialog/ProjectFieldDetailLogDialog';
import TaskInfoDialog from '../../dialog/taskDialog'
import PrjForm from "../../prjForm.js";
import classnames from 'classnames';
// const rightMenus = [
// [
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-edit", menuName: "编辑", type: "BTN_EDIT" },
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-delete", menuName: "删除", type: "BTN_DELETE" }
// ],
// [
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "添加", type: "BTN_APPEND" },
// { isControl: "1", isTop: "1", menuFun: "", menuIcon: "icon-coms-delete", menuName: "批量删除", type: "BTN_DELETEBATCH" }
// ],
// [
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "添加子任务", type: "BTN_NEWSUB" },
// { isTop: "0", menuFun: "", menuIcon: "icon-coms-Custom", menuName: "显示列定制", type: "BTN_COLUMN" },
// { isTop: "1", type: "searchsAd" }
// ],
// [
// ],
// [
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "新建流程", type: "BTN_NEWREQ" }
// ],
// [
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "新建文档", type: "BTN_NEWDOC" }
// ],
// [
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "添加", type: "BTN_APPEND" },
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-delete", menuName: "批量删除", type: "BTN_DELETEBATCH" }
// ],
// [
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-New-Flow", menuName: "添加", type: "BTN_APPEND" },
// { isTop: "1", menuFun: "", menuIcon: "icon-coms-delete", menuName: "批量删除", type: "BTN_DELETEBATCH" }
// ]
// ]
@inject("taskCardNewStore","taskDynamicStore")
@observer
class TaskCardNew extends React.Component {
static defaultProps = {
prefixCls: 'new'
};
constructor(props) {
super(props);
this.state = {
selectedKey : "",
showdt : false
}
}
componentDidMount(){
const { prjid, taskCardNewStore, hasList, taskid } = this.props;
if(hasList){
taskCardNewStore.initData(prjid);
}else{
taskCardNewStore.initTaskData(taskid);
}
}
componentWillReceiveProps(nextProps) {
if (this.props.prjid !== nextProps.prjid) {
const { prjid, taskCardNewStore, hasList, taskid } = nextProps;
if(hasList){
taskCardNewStore.initData(prjid);
}else{
taskCardNewStore.initTaskData(taskid);
}
}
}
render() {
const { taskCardNewStore, taskid, hasList, prefixCls, taskInfoStore, prjid, isDialog, taskDynamicStore, delCallBack, fromPortal } = this.props;
const { taskinfo, loading, changeTabs } = taskCardNewStore;
const { tabDatas, selectTabKey, shareStore, taskLogTableStore, taskFieldLogTableStore, taskFieldDetailLogTableStore, fieldname, fieldinfo, getTaskList, breadcrumb, rightMenu, getTaskForm, initData, initTaskData } = taskCardNewStore;
const { getPortalProjectDynamicInfo } = taskDynamicStore;
const tabDatas1 = toJS(tabDatas);
let _this = this;
const titleStyle = {
fontSize : "15px"
}
const height = document.body.offsetHeight - $(".prj-portal-page .wea-new-top-wapper").height() - 57 - 52.4 - $(".task_card_new .task_card_new_l_top").height() - 20 - 30;
const scrollHeight = ($(".e9theme-layout-header").length > 0 || $(".e8theme-layout-header").length > 0) ? height - 55 - 22 : height - 15;
const { showdt } = this.state;
const textdt = showdt ? getLabel('518183','显示动态') : getLabel('518184','隐藏动态');
const classdtArrow = classnames({
'new-show-dt-arrow': showdt,
'new-show-dt-arrow-r': !showdt
});
const classdtLine = classnames('new-dt-container',{
'new-show-dt-line': showdt,
'new-show-dt-line-r': !showdt
});
const classCardL = classnames('task_card_new_l',{
'task_card_new_l_contents': showdt
})
const bWidth = !showdt?"62%":"100%";
const showDynamic = !showdt?"":"none";
const tabRenderNode = {
[selectTabKey]: {
'taskinfo': <div style={{ height: '100%' }}>
<PrjForm ecId={`${this && this.props && this.props.ecId || ''}_PrjForm@bp6er7`} hasTopTitle={true} height={scrollHeight} showdt={showdt} fieldinfo={fieldinfo} titleStyle={titleStyle} />
< ProjectLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectLogDialog@t80d3f`} ref="taskLogDialog" title={getLabel('83926', '任务日志')} tableStore={taskLogTableStore} store={taskCardNewStore} />
<ProjectFieldLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectFieldLogDialog@zr29u4`} title={getLabel('82274', '字段日志')} tableStore={taskFieldLogTableStore} store={taskCardNewStore} />
<ProjectFieldDetailLogDialog ecId={`${this && this.props && this.props.ecId || ''}_ProjectFieldDetailLogDialog@6nltmz`} title={getLabel('82274', '字段日志') + "-" + fieldname} tableStore={taskFieldDetailLogTableStore} store={taskCardNewStore} />
<TaskInfoDialog ecId={`${this && this.props && this.props.ecId || ''}_TaskInfoDialog@hwfoga`} contentStore={taskCardNewStore.taskInfoStore} prjid={prjid} callBack={() =>{
if(hasList){
initData(prjid);
}else{
initTaskData(taskid);
}
getTaskForm({ viewtype: 'view', taskid: taskCardNewStore.taskid });
getPortalProjectDynamicInfo("alltask");
getPortalProjectDynamicInfo("tasklog");
}} />
</div>,
'tasksub': <div style={{ height: '100%' }}><TaskSub ecId={`${this && this.props && this.props.ecId || ''}_TaskSub@mlp2jf`} showTab={false} contentStore={taskCardNewStore} callBack={() =>{
if(hasList){
initData(prjid);
}else{
initTaskData(taskid);
}
}} /></div>,
'exchange': <div style={{ height: '100%' }}><TabDiscuss ecId={`${this && this.props && this.props.ecId || ''}_TabDiscuss@xb40d4`} contentStore={taskCardNewStore} sortid={taskCardNewStore.taskid} /></div>,
'taskshare': <div style={{ height: '100%' }}><TaskShare ecId={`${this && this.props && this.props.ecId || ''}_TaskShare@k4bcpa`} contentStore={taskCardNewStore} shareCondition={shareStore.shareCondition} title={getLabel(83973, "添加任务共享")} /></div>,
'req': <div style={{ height: '100%' }}><RelateWorkFlow ecId={`${this && this.props && this.props.ecId || ''}_RelateWorkFlow@odhonb`} contentStore={taskCardNewStore} /></div>,
'doc': <div style={{ height: '100%' }}><RelateDocument ecId={`${this && this.props && this.props.ecId || ''}_RelateDocument@c9lemy`} contentStore={taskCardNewStore} addDocFn={_this.addDocFn} /></div>,
'crm': <div style={{ height: '100%' }}>{_this.getReleateCrmOrCpt("crm")}<RealteCrmDialog ecId={`${this && this.props && this.props.ecId || ''}_RealteCrmDialog@b1jiru`} contentStore={taskCardNewStore} /></div>,
'cpt': <div style={{ height: '100%' }}> {_this.getReleateCrmOrCpt("cpt")}
<WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@o5rlg6`} type={"23"} title={getLabel(535, "资产")} ref={"addCpt"} fieldName={"addCpt"} onChange={(ids, names, datas) => _this.addCapital(ids, names, datas)} customized={true} hasAdvanceSerach={true} />
</div>
}
}
const tabRenderHandle = (id, shortname, linkurl) => {
if (shortname !== '') {
return tabRenderNode[id][shortname]
} else if (shortname === "") {
if (linkurl.indexOf("noright") > -1) {
return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@pkbax2`} >
<div style={{ color: '#000' }}>
{getLabel(2012, "对不起,您暂时没有权限!")}
</div>
</WeaAlertPage>
} else {
return linkurl;
}
}
}
let tabUrl = function () {
if (tabDatas1) {
const prefixCls = 'new-tab-bar-menu'
for (let i = 0; i < tabDatas1.length; i++) {
if (tabDatas1[i].id == selectTabKey) {
if (tabDatas1[i].shortname !== ''){
return (
<React.Fragment ecId={`${this && this.props && this.props.ecId || ''}_Fragment@201m41`}>
{
rightMenu&&rightMenu.length>1&&
<div className={`${prefixCls}-wraps`}>
<ul className={`${prefixCls}-ul`}>
{rightMenu.map((menu,i) => (
menu.isTop == 1 &&
(menu.type === 'searchsAd' ?
<div style={{ width: '300px', marginTop: '-3px' }}><TabSelf ecId={`${this && this.props && this.props.ecId || ''}_TabSelf@q2ohz0@${i}`} contentStore={taskCardNewStore} /></div>
: <li key={menu.type}><span className={`${prefixCls}-name`} onClick={() => { _this.menuClick(menu) }}>{menu.menuName}</span></li>)
))
}
</ul>
</div>
}
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@nkiv41`} scrollId='prj-req-content-main-scroll' style={{position: 'absolute',top: (rightMenu&&rightMenu.length>1)?'45px':'0px',bottom: '0px',width: '100%'}}>
{
tabRenderHandle(tabDatas1[i].id, tabDatas1[i].shortname, tabDatas[i].linkurl)
}
</WeaNewScroll>
</React.Fragment>
)
}else if (tabDatas1[i].shortname === ""){
return tabRenderHandle(tabDatas1[i].id, tabDatas1[i].shortname, tabDatas[i].linkurl);
}
}
}
return ""
}
}();
if (hasList) {
if(taskCardNewStore.taskList.length==0){
return <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@kk8y2i`} icon="icon-coms-blank" >
<div style={{color : '#000'}}>
{getLabel(83553, '暂无数据')}
</div>
<TaskInfoDialog ecId={`${this && this.props && this.props.ecId || ''}_TaskInfoDialog@4dt8lx`} contentStore={taskInfoStore} prjid={prjid} callBack={() => {
if(hasList){
initData(prjid);
if(delCallBack){
delCallBack();
}
}else{
initTaskData(taskid);
}
}} />
</WeaAlertPage>
}
return (
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@r8yfan`}
isNew={true}
leftWidth={230}
leftCom={<ListView ecId={`${this && this.props && this.props.ecId || ''}_ListView@fm2uqh`}
datas={taskCardNewStore.taskList}
onItemClick={taskCardNewStore.changeSelectedKey}
pagination={{
current:taskCardNewStore.pagination.current,
pageSize:taskCardNewStore.pagination.pageSize,
total:taskCardNewStore.pagination.total,
onChange:taskCardNewStore.onChangePaginNation
}}
currentKey={taskCardNewStore.currentKey}
scrollHeight={fromPortal?taskCardNewStore.commonStore.contentHeight - 171 - 51:taskCardNewStore.commonStore.contentHeight - 171}
/>}
onCollapse={showLeft => {}}
>
{/* <Row style={{borderBottom:"1px solid #eaeaea"}}>
<Col span={"4"}>任务1</Col>
<Col span={"18"}></Col>
<Col span={"2"}>展开收起按钮</Col>
</Row> */}
<div style={{ backgroundColor: '#f5f5f5', height: '100%' }}>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@uc44t3`}
buttons={[<div className={classdtLine} onClick={() => { this.setState(pre => ({ showdt: !pre.showdt })) }}><span className={classdtArrow}></span>{textdt}</div>]}
loading={loading}
breadcrumb={breadcrumb || [{ name: "#9" }, { name: "#12" }, { name: "#13" }]}
/>
<div style={{ height: "calc(100% - 52.4px)", position: 'relative' }} className={"task_card_new"}>
<div className={classCardL}>
<div className='task_card_new_l_top prj-mode-action-style'>
<div className={`${prefixCls}-task-wide-title`}>
<div className={`${prefixCls}-task-wide-title-container`}>{taskinfo.subject}</div>
</div>
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@33q3ma`} className={`${prefixCls}-task-wide`} style={{display:'flex'}}>
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@il6ubl`} span={5} style={{minWidth:110}}>
<div className={"top_tips"}>
<div className={"left_icon"}>
{
taskinfo.hrmid&& taskinfo.hrmid.length>0?
<a href={'javaScript:openhrm(' + taskinfo.hrmid[0] + ');'} onClick={e => window.pointerXY(e)} >
<img src={taskinfo.hrmidicon[0]} className="manager-img" />
</a>
:
<a href={'javaScript:openhrm(' + taskinfo.hrmid + ');'} onClick={e => window.pointerXY(e)} >
<img src={taskinfo.hrmidicon} className="manager-img" />
</a>
}
</div>
<div className={"right_info"}>
<Tooltip ecId={`${this && this.props && this.props.ecId || ''}_Tooltip@l7q4xe`} placement="topLeft" title={taskinfo.hrmidname&&taskinfo.hrmidname.length>0?taskinfo.hrmidname.join(' '):taskinfo.hrmidname}>
<div className="right_info_l right_info_overflow">
{taskinfo.hrmidname&&taskinfo.hrmidname.length>0?taskinfo.hrmidname.join(' '):taskinfo.hrmidname}
</div>
</Tooltip>
<div className={"right_info_r"}>
{getLabel('15285', '任务负责人')}
</div>
</div>
</div>
</Col>
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@dthkg8`} span={5} style={{minWidth:110}}>
<div className={"top_tips"}>
<div className={"left_icon"}>
{
taskinfo.finish == 100 ? <i className="icon-coms-Upload-successfully-o manager-img stauts_finish" /> :
taskinfo.islater ? <Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@zp5r47`} type="exclamation-circle" className="manager-img flag"/> :
// <Icon type="api" className="manager-img stauts_finish "/>
taskinfo.wks ? <i className="icon-coms-Narrow manager-img stauts_wks" /> :
<i className="icon-coms-Update-synchronization manager-img stauts_finish" />
}
</div>
<div className={"right_info"}>
<div className={"right_info_l"}>
{
taskinfo.finish == 100 ? getLabel('23774','已完成') : taskinfo.islater ? getLabel('21984', "已超期") : taskinfo.wks ? getLabel(1979,"未开始") : getLabel('1960','进行中')
}
</div>
<div className={"right_info_r"}>
{getLabel('1929','当前状态')}
</div>
</div>
</div>
</Col>
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@lsqbgv`} span={5} style={{minWidth:110}}>
<div className={"top_tips"}>
<div className={"left_icon"}>
<i className={taskinfo.islandmark == 0 ? "icon-coms-Flag manager-img flag1" : "icon-coms-Flag manager-img stauts_wks"} />
</div>
<div className={"right_info"}>
<div className={"right_info_l"}>
{taskinfo.islandmark == 0 ? getLabel('30587', '否') : getLabel('163', '是')}
</div>
<div className={"right_info_r"}>
{getLabel('2232', '里程碑任务')}
</div>
</div>
</div>
</Col>
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@6adw7h`} span={9} className='timecol'>
<div className={"top_tips timecol1"}>
<div className={"left_icon"}>
<i className="icon-coms-schedule manager-img" />
</div>
<div className={"right_info"} style={{width:0, flex:1}}>
<div className={"right_info_l"} title={(taskinfo.begindate ||getLabel('514133','未设置'))+'~'+(taskinfo.enddate ||getLabel('514133','未设置'))}>
{taskinfo.begindate ||getLabel('514133','未设置')}~{taskinfo.enddate ||getLabel('514133','未设置')}
</div>
<div className={"right_info_r"}>
{getLabel('518186','开始结束时间')}
</div>
</div>
</div>
</Col>
</Row>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@5leh4k`}
datas={tabDatas}
keyParam="viewcondition" //主键
selectedKey={selectTabKey}
onChange={v => changeTabs(v) }
/>
</div>
<div className="prj-req-content1" style={{ padding: "0px", position: 'absolute', left: '0px', right: '0px', top: '154px', bottom: '0px', width: bWidth }}>
<div className='prj-req-content-inner' style={{ border: "0px" }}>
{
typeof tabUrl === "object" ? tabUrl :
<iframe src={tabUrl} id="prjtabiframe" name="prjtabiframe" className="flowFrame" frameborder="0" width="100%" height="100%" />
}
</div>
</div>
</div>
<div style={{width:"38%",height:"calc(100%-51px)",borderLeft:"1px solid #eaeaea",float:"left",display:showDynamic}}>
<TaskDynamic ecId={`${this && this.props && this.props.ecId || ''}_TaskDynamic@p13cp0`} fromPortal={fromPortal} taskid={taskCardNewStore.taskid} style={{height:"100%"}}></TaskDynamic>
</div>
</div>
<TaskInfoDialog ecId={`${this && this.props && this.props.ecId || ''}_TaskInfoDialog@jp17m3`} contentStore={taskInfoStore} prjid={prjid} callBack={() => { getTaskList(); }} />
</div>
</WeaLeftRightLayout>)
}else{
return(
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@dq6rul`} className={"task_card_new"} style={{padding:'5px'}}>
{/* <Row style={{borderBottom:"1px solid #eaeaea"}}>
<Col span={"4"}>任务1</Col>
<Col span={"18"}></Col>
<Col span={"2"}>展开收起按钮</Col>
</Row> */}
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@349pgj`}
title={taskinfo.subject}
icon={<i className='icon-coms-project' />}
iconBgcolor='#217346'
buttons={[]}
loading={loading}
/>
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@nxkb6v`} style={{height:isDialog?"calc( 100% - 61px )":" 100% "}}>
<div style={{width:"70%",height:"100%",float:"left"}}>
<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@d6w74t`}>
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@yt75j3`} span={5}>
<div className={"top_tips"}>
<div className={"left_icon"}>
{
taskinfo.hrmid&& taskinfo.hrmid.length>0?
<a href={'javaScript:openhrm(' + taskinfo.hrmid[0] + ');'} onClick={e => window.pointerXY(e)} >
<img src={taskinfo.hrmidicon[0]} className="manager-img" />
</a>
:
<a href={'javaScript:openhrm(' + taskinfo.hrmid + ');'} onClick={e => window.pointerXY(e)} >
<img src={taskinfo.hrmidicon} className="manager-img" />
</a>
}
</div>
<div className={"right_info"}>
<Tooltip ecId={`${this && this.props && this.props.ecId || ''}_Tooltip@i2rgo4`} placement="topLeft" title={taskinfo.hrmidname&&taskinfo.hrmidname.length>0?taskinfo.hrmidname.join(' '):taskinfo.hrmidname}>
<div className="right_info_l right_info_overflow">
{taskinfo.hrmidname&&taskinfo.hrmidname.length>0?taskinfo.hrmidname.join(' '):taskinfo.hrmidname}
</div>
</Tooltip>
<div className={"right_info_r"}>
{getLabel('15285','任务负责人')}
</div>
</div>
</div>
</Col>
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@k6yxff`} span={5}>
<div className={"top_tips"}>
<div className={"left_icon"}>
{
taskinfo.finish == 100 ? <i className="icon-coms-Upload-successfully-o manager-img stauts_finish" /> :
taskinfo.islater ? <Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@n4ub2h`} type="exclamation-circle" className="manager-img flag"/> :
// <Icon type="api" className="manager-img stauts_finish "/>
taskinfo.wks ? <i className="icon-coms-Narrow manager-img stauts_wks" /> :
<i className="icon-coms-Update-synchronization manager-img stauts_finish" />
}
</div>
<div className={"right_info"}>
<div className={"right_info_l"}>
{
taskinfo.finish == 100 ? getLabel('23774','已完成') : taskinfo.islater ? getLabel('21984', "已超期") : taskinfo.wks ? getLabel(1979,"未开始") : getLabel('1960','进行中')
}
</div>
<div className={"right_info_r"}>
{getLabel('1929','当前状态')}
</div>
</div>
</div>
</Col>
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@5jjx3m`} span={5}>
{
<div className={"top_tips"}>
<div className={"left_icon"}>
<i className={taskinfo.islandmark == 0 ? "icon-coms-Flag manager-img flag1" : "icon-coms-Flag manager-img stauts_wks"} />
</div>
<div className={"right_info"}>
<div className={"right_info_l"}>
{taskinfo.islandmark == 0 ? getLabel('30587', '否') : getLabel('163', '是')}
</div>
<div className={"right_info_r"}>
{getLabel('2232','里程碑任务')}
</div>
</div>
</div>
}
</Col>
<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@yn5mao`} span={9}>
<div className={"top_tips"}>
<div className={"left_icon"}>
<i className="icon-coms-schedule manager-img" />
</div>
<div className={"right_info"}>
<div className={"right_info_l"}>
{taskinfo.begindate}~{taskinfo.enddate}
</div>
<div className={"right_info_r"}>
{getLabel('518186','开始结束时间')}
</div>
</div>
</div>
</Col>
</Row>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@nxvh8x`}
datas={tabDatas}
keyParam="viewcondition" //主键
selectedKey={selectTabKey}
onChange={v => changeTabs(v) }
/>
<div className="prj-req-content" style={{padding:"0px", height: 'calc( 100% - 100px)', position: "relative"}}>
<div className='prj-req-content-inner' style={{border:"0px"}}>
{
typeof tabUrl === "object" ? tabUrl :
<iframe src={tabUrl} id="prjtabiframe" name="prjtabiframe" className="flowFrame" frameborder="0" width="100%" height="100%" />
}
</div>
</div>
</div>
<div style={{width:"30%",height:"100%",borderLeft:"1px solid #eaeaea",float:"left",display:showDynamic}}>
<TaskDynamic ecId={`${this && this.props && this.props.ecId || ''}_TaskDynamic@wwp45h`} fromPortal={fromPortal} taskid={taskCardNewStore.taskid} style={{height:"100%"}} isDialog={isDialog}></TaskDynamic>
</div>
</Row>
</Row>)
}
}
getReleateCrmOrCpt(type) {
const { taskRelRight: { hasRight, verified }, taskCrmStore, taskCptStore } = this.props.taskCardNewStore;
if (verified && !hasRight) {
return (<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@0pe7bo`} >
<div style={{ color: '#000' }}>
{getLabel(2012, "对不起,您暂时没有权限!")}
</div>
</WeaAlertPage>
)
}
if (verified && hasRight) {
if (type == "crm") {
return <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@azmu9f`}
comsWeaTableStore={taskCrmStore}
hasOrder={true}
needScroll={true}
onOperatesClick={this.onCrmOperatesClick.bind(this)}
/>
}
if (type == "cpt") {
return <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@wjk05u`}
comsWeaTableStore={taskCptStore}
hasOrder={true}
needScroll={true}
onOperatesClick={this.onCptOperatesClick.bind(this)}
/>
}
}
return <div></div>
}
//资产操作按钮
onCrmOperatesClick = (record, index, operate, flag) => {
let _href = operate && operate.href ? operate.href : "";
let fn = _href.replace("javascript:", "");
fn = fn.substring(0, fn.indexOf('('));
const { taskCardNewStore } = this.props;
const { doDspTaskReferenceOpt, taskid, taskDocStore } = taskCardNewStore;
if (fn != "") {
if ("onDelRelated" == fn) { //delete
Modal.confirm({
title: getLabel(15172, "系统提示"),
content: getLabel(83600, "您确认要删除吗?"),
onOk() {
doDspTaskReferenceOpt({
dotype: 'crm',
method: 'del',
prjid: "",
taskid: taskid,
ids: record.randomFieldId
}, 'crm')
},
onCancel() { },
})
} else if ("onEdit" == fn) { //编辑
taskCardNewStore.setRelateCrmUpdateID(record.randomFieldId);
taskCardNewStore.handleRelateCrmDialog(true, "edit", {
crmid: {
value: record.customerid,
valueSpan: record.customeridspan,
valueObj: [{ id: record.customerid, name: record.customeridspan, }],
},
reasondesc: { value: record.reasondesc }
});
}
}
}
//资产操作按钮
onCptOperatesClick = (record, index, operate, flag) => {
let _href = operate && operate.href ? operate.href : "";
let fn = _href.replace("javascript:", "");
fn = fn.substring(0, fn.indexOf('('));
const { taskCardNewStore } = this.props;
const { doDspTaskReferenceOpt, taskid, taskDocStore } = taskCardNewStore;
if (fn != "") {
if ("onDelRelated" == fn) { //delete
Modal.confirm({
title: getLabel(15172, "系统提示"),
content: getLabel(83600, "您确认要删除吗?"),
onOk() {
doDspTaskReferenceOpt({
dotype: 'cpt',
method: 'del',
prjid: "",
taskid: taskid,
ids: record.randomFieldId
}, 'cpt')
},
onCancel() { },
})
}
}
}
menuClick = (m) =>{
const { taskCardNewStore, prjid, delCallBack } = this.props;
const { selectTabKey, shareTableStore, tabDatas, taskInfoStore, taskid } = taskCardNewStore;
const tabDatas1 = toJS(tabDatas);
if (tabDatas1) {
for (let i = 0; i < tabDatas1.length; i++) {
console.log(tabDatas1[i],tabDatas1[i].shortname,tabDatas1[i].key,selectTabKey)
if (tabDatas1[i].shortname == "taskinfo" && tabDatas1[i].id == selectTabKey) {
if (m.type == "BTN_EDIT") { //编辑
taskInfoStore.handleDialog(true,"edit",taskid);
} else if (m.type == "BTN_SAVE") { //保存
taskCardNewStore.saveTaskInfo({ taskid: taskid });
} else if (m.type == "BTN_DELETE") { //删除
taskCardNewStore.delTask("del", taskid, {callBack: ()=> {if(delCallBack){delCallBack()}}});
} else if (m.type == "BTN_BACK") { //返回
taskCardNewStore.getTaskForm({ viewtype: 'view', taskid: taskid });
}
} else if (tabDatas1[i].shortname == "cpt" && tabDatas1[i].id == selectTabKey) {
if (m.type == "BTN_APPEND") { //添加
this.refs.addCpt.openModal();
} else if (m.type == "BTN_DELETEBATCH") { //删除
this.deleteCrmOrCpt('cpt');
}
} else if (tabDatas1[i].shortname == "crm" && tabDatas1[i].id == selectTabKey) {
if (m.type == "BTN_APPEND") { //添加
taskCardNewStore.handleRelateCrmDialog(true, "add", {
crmid: { value: '', valueSpan: '', valueObj: [] },
reasondesc: { value: "" }
});
} else if (m.type == "BTN_DELETEBATCH") { //删除
this.deleteCrmOrCpt('crm');
}
} else if (tabDatas1[i].shortname == "req" && tabDatas1[i].id == selectTabKey) {
if (m.type == "BTN_NEWREQ") {
//console.log("新建流程")
this.openFullWindow((window.ecologyContentPath || '')+"/spa/workflow/static/index.html#/main/workflow/add?openNewWindow=0&taskid=" + taskid);
}
} else if (tabDatas1[i].shortname == "doc" && tabDatas1[i].id == selectTabKey) {
if (m.type == "BTN_NEWDOC") {
//console.log("新建文档")
this.openFullWindow((window.ecologyContentPath || '')+'/spa/document/static/index.html#/main/document/add?openNewWindow=0&moudleFrom=task');
let _this = this;
window.__createDocFn = function (obj) {
let docid = obj.docid;
let docsubject = obj.docSubject;
// console.log(docid,docsubject);
_this.addDocument(docid,docsubject,'');
}
}
} else if (tabDatas1[i].shortname == "taskshare" && tabDatas1[i].id == selectTabKey) {
if (m.type == "BTN_APPEND") { //添加
taskCardNewStore.showAddShareModal(true);
} else if (m.type == "BTN_DELETEBATCH") { //删除
let { selectedRowKeys } = shareTableStore;
if (selectedRowKeys.length > 0) {
taskCardNewStore.delBatchShare(`${toJS(selectedRowKeys)}`);
} else {
message.error(getLabel(84093, "请至少选择一条记录!"));
}
}
}
}
if(m.type == "BTN_NEWSUB"){ //添加子任务
taskInfoStore.handleDialog(true,"add",taskid,{prjid:prjid,parentid:taskid});
}
}
}
openFullWindow = (url) => {
const width = screen.availWidth - 10;
const height = screen.availHeight - 50;
let szFeatures = 'top=0,';
szFeatures += 'left=0,';
szFeatures += `width=${width},`;
szFeatures += `height=${height},`;
szFeatures += 'directories=no,';
szFeatures += 'status=yes,toolbar=no,location=no,';
szFeatures += 'menubar=no,';
szFeatures += 'scrollbars=yes,';
szFeatures += 'resizable=yes';
window.open(url, '', szFeatures);
}
//新建
addDocument=(ids, names, datas)=>{
const {taskCardNewStore,prjid} = this.props;
const {doDspTaskReferenceOpt,taskid} = taskCardNewStore;
doDspTaskReferenceOpt({
dotype:'doc',
method:'add',
prjid : prjid,
taskid:taskid,
docid:ids,
ids:""
},'doc')
}
addWorkFlow=(ids, names, datas)=>{
const {taskCardNewStore,prjid} = this.props;
const {doDspTaskReferenceOpt,taskid} = taskCardNewStore;
doDspTaskReferenceOpt({
dotype:'doc',
method:'add',
prjid : prjid,
taskid:taskid,
docid:ids,
ids:""
},'doc')
}
//资产新建
addCapital = (ids, name, data) => {
const { taskCardNewStore, prjid } = this.props;
const { doDspTaskReferenceOpt, taskid } = taskCardNewStore;
doDspTaskReferenceOpt({
dotype: 'cpt',
method: 'add',
prjid: prjid,
taskid: taskid,
cptid: ids
}, 'cpt');
}
deleteCrmOrCpt = (type) => {
const { taskCardNewStore } = this.props;
const { taskid, doDspTaskReferenceOpt, taskCrmStore, taskCptStore } = taskCardNewStore;
const { selectedRowKeys } = (type == "cpt" ? taskCptStore : taskCrmStore);
if (selectedRowKeys.length > 0) {
Modal.confirm({
title: getLabel(15172, "系统提示"),
content: getLabel(83601, "您确认要删除选中的记录吗?"),
onOk() {
doDspTaskReferenceOpt({
dotype: type,
method: 'del',
prjid: "",
taskid: taskid,
ids: `${toJS(selectedRowKeys)}`
}, type)
},
onCancel() { },
})
} else {
// Modal.warning({
// title: getLabel(15172,"系统提示"),
// content: getLabel(84093,"请至少选择一条记录!"),
// })
message.error(getLabel(84093, "请至少选择一条记录!"));
}
}
}
export default TaskCardNew;