提交 93576a8e authored 作者: 何守志's avatar 何守志

init commit to new server

上级 47796fcc
差异被折叠。
import React from 'react';
import {
Card,
WhiteSpace,
Flex,
} from 'antd-mobile';
import { withRouter } from "react-router-dom";
class CardViewFour extends React.Component{
render(){
return(
<div>
<WhiteSpace size="lg" style={{background:"#eee"}} />
<Card full>
<Card.Header
title={
<span style={ {paddingRight:"0.75rem",fontWeight:"600"}}>基地列表</span>
}
extra={
<span></span>
}
style={ {padding:"1.2rem 1.3rem",color:'#38c5b8'}}
/>
<CardTh data={this.props.data} />
</Card>
</div>
);
}
}
class CardTh extends React.Component{
render(){
const data = this.props.data;
if (data !== null){
return(
<div>
<Card.Body style={{padding:"0 1.5rem",fontSize:"0.8rem"}}>
<Flex style={{padding:"0.4rem 0"}}>
<Flex.Item style={{flex:"2"}}>
序号
</Flex.Item>
<Flex.Item style={{flex:"3"}}>
基地名称
</Flex.Item>
<Flex.Item style={{flex:"3"}}>
总户数
</Flex.Item>
<Flex.Item style={{flex:"3"}}>
已签约户数
</Flex.Item>
</Flex>
</Card.Body>
{data.map((item,index)=>(
<CardThBodyWithRouter item={item} key={index} index={index}/>
))}
</div>
);
}else {
return(
<div>
</div>
);
}
}
}
class CardThBody extends React.Component{
pushRoute=(item)=>{
try{
console.info(this.props.history);
this.props.history.push(`/BasePage/${item.jDName}`);
}catch (e)
{
console.info(e);
}
}
render(){
const item=this.props.item;
const index=this.props.index;
return (
<div>
<Card.Body style={{padding: "0 1.5rem", fontSize: "0.8rem", minHeight: "0"}} onClick={()=>this.pushRoute(item)}>
<Flex style={{padding: "0.4rem 0"}}>
<Flex.Item style={{flex: "2"}}>
{index+1}
</Flex.Item>
<Flex.Item style={{flex: "3"}}>
{item.jDName}
</Flex.Item>
<Flex.Item style={{flex: "3"}}>
{item.xiangMuZongHuShu}
</Flex.Item>
<Flex.Item style={{flex: "3"}}>
{item.yiQianYueHuShu}
</Flex.Item>
</Flex>
</Card.Body>
</div>
);
}
}
const CardThBodyWithRouter = withRouter(CardThBody)
export default CardViewFour;
import { getData } from '../../utils/DataTemplate';
export default {
namespace: 'base',
state: {
todayQianYue:null,
todayCheXiao:null,
suoDingTongJi:null,
jinDuTongJi:null,
chengBenTongJi:null,
shiYongFangYuanTongJi:null,
jiDiFangYuanTongJi:null,
xiaoQuTongJi:null,
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
},
},
effects: {
*getResult({ payload }, { take, put, call, select }) {
const { pjName,datasourceName,stateName} = payload;
const coordinate = {
containerType : 'module' ,
containerName : 'QueryJDModules',
datasourceName:datasourceName,
};
try {
const resultss = yield call(getData, coordinate, { pst: 0, psz: 10 ,params:{pjName:pjName}});
console.info('查询的结果');
console.info(resultss);
yield put({ type: 'setResult',payload:{stateName,resultss} });
}catch (erroer){
console.info(erroer);
}
},
},
reducers: {
setResult(state,{payload}){
console.info(payload.stateName);
console.info(payload.resultss);
return {...state,[`${payload.stateName}`]:payload.resultss};
},
},
};
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'dva';
import {
Select,
Page,
} from 'react-weui';
//import styles
import 'weui';
import styles from '../IndexPage.css';
import 'react-weui/build/packages/react-weui.css';
import MyTopCard from '../../components/BaseViewBody';
class BasePage extends React.Component{
constructor(props) {
super(props);
console.info(props.match.params);
}
componentWillMount() {
const { dispatch } = this.props;
dispatch({ type: 'base/getResult',payload: { pjName:this.props.match.params.pjName,datasourceName:'QueryTodayQianYue',stateName:'todayQianYue' }});
dispatch({ type: 'base/getResult',payload: { pjName:this.props.match.params.pjName,datasourceName:'QueryTodayCheXiao',stateName:'todayCheXiao'}});
dispatch({ type: 'base/getResult',payload: { pjName:this.props.match.params.pjName,datasourceName:'QuerySuoDingTongJi',stateName:'suoDingTongJi'}});
dispatch({ type: 'base/getResult',payload: { pjName:this.props.match.params.pjName,datasourceName:'QueryJinDuTongJi',stateName:'jinDuTongJi'}});
dispatch({ type: 'base/getResult',payload: { pjName:this.props.match.params.pjName,datasourceName:'QueryChengBenTongJi',stateName:'chengBenTongJi'}});
dispatch({ type: 'base/getResult',payload: { pjName:this.props.match.params.pjName,datasourceName:'QueryShiYongFangYuanTongJi',stateName:'shiYongFangYuanTongJi'}});
dispatch({ type: 'base/getResult',payload: { pjName:this.props.match.params.pjName,datasourceName:'QueryJiDiFangYuanTongJi',stateName:'jiDiFangYuanTongJi'}});
dispatch({ type: 'base/getResult',payload: { pjName:this.props.match.params.pjName,datasourceName:'QueryXiaoQuTongJi',stateName:'xiaoQuTongJi'}});
}
render(){
return (
<Page>
<div style={{padding:"0 26px", backgroundColor:"#38c5b8"}}>
<span className={styles.myspan}>
<Select style={{color:"#fff"}} data={[
{
value: `${this.props.match.params.pjName}`,
label: `${this.props.match.params.pjName}`
},
]}/>
</span>
</div>
<MyTopCard search={this.props.base}/>
</Page>
);
};
}
BasePage.propTypes = {
base: PropTypes.object,
};
// 指定订阅数据,这里关联了 login
function mapStateToProps({ base }) {
return {base};
}
export default connect(mapStateToProps)(BasePage);
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论