import React from "react";
import {inject, observer} from "mobx-react";
import {toJS} from "mobx";
import {Button, Modal, message} from "antd";
import {WeaLeftRightLayout, WeaLocaleProvider, WeaRightMenu, WeaTab, WeaTop } from "ecCom";
import {WeaLogView, WeaTableNew} from "comsMobx";
import isEmpty from 'lodash/isEmpty';
import * as IntegrationUtil from "../../util/IntegrationUtil";
import RegisterDML from "./RegisterDML";
import RegisterWebservice from "./RegisterWebservice";
import RegisterCustom from "./RegisterCustom";
import RegisterESB from "./RegisterESB";
import TestDialog from "./TestDialog"
import RegisterRunList from "./RegisterRunList";
import allStore from '../../stores';
import RegisterCustomOnline from "./RegisterCustomOnline";
import NewDeploymentForm from "./NewDeploymentForm";
import NoRight from "../../public/NoRight";
import OrganizationTree from '../../public/OrganizationTree';

const {WeaTable} = WeaTableNew;
const {confirm} = Modal;
const {getLabel} = WeaLocaleProvider;
const WeaLogViewComp = WeaLogView.Component;
const registerESBStore = allStore['registerESBStore'];

@inject("workflowFlowStore")
@observer
class WorkflowFlow extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
          targetId: '',
          visible: false,
          from: ""
        };
    }

    componentDidMount() {
        const {workflowFlowStore} = this.props;
        //来自其他入口
        let queryString = toJS(this.props.location.query);
        if(queryString && queryString.from){
            this.setState({
                from: queryString.from
            })
            workflowFlowStore.doInitDriver();
        }else{
            this.setState({
                from: ""
            })
            workflowFlowStore.doInit();
        }
        this.setState({
          targetId: '',
          visible: false
        })
    }

    componentWillReceiveProps(nextProps) {
        const {workflowFlowStore} = this.props;
        if (this.props.location.key !== nextProps.location.key) {
            workflowFlowStore.doInit();
        }
    }

    // 分权刷新
    refreshData = (id, type) => {
        const {
            workflowFlowStore,
        } = this.props, {
            selectedKey,
        } = toJS(workflowFlowStore.status);
        // 如果点击的是分部
        if("1" === type) {
          workflowFlowStore.setState({
            subcompanyid: id  
          })
        } else{
          workflowFlowStore.setState({
            subcompanyid: ""  
          })
        }
        if (selectedKey == 0) {
            workflowFlowStore.getInterfaceRegisterCondition({}, () => {
                workflowFlowStore.getInterfaceRegisterRightMenus();
                workflowFlowStore.getInterfaceRegisterList();
            });
        } else {
            workflowFlowStore.getInterfaceDeploymentCondition({}, () => {
                workflowFlowStore.getInterfaceDeploymentList();
                workflowFlowStore.getInterfaceDeploymentRightMenus();
            });
        }
    }

    getSearchFun = () => {
      const {workflowFlowStore} = this.props;
      const {selectedKey} = toJS(workflowFlowStore.status);
      const form = selectedKey == 0 ? workflowFlowStore.searchForm : workflowFlowStore.searchForm2;
      workflowFlowStore.setState({
        showSearchAd: false,
        subcompanyid: form.getFormParams().subcompanyid1,
      });
      if (selectedKey == 0) {
        workflowFlowStore.getInterfaceRegisterRightMenus();
        workflowFlowStore.getInterfaceRegisterList();
      } else {
        workflowFlowStore.getInterfaceDeploymentList();
        workflowFlowStore.getInterfaceDeploymentRightMenus();
      }
    }

    getTabButtonsAd() {
        const {workflowFlowStore} = this.props;
        const {selectedKey} = toJS(workflowFlowStore.status);
        let resetFun = () => {
          selectedKey == 0 ? workflowFlowStore.searchForm.reset() : workflowFlowStore.searchForm2.reset();
        };
        return IntegrationUtil.getSearchBtns(
            this.getSearchFun, 
            resetFun, 
            () => workflowFlowStore.setState({showSearchAd: false}),
            this && this.props && this.props.ecId || '', 
            "integrationWorkflowflow",
        );
    }

    /**
     * 获取右键菜单
     * @returns {Array}
     */
    getRightMenu() {
        const {workflowFlowStore} = this.props;
        const {selectedKey, rightMenus, rightMenus1, rowSelectIds} = toJS(workflowFlowStore.status);
        let btnArr = [];
        let mymenus = [];
        if (selectedKey == 0) {
            mymenus = rightMenus;
        } else {
            mymenus = rightMenus1;
        }
        //产品集成入口
        if(this.state.from=="productEntrance"){
            mymenus = rightMenus1;
        }
        mymenus&&mymenus.map(m => {
                btnArr.push({
                    key: m.type,
                    icon: <i className={m.menuIcon}/>,
                    content: m.menuName,
                    onClick: () => this.onRightMenuClick(m.type),
					disabled:(m.menuIcon==='icon-coms-delete' && rowSelectIds.length === 0)
                });
        });
        //显示列定制
        btnArr.push({
            key: "BTN_COLUMN",
            icon: <i className="icon-coms-Custom"/>,
            content: `${getLabel(32535, "显示列定制")}`,
            onClick: () => this.onRightMenuClick("BTN_COLUMN")
        });

        return btnArr;
    }

    /**
     * 右键菜单点击事件
     * @param type
     */
    onRightMenuClick = (type) => {
        const {workflowFlowStore} = this.props;
        let {selectedKey, rowSelectIds} = toJS(workflowFlowStore.status);
        if(this.state.from=="productEntrance"){
            selectedKey = 1;
        }
        if (selectedKey == 0) {
            if (type == "rb_1") {
                //注册DML
                workflowFlowStore.getInterfaceRegisterDMLAddForm({}, () => {
                    workflowFlowStore.setState({showRegisterDMLDialog: true});
                });
                workflowFlowStore.setDmlEditIndex('');
            }
            if (type == "rb_2") {
                //注册Webservice
                workflowFlowStore.getInterfaceRegisterWebserviceAddForm();
                workflowFlowStore.setState({showRegisterWebserviceDialog: true});
            }
            if (type == "rb_3") {
                //注册自定义接口
                this.doEditById({actionid: ''});
            }
            if (type == "rb_8") {
                workflowFlowStore.getESBRightMenu();
                workflowFlowStore.getESBFields();
                workflowFlowStore.setState({showRegisterESBDialog: true, operateSrc: ''});
            }
            if (type == "rb_4") {
                workflowFlowStore.setLogIndex('');
                workflowFlowStore.setState({logDMLVisible:true})
            }
            if (type == "rb_5") {
                workflowFlowStore.setLogIndex('');
                workflowFlowStore.setState({logWebserviceVisible:true})
            }
            if (type == "rb_6") {
                workflowFlowStore.setLogIndex('');
                workflowFlowStore.setState({logCustomVisible:true})
            }
            if (type == "rb_7") {
                //运行日志
                workflowFlowStore.getInterfaceRegisterRunLogCondition(workflowFlowStore.getInterfaceRegisterRunLogList);
                workflowFlowStore.setState({logRunListVisible: true, operateClickIndex: ""})
            }
        }else if(selectedKey==1) {
            if (type == "rb_1") {
                //新建接口部署
                this.doEditById2({workflowId: ''});
            }
            if (type == "rb_2") {
                //删除接口部署
                workflowFlowStore.confirmModal(`${getLabel(385625, '确定要删除选择的记录吗？')}`, workflowFlowStore.getInterfaceDeploymentOperation, {operate:'delete',workflowids: rowSelectIds});
            }
        }

        if (type == "BTN_COLUMN") {
            //显示列定制
            if (selectedKey == 0) {
                workflowFlowStore.interfaceRegisterStore.setColSetVisible(true);
                workflowFlowStore.interfaceRegisterStore.tableColSet(true);
            } else {
                workflowFlowStore.interfaceDeploymentStore.setColSetVisible(true);
                workflowFlowStore.interfaceDeploymentStore.tableColSet(true);
            }
        }
    };

    /**
     * 获取顶部按钮
     * @returns {Array}
     */
    getBtns = () => {
        const {workflowFlowStore} = this.props;
        let {selectedKey, rightMenus, rightMenus1, rowSelectIds} = toJS(workflowFlowStore.status);
        if(this.state.from=="productEntrance"){
            selectedKey = 1;
        }
        let mymenus = [];
        if (selectedKey == 0) {
            rightMenus && rightMenus.forEach(item => {
                if(!["rb_4", "rb_5", "rb_6", "rb_7"].includes(item.type)) {
                    mymenus.push(item);
                }
            })
        } else {
            mymenus = rightMenus1;
        }
        let btnArr = [];
        if(!mymenus){return btnArr}
        for (let j = 0, len = mymenus.length; j < len; j++) {
            if (j == 4) {
                break
            }
            let m = mymenus[j];
            let btn = <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5rj0dj`} type="primary" disabled={m.menuIcon === 'icon-coms-delete' && rowSelectIds.length === 0} onClick={() => {{this.onRightMenuClick(m.type);}}}>{`${m.menuName}`}</Button>;
            btnArr.push(btn);
        }
        return btnArr;
    };

    /**
     * 获取高级查询
     * @returns {Array}
     */
    getAdvancedSearch = () => {
      const {workflowFlowStore} = this.props;
      const {
        searchForm,
        searchForm2,
        status
      } = workflowFlowStore;
      let {
        selectedKey,
        interfaceRegisterConditionInfo=[],
        interfaceDeploymentConditionInfo=[],
      } = toJS(status);
      let datas = [], form = "";
      if(this.state.from == "productEntrance"){
        selectedKey = 1;
      }
      if (selectedKey == 0) {
        form = searchForm;
        datas = [...interfaceRegisterConditionInfo];
      } else {
        form = searchForm2;
        datas = [...interfaceDeploymentConditionInfo];
      }
      return IntegrationUtil.getAdvancedItem(
        form,
        datas,
        this.getSearchFun,
        false,
        this && this.props && this.props.ecId || '', 
        "integrationWorkflowflow",
      );;
    };

    /**
     * 数据列表行数据的操作项
     * @param record
     * @param index
     * @param operate
     * @param flag
     */
    onOperatesClick = (record, index, operate, flag) => {
        const {workflowFlowStore} = this.props;
        const { setDmlEditIndex, setState, setLogIndex, getInterfaceRegisterRunLogList, getInterfaceRegisterRunLogCondition } = workflowFlowStore;
        let {selectedKey, logDMLVisible} = toJS(workflowFlowStore.status);
        let fromtype = record.fromtype;
        if(this.state.from=="productEntrance"){
            selectedKey = 1;
        }
          if (selectedKey == 0) {
            if(fromtype==3) {
                //自定义接口
                switch (operate.index) {
                    case "2"://编辑
                        this.doEditById(record);
                        break;
                    case "6"://删除
                        workflowFlowStore.confirmModal(`${getLabel(15097, '确定要删除吗？')}`, workflowFlowStore.getInterfaceRegisterCustomOperation, {method:'deletesingle',actionid: record.id});
                        break;
                    case '10'://日志
                        setState({logCustomVisible:true})
                        setLogIndex(record.id);
                        break;
                    case '14'://运行日志
                        getInterfaceRegisterRunLogCondition(() => getInterfaceRegisterRunLogList({actiondbid:record.id}));
                        setState({logRunListVisible:true, operateClickIndex: record.id});
                        break;
                    default:
                        break;
                }
            }else if(fromtype==2) {
                //webservice接口
                switch (operate.index) {
                    case "1"://编辑
                        this.doEditById_ws(record);
                        break;
                    case "5"://删除
                        workflowFlowStore.confirmModal(`${getLabel(15097, '确定要删除吗？')}`, workflowFlowStore.getInterfaceRegisterWebserviceOperation, {operator:'delete',actionid: record.id});
                        break;
                    case "9"://系统日志
                        setState({logWebserviceVisible:true})
                        setLogIndex(record.id);
                        break;
                    case '13'://运行日志
                        getInterfaceRegisterRunLogCondition(() => getInterfaceRegisterRunLogList({actiondbid:record.id}));
                        setState({logRunListVisible: true, operateClickIndex: record.id})
                        break;
                    case '17'://测试
                        this.doTestById_ws(record);
                        break;
                    default:
                        break;
                }
            }else if(fromtype==1) {
                setDmlEditIndex(record.id);
                //DML接口
                switch (operate.index) {
                    case "0"://编辑
                        this.doEditById_dml(record);
                        break;
                    case "2"://编辑
                        this.doEditById_dml(record);
                        break;
                    case "4"://删除
                        workflowFlowStore.confirmModal(`${getLabel(15097, '确定要删除吗？')}`, workflowFlowStore.getInterfaceRegisterDMLOperation, {operate:'delete',actionid: record.id});
                        break;
                    case '8'://日志
                        setState({logDMLVisible:true})
                        setLogIndex(record.id);
                        break;
                    case '12'://运行日志
                        getInterfaceRegisterRunLogCondition(() => getInterfaceRegisterRunLogList({actiondbid:record.id}));
                        setState({logRunListVisible: true, operateClickIndex: record.id})
                        break;
                    case '16'://测试
                        this.doTestById_dml(record);
                        break;
                    default:
                        break;
                }

            }else if(fromtype==4){
            	switch (operate.index) {
	                case "3"://编辑
	                    this.doEditById_esb(record);
	                    break;
	                case "7"://删除
	                	confirm({
	            	  		title : getLabel(15097, '确定要删除吗？'),
	            	  		content : "",
	            	  		onOk(){
		                		let ret = registerESBStore.getInterfaceRegisterESBOperation({operateSrc:'delete',esbactionid: record.id});
			        			Promise.all([ret]).then((result) => {
                                    message.success(getLabel(20461, '删除成功'));
			        				workflowFlowStore.getInterfaceRegisterList();
			        			});
	            	  		},
	            	  		onCancel() {}
	            	  	})
	                    break;
	                default:
	                    break;
	            }
            }else if(fromtype == 6) {
              switch(Number(operate.index)) {
                case 7: 
                  workflowFlowStore.confirmModal(`${getLabel(15097, '确定要删除吗？')}`, workflowFlowStore.delectAction, {actionName: record.actionname});
                  break;
                case 3:
                  this.doEditById_esb(record);
                  break;
                case 11:
                  this.setState({
                    visible:true,
                    targetId: record.actionname
                  });
                  break;
                case 15:
                  getInterfaceRegisterRunLogCondition(() => getInterfaceRegisterRunLogList({actiondbid:record.id}));
                  setState({logRunListVisible: true, operateClickIndex: record.id})
                  break;
              }
            }
          }else {
              switch (operate.index) {
                case "0"://编辑
                    this.doEditById2(record);
                    break;
                case "1"://删除
                    workflowFlowStore.confirmModal(`${getLabel(15097, '确定要删除吗？')}`, workflowFlowStore.getInterfaceDeploymentOperation, {operate:'delete',workflowids: record.workflowId});
                    break;
                default:
                    break;
            }
        }

    };

    getColumnsInfo = (data) => {
        const that = this;

        if (!isEmpty(data)) {
            for (let index = 0; index < data.length; index++) {
                if (data[index].dbField == 'actionname') {
                    data[index].render = (text, record, index) => {
                        // console.log(record.fromtype);
                        let fromtype = record.fromtype;
                        if(fromtype==3) {
                            //自定义接口
                            return (<a onClick={that.doEditById.bind(that, record)}>{record.actionname}</a>);
                        }else if(fromtype==2) {
                            //webservice接口
                            return (<a onClick={that.doEditById_ws.bind(that, record)}>{record.actionname}</a>);
                        }else if(fromtype==1) {
                            //DML接口
                            return (<a onClick={that.doEditById_dml.bind(that, record)}>{record.actionname}</a>);
                        }else if(fromtype==4){
                        	//ESB历史接口无法编辑
                          return (<a onClick={() =>
                            Modal.warning({
                                title: getLabel(15172, "系统提示"),
                                content: getLabel(getLabel, "ESB历史接口无法编辑")
                            })}>{record.actionname}</a>
                          );
                        }else if(fromtype==6){
                            //ESB接口
                          return (<a onClick={that.doEditById_esb.bind(that, record)}>{record.actionname}</a>);
                        }

                    }
                } else if (data[index].dbField === 'subcompanyid') {
                    data[index].render = (text, record) => <a href={`${window.ecologyContentPath || ""}/spa/hrm/engine.html#/hrmengine/organization?showTree=false&isView=1&type=subcompany&id=${record.subcompanyid}`} target="_blank">{record.subcompanyidspan}</a>;
                }
            }
        }
    }

    getColumnsInfo2 = (data) => {
        const that = this;

        if (!isEmpty(data)) {
            for (let index = 0; index < data.length; index++) {
                if (data[index].dbField == 'workflowname') {
                    data[index].render = (text, record, index) => {
                        // console.log(record);
                        let workflowId = record.workflowId;
                        return (<a onClick={that.doEditById2.bind(that, record)}>{record.workflowname}</a>);

                    }
                } else if (data[index].dbField === 'subcompanyid') {
                    data[index].render = (text, record) => <a href={`${window.ecologyContentPath || ""}/spa/hrm/engine.html#/hrmengine/organization?showTree=false&isView=1&type=subcompany&id=${record.subcompanyid}`} target="_blank">{record.subcompanyidspan}</a>;
                }
            }
        }
    }

    doEditById(record) {
        const {workflowFlowStore} = this.props;
        workflowFlowStore.setCustomEditIndex(record.id);
        workflowFlowStore.getInterfaceRegisterCustomAddForm({actionid: record.id});
        workflowFlowStore.setState({showRegisterCustomDialog: true});
    }
    doEditById_ws(record) {
        const {workflowFlowStore} = this.props;
        workflowFlowStore.setWebServiceEditIndex(record.id);
        workflowFlowStore.newRegisterWebserviceForm.reset();
        workflowFlowStore.getInterfaceRegisterWebserviceAddForm({actionid: record.id,operate:'editws'});
        workflowFlowStore.setState({showRegisterWebserviceDialog: true});
    }


    doTestById_ws(record) {
        const {workflowFlowStore} = this.props;
        let type = 'ws';
        let testId = record.id;
        workflowFlowStore.testConfig(type,testId);
    }

    doEditById_dml(record) {
        const {workflowFlowStore} = this.props;
        workflowFlowStore.setDmlEditIndex(record.id);
        // workflowFlowStore.newRegisterDMLForm.reset();
        workflowFlowStore.getInterfaceRegisterDMLAddForm({actionid: record.id,operate:'edit'}, () => {
            workflowFlowStore.setState({showRegisterDMLDialog: true});
        });
    }

    doTestById_dml(record) {
        const {workflowFlowStore} = this.props;
        let type = 'dml';
        let testId = record.id;
        workflowFlowStore.testConfig(type, testId);
    }

    doEditById_esb(record) {
        const {workflowFlowStore} = this.props;

        workflowFlowStore.checkEsbService({actionName: record.actionname}, () => {
          workflowFlowStore.getESBRightMenu({actionName: record.actionname, operate: 'edit'});
          workflowFlowStore.getESBFields({actionName: record.actionname, operate: 'edit'});
          workflowFlowStore.setState({showRegisterESBDialog: true, operateSrc: record.actionname})
        })
        // workflowFlowStore.setEsbEditIndex(record.id);
        // registerESBStore.setESBActionid(record.id);
        // registerESBStore.setOperateSrc("edit");
        // registerESBStore.setState({ showRegisterESBDialog: true });
    }

    //流程部署接口编辑
    doEditById2(record) {
        const {workflowFlowStore} = this.props;
        workflowFlowStore.getInterfaceDeploymentAddForm({workflowid: record.workflowId,fromintegration:1,operate:'edit', subcompanyid: record.subcompanyid});
        workflowFlowStore.setState({showDeploymentDialog: true});
    }

  getRunLogDialogRightMenu() {
    const {workflowFlowStore} = this.props;
    let btnArr = [
      {
        key: 'BTN_SAVE',
        icon: <i className='icon-coms-go-back'/>,
        content : `${getLabel(309,'关闭')}`,
        onClick : () => {workflowFlowStore.setState({logRunListVisible:false})}
      }
    ];
    return btnArr;
  }

  getRowSelection = () => {
    return {
        onChange: selectedRowKeys =>
            this.props.workflowFlowStore.setState({
                rowSelectIds: selectedRowKeys
            })
    }
  }

    render() {
        const {workflowFlowStore} = this.props;
        const {
            loading,
            interfaceRegisterStore,
            searchForm,
            searchForm2,
            interfaceDeploymentStore,
            status,
            hasRight,
            rightLoading,
            hasManageDetachableRight,
        } = workflowFlowStore;
        let {
            showSearchAd,
            advancedSearchHeight,
            selectedKey,
            logDMLVisible,
            logWebserviceVisible,
            logCustomVisible,
            hasOrganization,
            subcompanyid,
        } = toJS(status);
        const {visible, targetId} = this.state;

        let topTab = [];
        let topTitle="";
        if(this.state.from=="productEntrance") {
            topTitle=getLabel(32268, "业务驱动");
            selectedKey = 1;
        }else{
            topTab = [
                {
                    color: "#000000",
                    groupid: "flowAll",
                    showcount: true,
                    title: `${getLabel(83002, "流程接口注册")}`,
                    viewcondition: 0
                },
                {
                    color: "#ff3232",
                    groupid: "flowNew",
                    showcount: true,
                    title: `${getLabel(83319, "流程接口部署")}`,
                    viewcondition: 1
                }
            ];
            topTitle=getLabel(32338, "流程流转集成");
        }
        return (rightLoading
          ? null
          : hasRight 
            ?  <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@3j7t8o`}
                    datas={(hasManageDetachableRight || selectedKey != 0) ? this.getRightMenu() : []}
                    collectParams={{
                        favname: topTitle,
                        favouritetype: 1,
                        objid: 0,
                        link: "wui/engine.html#/inteengine/workflowflow",
                        importantlevel: 1
                    }}
                >
                    <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@wr7mzc`}
                        loading={loading}
                        title={topTitle}
                        icon={<i className="icon-coms-integration"/>}
                        iconBgcolor="#1a57a0"
                        buttons={(hasManageDetachableRight || selectedKey != 0) ? this.getBtns() : []}
                        showDropIcon={true}
                        dropMenuDatas={(hasManageDetachableRight || selectedKey != 0) ? this.getRightMenu() : []}
                        dropMenuProps={{
                            collectParams: {
                                favname: topTitle,
                                favouritetype: 1,
                                objid: 0,
                                link: "wui/engine.html#/inteengine/workflowflow",
                                importantlevel: 1
                            }
                        }}
                    />
                    <WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@dsvrg3`}
                        showLeft={selectedKey != 1 && hasOrganization && hasManageDetachableRight}
                        showBtn={selectedKey != 1 && hasOrganization && hasManageDetachableRight}
                        leftCom={<OrganizationTree ecId={`${this && this.props && this.props.ecId || ''}_OrganizationTree@2ceqx4`} 
                            ref="workflow"
                            selectedKeys={[subcompanyid]}
                            refreshData={this.refreshData}
                            rightStr={"intergration:formactionsetting"}
                            {...(this.props.orgTreeParams || {})} 
                        />}
                    >
                        <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@nyik1s`}
                            datas={topTab}
                            keyParam="viewcondition" //主键
                            countParam="groupid" //数量
                            selectedKey={selectedKey}
                            searchType={(hasManageDetachableRight || selectedKey != 0) ? ['base','advanced'] : []}
                            searchsBaseValue={selectedKey == 0
                                ? searchForm.getFormParams().actionname
                                : searchForm2.getFormParams().namesimple}
                            advanceHeight={advancedSearchHeight}
                            searchsAd={this.getAdvancedSearch()}
                            showSearchAd={showSearchAd}
                            buttonsAd={this.getTabButtonsAd()}
                            setShowSearchAd={() => workflowFlowStore.setState({showSearchAd: !showSearchAd})}
                            hideSearchAd={() => workflowFlowStore.setState({showSearchAd: false})}
                            onChange={v => {
                                workflowFlowStore.setState({
                                    subcompanyid: "",
                                    selectedKey: v,
                                })
                                if (v == 0) {
                                    workflowFlowStore.getInterfaceRegisterCondition({}, () => {
                                        workflowFlowStore.getInterfaceRegisterList();
                                        workflowFlowStore.getInterfaceRegisterRightMenus();
                                    });
                                } else {
                                    workflowFlowStore.getInterfaceDeploymentCondition({}, () => {
                                        workflowFlowStore.getInterfaceDeploymentList();
                                        workflowFlowStore.getInterfaceDeploymentRightMenus();
                                    });
                                }
                            }}
                            onSearch={this.getSearchFun}
                            onSearchChange={value => {
                                selectedKey == 0
                                    ? searchForm.updateFields({actionname: value})
                                    : searchForm2.updateFields({namesimple: value});
                            }}
                        />
                        {selectedKey == 0 
                          ? hasManageDetachableRight
                            ? <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@f4ig7v`}
                                key="0"
                                comsWeaTableStore={interfaceRegisterStore}
                                hasOrder={true}
                                needScroll={true}
                                onOperatesClick={this.onOperatesClick}
                                uniqueId={true}
                                getColumns={this.getColumnsInfo}
                              />
                            : <NoRight ecId={`${this && this.props && this.props.ecId || ''}_NoRight@i7hyic`} />
                          : (
                            <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@zhnzmc`}
                                key="1"
                                comsWeaTableStore={interfaceDeploymentStore}
                                hasOrder={true}
                                needScroll={true}
                                onOperatesClick={this.onOperatesClick}
                                uniqueId={true}
                                rowSelection={this.getRowSelection()}
                                getColumns={this.getColumnsInfo2}
                            />
                        )}
                    </WeaLeftRightLayout>
                    <RegisterESB ecId={`${this && this.props && this.props.ecId || ''}_RegisterESB@qc6fzq`}/>
                    <RegisterRunList ecId={`${this && this.props && this.props.ecId || ''}_RegisterRunList@p7nmt5`}/>
                    <TestDialog ecId={`${this && this.props && this.props.ecId || ''}_TestDialog@1i8p30`}/>
                    <RegisterDML ecId={`${this && this.props && this.props.ecId || ''}_RegisterDML@6ntke0`}/>
                    <RegisterWebservice ecId={`${this && this.props && this.props.ecId || ''}_RegisterWebservice@q20qkd`}/>
                    <RegisterCustom ecId={`${this && this.props && this.props.ecId || ''}_RegisterCustom@kvfula`}/>
                    <RegisterCustomOnline ecId={`${this && this.props && this.props.ecId || ''}_RegisterCustomOnline@ogxp88`}/>
                    <NewDeploymentForm ecId={`${this && this.props && this.props.ecId || ''}_NewDeploymentForm@lzmw25`}/>
                    <WeaLogViewComp ecId={`${this && this.props && this.props.ecId || ''}_WeaLogViewComp@lnrdvv`} visible={logDMLVisible} onCancel={() => {
                        workflowFlowStore.setState({logDMLVisible: false})
                    }} logStore={workflowFlowStore.logStore} logType="15" logSmallType="81" targetId={workflowFlowStore.logIndex} />
                    <WeaLogViewComp ecId={`${this && this.props && this.props.ecId || ''}_WeaLogViewComp@909ej1`} visible={logWebserviceVisible} onCancel={() => {
                        workflowFlowStore.setState({logWebserviceVisible: false})
                    }} logStore={workflowFlowStore.logStoreWebservice} logType="15" logSmallType="82" targetId={workflowFlowStore.logIndex} />
                    <WeaLogViewComp ecId={`${this && this.props && this.props.ecId || ''}_WeaLogViewComp@tcwu32`} visible={logCustomVisible} onCancel={() => {
                        workflowFlowStore.setState({logCustomVisible: false})
                    }} logStore={workflowFlowStore.logStoreCustom} logType="15" logSmallType="83" targetId={workflowFlowStore.logIndex} />   
                    <WeaLogViewComp ecId={`${this && this.props && this.props.ecId || ''}_WeaLogViewComp@ls4o6d`} visible={visible} onCancel={() => {
                      this.setState({visible: false})
                    }} logStore={workflowFlowStore.logStoreESB} logType="30" logSmallType="33" targetId={targetId} />   
                </WeaRightMenu>
            :   <NoRight ecId={`${this && this.props && this.props.ecId || ''}_NoRight@5sg89x`} />
        );
    }
}

export default WorkflowFlow;
