Commit 29b2228f authored by cellee's avatar cellee

权限分配

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 64029eb2
...@@ -48,13 +48,7 @@ export default { ...@@ -48,13 +48,7 @@ export default {
//标准请求 //标准请求
*RA({ playload }, { call, put }) { *RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload); const resp = yield call(service.RA, playload);
// if (resp.code == 500||resp.error_code!="0000") { if (resp.error_code != '0000') {
// }
if (resp.code == 500 && resp.error_code != '0000') {
getObjectInfo(playload.body);
printf(playload, resp);
message.error(`${resp.code}:${resp.msg}`);
} else if (resp.error_code == '0001') {
getObjectInfo(playload.body); getObjectInfo(playload.body);
printf(playload, resp); printf(playload, resp);
message.error(`${resp.error_code}:${resp.error_msg}`); message.error(`${resp.error_code}:${resp.error_msg}`);
...@@ -79,9 +73,9 @@ export default { ...@@ -79,9 +73,9 @@ export default {
let village = null; let village = null;
yield put({ type: 'returnPage', Data }); yield put({ type: 'returnPage', Data });
yield put({ type: 'returnVillage', village }); yield put({ type: 'returnVillage', village });
// 提示跳转
message.success(`Information saved successfully!`); // 告知结果
history.push('/CommunityManagement/CellList'); yield put({ type: 'returnResult', Result });
} }
break; break;
case 32: // 获取小区详情 case 32: // 获取小区详情
......
/*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-12-14 18:28:21
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\models\init.ts
*/
import * as service from '../services/Init'; import * as service from '../services/Init';
import { message } from 'antd'; import { message } from 'antd';
...@@ -20,6 +28,16 @@ export default { ...@@ -20,6 +28,16 @@ export default {
*tosCommunityget({ playload }, { call, put }) { *tosCommunityget({ playload }, { call, put }) {
const resp = yield call(service.tosCommunityget, playload); const resp = yield call(service.tosCommunityget, playload);
let CommunityList = resp.data.communityList; let CommunityList = resp.data.communityList;
localStorage.setItem('CommunityList', JSON.stringify(CommunityList));
yield put({ type: 'returnCommunityList', CommunityList });
},
// 新增,
*addCommunityget({ playload }, { call, put, select }) {
const newData = playload ? playload.Result : []; // 如果是null 就是空数组
const village = yield select((state) => state.Init.CommunityList);
const CommunityList = [...village, ...newData];
localStorage.setItem('CommunityList', JSON.stringify(CommunityList));
yield put({ type: 'returnCommunityList', CommunityList }); yield put({ type: 'returnCommunityList', CommunityList });
}, },
}, },
......
...@@ -139,6 +139,7 @@ const Model: LoginModelType = { ...@@ -139,6 +139,7 @@ const Model: LoginModelType = {
// 清楚用户信息 // 清楚用户信息
localStorage.removeItem('userInfo'); localStorage.removeItem('userInfo');
localStorage.removeItem('permission'); localStorage.removeItem('permission');
localStorage.removeItem('CommunityList');
setCookie('token', ''); setCookie('token', '');
setCookie('id', ''); setCookie('id', '');
setCookie('name', ''); setCookie('name', '');
......
...@@ -31,7 +31,7 @@ const { RangePicker } = TimePicker; ...@@ -31,7 +31,7 @@ const { RangePicker } = TimePicker;
const Adds = (props: any) => { const Adds = (props: any) => {
const module = 'CellList'; const module = 'CellList';
const { Data, dispatch, loading, imgUrl } = props; const { Data, dispatch, loading, imgUrl, Result } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -102,6 +102,17 @@ const Adds = (props: any) => { ...@@ -102,6 +102,17 @@ const Adds = (props: any) => {
} }
}, [Data]); }, [Data]);
// 提交成功与否
useEffect(() => {
if (Result != null) {
// 更新本地小区
dispatch({ type: 'Init/addCommunityget', playload: { Result: new Array(Result.data) } });
// 提示跳转
message.success(`Information saved successfully!`);
history.push('/CommunityManagement/CellList');
}
}, [Result]);
// 监听编辑预览是否获取到地址以及发生改变 // 监听编辑预览是否获取到地址以及发生改变
useEffect(() => { useEffect(() => {
if (imgUrl != null) { if (imgUrl != null) {
...@@ -622,10 +633,11 @@ const Adds = (props: any) => { ...@@ -622,10 +633,11 @@ const Adds = (props: any) => {
// export default Adds; // export default Adds;
function map(state: any) { function map(state: any) {
console.log(state);
const Data = state.CellList.DataSave; const Data = state.CellList.DataSave;
const { imgUrl } = state.CellList; const { imgUrl, Result } = state.CellList;
const loading = state.loading.models.CellList ? state.loading.models.CellList : false; const loading = state.loading.models.CellList ? state.loading.models.CellList : false;
const { Result } = state.CellList;
return { Data, loading, Result, imgUrl }; return { Data, loading, Result, imgUrl };
} }
export default connect(map)(Adds); export default connect(map)(Adds);
...@@ -10,8 +10,6 @@ import TitleSearch from '@/components/TitleSearch/TitleSearch'; ...@@ -10,8 +10,6 @@ import TitleSearch from '@/components/TitleSearch/TitleSearch';
import { RA, SA } from '@/utils/method'; import { RA, SA } from '@/utils/method';
import { objectColumns } from '@/utils/string'; import { objectColumns } from '@/utils/string';
import { getCookie } from '@/utils/method';
const module = 'CellList'; const module = 'CellList';
import './celllist.less'; import './celllist.less';
...@@ -59,59 +57,43 @@ const CellLists = (props: any) => { ...@@ -59,59 +57,43 @@ const CellLists = (props: any) => {
], ],
]); ]);
const { dispatch, Data, loading, curString, village } = props; const { dispatch, loading, curString, village, Init } = props;
const [term, setTerm] = useState({} as any); // 拉取数据的条件存储 const [term, setTerm] = useState({ communityNameList: Init.CommunityList, pageNum: 1 } as any); // 拉取数据的条件存储
// 翻页数据 // 监听是否有数据
// function pagesList(name: string, list: any, num: number) {
// let msg = {
// residentialManagerUserName: name ? name : '',
// communityNameList: list,
// pageNum: num,
// };
// return msg;
// }
// 监听是否有小区列表
useEffect(() => { useEffect(() => {
if (Data != null) { if (village == null) {
let obj = { const obj = {
residentialManagerUserName: '', communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
communityNameList: Data.communityList,
pageNum: 1, pageNum: 1,
}; };
setTerm(obj); // 存进搜索条件 setTerm(obj);
} else { RA(48, obj, module, dispatch);
const userInfo = localStorage.getItem('userInfo') || '';
const id = JSON.parse(userInfo).userModel.id;
RA(55, { id: id }, module, dispatch);
}
}, [Data]);
// 监听是否有数据
useEffect(() => {
if (village == null) {
RA(48, term, module, dispatch);
} }
}, [village]); }, [village]);
const goToAdd = () => { const goToAdd = () => {
SA(null as any, module, dispatch); // 清空之前传递的数据 emptys(null);
dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
history.push('/CommunityManagement/CellList/Add'); history.push('/CommunityManagement/CellList/Add');
}; };
const goToEdit = (values: any, e: any) => { const goToEdit = (values: any, e: any) => {
dispatch({ type: module + '/urlRemove' }); // 清掉图片信息 emptys(values);
SA(values, module, dispatch);
history.push('/CommunityManagement/CellList/Add'); history.push('/CommunityManagement/CellList/Add');
}; };
const goToDetail = (values: any, e: any) => { const goToDetail = (values: any, e: any) => {
dispatch({ type: module + '/urlRemove' }); // 清掉图片信息 emptys(values);
SA(values, module, dispatch);
history.push('/CommunityManagement/CellList/Detail'); history.push('/CommunityManagement/CellList/Detail');
}; };
// 清除操作之前的数据
const emptys = (data: any) => {
dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
SA(data, module, dispatch);
dispatch({ type: module + '/ResultClear' }); // 清空之前保存成功的结果
};
// 点击搜索 // 点击搜索
const CallBackTitleSearch = (comment: any) => { const CallBackTitleSearch = (comment: any) => {
...@@ -122,7 +104,6 @@ const CellLists = (props: any) => { ...@@ -122,7 +104,6 @@ const CellLists = (props: any) => {
pageNum: 1, pageNum: 1,
}; };
setTerm(obj); // 存进搜索条件 setTerm(obj); // 存进搜索条件
RA(48, obj, module, dispatch); RA(48, obj, module, dispatch);
} else { } else {
message.error('Please Enter And Select A Content To Search!'); message.error('Please Enter And Select A Content To Search!');
...@@ -205,7 +186,8 @@ const CellLists = (props: any) => { ...@@ -205,7 +186,8 @@ const CellLists = (props: any) => {
function map(state: any) { function map(state: any) {
const loading = state.loading.models.CellList; const loading = state.loading.models.CellList;
const Init = state.Init;
const { Data, curString, village } = state[module]; const { Data, curString, village } = state[module];
return { Data, loading, curString, village }; return { Data, loading, curString, village, Init };
} }
export default connect(map)(CellLists); export default connect(map)(CellLists);
...@@ -297,7 +297,6 @@ const Detail = (props: any) => { ...@@ -297,7 +297,6 @@ const Detail = (props: any) => {
function map(state: any) { function map(state: any) {
const { DataSave, detailData, imgUrl, overCom } = state.CellList; // 上层传递来的值 const { DataSave, detailData, imgUrl, overCom } = state.CellList; // 上层传递来的值
const loading = state.loading.models.CellList; const loading = state.loading.models.CellList;
console.log(state);
return { DataSave, detailData, loading, imgUrl, overCom }; return { DataSave, detailData, loading, imgUrl, overCom };
} }
export default connect(map)(Detail); export default connect(map)(Detail);
...@@ -136,14 +136,19 @@ const FacilityBookings = (props: any) => { ...@@ -136,14 +136,19 @@ const FacilityBookings = (props: any) => {
setColumns2(objectColumns(key2) as any); setColumns2(objectColumns(key2) as any);
if (curString.tab == 1) { if (curString.tab == 1) {
RA(9, { RA(9, {
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
userToken: token, userToken: token,
pageNum: curString.curPage, pageNum: curString.curPage,
subscribeDate: curString.subscribeDate, subscribeDate: curString.subscribeDate,
status: curString.status, status: curString.status,
communityNameList: curString.communityNameList, // communityNameList: curString.communityNameList,
}); });
} else { } else {
RA(8, { userToken: token, pageNum: curString.curPage2 }); RA(8, {
userToken: token,
pageNum: curString.curPage2,
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
});
} }
}, []); }, []);
...@@ -190,14 +195,19 @@ const FacilityBookings = (props: any) => { ...@@ -190,14 +195,19 @@ const FacilityBookings = (props: any) => {
QA(tmp); QA(tmp);
if (tab == 1) { if (tab == 1) {
RA(9, { RA(9, {
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
userToken: token, userToken: token,
status: curString.status, status: curString.status,
subscribeDate: curString.subscribeDate, subscribeDate: curString.subscribeDate,
pageNum: curString.curPage, pageNum: curString.curPage,
communityNameList: curString.communityNameList, // communityNameList: curString.communityNameList,
}); });
} else { } else {
RA(8, { userToken: token, pageNum: curString.curPage2 }); RA(8, {
userToken: token,
pageNum: curString.curPage2,
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
});
} }
} }
function Pagechange(current: any, pageSize: any) { function Pagechange(current: any, pageSize: any) {
...@@ -378,6 +388,7 @@ const FacilityBookings = (props: any) => { ...@@ -378,6 +388,7 @@ const FacilityBookings = (props: any) => {
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
console.log(state);
const { Data, Data2, DataSave, curString, Result } = state.FacilityBookings; const { Data, Data2, DataSave, curString, Result } = state.FacilityBookings;
const { token } = state.login; const { token } = state.login;
const loading = const loading =
......
...@@ -43,33 +43,22 @@ const VisitorRecord = (props: any) => { ...@@ -43,33 +43,22 @@ const VisitorRecord = (props: any) => {
{ {
title: 'Visiting Time', title: 'Visiting Time',
dataIndex: 'updateTime', dataIndex: 'updateTime',
valueType: 'date', render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
}, },
{ title: 'Community', dataIndex: 'visitorCommunity' }, { title: 'Community', dataIndex: 'visitorCommunity' },
// { title: 'Unit', dataIndex: 'inviterAddress' },
{ {
title: 'Unit No', title: 'Unit No.',
dataIndex: 'inviterAddress', dataIndex: 'inviterAddress',
render: (text: any) => <span>{text}</span>, render: (text: any) => <span>{text}</span>,
}, },
// ["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)],
]; ];
const CallBackTitleSearch = (values: any) => {
console.log(values);
// visitorCommunity
TosVisitorRecordGet({
visitorCommunity: values.inviterAddress,
});
};
const [form] = Form.useForm(); const [form] = Form.useForm();
// 分页 // 分页
const pagination: any = { const pagination: any = {
defaultCurrent: 1, defaultCurrent: 1,
total: Data != null ? Data.length : 0, total: Data != null ? Data.length : 0,
defaultPageSize: 12, defaultPageSize: 15,
showSizeChanger: false, showSizeChanger: false,
showTitle: false, showTitle: false,
showTotal: false, showTotal: false,
......
...@@ -43,33 +43,22 @@ const VisitorRecord = (props: any) => { ...@@ -43,33 +43,22 @@ const VisitorRecord = (props: any) => {
{ {
title: 'Visiting Time', title: 'Visiting Time',
dataIndex: 'updateTime', dataIndex: 'updateTime',
valueType: 'date', render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
}, },
{ title: 'Community', dataIndex: 'visitorCommunity' }, { title: 'Community', dataIndex: 'visitorCommunity' },
// { title: 'Unit', dataIndex: 'inviterAddress' },
{ {
title: 'Unit No', title: 'Unit No.',
dataIndex: 'inviterAddress', dataIndex: 'inviterAddress',
render: (text: any) => <span>{text}</span>, render: (text: any) => <span>{text}</span>,
}, },
// ["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)],
]; ];
const CallBackTitleSearch = (values: any) => {
console.log(values);
// visitorCommunity
TosVisitorRecordGet({
visitorCommunity: values.inviterAddress,
});
};
const [form] = Form.useForm(); const [form] = Form.useForm();
// 分页 // 分页
const pagination: any = { const pagination: any = {
defaultCurrent: 1, defaultCurrent: 1,
total: Data != null ? Data.length : 0, total: Data != null ? Data.length : 0,
defaultPageSize: 12, defaultPageSize: 15,
showSizeChanger: false, showSizeChanger: false,
showTitle: false, showTitle: false,
showTotal: false, showTotal: false,
......
...@@ -9,7 +9,7 @@ import styles from './ContractContent.less'; ...@@ -9,7 +9,7 @@ import styles from './ContractContent.less';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity'; import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
const Contract = (props: any) => { const Contract = (props: any) => {
const { location, dispatch, Contract, loading } = props; const { location, dispatch, Contract, loading, Init } = props;
const { Data } = Contract; const { Data } = Contract;
// 把请求装在一个地方 // 把请求装在一个地方
...@@ -20,12 +20,15 @@ const Contract = (props: any) => { ...@@ -20,12 +20,15 @@ const Contract = (props: any) => {
// 数据 // 数据
useEffect(() => { useEffect(() => {
if (Data == null) { if (Data == null) {
if (Init != null) {
//如果没数据请求一次 //如果没数据请求一次
let obj = { let obj = {
communityNameList: Init.CommunityList,
pageNum: 1, pageNum: 1,
}; };
RA(19, obj); RA(19, obj);
} }
}
}, [Data]); }, [Data]);
// 表单标识 // 表单标识
...@@ -230,10 +233,11 @@ const Contract = (props: any) => { ...@@ -230,10 +233,11 @@ const Contract = (props: any) => {
}; };
const mapStateToProps = (state: any) => { const mapStateToProps = (state: any) => {
console.log(state); const Init = state.Init;
return { return {
Contract: state.Contract, Contract: state.Contract,
loading: state.loading.models.Contract || false, loading: state.loading.models.Contract || false,
Init,
}; };
}; };
......
...@@ -22,7 +22,7 @@ const Guard = (props: any) => { ...@@ -22,7 +22,7 @@ const Guard = (props: any) => {
return ( return (
<div className={styles.base}> <div className={styles.base}>
<TitleGet title={'Version 1.5.2'} /> <TitleGet title={'Version 1.5.3'} />
{/* <p> {/* <p>
token:{page.token} token:{page.token}
name:{getCookie('name')} name:{getCookie('name')}
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2020-11-19 16:54:53 * @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-12-11 14:22:27 * @LastEditTime: 2020-12-14 18:21:47
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\log.ts * @FilePath: \tostumi\src\utils\log.ts
...@@ -18,6 +18,7 @@ export const logOut = () => { ...@@ -18,6 +18,7 @@ export const logOut = () => {
localStorage.removeItem('userInfo'); localStorage.removeItem('userInfo');
localStorage.removeItem('loginTime'); localStorage.removeItem('loginTime');
localStorage.removeItem('permission'); localStorage.removeItem('permission');
localStorage.removeItem('CommunityList');
// 清掉本域名所有cookie // 清掉本域名所有cookie
let keys = document.cookie.match(/[^ =;]+(?==)/g); let keys = document.cookie.match(/[^ =;]+(?==)/g);
if (keys) { if (keys) {
......
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