Commit ac1c7cb5 authored by cellee's avatar cellee

删除小区

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 58c7aac0
/*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-12-14 18:28:21
* @LastEditTime: 2020-12-29 09:52:26
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\init.ts
......@@ -40,5 +40,12 @@ export default {
localStorage.setItem('CommunityList', JSON.stringify(CommunityList));
yield put({ type: 'returnCommunityList', CommunityList });
},
// 删除
*delCommunityget({ playload }, { call, put, select }) {
const CommunityList = playload ? playload.Result : [];
localStorage.setItem('CommunityList', JSON.stringify(CommunityList));
yield put({ type: 'returnCommunityList', CommunityList });
},
},
};
......@@ -18,7 +18,7 @@ import fileDownload from 'js-file-download';
const Detail = (props: any) => {
const module = 'CellList';
const { detailData, DataSave, dispatch, loading, overCom, user } = props;
const { detailData, DataSave, dispatch, loading, overCom, user, CommunityList } = props;
useEffect(() => {
if (DataSave) {
......@@ -32,11 +32,16 @@ const Detail = (props: any) => {
useEffect(() => {
if (overCom != null) {
message.success(`Community Deleted Successfully`);
history.push('/CommunityManagement/CellList');
// 然后在清空删除成功数据
dispatch({
type: module + '/comRemove',
});
dispatch({ type: module + '/comRemove' });
// 在删除搜索小区
let a = detailData.rows.residentialName; // 当前删除小区
let c = CommunityList.filter((item: any) => item != a); // 过滤掉
dispatch({ type: 'Init/delCommunityget', playload: { Result: c } });
// 跳转
history.push('/CommunityManagement/CellList');
}
}, [overCom]);
......@@ -301,8 +306,9 @@ const Detail = (props: any) => {
// export default Adds;
function map(state: any) {
const { DataSave, detailData, imgUrl, overCom } = state.CellList; // 上层传递来的值
const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.CellList;
const user = state.user;
return { DataSave, detailData, loading, imgUrl, overCom, user };
return { DataSave, detailData, loading, imgUrl, overCom, user, CommunityList };
}
export default connect(map)(Detail);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment