Commit ac1c7cb5 authored by cellee's avatar cellee

删除小区

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 58c7aac0
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-11-19 16:54:53 * @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 * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\init.ts * @FilePath: \tostumi\src\models\init.ts
...@@ -40,5 +40,12 @@ export default { ...@@ -40,5 +40,12 @@ export default {
localStorage.setItem('CommunityList', JSON.stringify(CommunityList)); localStorage.setItem('CommunityList', JSON.stringify(CommunityList));
yield put({ type: 'returnCommunityList', 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'; ...@@ -18,7 +18,7 @@ import fileDownload from 'js-file-download';
const Detail = (props: any) => { const Detail = (props: any) => {
const module = 'CellList'; const module = 'CellList';
const { detailData, DataSave, dispatch, loading, overCom, user } = props; const { detailData, DataSave, dispatch, loading, overCom, user, CommunityList } = props;
useEffect(() => { useEffect(() => {
if (DataSave) { if (DataSave) {
...@@ -32,11 +32,16 @@ const Detail = (props: any) => { ...@@ -32,11 +32,16 @@ const Detail = (props: any) => {
useEffect(() => { useEffect(() => {
if (overCom != null) { if (overCom != null) {
message.success(`Community Deleted Successfully`); message.success(`Community Deleted Successfully`);
history.push('/CommunityManagement/CellList');
// 然后在清空删除成功数据 // 然后在清空删除成功数据
dispatch({ dispatch({ type: module + '/comRemove' });
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]); }, [overCom]);
...@@ -301,8 +306,9 @@ const Detail = (props: any) => { ...@@ -301,8 +306,9 @@ const Detail = (props: any) => {
// export default Adds; // export default Adds;
function map(state: any) { function map(state: any) {
const { DataSave, detailData, imgUrl, overCom } = state.CellList; // 上层传递来的值 const { DataSave, detailData, imgUrl, overCom } = state.CellList; // 上层传递来的值
const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.CellList; const loading = state.loading.models.CellList;
const user = state.user; const user = state.user;
return { DataSave, detailData, loading, imgUrl, overCom, user }; return { DataSave, detailData, loading, imgUrl, overCom, user, CommunityList };
} }
export default connect(map)(Detail); 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