import React from 'react';
import { connect } from 'dva';
import { Button, Row, Col, Form, Input,Select,Checkbox,Modal,Transfer,Spin ,Table,Tabs,Popconfirm,message} from 'antd';
import {
extend,
extendRule,
initFilter,
initQueryFilter,
getOnlyPropertyData,
extendInclude,
getDataFieldValue, guid, initFilterGroup, extendGroupRule
} from "../../../utils/common";
import FormPage from '../../FormPage';
const FormItem = Form.Item;
const Option = Select.Option;
const TabPane = Tabs.TabPane;
const { TextArea } = Input;
class FlowPermitEditPage extends React.Component {
constructor(props) {
super(props);
this.state = {
data: {},
btns:[],
title:'流程审核',
historyData:[],
remark:'',
};
};
componentDidMount() {
this.props.form.resetFields();
this.loadData();
}
componentWillReceiveProps(NextProps) {
const {data}=this.props;
let {id}=data?data:{};
if(!id)
id='';
if (NextProps.custom['flowPermitEdit'+id] ) {
this.props.form.resetFields();
this.loadData();
this.props.dispatch({
type: 'custom/save',
payload: {
['flowPermitEdit'+id]:false
},
});
}
}
loadData=()=> {
const {data,formId,login,dispatch}=this.props;
const {id}=data?data:{};
if(id){
const json = initFilter(this.props.login.OrgId);
extendRule(json, 'ID', 1, id);
extendInclude(json,'Form');
this.props.dispatch({
type: 'PFFlowPermitEdit/getFlow',
payload: json,
onComplete: (ret) => {
if(ret){
this.setState({
data: ret,
});
}
}
});
const historyJson = initFilter(this.props.login.OrgId,'','CREATE_TIME',1);
extendRule(historyJson, 'InstanceId', 1, id);
this.props.dispatch({
type: 'PFFlowPermitEdit/getOperHistoryList',
payload: historyJson,
onComplete: (ret) => {
this.setState({
historyData: ret,
});
}
});
}
if(formId){
const btnJson = initFilter(this.props.login.OrgId,'','NUM',0);
extendRule(btnJson, 'PAGE_CUSTOM_FORM_ID', 1, formId);
this.props.dispatch({
type: 'PFFlowPermitEdit/getBtnList',
payload: btnJson,
onComplete: (ret) => {
if(ret){
this.setState({
btns: ret,
});
}
}
});
}
};
getBtns=()=>{
const isShow=this.props.data?this.props.data.isShow:false;
if(isShow)return;
if(this.state.btns){
return this.state.btns.map(item=>{
if(item.BTN_TYPE==7) {
if (item.CLICK_EVENT == 'agree') {//同意
return