Commit 6b46650b authored by cellee's avatar cellee

账号权限

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent a54e0a6a
......@@ -4,9 +4,9 @@ import SelectOptions from '../SelectOptions/Tow';
import { connect } from 'umi';
const index = (props: any) => {
const { dispatch, CommunityList, value, onChange, checklist } = props;
const { dispatch, CommunityList, value, onChange, checklist, list } = props;
// console.log(props)
const [Clist, setClist] = useState(CommunityList); // 二级账户id
const tosCommunityget = (values: any) => {
dispatch({ type: 'Init/tosCommunityget', playload: values });
......@@ -25,6 +25,12 @@ const index = (props: any) => {
}
}, [checklist]);
useEffect(() => {
if (list != null) {
setClist(list);
}
}, [list]);
// 点击选择的时候传递给子组件 已选列表
const printContent = (values: any) => {
onChange({ index: CommunityList.length == values.length ? 1 : 0, value: values });
......@@ -33,7 +39,7 @@ const index = (props: any) => {
<>
{CommunityList != null ? (
<SelectOptions
list={CommunityList.sort()}
list={Clist.sort()}
checklist={checklist}
show={true}
onSubmit={printContent}
......
......@@ -92,13 +92,13 @@ class SelectOptions extends React.PureComponent {
componentWillReceiveProps(nextProps) {
// 如果存在更新 就拿取最新的选中小区值
// 判断是不是props 的最新值 否则每次点击都要更新
if (nextProps.checklist !== this.props.checklist) {
if (nextProps.list !== this.props.list || nextProps.checklist !== this.props.checklist) {
this.setState({
menuList: ArrayToPingYin.get(nextProps.checklist),
checkedListOptions: nextProps.checklist,
menuList: ArrayToPingYin.get(nextProps.list),
checkedListOptions: nextProps.list,
checkedList: nextProps.checklist,
indeterminate: false, // 多选框 总框的 状态
checkAll: true, // 判断传递来的小区是不是全选
indeterminate: true, // 多选框 总框的 状态
checkAll: false, // 判断传递来的小区是不是全选
checkNone: false,
resultList: nextProps.checklist,
flag: false,
......
......@@ -337,7 +337,10 @@ const Account = (props: any) => {
</Descriptions>
<Form.Item name="community" label="Community">
<SelectCommunity checklist={community ? community : null} />
<SelectCommunity
checklist={community ? community : null}
list={community ? community : []}
/>
</Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}>
......
......@@ -7,7 +7,7 @@ import './Account.less';
import { zhCnFaci, enUsFaci } from '@/utils/power';
import { AccountTip } from '@/utils/tip';
import SelectCommunity from '@/components/SelectCommunity';
import SelectCommunity from '@/components/SelectCommunity/Tow';
import { getNumber } from '@/utils/string'; // 正则
import { RA } from '@/utils/method';
......@@ -19,7 +19,7 @@ const Account = (props: any) => {
// 权限列表
const treeData = localStorage.getItem('umi_locale') == 'zh-CN' ? zhCnFaci : enUsFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>(['0']); // 展开栏目
const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState([] as any); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
......@@ -346,7 +346,14 @@ const Account = (props: any) => {
</Descriptions>
<Form.Item name="community" label="Community">
<SelectCommunity checklist={community} />
<SelectCommunity
checklist={community}
list={
DataSave && DataSave.userLeaderCommunityNames
? DataSave.userLeaderCommunityNames
: CommunityList
}
/>
</Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}>
......
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