import React from 'react'; import { inject, observer} from 'mobx-react'; import {routerShape} from 'react-router'; import {Condition} from '../list/listCondition'; import {WeaErrorPage,WeaTools,WeaTop,WeaRightMenu,WeaLocaleProvider} from 'ecCom'; import {Button} from 'antd'; const getLabel = WeaLocaleProvider.getLabel; @inject("queryTaskStore") @observer class QueryTaskCondition extends React.Component { static contextTypes = { router: routerShape } constructor(props) { super(props); } resetHeight(height){ jQuery(".prj-query-condition").height(height - 60); } componentDidMount() { const {queryTaskStore} = this.props; queryTaskStore.getQueryCondition({},true); } componentWillReceiveProps(nextProps){ if(this.props.location.key !== nextProps.location.key){ const {queryTaskStore} = this.props; queryTaskStore.getQueryCondition({},true); } } render() { const { queryTaskStore } = this.props; const { loading,title, form} = queryTaskStore; // const formParams = form.getFormParams(); //Mobx-form的Bug,form传给子组件时需外层调用下取值,否则查询条件变了组件不会render // const cusFormParams = customForm && customForm.getFormParams(); return (
} iconBgcolor='#217346' getHeight={this.resetHeight.bind(this)} buttons={[]} buttonSpace={10} showDropIcon={true} dropMenuDatas={this.getRightMenu()} >
{this.getSearchButtons()}
) } getRightMenu(){ let btns = []; btns.push({ key: "search", icon: , content: getLabel(197,"搜索"), onClick: this.forwardQueryResult.bind(this) }); return btns; } getSearchButtons() { const { queryTaskStore } = this.props; const {clearFormFields } = queryTaskStore; const btnStyle = {borderRadius: 3, minWidth: 80} return [ (), (), () ] } forwardQueryResult(){ const path = "/queryTaskResult"; this.context.router.push({ pathname: "/main/prj"+path }); } } export default WeaTools.tryCatch(React, props => , {error: ""} )(QueryTaskCondition);