Commit d3e90aa3 authored by cellee's avatar cellee

Signed-off-by: cellee <893264950@qq.com>

parent df811d94
......@@ -35,31 +35,9 @@ const Account = (props: any) => {
// 当前账户信息
useEffect(() => {
if (user != null) {
let treeDatas = treeData;
let _a = user.currentUser.permission; // 当前账户权限
let _p = treeDatas[0].children; // 所有权限列表
let arr: any = []; // 一级栏目权限
let erArr: any = []; // 一级栏目权限
// 循环一级 判断当前账户有没有权限修改增加
for (let i of _a) {
for (let j in _p) {
if (_p[j].key == i) {
arr.push(_p[j].key);
_p[j].disabled = false;
}
// 二级权限
for (let k in _p[j].children) {
if (_p[j].children[k].key == i) {
erArr.push(_p[j].children[k].key);
_p[j].children[k].disableCheckbox = false;
}
}
}
}
// 赋值改变
treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表
// 发起请求
let data = {};
RA(56, data, module, dispatch);
}
}, [user]);
......@@ -105,23 +83,36 @@ const Account = (props: any) => {
value.tosUserServiceCellList = value.community.value; // 管辖小区
value.tosUserEmail = value.tosUserName; // 邮箱就是账号
value.tosUserLevel = values; //级别
value.creatorName = getCookie('name'); //新建者账号
value.creatorName = JSON.parse(userInfo).userModel.tosUserName; //新建者账号
value.creatorId = id; //新建者ID
delete value.community;
// console.log(checkedKeys);
// 判断有没有 0 有就删除
for (var i in checkedKeys) {
checkedKeys[i] == '0' ? checkedKeys.splice(i, 1) : '';
}
// 追加到上级id
let Obj = treeData[0].children;
console.log(Obj);
for (let i in Obj) {
for (let j in checkedKeys) {
if (JSON.stringify(Obj[i].children).indexOf(JSON.stringify(checkedKeys[j])) != -1) {
// 提取出上级id 并且追加
checkedKeys.push(Obj[i].key);
}
}
}
// 去重后在排序
let newData = Array.from(new Set(checkedKeys)).sort((n1: any, n2: any) => {
return parseInt(n1) - parseInt(n2);
});
// 另传权限
let obj = {
userName: value.tosUserName,
userPassword: value.tosUserPwd,
permissionArray: checkedKeys.sort((n1: any, n2: any) => {
return parseInt(n1) - parseInt(n2);
}),
permissionArray: newData,
};
RA(38, value, module, dispatch); // 信息上传
......@@ -149,7 +140,7 @@ const Account = (props: any) => {
// 点击树节点触发 - 大栏目
const onSelect = (selectedKeys: any, info: any) => {
console.log('onSelect', info);
// console.log('onSelect', info);
setSelectedKeys(selectedKeys);
};
......
......@@ -251,7 +251,7 @@ const Account = (props: any) => {
>
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0]}>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0] as any}>
<Input placeholder="Login Account" className="input" disabled />
</Form.Item>
</Descriptions.Item>
......@@ -259,12 +259,12 @@ const Account = (props: any) => {
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosAccountName" label="Name" rules={AccountTip[1]}>
<Form.Item name="tosAccountName" label="Name" rules={AccountTip[1] as any}>
<Input placeholder="Name Of Administrator" className="input" disabled />
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[2]}>
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[2] as any}>
<Input
placeholder="Contact Information"
className="input"
......
......@@ -64,6 +64,10 @@ const Account = (props: any) => {
let _a = user.currentUser.permission; // 当前账户权限
let _p = treeDatas[0].children; // 所有权限列表
for (let i in _p) {
console.log(_p[i].key);
}
let arr: any = []; // 一级栏目权限
let erArr: any = []; // 一级栏目权限
// 循环一级 判断当前账户有没有权限修改增加
......@@ -82,6 +86,8 @@ const Account = (props: any) => {
}
}
}
console.log(_p);
// 赋值改变
treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表
......@@ -150,16 +156,30 @@ const Account = (props: any) => {
// 判断有没有 0 有就删除
for (var i in checkedKeys) {
checkedKeys[i] == '0' ? checkedKeys.splice(i, 1) : '';
checkedKeys[i] == '0' ? checkedKeys.splice(i as any, 1) : '';
}
// 追加到上级id
let Obj = treeData[0].children;
console.log(Obj);
for (let i in Obj) {
for (let j in checkedKeys) {
if (JSON.stringify(Obj[i].children).indexOf(JSON.stringify(checkedKeys[j])) != -1) {
// 提取出上级id 并且追加
checkedKeys.push(Obj[i].key);
}
}
}
// 去重后在排序
let newData = Array.from(new Set(checkedKeys)).sort((n1: any, n2: any) => {
return parseInt(n1) - parseInt(n2);
});
// 另传权限
let obj = {
userName: value.tosUserName,
userPassword: value.tosUserPwd,
permissionArray: checkedKeys.sort((n1, n2) => {
return parseInt(n1) - parseInt(n2);
}),
permissionArray: newData,
};
RA(38, value, module, dispatch); // 信息上传
......@@ -240,7 +260,7 @@ const Account = (props: any) => {
>
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0]}>
<Form.Item name="tosUserName" label="Account ID" rules={AccountTip[0] as any}>
<Input placeholder="Login Account" className="input" disabled />
</Form.Item>
</Descriptions.Item>
......@@ -248,12 +268,12 @@ const Account = (props: any) => {
<Descriptions column={{ xs: 1, sm: 2, md: 3 }}>
<Descriptions.Item>
<Form.Item name="tosAccountName" label="Name" rules={AccountTip[1]}>
<Form.Item name="tosAccountName" label="Name" rules={AccountTip[1] as any}>
<Input placeholder="Name Of Administrator" className="input" />
</Form.Item>
</Descriptions.Item>
<Descriptions.Item>
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[2]}>
<Form.Item name="tosUserPhone" label="Phone" rules={AccountTip[2] as any}>
<Input
placeholder="Contact Information"
className="input"
......@@ -275,7 +295,7 @@ const Account = (props: any) => {
<span className="title">Privilege Level:</span>
</div>
<div className="label">
<Radio.Group defaultValue={DataSave.tosUserLevel} onChange={onRadio}>
<Radio.Group defaultValue={DataSave ? DataSave.tosUserLevel : 2} onChange={onRadio}>
<Radio style={radioStyle} value={2}>
Two Level Administrator
</Radio>
......@@ -302,6 +322,7 @@ const Account = (props: any) => {
onSelect={onSelect}
selectedKeys={selectedKeys}
treeData={treeData}
// checkStrictly={true}
/>
</div>
</div>
......
......@@ -129,4 +129,5 @@ export const requestList = [
['/tos/tosServiceScope/cancel', '53 删除服务范围'],
['/tos/user/permission/get', '54 根据用户名称获取用户权限', {}],
['/tos/tosCommunity/get/user', '55 根据用户id获取用户管辖小区名', {}],
['/tos/user/twoLevel/get', '56 获取二级账号', {}],
];
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