import React, {Component} from 'react';
import {observer} from 'mobx-react';
import {WeaAuth} from 'ecCom';
import classnames from 'classnames';
import {
	WeaTableNew
} from 'comsMobx';
const {
	WeaTable
} = WeaTableNew;

@observer
export default class Member extends Component{
    doDel = id => this.props.store.deleteMember({ids: id});

    onOperatesClick = (record, index, operate) => {
        const func = operate.href ? operate.href.split(':')[1].split('(')[0] : '';
        const id = record.id ? record.id : '';
        this[func] && this[func](id);
    }

    render(){
        const {
            store
        } = this.props;
        const {
            refreshTab,
            memberAuthParams
        } = store;
        const className = classnames({
			['tabPane']: true,
            ['tabPane-dialog']: true
        })
		const tableProps = {
			scroll: {
				y: this.props.height - 130
            }
        }

        return (
            <div className={className}>
                <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@akyh7j`} 
                    comsWeaTableStore={store.memberTable}
                    hasOrder={true}
                    needScroll={true}
                    {...tableProps}
                    onOperatesClick={(record, index, operate) => this.onOperatesClick(record, index, operate)}
                />
                {
	        		memberAuthParams.visible && <WeaAuth ecId={`${this && this.props && this.props.ecId || ''}_WeaAuth@1elfx3`} {...memberAuthParams} />
                }
            </div>
        )
    }
}