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 {
//标准请求
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
// if (resp.code == 500||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') {
if (resp.error_code != '0000') {
getObjectInfo(playload.body);
printf(playload, resp);
message.error(`${resp.error_code}:${resp.error_msg}`);
......@@ -79,9 +73,9 @@ export default {
let village = null;
yield put({ type: 'returnPage', Data });
yield put({ type: 'returnVillage', village });
// 提示跳转
message.success(`Information saved successfully!`);
history.push('/CommunityManagement/CellList');
// 告知结果
yield put({ type: 'returnResult', Result });
}
break;
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 { message } from 'antd';
......@@ -20,6 +28,16 @@ export default {
*tosCommunityget({ playload }, { call, put }) {
const resp = yield call(service.tosCommunityget, playload);
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 });
},
},
......
......@@ -139,6 +139,7 @@ const Model: LoginModelType = {
// 清楚用户信息
localStorage.removeItem('userInfo');
localStorage.removeItem('permission');
localStorage.removeItem('CommunityList');
setCookie('token', '');
setCookie('id', '');
setCookie('name', '');
......
......@@ -31,7 +31,7 @@ const { RangePicker } = TimePicker;
const Adds = (props: any) => {
const module = 'CellList';
const { Data, dispatch, loading, imgUrl } = props;
const { Data, dispatch, loading, imgUrl, Result } = props;
const [form] = Form.useForm();
......@@ -102,6 +102,17 @@ const Adds = (props: any) => {
}
}, [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(() => {
if (imgUrl != null) {
......@@ -622,10 +633,11 @@ const Adds = (props: any) => {
// export default Adds;
function map(state: any) {
console.log(state);
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 { Result } = state.CellList;
return { Data, loading, Result, imgUrl };
}
export default connect(map)(Adds);
......@@ -10,8 +10,6 @@ import TitleSearch from '@/components/TitleSearch/TitleSearch';
import { RA, SA } from '@/utils/method';
import { objectColumns } from '@/utils/string';
import { getCookie } from '@/utils/method';
const module = 'CellList';
import './celllist.less';
......@@ -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(() => {
if (Data != null) {
let obj = {
residentialManagerUserName: '',
communityNameList: Data.communityList,
if (village == null) {
const obj = {
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
pageNum: 1,
};
setTerm(obj); // 存进搜索条件
} else {
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);
setTerm(obj);
RA(48, obj, module, dispatch);
}
}, [village]);
const goToAdd = () => {
SA(null as any, module, dispatch); // 清空之前传递的数据
dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
emptys(null);
history.push('/CommunityManagement/CellList/Add');
};
const goToEdit = (values: any, e: any) => {
dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
SA(values, module, dispatch);
emptys(values);
history.push('/CommunityManagement/CellList/Add');
};
const goToDetail = (values: any, e: any) => {
dispatch({ type: module + '/urlRemove' }); // 清掉图片信息
SA(values, module, dispatch);
emptys(values);
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) => {
......@@ -122,7 +104,6 @@ const CellLists = (props: any) => {
pageNum: 1,
};
setTerm(obj); // 存进搜索条件
RA(48, obj, module, dispatch);
} else {
message.error('Please Enter And Select A Content To Search!');
......@@ -205,7 +186,8 @@ const CellLists = (props: any) => {
function map(state: any) {
const loading = state.loading.models.CellList;
const Init = state.Init;
const { Data, curString, village } = state[module];
return { Data, loading, curString, village };
return { Data, loading, curString, village, Init };
}
export default connect(map)(CellLists);
......@@ -297,7 +297,6 @@ const Detail = (props: any) => {
function map(state: any) {
const { DataSave, detailData, imgUrl, overCom } = state.CellList; // 上层传递来的值
const loading = state.loading.models.CellList;
console.log(state);
return { DataSave, detailData, loading, imgUrl, overCom };
}
export default connect(map)(Detail);
......@@ -136,14 +136,19 @@ const FacilityBookings = (props: any) => {
setColumns2(objectColumns(key2) as any);
if (curString.tab == 1) {
RA(9, {
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
userToken: token,
pageNum: curString.curPage,
subscribeDate: curString.subscribeDate,
status: curString.status,
communityNameList: curString.communityNameList,
// communityNameList: curString.communityNameList,
});
} 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) => {
QA(tmp);
if (tab == 1) {
RA(9, {
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
userToken: token,
status: curString.status,
subscribeDate: curString.subscribeDate,
pageNum: curString.curPage,
communityNameList: curString.communityNameList,
// communityNameList: curString.communityNameList,
});
} 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) {
......@@ -378,6 +388,7 @@ const FacilityBookings = (props: any) => {
};
function mapStateToProps(state: any) {
console.log(state);
const { Data, Data2, DataSave, curString, Result } = state.FacilityBookings;
const { token } = state.login;
const loading =
......
......@@ -43,33 +43,22 @@ const VisitorRecord = (props: any) => {
{
title: 'Visiting Time',
dataIndex: 'updateTime',
valueType: 'date',
render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
},
{ title: 'Community', dataIndex: 'visitorCommunity' },
// { title: 'Unit', dataIndex: 'inviterAddress' },
{
title: 'Unit No',
title: 'Unit No.',
dataIndex: 'inviterAddress',
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 pagination: any = {
defaultCurrent: 1,
total: Data != null ? Data.length : 0,
defaultPageSize: 12,
defaultPageSize: 15,
showSizeChanger: false,
showTitle: false,
showTotal: false,
......
......@@ -43,33 +43,22 @@ const VisitorRecord = (props: any) => {
{
title: 'Visiting Time',
dataIndex: 'updateTime',
valueType: 'date',
render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
},
{ title: 'Community', dataIndex: 'visitorCommunity' },
// { title: 'Unit', dataIndex: 'inviterAddress' },
{
title: 'Unit No',
title: 'Unit No.',
dataIndex: 'inviterAddress',
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 pagination: any = {
defaultCurrent: 1,
total: Data != null ? Data.length : 0,
defaultPageSize: 12,
defaultPageSize: 15,
showSizeChanger: false,
showTitle: false,
showTotal: false,
......
......@@ -9,7 +9,7 @@ import styles from './ContractContent.less';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
const Contract = (props: any) => {
const { location, dispatch, Contract, loading } = props;
const { location, dispatch, Contract, loading, Init } = props;
const { Data } = Contract;
// 把请求装在一个地方
......@@ -20,12 +20,15 @@ const Contract = (props: any) => {
// 数据
useEffect(() => {
if (Data == null) {
if (Init != null) {
//如果没数据请求一次
let obj = {
communityNameList: Init.CommunityList,
pageNum: 1,
};
RA(19, obj);
}
}
}, [Data]);
// 表单标识
......@@ -230,10 +233,11 @@ const Contract = (props: any) => {
};
const mapStateToProps = (state: any) => {
console.log(state);
const Init = state.Init;
return {
Contract: state.Contract,
loading: state.loading.models.Contract || false,
Init,
};
};
......
......@@ -22,7 +22,7 @@ const Guard = (props: any) => {
return (
<div className={styles.base}>
<TitleGet title={'Version 1.5.2'} />
<TitleGet title={'Version 1.5.3'} />
{/* <p>
token:{page.token}
name:{getCookie('name')}
......
/*
* @Author: your name
* @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
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\log.ts
......@@ -18,6 +18,7 @@ export const logOut = () => {
localStorage.removeItem('userInfo');
localStorage.removeItem('loginTime');
localStorage.removeItem('permission');
localStorage.removeItem('CommunityList');
// 清掉本域名所有cookie
let keys = document.cookie.match(/[^ =;]+(?==)/g);
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