Commit 34977cee authored by cellee's avatar cellee

账号权限需求变更

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 6b46650b
......@@ -90,6 +90,8 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
// 登录
if (history.location.pathname == '/') {
var isLogin = false;
console.log(getCookie('token'));
if (getCookie('token').length != 0) {
isLogin = true;
}
......
......@@ -138,7 +138,7 @@ export default {
},
*SA({ DataSave }, { call, put }) {
console.log(DataSave);
// console.log(DataSave);
yield put({ type: 'returnDataSave', DataSave });
},
......
......@@ -7,19 +7,18 @@ import './Account.less';
import { zhCnFaci, enUsFaci } from '@/utils/power';
import { AccountTip } from '@/utils/tip';
import SelectCommunity from '@/components/SelectCommunity/Tow';
import { getNumber } from '@/utils/string'; // 正则
import { RA } from '@/utils/method';
const Account = (props: any) => {
const module = 'Account';
const { dispatch, SubResult, CommunityList, loading, user, Info } = props;
const { dispatch, SubResult, loading, user, Info } = props;
// 权限列表
const treeData = localStorage.getItem('umi_locale') == 'zh-CN' ? zhCnFaci : enUsFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目
const [expandedKeys, setExpandedKeys] = useState<string[]>(['0']); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState([] as any); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
......@@ -29,8 +28,6 @@ const Account = (props: any) => {
const [disab, setdisab] = useState(false); // 是否禁止选择二级
const [towAccountId, settowAccountId] = useState(null); // 二级账户id
const [treeDataList, settreeDataList] = useState(treeData); // 权限列表
//默认选中的小区
const [community, setCommunity] = useState(CommunityList); // 默认全选
// 表单标识
const [form] = Form.useForm();
......@@ -103,7 +100,6 @@ const Account = (props: any) => {
// 二级管辖小区和权限
useEffect(() => {
if (Info != null) {
setCommunity(Info.community);
power(Info.permissions);
setCheckedKeys([]);
}
......@@ -162,10 +158,6 @@ const Account = (props: any) => {
// 权限
message.error('Please Select Permission!');
return false;
} else if (value.community.value == null || value.community.value.length == 0) {
// 小区
message.error('Please Select The Jurisdiction Area!');
return false;
} else if (value.tosUserName.length < 6) {
// 账号长度
message.error('The Account Password is Greater Than 6 Digits!');
......@@ -175,7 +167,6 @@ const Account = (props: any) => {
message.error('Please select affiliated account !');
return false;
} else {
value.tosUserServiceCellList = value.community.value; // 管辖小区
value.tosUserEmail = value.tosUserName; // 邮箱就是账号
value.tosUserLevel = values; //级别
value.creatorName = JSON.parse(userInfo).userModel.tosUserName; //新建者账号
......@@ -210,10 +201,11 @@ const Account = (props: any) => {
// 另传权限
let obj = {
userName: value.tosUserName,
userPassword: value.tosUserPwd,
permissionArray: newData,
};
console.log(value);
console.log(obj);
RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传
return true;
......@@ -258,7 +250,6 @@ const Account = (props: any) => {
if (e.target.value == 2) {
//否则打开
settowAccountId(null);
setCommunity(CommunityList);
}
};
......@@ -281,8 +272,6 @@ const Account = (props: any) => {
// 选择哪个二级账号
const handleChange = (value: any) => {
console.log(`selected ${value}`);
RA(57, { tosUserLevelId: value }, module, dispatch); // 根据用户id获取用户管辖小区名和权限
settowAccountId(value);
};
......@@ -310,15 +299,12 @@ const Account = (props: any) => {
name="contract"
onFinish={onFinishContract}
>
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions column={{ xs: 1, sm: 1, md: 2, xl: 3 }}>
<Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0] as any}>
<Input placeholder="Login Account" className="input" />
</Form.Item>
</Descriptions.Item>
</Descriptions>
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosAccountName" label="Name" rules={AccountTip[1] as any}>
<Input placeholder="Name Of Administrator" className="input" />
......@@ -336,13 +322,6 @@ const Account = (props: any) => {
</Descriptions.Item>
</Descriptions>
<Form.Item name="community" label="Community">
<SelectCommunity
checklist={community ? community : null}
list={community ? community : []}
/>
</Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}>
<div className="label">
<span className="title">Privilege Level:</span>
......@@ -407,7 +386,6 @@ const Account = (props: any) => {
const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result, SubResult, Info } = state.Account;
const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.Account || false;
const { user } = state;
return {
......@@ -416,7 +394,6 @@ const AccountProps = (state: any) => {
DataSaveDetail,
Result,
loading,
CommunityList,
user, // 获取当前账户信息
SubResult,
Info,
......
......@@ -78,7 +78,7 @@ const CellLists = (props: any) => {
useEffect(() => {
if (village == null) {
const obj = {
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
communityNameList: Init.CommunityList,
pageNum: 1,
};
setTerm(obj);
......@@ -134,7 +134,7 @@ const CellLists = (props: any) => {
<TitleSearch
username={['label', 'Please Enter Administrator']}
community={'communityName'}
checklist={curString.communityNameList != null ? curString.communityNameList : null}
checklist={Init ? Init.CommunityList : null}
onSubmit={CallBackTitleSearch}
/>
</div>
......
......@@ -206,18 +206,17 @@ const FacilityBookings = (props: any) => {
QA(tmp);
if (tab == 1) {
RA(9, {
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
communityNameList: CommunityList,
userToken: token,
status: curString.status,
subscribeDate: curString.subscribeDate,
pageNum: curString.curPage,
// communityNameList: curString.communityNameList,
});
} else {
RA(8, {
userToken: token,
pageNum: curString.curPage2,
communityNameList: JSON.parse(localStorage.getItem('CommunityList') as any),
communityNameList: CommunityList,
});
}
}
......@@ -231,9 +230,7 @@ const FacilityBookings = (props: any) => {
pageNum: current,
subscribeDate: curString.subscribeDate,
status: curString.status,
communityNameList: curString.communityNameList
? curString.communityNameList
: JSON.parse(localStorage.getItem('CommunityList') as any),
communityNameList: CommunityList,
});
} else {
var tmp = curString;
......
......@@ -12,23 +12,18 @@ import SelectCommunity from '@/components/SelectCommunity';
const module = 'VisitorRecord';
const VisitorRecord = (props: any) => {
const { dispatch, Data, DataSave, loading } = props;
const { dispatch, Data, DataSave, loading, CommunityList } = props;
// 新增搜索的时间 原来时间是时间戳格式
useEffect(() => {
if (Data != null) {
if (Data != null && CommunityList != null) {
Data.forEach((item: any) => {
item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
});
} else {
RA(
26,
{ communityNames: JSON.parse(localStorage.getItem('CommunityList') as any) },
module,
dispatch,
);
RA(26, { communityNames: CommunityList }, module, dispatch);
}
}, [Data]);
}, [Data, CommunityList]);
// 表头
const columns: any = [
......@@ -261,8 +256,9 @@ const VisitorRecord = (props: any) => {
function map(state: any) {
const { Data, DataSave } = state[module];
const { CommunityList } = state['Init'];
const loading = state.loading.models.VisitorRecord;
return { Data, DataSave, loading };
return { Data, DataSave, loading, CommunityList };
}
export default connect(map)(VisitorRecord);
// 备注
......
......@@ -12,23 +12,18 @@ import SelectCommunity from '@/components/SelectCommunity';
const module = 'VisitorRecord';
const VisitorRecord = (props: any) => {
const { dispatch, Data, DataSave, loading } = props;
const { dispatch, Data, DataSave, loading, CommunityList } = props;
// 新增搜索的时间 原来时间是时间戳格式
useEffect(() => {
if (Data != null) {
if (Data != null && CommunityList != null) {
Data.forEach((item: any) => {
item.showTime = moment(item.updateTime).format('YYYY-MM-DD');
});
} else {
RA(
26,
{ communityNames: JSON.parse(localStorage.getItem('CommunityList') as any) },
module,
dispatch,
);
RA(26, { communityNames: CommunityList }, module, dispatch);
}
}, [Data]);
}, [Data, CommunityList]);
// 表头
const columns: any = [
......@@ -261,8 +256,9 @@ const VisitorRecord = (props: any) => {
function map(state: any) {
const { Data, DataSave } = state[module];
const { CommunityList } = state['Init'];
const loading = state.loading.models.VisitorRecord;
return { Data, DataSave, loading };
return { Data, DataSave, loading, CommunityList };
}
export default connect(map)(VisitorRecord);
// 备注
......
/*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-12-11 17:23:30
* @LastEditTime: 2020-12-31 17:40:10
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\services\Init.ts
......@@ -9,22 +9,25 @@
import request from '@/utils/request';
// 新加的根据权限 获取小区的接口
// export function tosCommunityget(values: any) {
// const userInfo = localStorage.getItem('userInfo') || '';
// const id = JSON.parse(userInfo).userModel.id;
// return request('/tos/tosCommunity/get/user', {
// method: 'POST',
// body: JSON.stringify(values),
// headers: { 'Content-Type': 'application/json' },
// data: { mangerId: id },
// });
// }
// 原来的获取小区接口
export function tosCommunityget(values: any) {
const userInfo = localStorage.getItem('userInfo') || '';
const id = JSON.parse(userInfo).userModel.id;
return request('/tos/tosCommunity/get/user', {
return request('/tos/tosCommunity/get', {
method: 'POST',
body: JSON.stringify(values),
headers: { 'Content-Type': 'application/json' },
data: { mangerId: id },
});
}
// 原来的获取小区接口
// export function tosCommunityget(values: any) {
// return request('/tos/tosCommunity/get', {
// method: 'POST',
// body: JSON.stringify(values),
// headers: { 'Content-Type': 'application/json' },
// });
// }
/*
* @Author: your name
* @Date: 2020-11-19 20:34:18
* @LastEditTime: 2020-12-30 10:02:48
* @LastEditors: your name
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\params.ts
*/
export const validateMessages = {
required: '*it is required!',
types: {
......@@ -29,8 +37,6 @@ export const requestList = [
['/tos/community/categories/subscribe/fuzzy/query', '9 预订列表模糊查询', {}],
['/tos/user/newCurrentUser', '10 后台用户信息', {}],
['/tos/community/facilities/categories/subscribe', '11 预订', {}],
// ['/tos/tosOwner/getAll', '12 业主查询', {}],
['/tos/owner/query/fuuzy', '12 业主查询', {}],
['/tos/tosOwner/getDetailAll', '13 业主查询详细', {}],
['/tos/tosOwner/save', '14 业主添加', {}],
......@@ -38,7 +44,6 @@ export const requestList = [
['/tos/life/community/account/unit/del', '16 删除单元', {}],
['/tos/bookingService/edit', '17 编辑小区设施', {}],
['/tos/tosOwner/info/update', '18 编辑业主信息', {}],
['/tos/contract/list', '19 获取合同列表', {}],
['/tos/contract/detail/query', '20 获取合同列表详情', {}],
['/tos/community/service/get/detail', '21 小区服务获取详情', {}],
......@@ -48,20 +53,7 @@ export const requestList = [
['/tos/tosCommunityNotic/get', '25 获取小区公告列表', {}],
['/tos/tosVisitorRecord/get', '26 获取访客记录列表', {}],
['/tos/contract/add', '27 合同新增和编辑', {}],
[
'/tos/tosCommunityNotic/add',
'28 新增小区公告接口',
{
noticTitle: 'Garden公告',
communityNum: '珠江丽景小区',
noticText: '今晚晚上停水4小时',
noticScope: '1',
noticStartTime: '2020-07-01 12:30:00',
noticEndTime: '2020-08-01 9:30:00',
file: ['A.jpg'],
},
],
// ['/tos/tosManageCommunity/save', '29 新建一个小区', {}],
['/tos/tosCommunityNotic/add', '28 新增小区公告接口', {}],
['/tos/tosCommunity/save', '29 新建一个小区', {}],
['/tos/tosOrder/get', '30 获取订单详情', {}],
['/tos/property/community/houseCard/query', '31 获取住户卡列表', {}],
......@@ -81,44 +73,11 @@ export const requestList = [
},
],
['/tos/community/service/get', '40 获取小区服务回复列表', {}],
[
'/tos/users/save',
'41 添加后台账号',
{
id: 'null',
oneself: 0,
tosUserEmail: 'sales@huahui.com',
tosUserName: '小赵2',
tosUserPhone: '020-8888-4444',
tosUserPwd: '123456',
tosUserToCompany: '1',
tosUserServiceCell: '',
tosuserLevel: 1,
userStatus: 1,
},
],
[
'/tos/account/permission/savePermission',
'42 添加后台权限',
{
userName: '小赵2',
userPassword: '123456',
permissionArray: ['2', '1', '3', '4'],
},
],
['/tos/users/save', '41 添加后台账号', {}],
['/tos/account/permission/savePermission', '42 添加后台权限', {}],
['/tos/tosServiceScope/get', '43 获取服务范围'],
['/tos/tosServiceScope/save', '44 添加服务范围'],
[
'/tos/user/getAllInfrom',
'45 获取后台列表',
{
id: '',
moment: [],
name: '',
leaderID: '1',
userPhone: '',
},
],
['/tos/user/getAllInfrom', '45 获取后台列表', {}],
['/tos/tosServiceProvider/get', '46 获取服务商', {}],
['/tos/fileAndImage/preview', '47 获取附件地址', {}],
['/tos/tosCommunity/get/list', '48 修改获取小区列表', {}],
......
import React, { useState, useEffect,useRef} from 'react';
import { Input ,Tabs,Table,Space, Button} from 'antd';
const { TabPane } = Tabs;
import {connect,history} from 'umi';
import { RA } from '@/utils/method';
const module="XXX"
const XXX = (props:any) => {
const { dispatch, Data } = props;
const formRef = useRef(null)
return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
</div>
);
};
function map(state:any) {
const { Data} = state[module]
return { Data}
}
export default connect(map)(XXX);
\ No newline at end of file
import * as service from '../../services/tos';
import { message } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router'
import { printf } from '@/utils/log';
export default {
namespace: 'XXX',
state: {
Data: null,
Result: null,
DataSave: null,
DataSaveDetail:null,
},
reducers: {
returnPage(state, { Data}) {
return { ...state, Data };
},
returnResult(state, { Result}) {
return { ...state, Result};
},
returnDataSave(state, { DataSave }) {
return {...state,DataSave}
},
returnDataSaveDetail(state, { DataSaveDetail }) {
return {...state,DataSaveDetail}
},
},
effects: {
//标准请求
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
console.log(resp)
if (resp.code == 500||resp.error_code!="0000") {
}
if (resp.error_code != "0000") {
printf(playload, resp)
}
else {
switch (playload.index) {
case 24: {
let Data = resp.data;
yield put({ type: 'returnPage', Data });
} break;
}
}
},
*ResultClear({ }, { put }) {
var tmp=null
yield put({type: 'returnResult', tmp} )
},
*SA({ playload }, { call, put }) {
var DataSave = playload
yield put({type: 'returnDataSave', DataSave} )
},
},
};
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