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

添加新增人口Detail界面3

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