Commit 40e94a25 authored by Maofei94's avatar Maofei94

perf: perf

parent d777c01c
...@@ -19,8 +19,14 @@ export const checkChildrenByCondition = (item, fn, tag = 'every') => { ...@@ -19,8 +19,14 @@ export const checkChildrenByCondition = (item, fn, tag = 'every') => {
}; };
const ListCard = props => { const ListCard = props => {
const { ouid, searchWord, onCommit = () => {}, itemObj } = props; const {
const [valueList, setValueList] = useState([]); ouid,
searchWord,
onCommit = () => {},
itemObj,
btnLoading = false,
} = props;
const [valueList, setValueList] = useState({});
const [dataList, setdataList] = useState([]); const [dataList, setdataList] = useState([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [mapObj, setMapObj] = useState({}); const [mapObj, setMapObj] = useState({});
...@@ -131,7 +137,11 @@ const ListCard = props => { ...@@ -131,7 +137,11 @@ const ListCard = props => {
)} )}
{true && !loading && dataList && ( {true && !loading && dataList && (
<div className={styles.btnBox}> <div className={styles.btnBox}>
<Button type="primary" onClick={() => onCommit(valueList)}> <Button
type="primary"
onClick={() => onCommit(valueList)}
loading={btnLoading}
>
提交 提交
</Button> </Button>
</div> </div>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
.divSingle{ .divSingle{
border: none; border: none;
margin-top: 20px; margin-top: 20px;
flex:0 0 200px; flex:0 0 180px;
background: transparent; background: transparent;
} }
.isSearch{ .isSearch{
......
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
line-height: 32px; line-height: 32px;
} }
.btnBox { .btnBox {
display: flex; display: flex !important;
justify-content: space-around; justify-content: space-around;
} }
\ No newline at end of file
...@@ -177,6 +177,13 @@ const ManagementDataBase = () => { ...@@ -177,6 +177,13 @@ const ManagementDataBase = () => {
width: 200, width: 200,
ellipsis: true, ellipsis: true,
}, },
{
title: '解决方案',
dataIndex: 'solutionName',
key: 'solutionName',
width: 200,
ellipsis: true,
},
{ {
title: '数据库版本', title: '数据库版本',
dataIndex: 'version', dataIndex: 'version',
......
...@@ -163,6 +163,7 @@ const MongDBTable = props => { ...@@ -163,6 +163,7 @@ const MongDBTable = props => {
title: '操作', title: '操作',
dataIndex: 'options', dataIndex: 'options',
key: 'options', key: 'options',
width: 300,
render: (val, item) => [ render: (val, item) => [
<Button <Button
size="small" size="small"
......
import React, { useState, useEffect, useCallback, useRef } from 'react'; import React, { useState, useEffect, useCallback } from 'react';
import { Spin, Button } from 'antd'; import { Spin, Button } from 'antd';
import ListCardItem from './listCardItem'; import ListCardItem from './listCardItem';
import { get, post } from '../../services'; import { get, post } from '../../services';
...@@ -6,7 +6,13 @@ import styles from './listCardItem.less'; ...@@ -6,7 +6,13 @@ import styles from './listCardItem.less';
const tip = 'loading...'; const tip = 'loading...';
const ListCard = props => { const ListCard = props => {
const { ouid, searchWord, valueCallback, onCommit = () => {} } = props; const {
ouid,
searchWord,
valueCallback,
onCommit = () => {},
btnLoading = false,
} = props;
const [valueList, setValueList] = useState({}); const [valueList, setValueList] = useState({});
const [dataList, setdataList] = useState([]); const [dataList, setdataList] = useState([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
...@@ -77,7 +83,11 @@ const ListCard = props => { ...@@ -77,7 +83,11 @@ const ListCard = props => {
)} )}
{true && !loading && dataList && ( {true && !loading && dataList && (
<div className={styles.btnBox}> <div className={styles.btnBox}>
<Button type="primary" onClick={() => onCommit()}> <Button
type="primary"
onClick={() => onCommit()}
loading={btnLoading}
>
提交 提交
</Button> </Button>
</div> </div>
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
.ant-checkbox-group-item{ .ant-checkbox-group-item{
flex:0 0 auto; flex:0 0 150px;
margin-right: 100px;
margin-bottom: 5px; margin-bottom: 5px;
} }
} }
......
...@@ -9,7 +9,7 @@ const AddModal = props => { ...@@ -9,7 +9,7 @@ const AddModal = props => {
const [formLayout, setFormLayout] = useState('horizontal'); const [formLayout, setFormLayout] = useState('horizontal');
const [groupList, setGroupList] = useState([]); const [groupList, setGroupList] = useState([]);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const { confirmModal, itemObj } = props; const { confirmModal, itemObj, editVisible } = props;
console.log(itemObj, 'itemObj'); console.log(itemObj, 'itemObj');
useEffect(() => { useEffect(() => {
......
...@@ -8,9 +8,11 @@ import { ...@@ -8,9 +8,11 @@ import {
Spin, Spin,
notification, notification,
Button, Button,
Tooltip,
Space, Space,
} from 'antd'; } from 'antd';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons';
import { import {
setMenuToRole, setMenuToRole,
getRoleGroupList, getRoleGroupList,
...@@ -29,7 +31,7 @@ const SiteManage = () => { ...@@ -29,7 +31,7 @@ const SiteManage = () => {
const [treeData, setTreeData] = useState([]); const [treeData, setTreeData] = useState([]);
const [searchWord, setSearchWord] = useState(''); const [searchWord, setSearchWord] = useState('');
const [roleID, setRoleID] = useState(''); // 角色ID const [roleID, setRoleID] = useState(''); // 角色ID
const [saveTreeId, setSaveTreeId] = useState(''); // 保存点击回调的ird const [saveTreeId, setSaveTreeId] = useState(''); // 保存点击回调的roleid
const [modalVisible, setModalVisible] = useState(false); // 新增弹窗 const [modalVisible, setModalVisible] = useState(false); // 新增弹窗
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
const [itemObj, setItemObj] = useState({}); // 选择的角色item const [itemObj, setItemObj] = useState({}); // 选择的角色item
...@@ -38,29 +40,35 @@ const SiteManage = () => { ...@@ -38,29 +40,35 @@ const SiteManage = () => {
const [subList, setSubList] = useState([]); // 选中的数组 const [subList, setSubList] = useState([]); // 选中的数组
const [spinLoading, setSpinLoading] = useState(false); const [spinLoading, setSpinLoading] = useState(false);
const [currentSelectId, setCurrentSelectId] = useState([]); // 选中的树节点 const [currentSelectId, setCurrentSelectId] = useState([]); // 选中的树节点
const [saveCurId, setSaveCurId] = useState([]); // 树节点ID
const [groupVisible, setGroupVisible] = useState(false); // 分组编辑弹窗 const [groupVisible, setGroupVisible] = useState(false); // 分组编辑弹窗
const [btnLoading, setBtnLoading] = useState(false);
const [mulu, setMulu] = useState(true);
// 点击树的回调 // 点击树的回调
const handleTreeSelect = (e, treenode) => { const handleTreeSelect = (e, treenode) => {
const { node } = treenode; if (treenode) {
setItemObj(node); console.log(e, node, 'node');
console.log(e, node, 'node'); const { node } = treenode;
const { roleID: id } = node; const { roleID: id } = node;
// setCurrentSelectId(e); setItemObj(node);
if (e[0]) {
setCurrentSelectId(e);
if (id) { if (id) {
setSaveTreeId(id); setSaveTreeId(id);
setRoleID(id); setRoleID(id);
} else { } else {
setRoleID(saveTreeId); setRoleID(saveTreeId);
} }
}
if (e[0]) {
setCurrentSelectId(e);
setSaveCurId(e);
} else { } else {
setCurrentSelectId(saveCurId);
} }
}; };
useEffect(() => { useEffect(() => {
setSpinLoading(true); setSpinLoading(true);
getRoleGroupList({ userID: 1 }).then(res => { getRoleGroupList({ userID: 1 }).then(res => {
console.log(res, 'res');
setSpinLoading(false); setSpinLoading(false);
if (res.code === 0) { if (res.code === 0) {
const { roleList } = res.data; const { roleList } = res.data;
...@@ -68,6 +76,9 @@ const SiteManage = () => { ...@@ -68,6 +76,9 @@ const SiteManage = () => {
setTreeData(arr); setTreeData(arr);
} }
}); });
return () => {
setItemObj({});
};
}, [flag]); }, [flag]);
const handleAdd = e => { const handleAdd = e => {
setModalVisible(true); setModalVisible(true);
...@@ -99,23 +110,29 @@ const SiteManage = () => { ...@@ -99,23 +110,29 @@ const SiteManage = () => {
item.title = item.visibleTitle || ''; item.title = item.visibleTitle || '';
item.key = item.visibleValue || ''; item.key = item.visibleValue || '';
if (item.roleList && item.roleList.length > 0) { if (item.roleList && item.roleList.length > 0) {
item.roleList.map(itemRole => { item.roleList.map((itemRole, index) => {
if (itemRole.roleList) { if (itemRole.roleList) {
itemRole.title = itemRole.visibleTitle || ''; itemRole.title = itemRole.visibleTitle || '';
itemRole.key = itemRole.key = itemRole.visibleTitle + itemRole.visibleValue || '';
itemRole.visibleTitle + Math.floor(Math.random() * 100 + 1) || '';
itemRole.groupflag = itemRole.visibleTitle; itemRole.groupflag = itemRole.visibleTitle;
itemRole.roleList.map(i => { itemRole.roleList.map(i => {
i.title = i.roleName; i.title = i.roleName;
i.key = i.roleID; i.key = i.roleID;
i.subSystemValue = item.visibleValue; i.subSystemValue = item.visibleValue;
i.group = itemRole.visibleTitle; i.group = itemRole.visibleTitle;
if (roleID && roleID == i.roleID) {
setItemObj(i);
}
}); });
itemRole.children = itemRole.roleList; itemRole.children = itemRole.roleList;
} else { } else {
itemRole.title = itemRole.roleName; itemRole.title = itemRole.roleName;
itemRole.key = itemRole.roleID; itemRole.key = itemRole.roleID;
itemRole.subSystemValue = item.visibleValue; itemRole.subSystemValue = item.visibleValue;
if (roleID && roleID == itemRole.roleID) {
setItemObj(itemRole);
}
} }
return itemRole; return itemRole;
}); });
...@@ -149,19 +166,24 @@ const SiteManage = () => { ...@@ -149,19 +166,24 @@ const SiteManage = () => {
const editModal = () => { const editModal = () => {
setEditVisible(false); setEditVisible(false);
setFlag(flag + 1); setFlag(flag + 1);
setItemObj(''); handleTreeSelect(saveCurId);
// setItemObj('');
}; };
// 分组编辑回调 // 分组编辑回调
const groupModal = () => { const groupModal = () => {
setGroupVisible(false); setGroupVisible(false);
setFlag(flag + 1); setFlag(flag + 1);
setItemObj(''); setItemObj('');
handleTreeSelect(saveCurId);
}; };
const valueCallback = valueObj => { const valueCallback = valueObj => {
setSubList(valueObj); setSubList(valueObj);
}; };
const handleHide = () => {
setMulu(!mulu);
};
const handleCommit = rusults => { const handleCommit = rusults => {
console.log(rusults); setBtnLoading(true);
setMenuToRole( setMenuToRole(
qs.stringify({ qs.stringify({
roleID, roleID,
...@@ -174,6 +196,7 @@ const SiteManage = () => { ...@@ -174,6 +196,7 @@ const SiteManage = () => {
}, },
) )
.then(res => { .then(res => {
setBtnLoading(false);
if (res.success) { if (res.success) {
notification.success({ notification.success({
message: '提示', message: '提示',
...@@ -189,14 +212,15 @@ const SiteManage = () => { ...@@ -189,14 +212,15 @@ const SiteManage = () => {
} }
}) })
.catch(err => { .catch(err => {
setBtnLoading(false);
console.log(err); console.log(err);
}); });
}; };
return ( return (
<PageContainer> <PageContainer>
{/* <GridContent> */} {/* <GridContent> */}
<Row gutter={12}> <Row gutter={0}>
<Col lg={6}> <Col lg={mulu ? 5 : 0}>
<Card className={styles.cardBox}> <Card className={styles.cardBox}>
<Spin <Spin
tip="loading...." tip="loading...."
...@@ -209,12 +233,8 @@ const SiteManage = () => { ...@@ -209,12 +233,8 @@ const SiteManage = () => {
showIcon showIcon
onSelect={handleTreeSelect} onSelect={handleTreeSelect}
treeData={treeData} treeData={treeData}
// selectedKeys={currentSelectId} selectedKeys={currentSelectId}
blockNode blockNode
defaultExpandAll
// defaultExpandedKeys={currentSelectId}
autoExpandParent
expandedKeys={currentSelectId}
/> />
)} )}
</Spin> </Spin>
...@@ -244,7 +264,19 @@ const SiteManage = () => { ...@@ -244,7 +264,19 @@ const SiteManage = () => {
/> />
</Card> </Card>
</Col> </Col>
<Col lg={18}> <Col span={1}>
{mulu && (
<Tooltip title="隐藏站点" className={styles.hide}>
<DoubleLeftOutlined onClick={() => handleHide()} />
</Tooltip>
)}
{!mulu && (
<Tooltip title="显示站点" className={styles.hide}>
<DoubleRightOutlined onClick={() => handleHide()} />
</Tooltip>
)}
</Col>
<Col lg={mulu ? 18 : 23}>
<Card style={{ marginBottom: '10px' }}> <Card style={{ marginBottom: '10px' }}>
<Row align="middle"> <Row align="middle">
<Col span={1}>搜索</Col> <Col span={1}>搜索</Col>
...@@ -306,6 +338,7 @@ const SiteManage = () => { ...@@ -306,6 +338,7 @@ const SiteManage = () => {
itemObj={itemObj} itemObj={itemObj}
searchWord={searchWord} searchWord={searchWord}
onCommit={handleCommit} onCommit={handleCommit}
btnLoading={btnLoading}
/> />
)} )}
</Card> </Card>
......
...@@ -39,4 +39,14 @@ ...@@ -39,4 +39,14 @@
margin-left: 5px; margin-left: 5px;
} }
} }
}
.hide{
display: block;
position: relative;
font-size: 20px;
color: #1890FF!important;
top: 45%;
left: 50%;
transform: translate(-50%,-50%);
} }
\ No newline at end of file
...@@ -11,7 +11,13 @@ import { ...@@ -11,7 +11,13 @@ import {
List, List,
Space, Space,
} from 'antd'; } from 'antd';
import { FileAddTwoTone, EditTwoTone, DeleteTwoTone } from '@ant-design/icons'; import {
FileAddTwoTone,
EditTwoTone,
DeleteTwoTone,
DoubleLeftOutlined,
DoubleRightOutlined,
} from '@ant-design/icons';
import { GridContent } from '@ant-design/pro-layout'; import { GridContent } from '@ant-design/pro-layout';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import { import {
...@@ -38,7 +44,8 @@ const SiteManage = () => { ...@@ -38,7 +44,8 @@ const SiteManage = () => {
const [editVisible, setEditVisible] = useState(false); // 修改弹窗 const [editVisible, setEditVisible] = useState(false); // 修改弹窗
const [subList, setSubList] = useState([]); // 选中的数组 const [subList, setSubList] = useState([]); // 选中的数组
const [spinLoading, setSpinLoading] = useState(false); const [spinLoading, setSpinLoading] = useState(false);
const now = new Date().getTime(); const [btnLoading, setBtnLoading] = useState(false);
const [mulu, setMulu] = useState(true);
useEffect(() => { useEffect(() => {
setSpinLoading(true); setSpinLoading(true);
...@@ -46,7 +53,7 @@ const SiteManage = () => { ...@@ -46,7 +53,7 @@ const SiteManage = () => {
userMode: 'super', userMode: 'super',
select: '', select: '',
_version: 9999, _version: 9999,
_dc: now, _dc: Date.now(),
node: -2, node: -2,
}) })
.then(res => { .then(res => {
...@@ -157,6 +164,7 @@ const SiteManage = () => { ...@@ -157,6 +164,7 @@ const SiteManage = () => {
}; };
const handleCommit = value => { const handleCommit = value => {
let arr = Object.values(subList); let arr = Object.values(subList);
setBtnLoading(true);
chooseUserToStation( chooseUserToStation(
qs.stringify({ qs.stringify({
userList: String(arr.flat()), userList: String(arr.flat()),
...@@ -169,6 +177,7 @@ const SiteManage = () => { ...@@ -169,6 +177,7 @@ const SiteManage = () => {
}, },
) )
.then(res => { .then(res => {
setBtnLoading(false);
if (res.success) { if (res.success) {
notification.success({ notification.success({
message: '提示', message: '提示',
...@@ -184,10 +193,13 @@ const SiteManage = () => { ...@@ -184,10 +193,13 @@ const SiteManage = () => {
} }
}) })
.catch(err => { .catch(err => {
setBtnLoading(false);
console.log(err); console.log(err);
}); });
}; };
const handleHide = () => {
setMulu(!mulu);
};
const renderListItem = items => const renderListItem = items =>
items.map(t => ( items.map(t => (
<List.Item <List.Item
...@@ -207,8 +219,8 @@ const SiteManage = () => { ...@@ -207,8 +219,8 @@ const SiteManage = () => {
return ( return (
<PageContainer> <PageContainer>
<GridContent> <GridContent>
<Row gutter={12}> <Row gutter={0}>
<Col lg={6}> <Col lg={mulu ? 4 : 0}>
<Card className={styles.cardBox}> <Card className={styles.cardBox}>
<Spin <Spin
tip="loading...." tip="loading...."
...@@ -236,7 +248,20 @@ const SiteManage = () => { ...@@ -236,7 +248,20 @@ const SiteManage = () => {
/> />
</Card> </Card>
</Col> </Col>
<Col lg={18}> <Col span={1}>
{mulu && (
<Tooltip title="隐藏站点" className={styles.hide}>
<DoubleLeftOutlined onClick={() => handleHide()} />
</Tooltip>
)}
{!mulu && (
<Tooltip title="显示站点" className={styles.hide}>
<DoubleRightOutlined onClick={() => handleHide()} />
</Tooltip>
)}
</Col>
<Col lg={mulu ? 19 : 23}>
<Card style={{ marginBottom: '10px' }}> <Card style={{ marginBottom: '10px' }}>
<Row align="middle"> <Row align="middle">
<Col span={1}>搜索</Col> <Col span={1}>搜索</Col>
...@@ -251,7 +276,7 @@ const SiteManage = () => { ...@@ -251,7 +276,7 @@ const SiteManage = () => {
</Col> </Col>
<Col span={3} /> <Col span={3} />
<Col span={8}> <Col span={8}>
<Space> <Space size="large">
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
...@@ -289,6 +314,7 @@ const SiteManage = () => { ...@@ -289,6 +314,7 @@ const SiteManage = () => {
searchWord={searchWord} searchWord={searchWord}
valueCallback={valueCallback} valueCallback={valueCallback}
onCommit={handleCommit} onCommit={handleCommit}
btnLoading={btnLoading}
/> />
)} )}
</Card> </Card>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
.listItem{ .listItem{
padding-left: 5px; padding-left: 5px;
cursor: pointer; cursor: pointer;
font-size: 16px; font-size: 14px;
} }
.listItem:hover{ .listItem:hover{
background-color: #f8f8f8 ; background-color: #f8f8f8 ;
...@@ -40,4 +40,14 @@ ...@@ -40,4 +40,14 @@
.selected{ .selected{
font-weight: bold; font-weight: bold;
background-color: #bae7ff!important; background-color: #bae7ff!important;
}
.hide{
display: block;
position: relative;
font-size: 20px;
color: #1890FF!important;
top: 45%;
left: 50%;
transform: translate(-50%,-50%);
} }
\ No newline at end of file
...@@ -113,6 +113,9 @@ export const getSQLServerConnectionTest = params => ...@@ -113,6 +113,9 @@ export const getSQLServerConnectionTest = params =>
get( get(
'/Cityinterface/rest/services/OMS.svc/S_GetSQLServerConnectionTest', '/Cityinterface/rest/services/OMS.svc/S_GetSQLServerConnectionTest',
params, params,
{
timeout: 30000,
},
); );
/** /**
* @Oracle数据库 * @Oracle数据库
...@@ -128,7 +131,13 @@ export const editOracleConnString = params => ...@@ -128,7 +131,13 @@ export const editOracleConnString = params =>
get('/Cityinterface/rest/services/OMS.svc/S_EditOracleConnString', params); get('/Cityinterface/rest/services/OMS.svc/S_EditOracleConnString', params);
// 测试连接 // 测试连接
export const getOracleConnectionTest = params => export const getOracleConnectionTest = params =>
get('/Cityinterface/rest/services/OMS.svc/S_GetOracleConnectionTest', params); get(
'/Cityinterface/rest/services/OMS.svc/S_GetOracleConnectionTest',
params,
{
timeout: 30000,
},
);
/** /**
* @MongoDB连接 * @MongoDB连接
...@@ -144,7 +153,9 @@ export const editMongoDBConnString = params => ...@@ -144,7 +153,9 @@ export const editMongoDBConnString = params =>
get('/Cityinterface/rest/services/OMS.svc/S_EditMongoDBConnString', params); get('/Cityinterface/rest/services/OMS.svc/S_EditMongoDBConnString', params);
// 测试连接 // 测试连接
export const getMongoDBConnectionTest = params => export const getMongoDBConnectionTest = params =>
get('/Cityinterface/rest/services/OMS.svc/S_MongoDBConnectionTest', params); get('/Cityinterface/rest/services/OMS.svc/S_MongoDBConnectionTest', params, {
timeout: 30000,
});
/** /**
* @MySQL连接 * @MySQL连接
*/ */
...@@ -157,5 +168,8 @@ export const addMySQLConnString = params => ...@@ -157,5 +168,8 @@ export const addMySQLConnString = params =>
// 测试连接 // 测试连接
export const getMySQLConnectionTest = params => export const getMySQLConnectionTest = params =>
get('/Cityinterface/rest/services/OMS.svc/S_GetMySQLConnectionTest', params); get('/Cityinterface/rest/services/OMS.svc/S_GetMySQLConnectionTest', params);
// 编辑
export const editMySQLConnString = params => export const editMySQLConnString = params =>
get('/Cityinterface/rest/services/OMS.svc/S_EditMySQLConnString', params); get('/Cityinterface/rest/services/OMS.svc/S_EditMySQLConnString', params, {
timeout: 300000,
});
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