import React from 'react' import * as mobx from 'mobx' import { inject, observer, } from 'mobx-react' import { WeaTop, WeaTab, WeaFormItem, WeaRightMenu, } from 'ecCom' import { Row, Col, Spin, Modal, Button, message, Switch } from 'antd' import { WeaSwitch, WeaTableNew } from 'comsMobx' import { i18n } from '../../public/i18n'; import '../../style/common.less'; import NewAndEditDialog from '../NewAndEditDialog'; import { renderNoright } from '../../util'; const toJS = mobx.toJS; const confirm = Modal.confirm; @inject('group') @observer export default class Group extends React.Component { constructor(props) { super(props); } componentWillMount() { } componentDidMount() { this.init(); } componentWillReceiveProps(nextProps) { const { group } = this.props; if (this.props.location.key !== nextProps.location.key) { this.init(); } } init() { const { group } = this.props; group.getGroupForm(); group.getHasRight(); } getTopMenuBtns() { const { group } = this.props; const { topMenu, tableStore } = group; let btns = []; topMenu.map((item, i) => { btns.push(); }); return btns; } getDropMenuDatas() { const { group } = this.props; const { rightMenu } = group; let menus = []; toJS(rightMenu).map((item, index) => { let obj = { key: item.menuFun, icon: , content: item.menuName, } if (item.menuFun == 'collection' || item.menuFun == 'help' || item.menuFun == 'pageAddress') { obj.disabled = true; } menus.push(obj); }) return menus; } doEdit(id) { const { group } = this.props; group.setNeDialogTitle(i18n.label.editGroup()); group.setVisible(true); group.getForm(); } handleSave() { const { group } = this.props; group.edit(); } handleMenuClick(key) { this[key] && this[key](); } handleClick(item) { this[item.menuFun] && this[item.menuFun](); } changeData(key) { const { group } = this.props; group.changeData(key); } getFormField() { const { group } = this.props; const { form1, groupCondition } = group; const { isFormInit } = form1; const formParams = form1.getFormParams(); let items = []; isFormInit && toJS(groupCondition).map(c => { c.items.map((fields, index) => { items.push( ); }); }); return
{items}
; } render() { const { group } = this.props; const { nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey,date,hasRight } = group; if (hasRight === false) { return renderNoright(); } return ( hasRight &&
this.handleMenuClick(key)} > } iconBgcolor='#217346' loading={true} buttons={this.getTopMenuBtns()} showDropIcon={true} dropMenuDatas={this.getDropMenuDatas()} onDropMenuClick={(e) => this.handleMenuClick(e)} >
{this.getFormField()}
this.handleSave()} onCancel={() => group.setVisible(false)} />
) } }