提交 6932cc9c authored 作者: 吴强's avatar 吴强

fix bug

上级 d7a88e4b
......@@ -12,7 +12,7 @@ class FlatListItem extends PureComponent {
return (
<TouchableOpacity
{...this.props}
style={{ height: 120 }}
style={{ height: this.props.height }}
onPress={this.onPress}
>
<WingBlank size="lg">
......
/**
* 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';
import { getData, getMeta } from '../../utils/DataTemplate';
export default {
namespace: 'obligeeInfo',
state: {
sourceData: {},
detailData: {},
metas: [],
isDetail: false,
editable: false,
disabled: true,
},
effects: {
*getObligeeInfo({ payload }, { put, call, select }) {
if (payload.type === 'clear') {
yield put({ type: 'clearList', payload: {} });
}
const { sourceData } = yield select(state => state.obligeeInfo);
const size = sourceData.length;
const coordinate = {
containerType: 'module',
containerName: 'query-DSRInfo',
datasourceName: 'QueryDSRInfoTable',
};
const result = yield call(getData, coordinate, { pst: size, psz: 10, params: { pID: payload.id } });
const singularData = result[0];
yield put({ type: 'setDSRList', payload: { ...singularData } });
},
*getObligeeDetail({ payload }, { put, call }) {
const coordinate = {
containerType: 'module',
containerName: 'query-DSRInfo',
datasourceName: 'QueryDSRInfoDetails',
datasourceName: 'QueryDSRInfoRelation',
};
const result = yield call(getData, coordinate, { params: { pID: payload } });
yield put({ type: 'getDSRDetail', payload: { ...result[0] } });
yield put({ type: 'setDetail', payload: true });
yield put({ type: 'setEdit', payload: false });
},
*updateDSRDetail({ payload }, { call, put }) {
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: 'ObligeeInfo',
}));
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: 'ObligeeInfo',
}));
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 });
const metas = yield call(getMeta, coordinate);
yield put({ type: 'setMetas', payload: metas });
},
},
reducers: {
// 下拉刷新用到的,清空列表的数据
clearList(state) {
return { ...state, sourceData: {} };
},
getDSRDetail(state, { payload }) {
return {
...state,
detailData: payload,
};
},
setDSRList(state, { payload }) {
return {
...state,
sourceData: payload,
};
},
setMetas(state, { payload }) {
return { ...state, metas: payload };
},
setDetail(state, { payload }) {
return {
...state,
isDetail: payload,
};
},
setEdit(state, { payload }) {
return {
...state,
editable: payload,
};
},
setDisabled(state, { payload }) {
return {
...state,
disabled: payload,
};
},
},
};
......@@ -49,7 +49,6 @@ export default {
yield take('addPeople/@@end');
}
} catch (err) {
console.info(err);
}
},
*addPeople({ payload }, { put }) {
......@@ -159,12 +158,14 @@ export default {
detailData: payload,
};
},
setdetailData(state, { payload: { peopleName, idcard, birthDay, people } }) {
setdetailData(state, { payload: { peopleName, idcard, birthDay, people, sex, addr } }) {
const detailData = {
xingMing: peopleName,
identityCard: idcard,
birthday: birthDay,
minZu: people,
sex,
huJiDiZhi: addr,
};
return { ...state, detailData };
},
......
......@@ -29,7 +29,6 @@ export default {
return { ...state, metas: payload };
},
setSearchValue(state, { payload }) {
console.info(payload);
return {
...state,
searchValue: payload,
......@@ -40,13 +39,12 @@ export default {
*jumpPage({ payload: id }, { put }) {
yield put({ type: 'setQSID', payload: id });
yield put(NavigationActions.navigate({
routeName: 'QuanshuDetailScreen',
routeName: 'quanshuInfoDetail',
params: { id },
}));
},
*getQSList({ payload }, { take, put, call, select }) {
const { clear, pZhengShuMingCheng } = payload;
console.info(payload);
// console.info(payload);
if (clear === 'clear') {
yield put({ type: 'clearList', payload: {} });
......@@ -59,7 +57,6 @@ export default {
datasourceName: 'QueryfwqsTable',
};
const result = yield call(getData, coordinate, { pst: size, psz: 10, params: { pZhengShuMingCheng } });
console.info(result);
const meta = yield call(getMeta, coordinate);
yield put({ type: 'setMetas', payload: meta });
for (const row of result) {
......
......@@ -30,7 +30,7 @@ class DSRInfoScreeen extends Component {
this.props.dispatch(createAction('DSRInfo/jumpPage')(id));
};
getItemLayout = (data, index) => (
{ length: 120, offset: (120 + 1) * index, index }
{ length: 200, offset: (200 + 1) * index, index }
);
/**
* 此函数用于为给定的item生成一个不重复的Key。
......@@ -76,6 +76,7 @@ class DSRInfoScreeen extends Component {
renderItem = ({ item }) => {
return (
<FlatListItem
height={200}
title={item.dangShiRenXingMing}
meta={this.props.DSRInfo.metas}
item={item}
......
import React, { Component } from 'react';
import { View, ScrollView, Text } from 'react-native';
import { List, InputItem, Button, Toast, WhiteSpace, WingBlank } from 'antd-mobile';
import Icon from 'react-native-vector-icons/FontAwesome';
import { View, ScrollView } from 'react-native';
import { List, WhiteSpace } from 'antd-mobile';
import { createForm } from 'rc-form';
import { connect } from 'react-redux';
import { createAction } from '../../../utils/index';
......@@ -34,11 +33,11 @@ class HouseDetail extends Component {
<View>
<ScrollView>
<View style={{ flex: 1, flexDirection: 'column' }}>
<WhiteSpace />
{ /* <WhiteSpace />
<View style={{ width: 80, height: 40 }}>
<Button type="primary" onClick={this.modifyInfo}>编辑</Button>
</View>
<WhiteSpace />
<WhiteSpace /> */}
<View>
<List className="my-list">
{list}
......
......@@ -2,9 +2,8 @@
* 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 { ScrollView } from 'react-native';
import { List } from 'antd-mobile';
import { connect } from 'react-redux';
import { createAction } from '../../../utils';
......@@ -12,199 +11,82 @@ import { createAction } from '../../../utils';
class ObligeeInfo extends React.Component {
componentDidMount() {
const { houseID } = this.props.ListHouse;
this.props.dispatch(createAction('obligeeInfo/getObligeeInfo')({ id: houseID }));
this.props.dispatch(createAction('obligeeInfo/getObligeeDetail')(houseID));
}
onPress = () => {
const ID = this.props.obligeeInfo.sourceData.id;
this.props.dispatch(createAction('obligeeInfo/getObligeeDetail')(ID));
};
onEdit =() => {
this.props.dispatch(createAction('obligeeInfo/setStatus')(true));
};
onSubmit = () => {
this.props.form.validateFields({ force: true }, (error, value) => {
if (!error) {
this.props.dispatch(createAction('obligeeInfo/updateDSRDetail')({ id: this.props.obligeeInfo.sourceData.id, singularData: value }));
} else {
console.log('Validation failed');
}
});
};
onEditBack = () => {
const { houseID } = this.props.ListHouse;
this.props.dispatch(createAction('obligeeInfo/onEBack')(houseID));
};
onEndReached = () => {
// 以下是制造新数据
if (!this.props.loading) {
const { houseID } = this.props.ListHouse;
this.props.dispatch(createAction('obligeeInfo/getObligeeInfo')({ id: houseID }));
}
};
keyExtractor = item => `${item.id}`;
// 下拉刷新
renderRefresh = () => {
if (!this.props.loading) {
const { houseID } = this.props.ListHouse;
this.props.dispatch(createAction('obligeeInfo/getObligeeInfo')({ id: houseID, type: '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>
);
};
// onPress = () => {
// const ID = this.props.obligeeInfo.sourceData.id;
// this.props.dispatch(createAction('obligeeInfo/getObligeeDetail')(ID));
// };
// onEdit =() => {
// this.props.dispatch(createAction('obligeeInfo/setStatus')(true));
// };
// onSubmit = () => {
// this.props.form.validateFields({ force: true }, (error, value) => {
// if (!error) {
// this.props.dispatch(createAction('obligeeInfo/updateDSRDetail')({ id: this.props.obligeeInfo.sourceData.id, singularData: value }));
// } else {
// console.log('Validation failed');
// }
// });
// };
// onEditBack = () => {
// const { houseID } = this.props.ListHouse;
// this.props.dispatch(createAction('obligeeInfo/onEBack')(houseID));
// };
// onEndReached = () => {
// // 以下是制造新数据
// if (!this.props.loading) {
// const { houseID } = this.props.ListHouse;
// this.props.dispatch(createAction('obligeeInfo/getObligeeInfo')({ id: houseID }));
// }
// };
// keyExtractor = item => `${item.id}`;
// // 下拉刷新
// renderRefresh = () => {
// if (!this.props.loading) {
// const { houseID } = this.props.ListHouse;
// this.props.dispatch(createAction('obligeeInfo/getObligeeInfo')({ id: houseID, type: '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.obligeeInfo;
// console.log(this.props.obligeeInfo);
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 (
test
);
} else {
const { detailData, metas } = this.props.obligeeInfo;
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; }}
{
metas.map((m) => {
return (
<List.Item
key={m.key}
extra={detailData[m.key]}
>
是否原村民
</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>
{m.label}
</List.Item>
);
})
}
</List>
</ScrollView>
);
}
}
}
const Styles = StyleSheet.create({
cardText: {
color: '#2196F3',
textAlign: 'right',
},
cardBodyText: {
marginBottom: 10,
marginLeft: 13,
},
});
export default createForm()(ObligeeInfo);
export default ObligeeInfo;
......@@ -80,6 +80,7 @@ class ListHouContent extends Component {
renderItem = ({ item }) => {
return (
<FlatListItem
height={120}
title={item.fangWuZuoLuo}
meta={this.props.ListHouse.metas}
item={item}
......
......@@ -20,7 +20,6 @@ class PeopleInfo extends React.Component {
};
onSearchChange = (pxingMing) => {
this.props.dispatch(createAction('peopleInfo/setSearchValue')(pxingMing));
console.info(this.props.peopleInfo);
};
onPressItem = (id) => {
this.props.dispatch(createAction('peopleInfo/jumpPage')(id));
......@@ -44,6 +43,7 @@ class PeopleInfo extends React.Component {
renderItem =({ item }) => {
return (
<FlatListItem
height={120}
title={item.xingMing}
meta={this.props.peopleInfo.metas}
item={item}
......
......@@ -79,6 +79,7 @@ class QuanshuList extends Component {
renderItem = ({ item }) => {
return (
<FlatListItem
height={120}
title={item.zhengShuMingCheng}
meta={this.props.QSInfo.metas}
item={item}
......
......@@ -6,7 +6,7 @@ import { errors } from './error';
import { checkStatus, normParams, parseObject } from './http-helper';
const defaultOptions = {
timeout: 30 * 1000,
timeout: 3 * 1000,
headers: { Accept: 'application/json' },
};
......@@ -35,7 +35,6 @@ export default async function request(url, params = {}, options = {}, auth = tru
if (queryParams) {
realUrl = `${url}?${queryParams}`;
}
console.log(fetch);
return fetch(realUrl, _.defaults(options, defaultOptions))
.then(checkStatus)
.then(parseObject);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论