Commit ab5b1b4c authored by 张烨's avatar 张烨
parents d0122973 6596ed93
import React, { useState, useEffect } from 'react';
import { Select, Card, Row, Col, Button, Spin, notification } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
import { getSolutionList, changeSolution } from '@/services/database/api';
import styles from './CurrentSolution.less';
const { Option } = Select;
const CurrentSolution = () => {
const [currentData, setCurrentData] = useState('');
const [dataList, setDataList] = useState([]);
const [loading, setLoading] = useState(false);
useEffect(() => {
setLoading(true);
getSolutionList({
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
setLoading(false);
if (res.success) {
setCurrentData(res.currentSolution);
setDataList(res.solutions);
}
})
.catch(err => {
setLoading(false);
console.error(err);
});
}, []);
const handleSelect = e => {
setCurrentData(e);
console.log(e);
};
const submit = params => {
setLoading(true);
console.log(params);
changeSolution({
solution: currentData,
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
setLoading(false);
if (res.success) {
notification.success({
message: '提示',
description: '切换成功',
duration: 3,
});
} else {
notification.error({
message: '提示',
description: res.message,
duration: 3,
});
}
})
.catch(err => {
setLoading(false);
console.error(err);
});
};
return (
<PageContainer>
<Card className={styles.cardbox}>
<Spin tip="Loading..." spinning={loading} className={styles.tAlign}>
<Row>
<Col span={2} className={styles.divbox}>
<div>切换解决方案:</div>
</Col>
<Col span={21}>
{currentData && (
<Select
style={{ width: '100%' }}
placeholder="请切换解决方案"
defaultValue={currentData}
onChange={e => {
handleSelect(e);
}}
>
{dataList &&
dataList.map((item, index) => (
<Option value={item} key={`item${index}`}>
{item}
</Option>
))}
</Select>
)}
</Col>
</Row>
<div className={styles.btnBox}>
<Button type="primary" onClick={() => submit()}>
提交
</Button>
</div>
</Spin>
</Card>
</PageContainer>
);
};
export default CurrentSolution;
.divbox{
display: flex;
align-items: center;
}
.cardbox{
min-height: 200px;
}
.btnBox{
margin-top: 70px;
display: flex;
justify-content: center;
}
.tAlign{
text-align: center;
}
\ No newline at end of file
......@@ -430,8 +430,7 @@ const InitDataBase = props => {
console.log(defaultSqlDir);
return (
<Option value={item} key={index}>
{' '}
{item}{' '}
{item}
</Option>
);
})}
......
import React from 'react';
import { Card } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
const MobileConfigPage = props => (
<PageContainer>mobileConfigPage</PageContainer>
<PageContainer>
<Card>MobileConfigPage</Card>
</PageContainer>
);
export default MobileConfigPage;
import React, { useState, useEffect, useCallback } from 'react';
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Spin, Button } from 'antd';
import ListCardItem from './listCardItem';
import { get, post } from '../../services';
......@@ -10,10 +10,11 @@ const ListCard = props => {
const [valueList, setValueList] = useState([]);
const [dataList, setdataList] = useState([]);
const [loading, setLoading] = useState(true);
const { optionsList } = props;
const callbackValue = useRef([]);
const getValueCallback = useCallback((value, index) => {
console.log(value, index);
setValueList((valueList[index] = value));
callbackValue.current = valueList;
console.log(valueList, 'valueList');
}, []);
useEffect(() => {
......@@ -47,6 +48,9 @@ const ListCard = props => {
// orgTest().then(res =>{
// console.log(res,'res')
// })
return () => {
callbackValue.current = [];
};
}, [ouid]);
return (
<div>
......@@ -77,10 +81,10 @@ const ListCard = props => {
/>
))
)}
{false && !loading && dataList && (
{true && !loading && dataList && (
<Button
type="primary"
onClick={() => valueCallback(valueList)}
onClick={() => valueCallback()}
style={{ marginTop: '20px' }}
>
提交
......
......@@ -2,9 +2,9 @@ import React, { useState, useEffect } from 'react';
import { Row, Col, Tree, Card, Input, Tooltip, Button } from 'antd';
import { FileAddTwoTone, EditTwoTone, DeleteTwoTone } from '@ant-design/icons';
import { PageContainer, GridContent } from '@ant-design/pro-layout';
import { getWebModuleTree } from '@/services/userCenter/RoleManage/api';
import { getWebModuleTree } from '@/services/userCenter/roleManage/api';
import ListCard from '@/pages/orgnazation/ListCard';
import styles from '@/pages/userCenter/RoleManage/RoleManage.less';
import styles from '@/pages/userCenter/roleManage/RoleManage.less';
import AddModal from './AddModal';
import DelModal from './DelModal';
import EditModal from './EditModal';
......@@ -61,21 +61,21 @@ const SiteManage = () => {
<div className={styles.treeTitle}>
{text}
<div className={styles.titleBox}>
<Tooltip title="新增站点">
<Tooltip title="新增角色">
<FileAddTwoTone
onClick={() => {
handleAdd(props);
}}
/>
</Tooltip>
<Tooltip title="编辑站点">
<Tooltip title="编辑角色">
<EditTwoTone
onClick={() => {
handleEdit(props);
}}
/>
</Tooltip>
<Tooltip title="删除站点">
<Tooltip title="删除角色">
<DeleteTwoTone
onClick={() => {
handleDel(props);
......
......@@ -118,6 +118,10 @@ const SiteManage = () => {
const handleSearch = value => {
setSearchWord(value);
};
const handleChange = e => {
const { value } = e.target;
setSearchWord(value);
};
const confirmModal = e => {
setModalVisible(false);
setFlag(flag + 1);
......@@ -173,6 +177,7 @@ const SiteManage = () => {
allowClear
placeholder={placeholder}
onSearch={handleSearch}
onChange={handleChange}
enterButton
/>
</Col>
......
......@@ -16,8 +16,9 @@ import Welcome from '../pages/Welcome';
import RequestTest from '../pages/testPages/request';
import InitDataBase from '../pages/database/InitDataBase';
import ManagementDataBase from '../pages/database/ManagementDataBase';
import CurrentSolution from '@/pages/database/CurrentSolution';
import UserManage from '../pages/userCenter/UserManage';
import RoleManage from '../pages/userCenter/RoleManage/RoleManage';
import RoleManage from '../pages/userCenter/roleManage/RoleManage';
import SiteManage from '../pages/userCenter/siteManage/SiteManage';
// import DefaultComponent from '../pages/orgnazation/DefaultComponent';
import TestTable from '../pages/orgnazation/TestTable';
......@@ -73,6 +74,12 @@ export default {
authority: superAuthority,
component: ManagementDataBase,
},
{
path: '/dbm/solution',
name: '数据库解决方案',
authority: superAuthority,
component: CurrentSolution,
},
],
},
{
......
......@@ -8,3 +8,10 @@ export const setTableSQLDirName = params =>
export const deleteConn = params =>
get('/Cityinterface/rest/services/OMS.svc/S_DeleteConn', params);
// 切换解决方案配置
export const getSolutionList = params =>
get('/Cityinterface/rest/services/OMS.svc/W4_GetSolutionList', params);
// 切换解决方案
export const changeSolution = params =>
get('/Cityinterface/rest/services/OMS.svc/W4_ChangeSolution', params);
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