import React from 'react'; import { inject, observer } from 'mobx-react'; import { Button, } from 'antd'; import {toJS} from "mobx"; import {WeaTableNew} from 'comsMobx'; import {WeaRightMenu,WeaTop,WeaTab,WeaErrorPage,WeaTools,WeaProgress,WeaBrowser,WeaLocaleProvider} from 'ecCom'; const WeaTable = WeaTableNew.WeaTable; const getLabel = WeaLocaleProvider.getLabel; import {Condition,getAdButtons} from './list/listCondition'; @inject('projectReportStore') @observer class ProjectReport extends React.Component { constructor(props) { super(props); } componentDidMount(){ const {projectReportStore,params } = this.props; const {doSearch,initData} = projectReportStore; initData(params); doSearch(params); } componentWillReceiveProps(nextProps){ const keyOld = this.props.location.key; const keyNew = nextProps.location.key; if(keyOld !== keyNew) { const {projectReportStore,params } = nextProps; const {doSearch,initData} = projectReportStore; initData(params); doSearch(params); } } componentWillUnmount(){ const {projectReportStore,params } = this.props; projectReportStore.clearStatus(); } render(){ const {projectReportStore} = this.props; const {title,loading,form,showSearchAd,tableStore,reLoad} = projectReportStore; return ( } iconBgcolor='#217346' buttons={[]} buttonSpace={10} showDropIcon={true} dropMenuDatas={this.getRightMenu()} onDropMenuClick={this.onRightMenuClick.bind(this)} > {projectReportStore.setShowSearchAd(bool)}} hideSearchAd={()=> projectReportStore.setShowSearchAd(false)} searchsAd={
} showSearchAd={showSearchAd} onSearch={v=>{prjExecuteStore.doSearch()}} advanceHeight={100} /> this.reRenderColumns(c)} register_table={()=>reLoad()} />
) } onEnterSearch = ()=>{ const projectReportStore = this.props; projectReportStore.doSearch(); projectReportStore.setShowSearchAd(false); } reRenderColumns(columns){ columns.forEach(c=>{ if(c.dataIndex=='resultcount'){ c.render = function(text, record){ if(record.resultcountspan){ return } } } else { // c.render = function(text, record){ // let valueSpan = record[c.dataIndex + "span"] !== undefined ? record[c.dataIndex + "span"] : record[c.dataIndex]; // return // } } }) return columns; } getRightMenu(){ const {projectReportStore} = this.props; const {rightMenu} = projectReportStore; let btnArr = []; rightMenu && rightMenu.length>0 && rightMenu.map(m=>{ btnArr.push({ icon: , content: m.menuName, }) }); return btnArr } onRightMenuClick(key){ const {projectReportStore} = this.props; const {rightMenu} = projectReportStore; let that = this; rightMenu && rightMenu.length>0 && rightMenu.map((m,i)=>{ if(Number(key) == i){ if(m.type == "BTN_SEARCH"){ projectReportStore.doSearch(); } } }); } } export default WeaTools.tryCatch(React, props => , {error: ""} )(ProjectReport);