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