import {Button,Row,Col, Icon,message,Modal} from 'antd';
import {WeaTools,WeaBrowser,WeaAlertPage,WeaLocaleProvider} from 'ecCom';
import {inject, observer} from "mobx-react";
import {toJS} from 'mobx';
import PrjShowGroup from '../comp/prj-show-group'
import PrjTableEdit from '../comp/prj-table-edit'
import {WeaTableNew} from 'comsMobx';
const WeaTable = WeaTableNew.WeaTable;
const getLabel = WeaLocaleProvider.getLabel;
@observer
export default class RelateExchange extends React.Component {
constructor(props) {
super(props);
this.state ={
}
}
componentDidMount(){
}
componentWillReceiveProps(nextProps) {
}
render() {
const {contentStore} = this.props;
const {taskReqStore,relateList,relateList:{canRef},taskRelRight:{hasRight,verified},register_table} = contentStore;
const columns = [
{
title: getLabel(16579,"流程类型"), //列名
dataIndex: 'wfname', //列的id 对应数据
key: 'wfname', //前端渲染key值
com: [
{ label: '', type: 'LINK_WF' , key: 'wfname', viewAttr:1, width: 120, otherParams: {className: 'test-className'}},
],
colSpan: 1,
width: '50%',
className: 'wea-table-edit-name',
},
{
title: getLabel(17906,"必要"), //列名
dataIndex: 'isNecessary', //列的id 对应数据
key: 'isNecessary', //前端渲染key值
com: [
{ label: '', type: 'CHECKBOX' ,editType: '1', viewAttr:canRef?2:1,key: 'isNecessary', width: 80, }
],
colSpan: 1,
width: '40%',
className: 'wea-table-edit-ismust',
},
{
title: '', //列名
dataIndex: 'operate', //列的id 对应数据
key: 'sex', //前端渲染key值
com: [
{ label: '', type: 'OPERATE' ,editType: '1', key: 'operate', options: [{ key: '1', showname: getLabel(91,"删除")}] }
],
colSpan: 1,
width: '10%',
className: 'prj-dropdown-link',
},
];
if (verified && !hasRight) {
return (
{getLabel(2012,"对不起,您暂时没有权限!")}
)
}
if (verified && hasRight) {
return (
)
}
return
}
getButtons(){
const {contentStore} = this.props;
const {taskReqStore,relateList:{canRef}} = contentStore;
let btn = [];
if(canRef){
btn.push(
this.addWorkFlowType(ids, names, datas)} customized={true} >
);
}
return btn;
}
getRelateButtons(){
const {contentStore} = this.props;
const {taskReqStore,relateList:{canRelated}} = contentStore;
const {selectedRowKeys} = taskReqStore;
let btn = [];
if(canRelated){
btn.push(this.addWorkFlow(ids, names, datas)} customized={true} >
);
btn.push( );
}
return btn;
}
//编辑
onChange=(data)=>{
const {contentStore} = this.props;
const {doDspTaskRequiredOpt,taskid,} = contentStore;
doDspTaskRequiredOpt({
method:'modifyRequiredWFN',
taskid : taskid,
wfid : data.wfid1,
isNecessary:data.isNecessary
},'req');
}
//新增
addWorkFlowType=(ids, names, datas)=>{
const {contentStore} = this.props;
const {doDspTaskRequiredOpt,taskid,} = contentStore;
doDspTaskRequiredOpt({
method:'addRequiredWF',
taskid : taskid,
wfids : ids
},'req');
}
//删除
handleOperate=(record)=>{
const {contentStore} = this.props;
const {doDspTaskRequiredOpt,taskid,} = contentStore;
Modal.confirm({
title: getLabel(15172,"系统提示"),
content: getLabel(83600,"您确认要删除吗?"),
onOk() {
doDspTaskRequiredOpt({
method:'delRequiredWF',
taskid : taskid,
wfid : record.wfid1
},'req');
},
onCancel() { },
})
}
onCreatReq = (workflowid,taskId) => {
window.open("/workflow/request/CreateRequestForward.jsp?workflowid="+workflowid+"&taskrecordid="+taskId , "_blank");
}
onCreatDoc = (docid,taskid) => {
window.open((window.ecologyContentPath || '')+"/spa/document/index.jsp?secid="+ docid +"&isEdit=1&router=1&moudleFrom=task#/main/document/edit?taskrecordid="+taskid , "_blank");
}
//新建流程
addWorkFlow=(ids, names, datas)=>{
const {contentStore} = this.props;
const {doDspTaskReferenceOpt,taskid,prjid} = contentStore;
doDspTaskReferenceOpt({
dotype:'workflow',
method:'add',
prjid : prjid,
taskid:taskid,
requestid:ids,
ids:""
},'req')
}
//删除流程
deleteWorkFlow = ()=>{
const {contentStore} = this.props;
const {doDspTaskReferenceOpt,taskid,taskReqStore,prjid} = contentStore;
const {selectedRowKeys} = taskReqStore;
Modal.confirm({
title: getLabel(15172,"系统提示"),
content: getLabel(83601,"您确认要删除选中的记录吗?"),
onOk() {
doDspTaskReferenceOpt({
dotype:'workflow',
method:'del',
prjid : prjid,
taskid:taskid,
requestid:"",
ids:`${toJS(selectedRowKeys)}`
},'req')
},
onCancel() { },
})
}
onOperatesClick(record,index,operate,flag){
let _href = operate && operate.href ? operate.href : "";
let fn = _href.replace("javascript:","");
fn = fn.substring(0,fn.indexOf('('));
const {contentStore} = this.props;
const {doDspTaskReferenceOpt,taskid,taskReqStore,prjid} = contentStore;
if(fn != ""){
if("onDelRelated"==fn){ //delete
Modal.confirm({
title: getLabel(15172,"系统提示"),
content: getLabel(83600,"您确认要删除吗?"),
onOk() {
doDspTaskReferenceOpt({
dotype:'workflow',
method:'del',
prjid : prjid,
taskid:taskid,
requestid:"",
ids:record.randomFieldId
},'req')
},
onCancel() { },
})
}
}
}
}