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

fix bug

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