提交 ef454f6b authored 作者: zhouhuan's avatar zhouhuan

人口

上级 97053228
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
/**
* Created by zhouhuan on 2017/10/30.
*/
import { Toast } from 'antd-mobile';
import { NavigationActions } from 'react-navigation';
import { getData } from '../../utils/DataTemplate';
import { datasourceApi } from '../../services/datasource';
export default {
namespace: 'peopleInfo',
state: {
sourceData: {},
detailData: {},
isDetail: false,
editable: false,
disabled: true,
},
effects: {
*getPeopleInfo({ payload }, { put, call, select }) {
if (payload === 'clear') {
yield put({ type: 'clearList', payload: {} });
}
console.log('gogogo');
const { sourceData } = yield select(state => state.peopleInfo);
const size = sourceData.length;
console.log(size);
const coordinate = {
containerType: 'module',
containerName: 'query-RKInfo',
datasourceName: 'QueryRKTable',
};
const result = yield call(getData, coordinate, { pst: size, psz: 10 });
console.log(result);
const singularData = result[0];
yield put({ type: 'setDSRList', payload: { ...singularData } });
},
*getPeopleDetail({ payload }, { put, call }) {
const coordinate = {
containerType: 'module',
containerName: 'query-DSRInfo',
datasourceName: 'QueryDSRInfoDetails',
};
const result = yield call(getData, coordinate, { params: { pID: payload } });
console.log(result);
yield put({ type: 'getDSRDetail', payload: { ...result[0] } });
yield put({ type: 'setDetail', payload: true });
yield put({ type: 'setEdit', payload: false });
},
*updateDSRDetail({ payload }, { call, put }) {
console.log('update');
const coordinate = {
containerType: 'module',
containerName: 'query-DSRInfo',
datasourceName: 'QueryDSRInfoDetails',
};
const api = datasourceApi(coordinate);
yield call(api.update, payload.id, payload.singularData);
Toast.success('修改成功!', 1);
yield put(NavigationActions.navigate({
routeName: 'peopleInfo',
}));
yield put({ type: 'setDisabled', payload: true });
yield put({ type: 'setDetail', payload: false });
},
*onEBack({ payload }, { put, call }) {
const coordinate = {
containerType: 'module',
containerName: 'query-DSRInfo',
datasourceName: 'QueryDSRInfoTable',
};
const result = yield call(getData, coordinate, { params: { pID: payload } });
const singularData = result[0];
yield put({ type: 'setDSRList', payload: { ...singularData } });
yield put(NavigationActions.navigate({
routeName: 'peopleInfo',
}));
yield put({ type: 'setDisabled', payload: true });
yield put({ type: 'setDetail', payload: false });
},
*setStatus({ payload }, { put }) {
yield put({ type: 'setDisabled', payload: false });
yield put({ type: 'setEdit', payload });
},
},
reducers: {
// 下拉刷新用到的,清空列表的数据
clearList(state) {
return { ...state, sourceData: {} };
},
getDSRDetail(state, { payload }) {
return {
...state,
detailData: payload,
};
},
setDSRList(state, { payload }) {
return {
...state,
sourceData: payload,
};
},
setDetail(state, { payload }) {
return {
...state,
isDetail: payload,
};
},
setEdit(state, { payload }) {
return {
...state,
editable: payload,
};
},
setDisabled(state, { payload }) {
return {
...state,
disabled: payload,
};
},
},
};
...@@ -50,7 +50,7 @@ class ObligeeInfo extends React.Component { ...@@ -50,7 +50,7 @@ class ObligeeInfo extends React.Component {
} }
}; };
renderItem =({ item }) => { renderItem =({ item }) => {
console.log(item); // console.log(item);
return ( return (
<WingBlank size="lg"> <WingBlank size="lg">
<WhiteSpace size="lg" /> <WhiteSpace size="lg" />
...@@ -72,7 +72,7 @@ class ObligeeInfo extends React.Component { ...@@ -72,7 +72,7 @@ class ObligeeInfo extends React.Component {
const { sourceData, isDetail, detailData, editable, disabled } = this.props.obligeeInfo; const { sourceData, isDetail, detailData, editable, disabled } = this.props.obligeeInfo;
console.log(this.props.obligeeInfo); console.log(this.props.obligeeInfo);
const data = [sourceData]; const data = [sourceData];
console.log(data); // console.log(data);
const { getFieldProps } = this.props.form; const { getFieldProps } = this.props.form;
const test = ( const test = (
<FlatList <FlatList
......
...@@ -3,7 +3,7 @@ import { View, Text, Image, StyleSheet } from 'react-native'; ...@@ -3,7 +3,7 @@ import { View, Text, Image, StyleSheet } from 'react-native';
import { TabNavigator } from 'react-navigation'; import { TabNavigator } from 'react-navigation';
import userInfoPageScreen from './userinfopage'; import userInfoPageScreen from './userinfopage';
import fwInfo from './fwInfo'; import fwInfo from './fwInfo';
import ObligeeInfo from './houseinfo/ObligeeInfo'; import PeopleInfo from './peopleInfo/peopelInfo';
import chatsIcon from '../../../image/chats-icon.png'; import chatsIcon from '../../../image/chats-icon.png';
import Empty from '../empty'; import Empty from '../empty';
...@@ -51,7 +51,7 @@ const Content = TabNavigator({ ...@@ -51,7 +51,7 @@ const Content = TabNavigator({
}, },
}, },
RKInfo: { RKInfo: {
screen: ObligeeInfo, screen: Empty('权属信息的新增,修改,还可以勾选房子', 'DSRInfoScreen'),
navigationOptions: { navigationOptions: {
lazy: true, lazy: true,
tabBarLabel: '人口信息', tabBarLabel: '人口信息',
......
/**
* Created by zhouhuan on 2017/10/30.
*/
import React from 'react';
import { createForm } from 'rc-form';
import { View, StyleSheet, FlatList, Text, ScrollView } from 'react-native';
import { Card, WingBlank, WhiteSpace, Button, List, InputItem } from 'antd-mobile';
import { connect } from 'react-redux';
import { createAction } from '../../../utils';
@connect(({ peopleInfo, loading }) => ({ peopleInfo, loading: !!loading.effects['peopleInfo/getPeopleInfo'] }))
class PeopleInfo extends React.Component {
componentDidMount() {
this.props.dispatch(createAction('peopleInfo/getPeopleInfo')());
}
onPress = () => {
const ID = this.props.peopleInfo.sourceData.id;
this.props.dispatch(createAction('peopleInfo/getPeopleDetail')(ID));
};
onEdit =() => {
this.props.dispatch(createAction('peopleInfo/setStatus')(true));
};
onSubmit = () => {
this.props.form.validateFields({ force: true }, (error, value) => {
if (!error) {
this.props.dispatch(createAction('peopleInfo/updateDSRDetail')({ id: this.props.peopleInfo.sourceData.id, singularData: value }));
} else {
console.log('Validation failed');
}
});
};
onEditBack = () => {
this.props.dispatch(createAction('peopleInfo/onEBack')());
};
onEndReached = () => {
// 以下是制造新数据
if (!this.props.loading) {
this.props.dispatch(createAction('peopleInfo/getPeopleInfo')());
}
};
keyExtractor = item => `${item.id}`;
// 下拉刷新
renderRefresh = () => {
if (!this.props.loading) {
this.props.dispatch(createAction('peopleInfo/getPeopleInfo')('clear'));
}
};
renderItem =({ item }) => {
// console.log(item);
return (
<WingBlank size="lg">
<WhiteSpace size="lg" />
<Card>
<Card.Header
title={item.dangShiRenXingMing}
extra={<Text style={Styles.cardText} onPress={this.onPress}>&gt;&gt;详情</Text>}
/>
<Card.Body>
<Text style={Styles.cardBodyText}>当事人编号:<Text style={Styles.cardBodyText2}>{item.dangShiRenBianHao}</Text></Text>
<Text style={Styles.cardBodyText}>证件号码:<Text style={Styles.cardBodyText2}>{item.dangShiRenIdentityCard}</Text></Text>
</Card.Body>
</Card>
<WhiteSpace size="lg" />
</WingBlank>
);
};
render() {
const { sourceData, isDetail, detailData, editable, disabled } = this.props.peopleInfo;
console.log(this.props.peopleInfo);
console.log(isDetail);
// const data = [sourceData];
// console.log(data);
const { getFieldProps } = this.props.form;
/* const test = (
<FlatList
data={data}
renderItem={this.renderItem}
keyExtractor={this.keyExtractor}
onEndReachedThreshold={0.3}
onEndReached={this.onEndReached}
refreshing={this.props.loading}
onRefresh={this.renderRefresh}
/>); */
if (isDetail === false) {
return (
<View><Text>123</Text></View>
);
} else {
return (
<ScrollView>
<List>
<InputItem
{...getFieldProps('dangShiRenXingMing', {
initialValue: detailData.dangShiRenXingMing,
rules: [
{ required: true, message: '不允许为空' },
{ validator: this.validateFWBianMa },
],
})}
clear
placeholder="请输入"
editable={editable}
ref={(el) => { this.customFocusInst = el; }}
>
姓名
</InputItem>
<InputItem
{...getFieldProps('dangShiRenXingBie', {
initialValue: detailData.dangShiRenXingBie,
})}
clear
placeholder="请输入"
editable={editable}
ref={(el) => { this.customFocusInst = el; }}
>
性别
</InputItem>
<InputItem
{...getFieldProps('dangShiRenTelephone', {
initialValue: detailData.dangShiRenTelephone,
})}
clear
placeholder="请输入"
editable={editable}
ref={(el) => { this.customFocusInst = el; }}
>
电话号码
</InputItem>
<InputItem
{...getFieldProps('dangShiRenIdentityCard', {
initialValue: detailData.dangShiRenIdentityCard,
})}
clear
placeholder="请输入"
editable={editable}
ref={(el) => { this.customFocusInst = el; }}
>
身份证号码
</InputItem>
<InputItem
{...getFieldProps('dangShiRenIdentityCardbak', {
initialValue: detailData.dangShiRenIdentityCardbak,
})}
clear
placeholder="请输入"
editable={editable}
ref={(el) => { this.customFocusInst = el; }}
>
身份证类型
</InputItem>
<InputItem
{...getFieldProps('dangShiRenAddress', {
initialValue: detailData.dangShiRenAddress,
})}
clear
placeholder="请输入"
editable={editable}
ref={(el) => { this.customFocusInst = el; }}
>
地址
</InputItem>
<InputItem
{...getFieldProps('DSRMaritalStatus', {
initialValue: detailData.DSRMaritalStatus,
})}
clear
placeholder="请输入"
editable={editable}
ref={(el) => { this.customFocusInst = el; }}
>
婚姻状态
</InputItem>
<InputItem
{...getFieldProps('DSRCensusType', {
initialValue: detailData.DSRCensusType,
})}
clear
placeholder="请输入"
editable={editable}
ref={(el) => { this.customFocusInst = el; }}
>
是否原村民
</InputItem>
<List.Item>
<View style={{ flexDirection: 'row' }}>
<Button style={{ marginRight: 8 }} type="primary" onClick={this.onEdit}>编辑</Button>
<Button style={{ marginRight: 8 }} onClick={this.onSubmit} disabled={disabled}>保存</Button>
<Button onClick={this.onEditBack}>返回</Button>
</View>
</List.Item>
</List>
</ScrollView>
);
}
}
}
const Styles = StyleSheet.create({
cardText: {
color: '#2196F3',
textAlign: 'right',
},
cardBodyText: {
marginBottom: 10,
marginLeft: 13,
},
});
export default createForm()(PeopleInfo);
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论