import React from 'react';
import {observer} from 'mobx-react';
import {toJS} from 'mobx';
import {Button, Row} from 'antd';
import {
    WeaDialog,
    WeaFormItem,
    WeaLocaleProvider,
    WeaNewScroll,
    WeaRightMenu,
    WeaSearchGroup,
    WeaTab,
    WeaTableEditable,
    WeaHelpfulTip,
    WeaInput,
    WeaTop,
    WeaTextarea
} from 'ecCom';
import {WeaSwitch, WeaTableNew} from 'comsMobx';
import SchedulePlugins from './SchedulePlugins.js'
import {checkTableFieldValueUnique}  from "../../../apis/CommonService";
import {getSearchBtns, getAdvancedItem} from '../../../util/IntegrationUtil';
import TestTable from './TestTable'

const getLabel = WeaLocaleProvider.getLabel;
const {WeaTable} = WeaTableNew;

@observer
export default class BaseSet extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            src: (window.ecologyContentPath || "") + '/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4',
            num: 0
        }
    }

    componentDidMount() {
        if (this.props.show) {
            const {baseSetStore} = this.props;
            baseSetStore.setState({
                showDialog: this.props.show,
                datas: this.props.datas,
                apiUrl: this.props.apiUrl
            });
            baseSetStore.doInit(this.props.initTableEdit, this.props.initCustomColum,this.props.initTableData);
        }
    }

    componentWillReceiveProps(nextProps) {
        const {baseSetStore} = this.props;

        baseSetStore.setState({
            showDialog: nextProps.show,
            datas: nextProps.datas,
            apiUrl: nextProps.apiUrl,
            baseModifyType: nextProps.baseModifyType,
            dialogType: nextProps.dialogType,
            colums: nextProps.colums,
            showLogDetailDialog: nextProps.showLogDetail
        });

        if (nextProps.show && "synclogdetail"!==nextProps.dialogType) {
            if("synclog" == nextProps.dialogType){
                baseSetStore.getCondition();
                baseSetStore.getMenu();
                baseSetStore.getDatas(true,nextProps.datas);
            }else{
                baseSetStore.doInit(this.props.initTableEdit, this.props.initCustomColum,this.props.initTableData);
            }
        }else if(nextProps.showLogDetail && "synclogdetail"==nextProps.dialogType){
            baseSetStore.getLogDetial(nextProps.datas,0)
        }
    }

    /**
     * 行操作区
     * @param record
     * @param index
     * @param operate
     * @param flag
     */
    onOperatesClick = (record, index, operate, flag) => {
        this.props.onRowClick && typeof(this.props.onRowClick) == "function" && this.props.onRowClick(record, index, operate, flag);
    }

    /**
     * 获取按钮
     * @returns {*[]}
     */
    getBtns() {
        const {baseSetStore} = this.props;
        const {buttoninfo, rowSelectIds} = toJS(baseSetStore.status);

        let btnArr = [];
        buttoninfo && buttoninfo.map(b => {
            if(b.type == 'BTN_BatchDelete_Log'){
                btnArr.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@integrationBaseset@integrationBasesetButton${b.type}`} type={b.btnType} disabled={rowSelectIds.length === 0} onClick={() => this.onRightMenuClick(b.type)}>
                        {b.btnName}
                    </Button>
                );
            }else{
                btnArr.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@integrationBaseset@integrationBasesetButton${b.type}`} type={b.btnType} disabled={ baseSetStore.buttonShowStatus === '1'} onClick={() => this.onRightMenuClick(b.type)}>
                        {b.btnName}
                    </Button>
                );
            }
        });
        return btnArr;
    }

    /**
     * 获取查询条件
     * @returns {Array}
     */
    getSearchs() {
        const {baseSetStore} = this.props;
        const {status, searchForm} = baseSetStore;
        const {conditioninfo} = toJS(status);
        return getAdvancedItem(searchForm, conditioninfo, this.handleSearchFun, false, this && this.props && this.props.ecId || '', "integrationLdapBasesetComponent")
    }

    handleSearchFun = () => {
        const {baseSetStore} = this.props;
        const {datas} = toJS(baseSetStore.status);
        baseSetStore.getDatas(true,datas);
        baseSetStore.setShowSearchAd(false); 
    }

    /**
     * 高级搜索按钮
     * @returns {*[]}
     */
    getTabButtonsAd() {
        const {baseSetStore} = this.props;
        return getSearchBtns(
            this.handleSearchFun,
            () => baseSetStore.searchForm.reset(),
            () => baseSetStore.setShowSearchAd(false),
            this && this.props && this.props.ecId || '', 
            "integrationLdapBasesetComponent",
        )
    }

    /**
     * FORM表单控件修改触发
     * @param changeItem
     * @param v
     */
    onFormChange(changeItem, v) {
        const {baseSetStore} = this.props;
        const {baseSetForm} = baseSetStore;

        let onChange = false;
        let defaultValue = {};

        if(v.ldapid) {
            let checkParams = {
                tableName: 'ldap_setting',
                fieldName: 'ldapid',
                fieldValue: v.ldapid.value.replace(/^(\s*)|(\s*)$/g, ''),
                idName: 'id',
                idValue: ''
            };
            checkTableFieldValueUnique(checkParams).then(result => {
                if(result&&result.isNotUnique) {
                    baseSetForm.showError('ldapid',getLabel('387654','标识已存在'));
                }
            });
        }else if(v.formartid) {
            let checkParams = {
                tableName: 'ldap_formart',
                fieldName: 'formartid',
                fieldValue: v.formartid.value.replace(/^(\s*)|(\s*)$/g, ''),
                idName: 'id',
                idValue: ''
            };
            checkTableFieldValueUnique(checkParams).then(result => {
                if(result&&result.isNotUnique) {
                    baseSetForm.showError('formartid',getLabel('387654','标识已存在'));
                }
            });
        }

        if (changeItem) {
            for (let item of changeItem) {
                if (item.value) {
                    if (item.key && v[item.key] && item.value == v[item.key].value) {

                        baseSetForm.updateFields(item.change);
                        onChange = false;
                        break;
                    }
                } else if (item.key && v[item.key]) {
                    onChange = true;
                    defaultValue = item.change;
                }
            }

            if (onChange) {
                baseSetForm.updateFields(defaultValue);
            }
        }
    }

    /**
     * 获取表单数据
     * @returns {Array}
     */
    getFormItem() {
        const {baseSetStore} = this.props;
        const {status, baseSetForm} = baseSetStore;
        const {fieldsinfo, topinfo, dialogType} = toJS(status);
        const {isFormInit} = baseSetForm;
        const formParams = baseSetForm.getFormParams();
        let group = [];
        isFormInit && fieldsinfo && fieldsinfo.map((c, index) => {
            let items = [];
            let i = 0;
            c.items && c.items.map(f => {
                items.push({
                    com: (<WeaFormItem
                        ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@d60ifwintegrationldapBaseSet@integrationldqpForm${f.domkey[0]}`}
                        label={`${f.label}`}
                        labelCol={{span: `${f.labelcol}`}}
                        error={baseSetForm.getError(f)}
                        wrapperCol={{span: `${f.fieldcol}`}}
                        hideLabel={f.hideLabel}
                        tipPosition="bottom"
                    ><nobr>
                        {
                            f.domkey[0] == 'formartclass' ?
                                this.getJavaSwitch(baseSetStore.baseModifyType, baseSetForm, formParams):
                            f.scroll && f.scroll.show ? (
                                <WeaNewScroll {...f.scroll} ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll0@d60ifwintegrationldapBaseSet@integrationldqpForm${f.domkey[0]}`}>
                                    <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d60ifwintegrationldapBaseSet@integrationldqpForm1${f.domkey[0]}`} onChange={(v) => {
                                    dialogType === 'userdesigndepartment' ? 
                                        baseSetStore.setState({
                                        subcompanyId: v.departmentId && v.departmentId.valueObj && v.departmentId.valueObj[0] && v.departmentId.valueObj[0].psubcompanyid ? v.departmentId.valueObj[0].psubcompanyid : ''
                                        }) : this.onFormChange(f.changeItem, v);
                                    }} fieldConfig={f} form={baseSetForm} formParams={formParams}/>
                                </WeaNewScroll>)
                            : (
                                <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d60ifwintegrationldapBaseSet@integrationldqpForm2${f.domkey[0]}`} onChange={(v) => {
                                    dialogType === 'userdesigndepartment' ? 
                                        baseSetStore.setState({
                                        subcompanyId: v.departmentId && v.departmentId.valueObj && v.departmentId.valueObj[0] && v.departmentId.valueObj[0].psubcompanyid ? v.departmentId.valueObj[0].psubcompanyid : ''
                                        }) : this.onFormChange(f.changeItem, v);
                                    }
                                } fieldConfig={f} form={baseSetForm} formParams={formParams}/>)
                        
                        }
                        {
                            f.domkey[0] === "basedomain" 
                              ? <WeaHelpfulTip ecId={`${this && this.props && this.props.ecId || ''}_WeaHelpfulTip@d60ifwintegrationldapBaseSet@integrationldqpForm3${f.domkey[0]}`} style={{marginLeft: 20, lineHeight: "30px"}} placement={"bottom"} title={getLabel('513276','值为“用DNS服务器上面的域名”。例：如远程登录windows服务器输入的账号为abc\\Administrator则应配置： abc; 或者域用户登录域时ou=op，dc=abc， dc=com，则应配置：abc')} />
                              : null
                        }         
                        {f.validatecode && (
                            <img style={{height: 30, marginLeft:20, verticalAlign: 'middle'}} src={this.state.src} onClick={() => {
                                this.setState({num: this.state.num + 1}, function() {
                                    this.setState({src: (window.ecologyContentPath || "") + '/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=' + this.state.num})
                                })
                            }}></img>
                        )}
                    </nobr>
                    </WeaFormItem>),
                    colSpan: 1,
                    hide: baseSetForm.isHide(f, (keys, allParams) => {
                        let bool = false;
                        f && f.showWhere && f.showWhere.length > 0 && f.showWhere.map(w => {
                            if(!bool){
                                let show = false;
                                for(let val of w.value){
                                    if(allParams[w.domkey] == val){
                                        show = true;
                                        break;
                                    }
                                }
                                bool = !show;
                            }
                        })
                        return bool;
                    })
                });
            });
            if(['userdesigndepartment', 'usermerge', 'useraccountmatchbase'].indexOf(dialogType) != -1) {
              group.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@d60ifwintegrationldapBaseSet@integrationldqpForm4${dialogType}`} col={1} needTigger={true} center={true} showGroup={true} items={items} title={""} />);
            }else {
              group.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@d60ifwintegrationldapBaseSet@integrationldqpForm5${dialogType}`} col={1} needTigger={true} center={!c.leftshow} showGroup={c.defaultshow}
                title={c.title}
                items={items}/>);
            }            
        });

        return group;
    }

    getJavaSwitch = (baseModifyType, dialogForm, formParams) => {
        const {baseSetStore} = this.props;
        return (
            <div style={{position: 'relative'}}>
            <WeaInput
                ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@d60ifwintegrationldapBaseSet@integrationldqpForm6${baseModifyType}`}
                viewAttr={baseModifyType == 'BTN_DETAIL' ? 1 : 3}
                value={formParams.formartclass}
                hasBorder={true}
                onChange={v => dialogForm.updateFields({formartclass: v})}
                onBlur={v => baseSetStore.doJavaClazzName(v)}
            />
            </div>
        )
    }

    /**
     * 获取可编辑列表
     * @returns {Array}
     */
    getTableEdit() {
        const {baseSetStore} = this.props;
        const {status, tableEditDatas, tableInitStatus,cells} = baseSetStore;
        const {tablesinfo, topinfo} = toJS(status);
        if(topinfo.tab && topinfo.tab.selectedKey == 'mapping' && tablesinfo[0] && tablesinfo[0].items && tablesinfo[0].items.length==0) {
            return (
              <div style={{color: 'red', top: 10, textAlign: 'center'}}>
                {getLabel(391315,'同步设置同步组织结构和用户均未开启')}<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@integrationBaseset@integrationBasesetButtonbase`} size="small" style={{marginLeft: 20}} onClick={() => {
                  topinfo.tab.selectedKey = 'base';
                  baseSetStore.setState({
                    topinfo: topinfo
                  });
                  this.props.onTabChange && typeof(this.props.onTabChange) == "function"
                    && this.props.onTabChange('base');
                }}>
                {getLabel(391316, '立即开启')}</Button>
              </div>
            )
        }

        let group = [];
        tablesinfo && tablesinfo.map((c, groupid) => {
            let items = [];
            c.items && c.items.map((f, index)=> {
                items.push({
                    com: (<Row className={f.rowClassName} ecId={`${this && this.props && this.props.ecId || ''}_Row@integrationBaseset@integrationBasesetRow7${f.ref||index}`}>
                        <WeaTableEditable ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEditable@d60ifwintegrationldapBaseSet@integrationldqpForm8${f.ref||index}`}
                            {...f}
                            initialDatas={tableInitStatus.get(f.ref) && tableInitStatus.get(f.ref) == true && tableEditDatas.get(f.ref) ? tableEditDatas.get(f.ref).slice(0) : []}
                            datas={tableInitStatus.get(f.ref) && tableInitStatus.get(f.ref) == true && tableEditDatas.get(f.ref) ? tableEditDatas.get(f.ref).slice(0) : []}
                            onChange={(datas, other) => {
                                baseSetStore.tableEditDatas.set(f.ref,datas);
                                baseSetStore.tableRowDatas[f.ref] = datas;
                            }}
                            cells={cells.get(f.ref) ? toJS(cells.get(f.ref)):[]}
                            willEdit={(datas, result) => {
                                if (this.props.willEdit && typeof(this.props.willEdit) == "function") {
                                    let id = f.rowKey?f.rowKey : "id";
                                    let obj = this.props.willEdit( f.ref, id, datas, result);
                                    if(obj && obj.cells){
                                        if(!baseSetStore.cells.get(f.ref)){
                                            baseSetStore.cells.set(f.ref,[]);
                                        }
                                        let cell = toJS(baseSetStore.cells.get(f.ref));
                                        for(let val of obj.cells ){
                                            cell.splice(cell.findIndex(v=> v[id] === val[id]),1,val);
                                        }
                                        baseSetStore.cells.set(f.ref, cell);
                                    }
                                    return obj && obj.datas ? obj.datas : datas;
                                }
                                return datas;
                            }}
                            getRowSelection={rowSelection => {
                                if (this.props.getRowSelection && typeof(this.props.getRowSelection) == "function") {
                                    return this.props.getRowSelection(f.ref, rowSelection);
                                } else {
                                    return rowSelection;
                                }
                            }}
                        ></WeaTableEditable>
                    </Row>),
                    colSpan: 1
                });
            });

            if (c.group) {
                group.push(<WeaSearchGroup col={1} needTigger={true} ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@d60ifwintegrationldapBaseSet@integrationldqpForm10${groupid}`}
                                           showGroup={c.group.defaultshow}
                                           title={c.group.title}
                                           center={true}
                                           items={items}/>);
            } else {
                items.map(i => {
                    group.push(i.com);
                });
            }
        });

        return group;
    }

    /**
     * 获取Tab页信息
     * @returns {*}
     */
    getTab = () => {
        const {baseSetStore} = this.props;
        const {status} = baseSetStore;
        const {topinfo} = toJS(status);

        if (topinfo && topinfo.tab) {
            return (<WeaTab {...topinfo.tab} ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@d60ifwintegrationldapBaseSet@integrationldqpForm11tabDatas`}
                onChange={tabKey => {
                    var that = this;
                    setTimeout(function(){
                        topinfo.tab.selectedKey = tabKey;
                        baseSetStore.setState({
                            topinfo: topinfo
                        });
                        that.props.onTabChange && typeof(that.props.onTabChange) == "function"
                        && that.props.onTabChange(tabKey);
                    }, 300)
                }}
            />);
        }

    }

    /**
     * 获取说明信息
     * @returns {*}
     */
    getDescription() {

        const {baseSetStore} = this.props;
        const {status} = baseSetStore;
        const {description} = toJS(status);

        if (description && description.length > 0) {

            let content = '';
            description.map(d => {
                content += `<br><div>`;
                if (d.title) {
                    content += `<h3>${d.title}</h3>`;
                }
                let num = 1;
                d.content.map(c => {
                    content += `<span>`
                    if (d.shownum) {
                        content += num + "、&nbsp;";
                        num++;
                    }
                    content += `${c} </span><br>`;

                });
                content += `</div>`;
            });
            return (<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@d60ifwintegrationldapBaseSet@integrationldqpForm12`} col={1} needTigger={true} showGroup={true} title={getLabel(25734, '说明')}>
            <div style={{marginLeft: 10}}>
                <div dangerouslySetInnerHTML={{__html: content}}>

                </div>
            </div>
            </WeaSearchGroup>);
        }
    }

    /**
     * 获取更多按键
     * @returns {*[]}
     */

    getMoreBtn() {
        const {baseSetStore} = this.props;
        const {moreBtninfo} = toJS(baseSetStore.status);
        let btnArr = [];
        moreBtninfo && moreBtninfo.map(m => {
            btnArr.push({
                key: m.key,
                icon: <i className={m.icon}/>,
                content: m.btnName,
				disabled: baseSetStore.buttonShowStatus === '1',
                onClick: () => this.onRightMenuClick(m.type)
            });
        });
        return btnArr;
    }

    /**
     * 获取右键菜单
     * @returns {*[]}
     */

    getRightMenu() {
        const {baseSetStore} = this.props;
        const {menuinfo, rowSelectIds} = toJS(baseSetStore.status);
        let btnArr = [];
        menuinfo && menuinfo.map(m => {
            let disable = false;
			if (m.type === "BTN_BatchDelete_Log") {
				disable = rowSelectIds.length === 0;
			}else{
                disable = baseSetStore.buttonShowStatus === '1';
            }
            btnArr.push({
                key: m.type,
                icon: <i className={m.menuIcon}/>,
                content: m.menuName,
				disabled: disable,
                onClick: () => this.onRightMenuClick(m.type)
            });
        });
        return btnArr;
    }

    /**
     * 右键菜单操作作
     * @param type
     */
    onRightMenuClick = (type) => {
        const {baseSetStore} = this.props;
        const {tableRowDatas, status} = baseSetStore;
        const {apiUrl} = toJS(status);

        let args = apiUrl.split('/');
        if(args.indexOf('base') != -1) {
            baseSetStore.baseSetForm && baseSetStore.baseSetForm.isFormInit && baseSetStore.baseSetForm.validateForm().then(f => {
                if(f.isValid) {
                    this.props.onMenuClick && typeof(this.props.onMenuClick) == "function" && this.props.onMenuClick(type, baseSetStore.baseSetForm, tableRowDatas, this.refs);
                }else {
                    f.showErrors();
                }
            })
        }else if(args.indexOf('custominterfacebase') != -1){
			baseSetStore.baseSetForm && baseSetStore.baseSetForm.isFormInit && baseSetStore.baseSetForm.validateForm().then(f => {
				if(f.isValid){
					this.props.onMenuClick && typeof(this.props.onMenuClick) == "function"
					&& this.props.onMenuClick(type, baseSetStore.baseSetForm, tableRowDatas, this.refs);
				}else{
					f.showErrors();
				}
			})
        }else{
            this.props.onMenuClick && typeof(this.props.onMenuClick) == "function"
            && this.props.onMenuClick(type, baseSetStore.baseSetForm, tableRowDatas, this.refs);
        }
    }

    /**
     * 列操作
     * @param record
     * @param type
     */
    onColumClick = (record, type) => {
        this.props.onColumClick && typeof(this.props.onColumClick) == "function" && this.props.onColumClick(record, type);
    }

    getColumns = (columns) => {
        const {baseSetStore} = this.props;
        let newColumns = '';
        newColumns = columns.map(column => {
            let newColumn = column;
            newColumn.render = (text, record, index) => { //前端元素转义

                let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex];

                let column = baseSetStore.status.colums.find((c) => c.key && c.key == newColumn.dataIndex);

                return (
                    column && column.type ?
                        <a onClick={() => this.onColumClick(record, column.type)}
                           dangerouslySetInnerHTML={{__html: valueSpan}}/>
                        :
                        <div dangerouslySetInnerHTML={{__html: valueSpan}}/>
                )
            };
            return newColumn;
        });
        return newColumns;
    }

    getTable = () => {
      const {baseSetStore} = this.props;
      const {testMatchColumns, testMatchDatas} = toJS(baseSetStore.status);
      let items = [];

      items.push({
        com:<div style={{marginLeft: -125, marginRight: -125}}>
              <TestTable ecId={`${this && this.props && this.props.ecId || ''}_TestTable@d60ifwintegrationldapBaseSet@integrationldqpForm13`} dataSource={testMatchDatas} columns={testMatchColumns} />
            </div> 
      });

      return <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@d60ifwintegrationldapBaseSet@integrationldqpForm14`} style={{marginBottom: 10}} col={1} needTigger={true} center={true} showGroup={true} items={items} title={getLabel(500721, "匹配结果")} />;
    }

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

    render() {
        const {baseSetStore} = this.props;
        const {baseSetForm, status, tableStore} = baseSetStore;
        const {showSearchAd, topinfo, collectinfo, showDialog, showLogDetailDialog, dialogType, loading} = toJS(status);
        let styleSheet = (dialogType === 'userdesigndepartment' || dialogType === 'usermerge') ? {width: 700, height: 150} : {width: 800, height: 600};

        return (
            dialogType == 'synclog' || dialogType == 'synclogdetail'
            ? 
            <div>
            <WeaDialog
                ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@integrationBaseset@integrationBasesetWeaDialog16${dialogType}`}
                    title={topinfo.title}
                    visible={showDialog}
                    hasScroll={true}
                    icon={topinfo.icon}
                    iconBgcolor={topinfo.iconColor}
                    style={{width: 1400, height: 600}}
                    onCancel={() => {
                        this.setState({num: 0});
                        this.props.onCancel && typeof(this.props.onCancel) == "function"
                        && this.props.onCancel();
                        baseSetStore.setState({
                            showDialog: false,
                            showLogDetailDialog : false
                        });
                        baseSetStore.setButtonShowStatus('');
                        baseSetStore.setInputModifyType('');
                        baseSetForm.reset(); //关闭时清空表单数据，打开重新加载表单。
                    }}
            >
            <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@d60ifwintegrationldapBaseSet@integrationldqpForm15${dialogType}`}
                    datas={this.getRightMenu()}
                    collectParams={collectinfo}
                >
                    <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@d60ifwintegrationldapBaseSet@integrationldqpForm17${dialogType}`}
                        buttons={this.getBtns()}
                        buttonSpace={10}
                        showDropIcon={true}
                        dropMenuDatas={this.getRightMenu()}
                        dropMenuProps={{collectParams: collectinfo}}
                    >
                    <WeaNewScroll height={550} ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@d60ifwintegrationldapBaseSet@integrationldqpForm18${dialogType}`}>
                    <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@d60ifwintegrationldapBaseSet@integrationldqpForm19${dialogType}`}
                        {...topinfo.tab}
                        datas={[]}
                        showSearchAd={showSearchAd}
                        searchsAd={this.getSearchs()}
                        buttonsAd={this.getTabButtonsAd()}
                        setShowSearchAd={() => {
                            baseSetStore.setShowSearchAd(!showSearchAd);
                        }}
                    />
                        
                        <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@d60ifwintegrationldapBaseSet@integrationldqpForm20${dialogType}`}
                            comsWeaTableStore={tableStore}
                            hasOrder={true}
                            needScroll={true}
                            loading={true}
                            rowSelection={this.getRowSelection()}
                            onOperatesClick={this.onOperatesClick}
                            getColumns={this.getColumns}
                        />
                        </WeaNewScroll>
                    </WeaTop>
                </WeaRightMenu>
                </WeaDialog>

            <WeaDialog
            ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@integrationBaseset@integrationBasesetWeaDialogLog21${dialogType}`}
                title={getLabel('125928' ,'同步日志')}
                icon='icon-coms-integration'
                iconBgcolor='#1a57a0'
                visible={showLogDetailDialog}
                hasScroll={true}
                style={{width: 1080, height: 600}}
                onCancel={()=> {
                    baseSetStore.setState({
                        showLogDetailDialog : false
                    });
                    baseSetStore.setSyncLogValue('');
                    baseSetForm.reset();
                }}
            >
                <div style={{margin:20}}>
                    <WeaTextarea ecId={`${this && this.props && this.props.ecId || ''}_WeaTextarea@d60ifwintegrationldapBaseSet@integrationldqpForm22${dialogType}`}
                        viewAttr={1}
                        value={baseSetStore.logValue}
                        maxRows={5}
                        style={{marginLeft:20,marginBottom:20}}
                    >
                    </WeaTextarea>
                </div>
            </WeaDialog>
            </div>
            :
            <WeaDialog
            ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@integrationBaseset@integrationBasesetWeaDialog23${dialogType}`}
                title={topinfo.title}
                visible={showDialog}
                hasScroll={true}
                icon={topinfo.icon}
                iconBgcolor={topinfo.iconColor}
                style={styleSheet}
                onCancel={() => {
                    this.setState({num: 0});
                    this.props.onCancel && typeof(this.props.onCancel) == "function"
                    && this.props.onCancel();
                    baseSetStore.setState({
                        showDialog: false
                    });
                    baseSetStore.setButtonShowStatus('');
                    baseSetStore.setInputModifyType('');
                    baseSetForm.reset(); //关闭时清空表单数据，打开重新加载表单。
                }}
                buttons={this.getBtns()}
                moreBtn={this.getMoreBtn().length > 0 ? {
                    datas: this.getMoreBtn(),
                    collectParams: collectinfo
                } : []}
            >
                <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@d60ifwintegrationldapBaseSet@integrationldqpForm24${dialogType}`}
                    datas={this.getRightMenu()}
                    collectParams={collectinfo}
                >
                    {this.getTab()}
                    <WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@d60ifwintegrationldapBaseSet@integrationldqpForm25${dialogType}`} height={(['userdesigndepartment', 'usermerge'].indexOf(dialogType) != -1) ? 0 : 550}>
                        {topinfo && topinfo.tab && topinfo.tab.selectedKey == 'schedule' ? <SchedulePlugins ecId={`${this && this.props && this.props.ecId || ''}_SchedulePlugins@wmk0fo`} baseSetStore={baseSetStore} /> : this.getFormItem()}
                        {this.getTableEdit()}
                        {(dialogType === 'useraccountmatchbase' && loading) ? this.getTable() : ''}
                        {this.getDescription()}
                    </WeaNewScroll>
                </WeaRightMenu>
            </WeaDialog>
        );
    }
}