提交 cf9825f8 authored 作者: 吴强's avatar 吴强

添加新增人口Detail界面3

上级 e85ec686
...@@ -41,40 +41,26 @@ export default { ...@@ -41,40 +41,26 @@ export default {
})); }));
}, },
*getHouseList({ payload }, { take, put, call, select }) { *getHouseList({ payload }, { take, put, call, select }) {
console.info(1);
const { clear, pFWDiZhi } = payload; const { clear, pFWDiZhi } = payload;
console.info(2);
if (clear === 'clear') { if (clear === 'clear') {
console.info(3);
yield put({ type: 'clearList', payload: {} }); yield put({ type: 'clearList', payload: {} });
console.info(4);
} }
const { sourceData } = yield select(state => state.ListHouse); const { sourceData } = yield select(state => state.ListHouse);
console.info(5);
const size = sourceData.length; const size = sourceData.length;
console.info(6);
const coordinate = { const coordinate = {
containerType: 'module', containerType: 'module',
containerName: 'query-DSRFWInfo', containerName: 'query-DSRFWInfo',
datasourceName: 'QueryfwTable', datasourceName: 'QueryfwTable',
}; };
console.info(7);
const result = yield call(getData, coordinate, { pst: size, psz: 10, params: { pFWDiZhi } }); const result = yield call(getData, coordinate, { pst: size, psz: 10, params: { pFWDiZhi } });
console.info(78);
const meta = yield call(getMeta, coordinate); const meta = yield call(getMeta, coordinate);
console.info(9);
yield put({ type: 'setMetas', payload: meta }); yield put({ type: 'setMetas', payload: meta });
console.info(10);
for (const row of result) { for (const row of result) {
console.info(11);
yield put({ type: 'addHouse', payload: row }); yield put({ type: 'addHouse', payload: row });
console.info(12);
yield take('addHouse/@@end'); yield take('addHouse/@@end');
console.info(13);
} }
}, },
*addHouse({ payload }, { put }) { *addHouse({ payload }, { put }) {
console.info(11111);
yield put({ type: 'setList', payload: { arrayData: [payload] } }); yield put({ type: 'setList', payload: { arrayData: [payload] } });
}, },
}, },
......
...@@ -34,17 +34,14 @@ export default { ...@@ -34,17 +34,14 @@ export default {
yield put({ type: 'clearList', payload: {} }); yield put({ type: 'clearList', payload: {} });
} }
const { sourceData } = yield select(state => state.peopleInfo); const { sourceData } = yield select(state => state.peopleInfo);
console.info(sourceData);
const size = sourceData.length; const size = sourceData.length;
const coordinate = { const coordinate = {
containerType: 'module', containerType: 'module',
containerName: 'query-RKInfo', containerName: 'query-RKInfo',
datasourceName: 'QueryRKTable', datasourceName: 'QueryRKTable',
}; };
console.info(`pst${size}params${pxingMing}`);
try { try {
const result = yield call(getData, coordinate, { pst: size, psz: 10, params: { pxingMing } }); const result = yield call(getData, coordinate, { pst: size, psz: 10, params: { pxingMing } });
console.info(sourceData);
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) {
...@@ -65,12 +62,10 @@ export default { ...@@ -65,12 +62,10 @@ export default {
datasourceName: 'QueryRKDetails', datasourceName: 'QueryRKDetails',
}; };
const result = yield call(getData, coordinate, { params: { pID: payload } }); const result = yield call(getData, coordinate, { params: { pID: payload } });
console.log(result);
yield put({ type: 'getPeopleDetailInfo', payload: { ...result[0] } }); yield put({ type: 'getPeopleDetailInfo', payload: { ...result[0] } });
yield put({ type: 'setEdit', payload: false }); yield put({ type: 'setEdit', payload: false });
}, },
*savePeopleInfo({ payload }, { put, call }) { *savePeopleInfo({ payload }, { put, call }) {
console.log(payload);
const coordinate = { const coordinate = {
containerType: 'module', containerType: 'module',
containerName: 'query-RKInfo', containerName: 'query-RKInfo',
...@@ -89,13 +84,13 @@ export default { ...@@ -89,13 +84,13 @@ export default {
routeName: 'addPeoppleInfo', routeName: 'addPeoppleInfo',
})); }));
}, },
*GoToPeopleDetailEditScreen(ignore, { put }) { *GoToPeopleDetailEditScreen({ payload: id }, { put }) {
yield put({ type: 'setPeopPleID', payload: id });
yield put(NavigationActions.navigate({ yield put(NavigationActions.navigate({
routeName: 'peopleInfoDetailEdit', routeName: 'peopleInfoDetailEdit',
})); }));
}, },
*updateDSRDetail({ payload }, { call, put }) { *updateDSRDetail({ payload }, { call, put }) {
console.log('update');
const coordinate = { const coordinate = {
containerType: 'module', containerType: 'module',
containerName: 'query-RKInfo', containerName: 'query-RKInfo',
...@@ -137,7 +132,6 @@ export default { ...@@ -137,7 +132,6 @@ export default {
try { try {
Toast.loading('读卡中...', 0); Toast.loading('读卡中...', 0);
const result = yield call(scan); const result = yield call(scan);
console.info(result);
if (result) { if (result) {
yield put({ type: 'setdetailData', payload: result }); yield put({ type: 'setdetailData', payload: result });
} }
......
...@@ -12,8 +12,7 @@ import { createAction } from '../../../utils'; ...@@ -12,8 +12,7 @@ import { createAction } from '../../../utils';
@connect(({ peopleInfo }) => ({ peopleInfo })) @connect(({ peopleInfo }) => ({ peopleInfo }))
class PeopleDetailEditScreen extends React.Component { class PeopleDetailEditScreen extends React.Component {
componentDidMount() { componentDidMount() {
const { id } = this.props.navigation.state.params; this.props.dispatch(createAction('peopleInfo/getPeopleDetail')(this.props.peopleInfo.peopleID));
this.props.dispatch(createAction('peopleInfo/getPeopleDetail')(id));
} }
onSubmit = () => { onSubmit = () => {
this.props.form.validateFields({ force: true }, (error, value) => { this.props.form.validateFields({ force: true }, (error, value) => {
...@@ -26,7 +25,6 @@ class PeopleDetailEditScreen extends React.Component { ...@@ -26,7 +25,6 @@ class PeopleDetailEditScreen extends React.Component {
}; };
render() { render() {
const { detailData, metas } = this.props.peopleInfo; const { detailData, metas } = this.props.peopleInfo;
console.log(this.props.peopleInfo);
const { getFieldProps } = this.props.form; const { getFieldProps } = this.props.form;
return ( return (
<ScrollView> <ScrollView>
......
...@@ -15,118 +15,43 @@ class PeopleDetailInfo extends React.Component { ...@@ -15,118 +15,43 @@ class PeopleDetailInfo extends React.Component {
this.props.dispatch(createAction('peopleInfo/getPeopleDetail')(id)); this.props.dispatch(createAction('peopleInfo/getPeopleDetail')(id));
} }
onEdit =() => { onEdit =() => {
this.props.dispatch(createAction('peopleInfo/GoToPeopleDetailEditScreen')()); const { id } = this.props.navigation.state.params;
this.props.dispatch(createAction('peopleInfo/GoToPeopleDetailEditScreen')(id));
}; };
render() { render() {
const { detailData, editable, metas } = this.props.peopleInfo; const { detailData, metas } = this.props.peopleInfo;
if (editable === true) { return (
return ( <ScrollView>
<ScrollView> <WhiteSpace />
<WhiteSpace/> <WhiteSpace />
<View style={{flexDirection: 'row', justifyContent: 'space-between'}}> <WingBlank>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Icon.Button <Icon.Button
name="id-card" name="edit"
backgroundColor="#08BBF9" backgroundColor="#08BBF9"
onPress={() => { onPress={this.onEdit}
this.props.dispatch({type: 'peopleInfo/DuKa'});
}}
> >
读卡 编辑
</Icon.Button> </Icon.Button>
</View> </View>
<WhiteSpace/> <WhiteSpace />
<List> <List>
{ {
metas.map((m) => { metas.map((m) => {
if (m.required === true) { return (
return ( <List.Item
<InputItem key={m.key}
{...getFieldProps(m.key, { extra={detailData[m.key]}
initialValue: detailData[m.key], >
rules: [ {m.label}
{required: true, message: '不允许为空'}, </List.Item>
{validator: this.validateNoNull}, );
], })
})}
clear
placeholder="请输入"
ref={(el) => {
this.customFocusInst = el;
}}
>
{m.label}
</InputItem>
);
} else {
return (
<InputItem
{...getFieldProps(m.key, {
initialValue: detailData[m.key],
})}
clear
placeholder="请输入"
ref={(el) => {
this.customFocusInst = el;
}}
>
{m.label}
</InputItem>
);
}
})}
{[1].map(() => {
return (
<List.Item>
<View style={{flexDirection: 'row', justifyContent: 'center'}}>
<Icon.Button
name="save"
backgroundColor="#08BBF9"
onPress={this.onSubmit}
>
保存
</Icon.Button>
</View>
</List.Item>
);
})
} }
</List> </List>
</ScrollView> </WingBlank>
); </ScrollView>
} else { );
return (
<ScrollView>
<WhiteSpace />
<WhiteSpace />
<WingBlank>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Icon.Button
name="edit"
backgroundColor="#08BBF9"
onPress={this.onEdit}
>
编辑
</Icon.Button>
</View>
<WhiteSpace />
<List>
{
metas.map((m) => {
return (
<List.Item
key={m.key}
extra={detailData[m.key]}
>
{m.label}
</List.Item>
);
})
}
</List>
</WingBlank>
</ScrollView>
);
}
} }
} }
export default PeopleDetailInfo; export default PeopleDetailInfo;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论