import React from 'react'; import {inject, observer} from 'mobx-react'; import {toJS} from 'mobx'; import NoRight from '../util/NoRight' import { WeaTop, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaHelpfulTip, WeaDialog, WeaTools} from 'ecCom'; import {Button} from 'antd'; import {WeaSwitch} from 'comsMobx'; import * as EsearchUtil from '../util/EsearchUtil'; import {WeaLocaleProvider} from 'ecCom'; const getLabel = WeaLocaleProvider.getLabel; @inject('weesoSetStore') @observer export default class ApiSet extends React.Component { constructor(props) { super(props); this.state = { } } componentDidMount() { const {weesoSetStore} = this.props; weesoSetStore.doInit(); } getBtns = () => { const {weesoSetStore} = this.props; const {saveLoading} = toJS(weesoSetStore.status); const formParams = weesoSetStore.form.getFormParams(); let btns = [ ] return btns; } getRightMenu() { const {weesoSetStore} = this.props; const formParams = weesoSetStore.form.getFormParams(); let btnArr = [ { key: 'BTN_SAVE', icon: , content : `${getLabel(86,'保存')}`, onClick : () => EsearchUtil.onCheck(weesoSetStore.form, () => weesoSetStore.saveSearchSet({...formParams})) }] return btnArr; } getSearchs = () => { const {weesoSetStore} = this.props; const {form, status} = weesoSetStore; const {fields} = toJS(status); const {isFormInit} = form; let group = []; const formParams = form.getFormParams(); isFormInit && fields && fields.map((c, _index) =>{ let items = []; c.items.map(fields => { items.push({ com:( {fields.domkey[0] == 'address' &&
{getLabel(18541,'例如')}:127.0.0.1:2098,
( {getLabel(384390,'此处的端口跟搜索服务端的端口对应')} )
} />
} {fields.domkey[0] == 'isuse' && false && } {fields.domkey[0] == 'showSub' && false && }
), colSpan:1 }) }); group.push() }); return group; } render() { const {weesoSetStore} = this.props; const {showDialog, fields} = weesoSetStore.status; const title = getLabel(19665,'接口设置'); const collectParams = { favname: title, favouritetype: 5, objid:0, importantlevel: 1, }; if(!weesoSetStore.apiSetRight && !this.props.isDialog) { return } return (
{ this.props.isDialog ? { weesoSetStore.setState({showDialog: false}); weesoSetStore.form.resetForm(); weesoSetStore.form.initFormFields(fields); }} buttons={this.getBtns()} moreBtn={{ datas : this.getRightMenu(), collectParams: collectParams }} > {this.getSearchs()} :
} iconBgcolor='#A0B0BA' buttons={this.getBtns()} buttonSpace={10} showDropIcon={true} dropMenuDatas={this.getRightMenu()} dropMenuProps={{ collectParams:collectParams }} /> {this.getSearchs()}
}
) } }