Commit 0064e792 authored by tianfen's avatar tianfen

perf: 修改数据初始化的滚动条

parent 090ad4f5
......@@ -7,6 +7,11 @@ import { setAuthority } from '@/utils/authority';
import { appConnector } from '@/containers/App/store';
import logo from '@/assets/images/logo/panda-logo2.png';
import connectHistoryHoc from '@/containers/connectHistoryHoc';
const roleName = {
admin: '管理员',
super: '超级管理员',
};
class AvatarDropdown extends React.Component {
/* eslint-disable no-unused-vars */
onMenuClick = event => {
......@@ -56,6 +61,7 @@ class AvatarDropdown extends React.Component {
</Menu.Item>
</Menu>
);
let role = JSON.parse(localStorage.getItem('panda-oms-authority'))[1];
return currentUser ? (
<HeaderDropdown overlay={menuHeaderDropdown}>
<span className={`${styles.action} ${styles.account}`}>
......@@ -66,7 +72,8 @@ class AvatarDropdown extends React.Component {
alt="avatar"
/>
<span className={`${styles.name} anticon`}>
{currentUser.name || loginName || '管理员'}
{roleName[role]}
{/* {currentUser.name || loginName || '管理员'} */}
</span>
</span>
</HeaderDropdown>
......
import React, { useEffect, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import {
Card,
Form,
......@@ -60,7 +60,7 @@ const InitDataBase = props => {
const [initContent, setInitContent] = useState(''); // 数据库初始化内容
const [cardLoading, setCardLoading] = useState(false); // 初始化card Loading
const [finish, setFinish] = useState(false);
const scroll = useRef(null);
// 获取数据库链接记录
useEffect(() => {
setTableLoading(true);
......@@ -136,11 +136,20 @@ const InitDataBase = props => {
setInitVisible(true);
let obj = form.getFieldsValue();
doInitLog();
for (let i = 0; i < 9; i++) {
for (let i = 0; i < 3; i++) {
setTimeout(() => {
doInitLog();
}, 100);
}
const timer = setInterval(() => {
if (
scroll.current.scrollHeight ===
scroll.current.clientHeight + scroll.current.scrollTop
) {
clearInterval(timer);
}
scroll.current.scrollTo(0, scroll.current.scrollHeight - 570);
}, 1000);
initDBv4({
_version: 9999,
_dc: Date.now(),
......@@ -580,10 +589,10 @@ const InitDataBase = props => {
setInitVisible(false);
setInitContent('');
}}
width="800px"
width={800}
bodyStyle={{
maxHeight: '600px',
overflowY: 'scroll',
height: '600px',
// overflowY: 'auto',
}}
footer={[
<Button
......@@ -596,7 +605,9 @@ const InitDataBase = props => {
</Button>,
]}
>
{initContent}
<div ref={scroll} style={{ maxHeight: '570px', overflowY: 'auto' }}>
{initContent}
</div>
</Modal>
<Modal
......
......@@ -10,7 +10,6 @@ import {
Spin,
List,
Space,
Collapse,
Checkbox,
Select,
} from 'antd';
......@@ -28,10 +27,10 @@ import {
getAllGroup,
getStationUserList,
} from '@/services/userCenter/siteManage/api';
import ListCard, {
checkChildrenByCondition,
getId,
} from '@/components/CheckGroup';
// import ListCard, {
// checkChildrenByCondition,
// getId,
// } from '@/components/CheckGroup';
import styles from '@/pages/userCenter/siteManage/SiteManage.less';
import qs from 'qs';
import { appConnector } from '@/containers/App/store';
......@@ -175,8 +174,8 @@ const SiteManage = props => {
</List.Item>
));
const handleChangeCollpase = (groupId, isShow) => {
let index = dataList.findIndex(item => item.GroupId == groupId);
dataList[index].isShow = !isShow;
let index = dataList.findIndex(item => item.GroupId === groupId);
// dataList[index].isShow = !isShow;
if (dataList[index].children && dataList[index].children.length > 0) {
setdataList(lodash.cloneDeep(dataList));
return;
......@@ -198,10 +197,12 @@ const SiteManage = props => {
dataList[index].selectList = e.target.checked
? dataList[index].userList
: [];
dataList[index].children &&
if (dataList[index].children) {
dataList[index].children.forEach(item => {
item.isChecked = e.target.checked;
});
}
setdataList(lodash.cloneDeep(dataList));
};
// 单个选择checkbox
......@@ -369,9 +370,9 @@ const SiteManage = props => {
))}
</Select>
</Col>
{/* <Col span={3} /> */}
<Col span={15} style={{ textAlign: 'right' }}>
<Space size="small">
<Col span={3} />
<Col span={8}>
<Space size="large">
<Button
type="primary"
onClick={() => {
......@@ -427,13 +428,15 @@ const SiteManage = props => {
))}
</Spin>
{dataList.length ? (
<Button
type="primary"
className={styles.siteCommit}
onClick={handleCommitBtn}
>
提交
</Button>
<div style={{ textAlign: 'right' }}>
<Button
type="primary"
className={styles.siteCommit}
onClick={handleCommitBtn}
>
提交
</Button>
</div>
) : null}
</Card>
</div>
......@@ -452,35 +455,34 @@ const Panels = React.memo(props => {
className={styles.sitePanelHead}
onClick={() => props.handleChangeCollpase(GroupId, isShow)}
>
{isShow ? (
{/* {isShow ? (
<UpOutlined className={styles.siteIcon} />
) : (
<DownOutlined className={styles.siteIcon} />
)}
)} */}
<UpOutlined className={styles.siteIcon} />
<p style={{ color }}>{GroupName}</p>
</div>
{isShow ? (
<div className={styles.sitePanelCon}>
<Checkbox
key="0"
className={styles.siteList}
checked={isChecked}
onClick={e => props.handleChangeAll(e, index)}
>
全选
</Checkbox>
{children &&
children.map((v, vIndex) => (
<CheckBoxRow
{...v}
index={index}
vIndex={vIndex}
key={v.userID}
handleChangeSignel={props.handleChangeSignel}
/>
))}
</div>
) : null}
<div className={styles.sitePanelCon}>
<Checkbox
key="0"
className={styles.siteList}
checked={isChecked}
onClick={e => props.handleChangeAll(e, index)}
>
全选
</Checkbox>
{children &&
children.map((v, vIndex) => (
<CheckBoxRow
{...v}
index={index}
vIndex={vIndex}
key={v.userID}
handleChangeSignel={props.handleChangeSignel}
/>
))}
</div>
</div>
);
});
......
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