Commit 7955ee38 authored by cellee's avatar cellee

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

parent c9b23759
import React, { useState,useEffect} from 'react'; import React, { useState, useEffect } from 'react';
import SelectOptions from '../SelectOptions'; import SelectOptions from '../SelectOptions';
import { connect } from 'umi' import { connect } from 'umi';
const index = (props:any) => { const index = (props: any) => {
const { dispatch, CommunityList, value, onChange, checklist } = props;
const {dispatch, CommunityList,value,onChange , checklist} = props;
// console.log(props) // console.log(props)
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})}; const tosCommunityget = (values: any) => {
dispatch({ type: 'Init/tosCommunityget', playload: values });
};
useEffect(() => { useEffect(() => {
if (CommunityList == null) { if (CommunityList == null) {
tosCommunityget(null) tosCommunityget(null);
} }
}, []); }, []);
// 给已选值默认 如果有默认就传递默认 否则传递列表数据 // 给已选值默认 如果有默认就传递默认 否则传递列表数据
useEffect(() => { useEffect(() => {
if (checklist != null) { if (checklist != null) {
onChange({ index:1,value: checklist}) onChange({ index: 1, value: checklist });
}else{ } else {
onChange({ index:1,value: CommunityList}) onChange({ index: 1, value: CommunityList });
} }
}, [checklist]); }, [checklist]);
// 点击选择的时候传递给子组件 已选列表 // 点击选择的时候传递给子组件 已选列表
const printContent = (values:any) => { const printContent = (values: any) => {
onChange({ index:CommunityList.length==values.length?1:0,value: values}) onChange({ index: CommunityList.length == values.length ? 1 : 0, value: values });
} };
return ( return (
<> <>
{ {CommunityList != null ? (
CommunityList != null ? <SelectOptions
<SelectOptions list={CommunityList.sort()} checklist={checklist} show={true} onSubmit={printContent} />: list={CommunityList.sort()}
null checklist={checklist}
} show={true}
onSubmit={printContent}
/>
) : null}
</> </>
); );
}; };
function mapStateToProps(state:any) { function mapStateToProps(state: any) {
const { CommunityList } = state.Init; const { CommunityList } = state.Init;
return { return {
CommunityList, CommunityList,
}; };
......
...@@ -75,7 +75,6 @@ class SelectOptions extends React.PureComponent { ...@@ -75,7 +75,6 @@ class SelectOptions extends React.PureComponent {
lastValue: null, lastValue: null,
}; };
} else { } else {
// console.log(checklist);
this.state = { this.state = {
menuList: ArrayToPingYin.get(list), menuList: ArrayToPingYin.get(list),
checkedListOptions: list, checkedListOptions: list,
...@@ -89,6 +88,17 @@ class SelectOptions extends React.PureComponent { ...@@ -89,6 +88,17 @@ class SelectOptions extends React.PureComponent {
}; };
} }
} }
componentWillReceiveProps(nextProps) {
// 如果存在更新 就拿取最新的选中小区值
// 判断是不是props 的最新值 否则每次点击都要更新
if (nextProps.checklist !== this.props.checklist) {
this.setState({
checkedList: nextProps.checklist,
});
}
}
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
if (this.props.show != null) { if (this.props.show != null) {
if (this.props.show == this.state.flag) { if (this.props.show == this.state.flag) {
...@@ -100,8 +110,8 @@ class SelectOptions extends React.PureComponent { ...@@ -100,8 +110,8 @@ class SelectOptions extends React.PureComponent {
} }
console.log(this.state.componetVisible); console.log(this.state.componetVisible);
} }
if (this.props.list.length > this.state.checkedList.length) { // if (this.props.list.length > this.state.checkedList.length) {
} // }
// console.log(prevProps.list); // console.log(prevProps.list);
// if (this.props.list.length > prevProps.list.length) { // if (this.props.list.length > prevProps.list.length) {
// console.log(this.props.list); // console.log(this.props.list);
......
...@@ -16,9 +16,16 @@ export default { ...@@ -16,9 +16,16 @@ export default {
Permission: null, Permission: null,
SubResult: null, // 结果 SubResult: null, // 结果
Info: null, // 二级管辖小区和权限
}, },
reducers: { reducers: {
// 二级账户管辖小区和权限
returnInfo(state, { Info }) {
return { ...state, Info };
},
returnPage(state, { Data }) { returnPage(state, { Data }) {
return { ...state, Data }; return { ...state, Data };
}, },
...@@ -110,6 +117,12 @@ export default { ...@@ -110,6 +117,12 @@ export default {
localStorage.setItem('towAccount', JSON.stringify(resp.data)); localStorage.setItem('towAccount', JSON.stringify(resp.data));
} }
break; break;
case 57: // 二级账号
{
let Info = resp.data;
yield put({ type: 'returnInfo', Info });
}
break;
} }
} }
}, },
...@@ -134,5 +147,11 @@ export default { ...@@ -134,5 +147,11 @@ export default {
var SubResult = null; var SubResult = null;
yield put({ type: 'returnDelccount', SubResult }); yield put({ type: 'returnDelccount', SubResult });
}, },
// 清除二级账户选择
*InfoClear({}, { put }) {
var Info = null;
yield put({ type: 'returnInfo', Info });
},
}, },
}; };
...@@ -161,6 +161,8 @@ const Account = (props: any) => { ...@@ -161,6 +161,8 @@ const Account = (props: any) => {
// 编辑- 新增 // 编辑- 新增
const edit = (item: any) => { const edit = (item: any) => {
// console.log(item); // console.log(item);
// 无论编辑还是新增都清掉二级账户选择
dispatch({ type: 'Account/InfoClear' });
if (item == 1) { if (item == 1) {
history.push('/AccountManagement/account/Add'); history.push('/AccountManagement/account/Add');
} else { } else {
......
...@@ -14,10 +14,10 @@ import { RA } from '@/utils/method'; ...@@ -14,10 +14,10 @@ import { RA } from '@/utils/method';
const Account = (props: any) => { const Account = (props: any) => {
const module = 'Account'; const module = 'Account';
const { dispatch, SubResult, CommunityList, loading, user } = props; const { dispatch, SubResult, CommunityList, loading, user, Info } = props;
// 权限列表 // 权限列表
const treeData = enUsFaci || zhCnFaci; const treeData = localStorage.getItem('umi_locale') == 'zh-CN' ? zhCnFaci : enUsFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目 const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState([] as any); // 默认已选栏目 const [checkedKeys, setCheckedKeys] = useState([] as any); // 默认已选栏目
...@@ -28,6 +28,9 @@ const Account = (props: any) => { ...@@ -28,6 +28,9 @@ const Account = (props: any) => {
const [values, setvalues] = useState(2); // 树形菜单展开关闭 const [values, setvalues] = useState(2); // 树形菜单展开关闭
const [disab, setdisab] = useState(false); // 是否禁止选择二级 const [disab, setdisab] = useState(false); // 是否禁止选择二级
const [towAccountId, settowAccountId] = useState(null); // 二级账户id const [towAccountId, settowAccountId] = useState(null); // 二级账户id
const [treeDataList, settreeDataList] = useState(treeData); // 权限列表
//默认选中的小区
const [community, setCommunity] = useState(CommunityList); // 默认全选
// 表单标识 // 表单标识
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -40,8 +43,9 @@ const Account = (props: any) => { ...@@ -40,8 +43,9 @@ const Account = (props: any) => {
// 当前账户权限 // 当前账户权限
useEffect(() => { useEffect(() => {
if (user != null) { if (user != null || values == 2) {
let treeDatas = treeData; let _tmp = JSON.stringify(treeData); //将对象转换为json字符串形式
let treeDatas = JSON.parse(_tmp); //将转换而来的字符串转换为原生js对
let _a = user.currentUser.permission; // 当前账户权限 let _a = user.currentUser.permission; // 当前账户权限
let _p = treeDatas[0].children; // 所有权限列表 let _p = treeDatas[0].children; // 所有权限列表
...@@ -68,13 +72,10 @@ const Account = (props: any) => { ...@@ -68,13 +72,10 @@ const Account = (props: any) => {
if (user.currentUser.userModel.tosUserLevel > 1) { if (user.currentUser.userModel.tosUserLevel > 1) {
setvalues(3); setvalues(3);
setdisab(true); setdisab(true);
settowAccountId(user.currentUser.id); settowAccountId(user.currentUser.userModel.id);
// 如果是三级账户,禁用最后两个账户管理 // 且禁用最后两个账户管理
if (user.currentUser.userModel.tosUserLevel == 3) { _p[_p.length - 1].children[2].disableCheckbox = true;
// 禁用最后两个 _p[_p.length - 1].children[3].disableCheckbox = true;
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
}
} else { } else {
// 如果是一级账户获取挂靠的二级账户名称 // 如果是一级账户获取挂靠的二级账户名称
RA(56, {}, module, dispatch); // 权限上传 RA(56, {}, module, dispatch); // 权限上传
...@@ -82,9 +83,9 @@ const Account = (props: any) => { ...@@ -82,9 +83,9 @@ const Account = (props: any) => {
// 赋值改变 // 赋值改变
treeDatas[0].children = _p; treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表 settreeDataList(treeDatas as any); // 可勾选列表
} }
}, [user]); }, [user, values]);
useEffect(() => { useEffect(() => {
// 提交信息结果 // 提交信息结果
...@@ -99,10 +100,57 @@ const Account = (props: any) => { ...@@ -99,10 +100,57 @@ const Account = (props: any) => {
} }
}, [SubResult]); }, [SubResult]);
// 二级管辖小区和权限
useEffect(() => {
if (Info != null) {
setCommunity(Info.community);
power(Info.permissions);
}
}, [Info]);
//权限赋值
const power = (val: any) => {
let _tmp = JSON.stringify(treeData); //将对象转换为json字符串形式
let treeDatas = JSON.parse(_tmp); //将转换而来的字符串转换为原生js对
let _a = val; // 当前账户权限
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;
}
}
}
}
// 且禁用最后两个账户管理
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
// 赋值改变
treeDatas[0].children = _p;
settreeDataList(treeDatas as any); // 可勾选列表
};
// 保存提交 // 保存提交
const onFinishContract = async (value: any) => { const onFinishContract = async (value: any) => {
const userInfo = localStorage.getItem('userInfo') || ''; const userInfo = localStorage.getItem('userInfo') || '';
const id = JSON.parse(userInfo).userModel.id; const id = JSON.parse(userInfo).userModel.id;
console.log(treeDataList);
console.log();
if ( if (
value.tosAccountName.length <= 2 && value.tosAccountName.length <= 2 &&
value.tosUserPhone.length != 8 && value.tosUserPhone.length != 8 &&
...@@ -111,7 +159,7 @@ const Account = (props: any) => { ...@@ -111,7 +159,7 @@ const Account = (props: any) => {
// 姓名联系方式 // 姓名联系方式
message.error('Please enter the correct name and contact information!'); message.error('Please enter the correct name and contact information!');
return false; return false;
} else if (checkedKeys[0].key) { } else if (checkedKeys.length == 0) {
// 如果存在key 就是没有选择 // 如果存在key 就是没有选择
// 权限 // 权限
message.error('Please Select Permission!'); message.error('Please Select Permission!');
...@@ -209,7 +257,7 @@ const Account = (props: any) => { ...@@ -209,7 +257,7 @@ const Account = (props: any) => {
setvalues(e.target.value); setvalues(e.target.value);
// 如果是3级,取消后面两个选择 // 如果是3级,取消后面两个选择
let treeDatas = treeData; let treeDatas = treeDataList; //将转换而来的字符串转换为原生js对
let _p = treeDatas[0].children; // 所有权限列表 let _p = treeDatas[0].children; // 所有权限列表
// 禁用最后两个 // 禁用最后两个
if (e.target.value == 3) { if (e.target.value == 3) {
...@@ -221,10 +269,11 @@ const Account = (props: any) => { ...@@ -221,10 +269,11 @@ const Account = (props: any) => {
_p[_p.length - 1].children[3].disableCheckbox = false; _p[_p.length - 1].children[3].disableCheckbox = false;
settowAccountId(null); settowAccountId(null);
setCommunity(CommunityList);
} }
// 赋值改变 // 赋值改变
treeDatas[0].children = _p; treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表 settreeDataList(treeDatas as any); // 可勾选列表
}; };
//手机号 //手机号
...@@ -247,6 +296,8 @@ const Account = (props: any) => { ...@@ -247,6 +296,8 @@ const Account = (props: any) => {
// 选择哪个二级账号 // 选择哪个二级账号
const handleChange = (value: any) => { const handleChange = (value: any) => {
console.log(`selected ${value}`); console.log(`selected ${value}`);
RA(57, { tosUserLevelId: value }, module, dispatch); // 根据用户id获取用户管辖小区名和权限
settowAccountId(value); settowAccountId(value);
}; };
...@@ -300,7 +351,7 @@ const Account = (props: any) => { ...@@ -300,7 +351,7 @@ const Account = (props: any) => {
</Descriptions> </Descriptions>
<Form.Item name="community" label="Community"> <Form.Item name="community" label="Community">
<SelectCommunity checklist={CommunityList == null ? null : CommunityList} /> <SelectCommunity checklist={community ? community : null} />
</Form.Item> </Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}> <div className="diy" style={{ marginBottom: '14px' }}>
...@@ -346,7 +397,7 @@ const Account = (props: any) => { ...@@ -346,7 +397,7 @@ const Account = (props: any) => {
checkedKeys={checkedKeys} checkedKeys={checkedKeys}
onSelect={onSelect} onSelect={onSelect}
selectedKeys={selectedKeys} selectedKeys={selectedKeys}
treeData={treeData} treeData={treeDataList}
/> />
</div> </div>
</div> </div>
...@@ -366,7 +417,7 @@ const Account = (props: any) => { ...@@ -366,7 +417,7 @@ const Account = (props: any) => {
}; };
const AccountProps = (state: any) => { const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result, SubResult } = state.Account; const { Data, DataSave, DataSaveDetail, Result, SubResult, Info } = state.Account;
const { CommunityList } = state.Init; // 小区列表 const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.Account || false; const loading = state.loading.models.Account || false;
const { user } = state; const { user } = state;
...@@ -379,6 +430,7 @@ const AccountProps = (state: any) => { ...@@ -379,6 +430,7 @@ const AccountProps = (state: any) => {
CommunityList, CommunityList,
user, // 获取当前账户信息 user, // 获取当前账户信息
SubResult, SubResult,
Info,
}; };
}; };
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Form, Input, Button, Spin, message, Descriptions, Modal, Tree, Radio } from 'antd'; import { Form, Input, Button, Spin, message, Descriptions, Modal, Tree, Tag } from 'antd';
import { connect, history } from 'umi'; import { connect, history } from 'umi';
import { EditOutlined, LeftOutlined, PoweroffOutlined } from '@ant-design/icons'; import {
EditOutlined,
LeftOutlined,
PoweroffOutlined,
RightOutlined,
CheckCircleOutlined,
} from '@ant-design/icons';
import { getCookie } from '@/utils/method'; import { getCookie } from '@/utils/method';
import './Account.less'; import './Account.less';
...@@ -92,10 +98,37 @@ const Account = (props: any) => { ...@@ -92,10 +98,37 @@ const Account = (props: any) => {
useEffect(() => { useEffect(() => {
if (Permission != null) { if (Permission != null) {
let newPer = eval('(' + Permission + ')'); let newPer = eval('(' + Permission + ')');
let data: any = []; let data: any = []; // 编辑的账户的权限
for (let i in newPer) { for (let i in newPer) {
data[i] = newPer[i] + ''; data[i] = newPer[i] + '';
} }
let _p = treeData[0].children; // 所有权限列表
// console.log(_p); // 所有权限列表
for (let i in _p) {
let arr = _p[i].children; // 每个权限
let newArr = []; // 每个权限下的子权限列表
for (let j in arr) {
newArr.push(arr[j].key);
}
// console.log(newArr);
if (!newArr.every((val) => data.includes(val))) {
// 判断数组是否包含另一个数组
// console.log('不包含' + _p[i].key);
// 不全部包含就删除数组的元素
var index = data.indexOf(_p[i].key);
if (index > -1) {
data.splice(index, 1);
}
} else {
// console.log('包含' + _p[i].key);
}
}
// 再赋值给列表
// data.push('0');
setCheckedKeys(data); setCheckedKeys(data);
} }
}, [Permission]); }, [Permission]);
...@@ -292,15 +325,26 @@ const Account = (props: any) => { ...@@ -292,15 +325,26 @@ 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} disabled> <Tag
<Radio style={radioStyle} value={2}> icon={<CheckCircleOutlined />}
Two Level Administrator color="success"
</Radio> style={{ verticalAlign: 'sub', fontSize: 14, padding: '4px 7px' }}
<Radio style={radioStyle} value={3}> >
Three Level Administrator {DataSave.tosUserLevel == 2
{/* <Input placeholder="三级管理员" style={{ width: 160, marginLeft: 10 }} /> */} ? 'Two Level Administrator '
</Radio> : 'Three Level Administrator'}
</Radio.Group> </Tag>
{DataSave.tosUserLevel == 3 ? (
<Tag
icon={<RightOutlined />}
color="processing"
style={{ verticalAlign: 'sub', fontSize: 14, padding: '4px 7px' }}
>
Superiors:{DataSave.userLeaderAccountName} - {DataSave.userLeaderName}
</Tag>
) : (
''
)}
</div> </div>
</div> </div>
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Form, Input, Button, Spin, message, Descriptions, Tree, Radio } from 'antd'; import { Form, Input, Button, message, Descriptions, Spin, Tree, Radio, Select } from 'antd';
import { connect, history } from 'umi'; import { connect, history } from 'umi';
import { EditOutlined, LeftOutlined } from '@ant-design/icons'; import { EditOutlined, LeftOutlined } from '@ant-design/icons';
import { getCookie } from '@/utils/method';
import './Account.less'; import './Account.less';
import { zhCnFaci, enUsFaci } from '@/utils/power'; import { zhCnFaci, enUsFaci } from '@/utils/power';
...@@ -15,45 +14,39 @@ import { RA } from '@/utils/method'; ...@@ -15,45 +14,39 @@ import { RA } from '@/utils/method';
const Account = (props: any) => { const Account = (props: any) => {
const module = 'Account'; const module = 'Account';
const { dispatch, Data, DataSave, DataSaveDetail, SubResult, loading, Permission, user } = props; const { dispatch, SubResult, CommunityList, loading, user, DataSave, Permission, Info } = props;
// 权限列表 // 权限列表
const treeData = enUsFaci || zhCnFaci; const treeData = localStorage.getItem('umi_locale') == 'zh-CN' ? zhCnFaci : enUsFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目 const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState<string[]>([]); // 默认已选栏目 const [checkedKeys, setCheckedKeys] = useState([] as any); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点 const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭 const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
const [treeDataList, settreeDataList] = useState(treeData); // 权限列表
// 单选 二级还是三级管理员 // 单选 二级还是三级管理员
const [values, setvalues] = useState(2); // 树形菜单展开关闭 const [values, setvalues] = useState(2); // 树形菜单展开关闭
const [disab, setdisab] = useState(false); // 是否禁止选择二级 const [disab, setdisab] = useState(false); // 是否禁止选择二级
const [towAccountId, settowAccountId] = useState(null); // 二级账户id
//默认选中的小区
const [community, setCommunity] = useState([] as any);
// 表单标识 // 表单标识
const [form] = Form.useForm(); const [form] = Form.useForm();
const formRef = useRef(null); const formRef = useRef(null);
// 数据 const { Option } = Select;
useEffect(() => {
if (DataSave != null) {
// 赋值
form.setFieldsValue({
tosUserName: DataSave.tosUserName,
tosUserPhone: DataSave.tosUserPhone,
tosAccountName: DataSave.tosAccountName,
});
setvalues(DataSave.tosUserLevel); // 等级 //二级账户列表
const towAccount = JSON.parse(localStorage.getItem('towAccount') || '[]');
// 发起获取权限请求
RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求
}
}, [DataSave]);
// 当前账户权限 // 当前账户权限
useEffect(() => { useEffect(() => {
if (user != null) { if (user != null || values == 2) {
let treeDatas = treeData; let _tmp = JSON.stringify(treeData); //将对象转换为json字符串形式
let treeDatas = JSON.parse(_tmp); //将转换而来的字符串转换为原生js对
let _a = user.currentUser.permission; // 当前账户权限 let _a = user.currentUser.permission; // 当前账户权限
let _p = treeDatas[0].children; // 所有权限列表 let _p = treeDatas[0].children; // 所有权限列表
...@@ -78,23 +71,69 @@ const Account = (props: any) => { ...@@ -78,23 +71,69 @@ const Account = (props: any) => {
// 当当前账户是二级以上禁用创建二级菜单 // 当当前账户是二级以上禁用创建二级菜单
if (user.currentUser.userModel.tosUserLevel > 1) { if (user.currentUser.userModel.tosUserLevel > 1) {
setvalues(user.currentUser.userModel.tosUserLevel); setvalues(3);
setdisab(true); setdisab(true);
settowAccountId(user.currentUser.userModel.id);
// 禁用最后两个 // 且禁用最后两个账户管理
_p[_p.length - 1].children[2].disableCheckbox = true; _p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true; _p[_p.length - 1].children[3].disableCheckbox = true;
// 如果是三级账户,删除最后两个账户管理 } else {
if (user.currentUser.userModel.tosUserLevel == 3) { // 如果是一级账户获取挂靠的二级账户名称
console.log(treeData); RA(56, {}, module, dispatch); // 权限上传
}
} }
// 赋值改变 // 赋值改变
treeDatas[0].children = _p; treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表 settreeDataList(treeDatas as any); // 可勾选列表
} }
}, [user]); }, [user, values]);
// 当前编辑账户的数据
useEffect(() => {
if (DataSave != null && user != null) {
// 赋值
form.setFieldsValue({
tosUserName: DataSave.tosUserName,
tosUserPhone: DataSave.tosUserPhone,
tosAccountName: DataSave.tosAccountName,
});
setvalues(DataSave.tosUserLevel); // 等级
setCommunity([...DataSave.tosUserServiceCell.split(',')]); // 默认小区
// 当前登录的不是admin 就 给默认id
if (user.currentUser.userModel.tosUserLevel > 1) {
settowAccountId(DataSave.userLeader); // 二级账户id
}
// 如果是3级,取消后面两个选择
if (DataSave.tosUserLevel == 3) {
let treeDatas = treeData;
let _p = treeDatas[0].children; // 所有权限列表
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
// 赋值改变
treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表
}
// 发起获取权限请求
RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求
}
}, [DataSave, user]);
// 提交信息结果
useEffect(() => {
if (SubResult != null) {
if (SubResult.statr == 0 && SubResult.desc == 0) {
// 保存成功, 清掉原来数据 并且跳转
message.success('Submitted Successfully !');
dispatch({ type: module + '/ReData' });
dispatch({ type: module + '/AccountClear' });
history.go(-1);
}
}
}, [SubResult]);
// 已选权限 // 已选权限
useEffect(() => { useEffect(() => {
...@@ -104,7 +143,6 @@ const Account = (props: any) => { ...@@ -104,7 +143,6 @@ const Account = (props: any) => {
for (let i in newPer) { for (let i in newPer) {
data[i] = newPer[i] + ''; data[i] = newPer[i] + '';
} }
// console.log(data); // 编辑的账户的权限
let _p = treeData[0].children; // 所有权限列表 let _p = treeData[0].children; // 所有权限列表
// console.log(_p); // 所有权限列表 // console.log(_p); // 所有权限列表
...@@ -129,25 +167,53 @@ const Account = (props: any) => { ...@@ -129,25 +167,53 @@ const Account = (props: any) => {
// console.log('包含' + _p[i].key); // console.log('包含' + _p[i].key);
} }
} }
// console.log(data);
// 再赋值给列表 // 再赋值给列表
setCheckedKeys(data); setCheckedKeys(data);
} }
}, [Permission]); }, [Permission]);
// 监听改变状态提交结果 // 二级管辖小区和权限
useEffect(() => { useEffect(() => {
// 提交信息结果 if (Info != null) {
if (SubResult != null) { setCommunity(Info.community);
if (SubResult.statr == 0 && SubResult.desc == 0) { power(Info.permissions);
// 保存成功, 清掉原来数据 并且跳转 }
message.success('Submitted Successfully !'); }, [Info]);
dispatch({ type: module + '/ReData' });
dispatch({ type: module + '/AccountClear' }); //权限赋值
history.go(-1); const power = (val: any) => {
let _tmp = JSON.stringify(treeData); //将对象转换为json字符串形式
let treeDatas = JSON.parse(_tmp); //将转换而来的字符串转换为原生js对
let _a = val; // 当前账户权限
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;
}
}
} }
} }
}, [SubResult]); // 且禁用最后两个账户管理
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
// 赋值改变
treeDatas[0].children = _p;
settreeDataList(treeDatas as any); // 可勾选列表
};
// 保存提交 // 保存提交
const onFinishContract = async (value: any) => { const onFinishContract = async (value: any) => {
...@@ -161,7 +227,8 @@ const Account = (props: any) => { ...@@ -161,7 +227,8 @@ const Account = (props: any) => {
// 姓名联系方式 // 姓名联系方式
message.error('Please enter the correct name and contact information!'); message.error('Please enter the correct name and contact information!');
return false; return false;
} else if (checkedKeys.length == 0) { } else if (checkedKeys[0].key) {
// 如果存在key 就是没有选择
// 权限 // 权限
message.error('Please Select Permission!'); message.error('Please Select Permission!');
return false; return false;
...@@ -173,19 +240,25 @@ const Account = (props: any) => { ...@@ -173,19 +240,25 @@ const Account = (props: any) => {
// 账号长度 // 账号长度
message.error('The Account Password is Greater Than 6 Digits!'); message.error('The Account Password is Greater Than 6 Digits!');
return false; return false;
} else if (values == 3 && towAccountId == null) {
// 如果创建的是三级账号就要判断是否选择了绑定的二级账户
message.error('Please select affiliated account !');
return false;
} else { } else {
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
if (values == 3) {
value.userLeader = towAccountId;
}
delete value.community; delete value.community;
DataSave ? (value.id = DataSave.id) : '';
value.id = DataSave.id;
// 判断有没有 0 有就删除 // 判断有没有 0 有就删除
for (var i in checkedKeys) { for (var i in checkedKeys) {
checkedKeys[i] == '0' ? checkedKeys.splice(i as any, 1) : ''; checkedKeys[i] == '0' ? checkedKeys.splice(i, 1) : '';
} }
// 追加到上级id // 追加到上级id
...@@ -213,6 +286,7 @@ const Account = (props: any) => { ...@@ -213,6 +286,7 @@ const Account = (props: any) => {
RA(38, value, module, dispatch); // 信息上传 RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传 RA(42, obj, module, dispatch); // 权限上传
return true;
} }
}; };
...@@ -221,9 +295,6 @@ const Account = (props: any) => { ...@@ -221,9 +295,6 @@ const Account = (props: any) => {
history.go(-1); history.go(-1);
}; };
// 全选
const onCheckAllChange = (e: any) => {};
// 展开/收起树形菜单触发 // 展开/收起树形菜单触发
const onExpand = (expandedKeys: any) => { const onExpand = (expandedKeys: any) => {
setExpandedKeys(expandedKeys); setExpandedKeys(expandedKeys);
...@@ -232,13 +303,13 @@ const Account = (props: any) => { ...@@ -232,13 +303,13 @@ const Account = (props: any) => {
// 点击单个触发 // 点击单个触发
const onCheck = (checkedKeys: any) => { const onCheck = (checkedKeys: any) => {
console.log('onCheck', checkedKeys); // console.log('onCheck', checkedKeys);
setCheckedKeys(checkedKeys); setCheckedKeys(checkedKeys);
}; };
// 点击树节点触发 - 大栏目 // 点击树节点触发 - 大栏目
const onSelect = (selectedKeys: any, info: any) => { const onSelect = (selectedKeys: any, info: any) => {
console.log('onSelect', info); // console.log('onSelect', info);
setSelectedKeys(selectedKeys); setSelectedKeys(selectedKeys);
}; };
...@@ -252,7 +323,32 @@ const Account = (props: any) => { ...@@ -252,7 +323,32 @@ const Account = (props: any) => {
//级别切换 //级别切换
const onRadio = (e: any) => { const onRadio = (e: any) => {
setvalues(e.target.value); // 当编辑自己的时候不能切换
if (user.currentUser.userModel.id === DataSave.id) {
message.info('You cannot modify your own level!');
return false;
} else {
setvalues(e.target.value);
// 如果是3级,取消后面两个选择
let treeDatas = treeData;
let _p = treeDatas[0].children; // 所有权限列表
// 禁用最后两个
if (e.target.value == 3) {
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
} else {
//否则打开
_p[_p.length - 1].children[2].disableCheckbox = false;
_p[_p.length - 1].children[3].disableCheckbox = false;
settowAccountId(null);
}
// 赋值改变
treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表
return;
}
}; };
//手机号 //手机号
...@@ -263,6 +359,21 @@ const Account = (props: any) => { ...@@ -263,6 +359,21 @@ const Account = (props: any) => {
return getNumber(value.replace(/[^\d^\.]+/g, '')); return getNumber(value.replace(/[^\d^\.]+/g, ''));
}; };
// 二级账户
const listItems = towAccount.map((item: any) => {
return (
<Option key={item.id} value={item.id}>
{item.tosAccountName}-{item.tosUserEmail}
</Option>
);
});
// 选择哪个二级账号
const handleChange = (value: any) => {
RA(57, { tosUserLevelId: value }, module, dispatch); // 根据用户id获取用户管辖小区名和权限
settowAccountId(value);
};
return ( return (
<Spin spinning={loading}> <Spin spinning={loading}>
<div className="contop" style={{ padding: '12px 20px' }}> <div className="contop" style={{ padding: '12px 20px' }}>
...@@ -277,7 +388,6 @@ const Account = (props: any) => { ...@@ -277,7 +388,6 @@ const Account = (props: any) => {
</div> </div>
</h3> </h3>
<hr></hr> <hr></hr>
<Form <Form
ref={formRef} ref={formRef}
form={form} form={form}
...@@ -290,7 +400,7 @@ const Account = (props: any) => { ...@@ -290,7 +400,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] as any}> <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" />
</Form.Item> </Form.Item>
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
...@@ -314,9 +424,7 @@ const Account = (props: any) => { ...@@ -314,9 +424,7 @@ const Account = (props: any) => {
</Descriptions> </Descriptions>
<Form.Item name="community" label="Community"> <Form.Item name="community" label="Community">
<SelectCommunity <SelectCommunity checklist={community} />
checklist={DataSave == null ? null : DataSave.tosUserServiceCell.split(',')}
/>
</Form.Item> </Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}> <div className="diy" style={{ marginBottom: '14px' }}>
...@@ -330,9 +438,22 @@ const Account = (props: any) => { ...@@ -330,9 +438,22 @@ const Account = (props: any) => {
</Radio> </Radio>
<Radio style={radioStyle} value={3}> <Radio style={radioStyle} value={3}>
Three Level Administrator Three Level Administrator
{/* <Input placeholder="三级管理员" style={{ width: 160, marginLeft: 10 }} /> */}
</Radio> </Radio>
</Radio.Group> </Radio.Group>
{/* 选择挂靠的二级菜单 */}
{values === 3 && user.currentUser.userModel.tosUserLevel <= 1 ? (
<Select
style={{ width: 260 }}
onChange={handleChange}
placeholder="Please select affiliated account"
defaultValue={towAccountId as any}
>
{towAccount ? listItems : ''}
</Select>
) : (
''
)}
</div> </div>
</div> </div>
...@@ -350,8 +471,7 @@ const Account = (props: any) => { ...@@ -350,8 +471,7 @@ const Account = (props: any) => {
checkedKeys={checkedKeys} checkedKeys={checkedKeys}
onSelect={onSelect} onSelect={onSelect}
selectedKeys={selectedKeys} selectedKeys={selectedKeys}
treeData={treeData} treeData={treeDataList}
// checkStrictly={true}
/> />
</div> </div>
</div> </div>
...@@ -371,7 +491,8 @@ const Account = (props: any) => { ...@@ -371,7 +491,8 @@ const Account = (props: any) => {
}; };
const AccountProps = (state: any) => { const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result, Permission, SubResult } = state.Account; const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission, Info } = state.Account;
const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.Account || false; const loading = state.loading.models.Account || false;
const { user } = state; const { user } = state;
return { return {
...@@ -381,8 +502,10 @@ const AccountProps = (state: any) => { ...@@ -381,8 +502,10 @@ const AccountProps = (state: any) => {
Result, Result,
loading, loading,
Permission, Permission,
user, CommunityList,
user, // 获取当前账户信息
SubResult, SubResult,
Info,
}; };
}; };
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Form, Input, Button, message, Descriptions, Spin, Tree, Radio, Select } from 'antd'; import { Form, Input, Button, message, Descriptions, Spin, Tree, Tag, Select } from 'antd';
import { connect, history } from 'umi'; import { connect, history } from 'umi';
import { EditOutlined, LeftOutlined } from '@ant-design/icons'; import { EditOutlined, LeftOutlined, CheckCircleOutlined, RightOutlined } from '@ant-design/icons';
import './Account.less'; import './Account.less';
import { zhCnFaci, enUsFaci } from '@/utils/power'; import { zhCnFaci, enUsFaci } from '@/utils/power';
...@@ -14,31 +14,29 @@ import { RA } from '@/utils/method'; ...@@ -14,31 +14,29 @@ import { RA } from '@/utils/method';
const Account = (props: any) => { const Account = (props: any) => {
const module = 'Account'; const module = 'Account';
const { dispatch, SubResult, CommunityList, loading, user, DataSave, Permission } = props; const { dispatch, SubResult, CommunityList, loading, user, DataSave, Permission, Info } = props;
// 权限列表 // 权限列表
const treeData = enUsFaci || zhCnFaci; 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 [checkedKeys, setCheckedKeys] = useState([] as any); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点 const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭 const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
const [treeDataList, settreeDataList] = useState(treeData); // 权限列表
// 单选 二级还是三级管理员 // 单选 二级还是三级管理员
const [values, setvalues] = useState(2); // 树形菜单展开关闭 const [values, setvalues] = useState(2); // 树形菜单展开关闭
const [disab, setdisab] = useState(false); // 是否禁止选择二级
const [towAccountId, settowAccountId] = useState(null); // 二级账户id const [towAccountId, settowAccountId] = useState(null); // 二级账户id
//默认选中的小区
const [community, setCommunity] = useState([] as any);
// 表单标识 // 表单标识
const [form] = Form.useForm(); const [form] = Form.useForm();
const formRef = useRef(null); const formRef = useRef(null);
const { Option } = Select; // 当前账户权限
//二级账户列表
const towAccount = JSON.parse(localStorage.getItem('towAccount') || '[]');
// 登录账户权限
useEffect(() => { useEffect(() => {
if (user != null) { if (user != null) {
let treeDatas = treeData; let treeDatas = treeData;
...@@ -63,23 +61,6 @@ const Account = (props: any) => { ...@@ -63,23 +61,6 @@ const Account = (props: any) => {
} }
} }
} }
// 当当前账户是二级以上禁用创建二级菜单
if (user.currentUser.userModel.tosUserLevel > 1) {
setvalues(3);
setdisab(true);
settowAccountId(user.currentUser.id);
// 如果是三级账户,禁用最后两个账户管理
if (user.currentUser.userModel.tosUserLevel == 3) {
// 禁用最后两个
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
}
} else {
// 如果是一级账户获取挂靠的二级账户名称
RA(56, {}, module, dispatch); // 权限上传
}
// 赋值改变 // 赋值改变
treeDatas[0].children = _p; treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表 setCheckedKeys(treeDatas as any); // 可勾选列表
...@@ -88,7 +69,7 @@ const Account = (props: any) => { ...@@ -88,7 +69,7 @@ const Account = (props: any) => {
// 当前编辑账户的数据 // 当前编辑账户的数据
useEffect(() => { useEffect(() => {
if (DataSave != null) { if (DataSave != null && user != null) {
// 赋值 // 赋值
form.setFieldsValue({ form.setFieldsValue({
tosUserName: DataSave.tosUserName, tosUserName: DataSave.tosUserName,
...@@ -96,24 +77,22 @@ const Account = (props: any) => { ...@@ -96,24 +77,22 @@ const Account = (props: any) => {
tosAccountName: DataSave.tosAccountName, tosAccountName: DataSave.tosAccountName,
}); });
settowAccountId(DataSave.userLeader); // 二级账户id
setvalues(DataSave.tosUserLevel); // 等级 setvalues(DataSave.tosUserLevel); // 等级
setCommunity([...DataSave.tosUserServiceCell.split(',')]); // 默认小区
// 当前登录的不是admin 就 给默认id
if (user.currentUser.userModel.tosUserLevel > 1) {
settowAccountId(DataSave.userLeader); // 二级账户id
}
// 如果是3级,取消后面两个选择
if (DataSave.tosUserLevel == 3) { if (DataSave.tosUserLevel == 3) {
let treeDatas = treeData; settowAccountId(DataSave.userLeader); //上级id
let _p = treeDatas[0].children; // 所有权限列表
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
// 赋值改变
treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表
} }
// 发起获取权限请求 // 发起获取权限请求
RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求 RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求
} }
}, [DataSave]); }, [DataSave, user]);
// 提交信息结果 // 提交信息结果
useEffect(() => { useEffect(() => {
...@@ -160,11 +139,55 @@ const Account = (props: any) => { ...@@ -160,11 +139,55 @@ const Account = (props: any) => {
// console.log('包含' + _p[i].key); // console.log('包含' + _p[i].key);
} }
} }
// 再赋值给列表 // 再赋值给列表
// data.push('0');
setCheckedKeys(data); setCheckedKeys(data);
} }
}, [Permission]); }, [Permission]);
// 二级管辖小区和权限
useEffect(() => {
if (Info != null) {
setCommunity(Info.community);
power(Info.permissions);
}
}, [Info]);
//权限赋值
const power = (val: any) => {
let _tmp = JSON.stringify(treeData); //将对象转换为json字符串形式
let treeDatas = JSON.parse(_tmp); //将转换而来的字符串转换为原生js对
let _a = val; // 当前账户权限
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;
}
}
}
}
// 且禁用最后两个账户管理
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
// 赋值改变
treeDatas[0].children = _p;
settreeDataList(treeDatas as any); // 可勾选列表
};
// 保存提交 // 保存提交
const onFinishContract = async (value: any) => { const onFinishContract = async (value: any) => {
const userInfo = localStorage.getItem('userInfo') || ''; const userInfo = localStorage.getItem('userInfo') || '';
...@@ -198,7 +221,7 @@ const Account = (props: any) => { ...@@ -198,7 +221,7 @@ 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 = JSON.parse(userInfo).userModel.tosUserName; //新建者账号 // value.creatorName = JSON.parse(userInfo).userModel.tosUserName; //新建者账号
value.creatorId = id; //新建者ID value.creatorId = id; //新建者ID
if (values == 3) { if (values == 3) {
value.userLeader = towAccountId; value.userLeader = towAccountId;
...@@ -263,37 +286,6 @@ const Account = (props: any) => { ...@@ -263,37 +286,6 @@ const Account = (props: any) => {
setSelectedKeys(selectedKeys); setSelectedKeys(selectedKeys);
}; };
// 管理员级别样式
const radioStyle = {
display: 'block',
height: '30px',
lineHeight: '30px',
marginBottom: '15px',
};
//级别切换
const onRadio = (e: any) => {
setvalues(e.target.value);
// 如果是3级,取消后面两个选择
let treeDatas = treeData;
let _p = treeDatas[0].children; // 所有权限列表
// 禁用最后两个
if (e.target.value == 3) {
_p[_p.length - 1].children[2].disableCheckbox = true;
_p[_p.length - 1].children[3].disableCheckbox = true;
} else {
//否则打开
_p[_p.length - 1].children[2].disableCheckbox = false;
_p[_p.length - 1].children[3].disableCheckbox = false;
settowAccountId(null);
}
// 赋值改变
treeDatas[0].children = _p;
setCheckedKeys(treeDatas as any); // 可勾选列表
};
//手机号 //手机号
const keyup_communityManagerFee = (e: any) => { const keyup_communityManagerFee = (e: any) => {
e.target.value = keyup_tool(e.target.value); e.target.value = keyup_tool(e.target.value);
...@@ -302,21 +294,6 @@ const Account = (props: any) => { ...@@ -302,21 +294,6 @@ const Account = (props: any) => {
return getNumber(value.replace(/[^\d^\.]+/g, '')); return getNumber(value.replace(/[^\d^\.]+/g, ''));
}; };
// 二级账户
const listItems = towAccount.map((item: any) => {
return (
<Option key={item.id} value={item.id}>
{item.tosAccountName}-{item.tosUserEmail}
</Option>
);
});
// 选择哪个二级账号
const handleChange = (value: any) => {
// console.log(`selected ${value}`);
settowAccountId(value);
};
return ( return (
<Spin spinning={loading}> <Spin spinning={loading}>
<div className="contop" style={{ padding: '12px 20px' }}> <div className="contop" style={{ padding: '12px 20px' }}>
...@@ -367,7 +344,7 @@ const Account = (props: any) => { ...@@ -367,7 +344,7 @@ const Account = (props: any) => {
</Descriptions> </Descriptions>
<Form.Item name="community" label="Community"> <Form.Item name="community" label="Community">
<SelectCommunity checklist={CommunityList == null ? null : CommunityList} /> <SelectCommunity checklist={community} />
</Form.Item> </Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}> <div className="diy" style={{ marginBottom: '14px' }}>
...@@ -375,25 +352,23 @@ const Account = (props: any) => { ...@@ -375,25 +352,23 @@ 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 value={values} onChange={onRadio}> <Tag
<Radio style={radioStyle} disabled={disab} value={2}> icon={<CheckCircleOutlined />}
Two Level Administrator color="success"
</Radio> style={{ verticalAlign: 'sub', fontSize: 14, padding: '4px 7px' }}
<Radio style={radioStyle} value={3}> >
Three Level Administrator {DataSave.tosUserLevel == 2
</Radio> ? 'Two Level Administrator '
</Radio.Group> : 'Three Level Administrator'}
</Tag>
{/* 选择挂靠的二级菜单 */} {DataSave.tosUserLevel == 3 ? (
{values === 3 && user.currentUser.userModel.tosUserLevel <= 1 ? ( <Tag
<Select icon={<RightOutlined />}
style={{ width: 260 }} color="processing"
onChange={handleChange} style={{ verticalAlign: 'sub', fontSize: 14, padding: '4px 7px' }}
placeholder="Please select affiliated account"
defaultValue={towAccountId as any}
> >
{towAccount ? listItems : ''} Superiors:{DataSave.userLeaderAccountName} - {DataSave.userLeaderName}
</Select> </Tag>
) : ( ) : (
'' ''
)} )}
...@@ -414,7 +389,8 @@ const Account = (props: any) => { ...@@ -414,7 +389,8 @@ const Account = (props: any) => {
checkedKeys={checkedKeys} checkedKeys={checkedKeys}
onSelect={onSelect} onSelect={onSelect}
selectedKeys={selectedKeys} selectedKeys={selectedKeys}
treeData={treeData} treeData={treeDataList}
disabled
/> />
</div> </div>
</div> </div>
...@@ -434,7 +410,7 @@ const Account = (props: any) => { ...@@ -434,7 +410,7 @@ const Account = (props: any) => {
}; };
const AccountProps = (state: any) => { const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission } = state.Account; const { Data, DataSave, DataSaveDetail, Result, SubResult, Permission, Info } = state.Account;
const { CommunityList } = state.Init; // 小区列表 const { CommunityList } = state.Init; // 小区列表
const loading = state.loading.models.Account || false; const loading = state.loading.models.Account || false;
const { user } = state; const { user } = state;
...@@ -448,6 +424,7 @@ const AccountProps = (state: any) => { ...@@ -448,6 +424,7 @@ const AccountProps = (state: any) => {
CommunityList, CommunityList,
user, // 获取当前账户信息 user, // 获取当前账户信息
SubResult, SubResult,
Info,
}; };
}; };
......
...@@ -167,9 +167,7 @@ const BookingDetail = (props: any) => { ...@@ -167,9 +167,7 @@ const BookingDetail = (props: any) => {
<hr /> <hr />
{/* 已交押金且未产生退费 */} {/* 已交押金且未产生退费 */}
{DataSave != null && {DataSave != null && DataSave.managerFeeStatus == 1 && DataSave.backMarginFee > 0 ? (
DataSave.managerFeeStatus == 1 &&
DataSave.communityManagerFee > 0 ? (
<> <>
<Form <Form
ref={formRef} ref={formRef}
......
...@@ -130,4 +130,5 @@ export const requestList = [ ...@@ -130,4 +130,5 @@ export const requestList = [
['/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 获取二级账号', {}], ['/tos/user/twoLevel/get', '56 获取二级账号', {}],
['/tos/user/twoLevel/get/CommunityAuth', '57 根据用户id获取用户管辖小区名和权限', {}],
]; ];
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