Commit c40fbb91 authored by mayongxin's avatar mayongxin

数据鉴权

parent 73d07fda
# PUBLIC_PATH = reactOMS, 默认转发 /cityinterface # PUBLIC_PATH = reactOMS, 默认转发 /cityinterface
PROXY=/Cityinterface:http://192.168.10.150:8777;/Publish:http://192.168.10.150:8777;/Web4:http://192.168.10.150:8777;/CityTemp:http://192.168.10.150:8777 PROXY=/Cityinterface:http://192.168.19.105:8049;/Publish:http://192.168.19.105:8049;/Web4:http://192.168.19.105:8049;/CityTemp:http://192.168.19.105:8049
# 可设置第二个代理,test为转发前缀,后面为代理转发的地址 # 可设置第二个代理,test为转发前缀,后面为代理转发的地址
# PROXY2 = test : http://localhost:8006/ # PROXY2 = test : http://localhost:8006/
......
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import { Card, Form, Input, Button, Switch, message } from 'antd' import { Card, Form, Input, Button, Switch, message } from 'antd'
import { GetAuthSet, AuthSetting } from '@/services/database/api'
import styles from './index.less' import styles from './index.less'
import { useTheme } from 'bizcharts';
const AuthControl = () => { const AuthControl = () => {
const [checked,setChecked] = useState() const [flag,setFlag] = useState(0)
const [auChecked, setAuChecked] = useState()
const [cacheChecked, setCacheAuChecked] = useState()
useEffect(() => { useEffect(() => {
GetAuthSet().then(
res => {
if (res.code === 0) {
setAuChecked(res.IsOpenAuth)
setCacheAuChecked(res.IsUseCache)
}
}
)
}, []) }, [flag])
const loadConfig = () => { const loadConfig = () => {
} }
const operateControl = ()=>{ const operateControl = value => {
AuthSetting({
IsOpenAuth:value
}).then(
res =>{
if(res.code === 0){
setFlag(flag + 1)
message.success("设置成功!")
}
}
)
} }
return ( return (
<> <>
<PageContainer> <PageContainer>
<Card title="数据管理" style={{ width: 350, marginLeft: 15 }}> <div style={{display:"flex",flexWrap:"wrap"}}>
<div className={styles.auth_container}> <Card title="数据管理" style={{ width: 350, marginLeft: 15 }}>
<div className={styles.operate_item}> <div className={styles.auth_container}>
<div>数据库鉴权</div> <div className={styles.operate_item}>
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={checked} onChange={operateControl} /> <div>数据库鉴权</div>
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={auChecked} onChange={operateControl} />
</div>
</div> </div>
</div> </Card>
</Card> <Card title="缓存管理" style={{ width: 350, marginLeft: 15 }}>
<div className={styles.auth_container}>
<div className={styles.operate_item}>
<div>开启缓存</div>
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={cacheChecked} disabled={true} />
</div>
</div>
</Card>
</div>
</PageContainer> </PageContainer>
</> </>
) )
......
import React, { useState } from 'react' import React, { useEffect, useState } from 'react'
import { Modal, Form, Input, notification, message, Radio,Checkbox } from 'antd'; import { Modal, Form, Input, notification, message, Radio, Checkbox } from 'antd';
import {GetUserAuthSet,} from '@/services/database/api'
import SiteModal from '@/components/Modal/SiteModa';
const AuthModal = props => { const AuthModal = props => {
const plainOptions = ['新增', '编辑', '删除']; const plainOptions = ['访客', '普通用户', '管理员',"超级管理员"];
const [form] = Form.useForm(); const [form] = Form.useForm();
const { Item } = Form; const { Item } = Form;
const { title, visible, onCancel, onSelect } = props; const { title, visible, onCancel, onSelect,currentUser } = props;
useEffect(()=>{
currentUser.userID&&visible
GetUserAuthSet({
UserId:currentUser.userID
}).then(
res =>{
}
)
},[currentUser])
const onTypeChange = () => { const onTypeChange = () => {
} }
...@@ -17,26 +31,29 @@ const AuthModal = props => { ...@@ -17,26 +31,29 @@ const AuthModal = props => {
return ( return (
<Modal <SiteModal
title={title} title={title}
visible={visible} visible={visible}
onCancel={onCancel} onCancel={onCancel}
onOk={onSubmit} onOk={onSubmit}
okText="确认" okText="确认"
cancelText="取消" cancelText="取消"
width="800px"
> >
<Form form={form} labelCol={{ span: 4 }}> <div style={{width:'800px'}}>
<Item <Form form={form}>
label="允许操作" <Item
name="operate_type" label="数据权限"
> name="operate_type"
<Checkbox.Group >
options={plainOptions} <Checkbox.Group
onChange={onTypeChange} options={plainOptions}
/> onChange={onTypeChange}
</Item> />
</Form> </Item>
</Modal> </Form>
</div>
</SiteModal>
) )
} }
......
...@@ -46,7 +46,8 @@ import { ...@@ -46,7 +46,8 @@ import {
multiDeleteUsers, multiDeleteUsers,
setOrgArea, setOrgArea,
getOrgArea, getOrgArea,
GetMapSetByGroupID GetMapSetByGroupID,
GetOUTreeNew
} from '@/services/userCenter/userManage/api'; } from '@/services/userCenter/userManage/api';
import Tree from '@/components/ExpendableTree'; import Tree from '@/components/ExpendableTree';
import classnames from 'classnames'; import classnames from 'classnames';
...@@ -323,9 +324,32 @@ const UserManage = () => { ...@@ -323,9 +324,32 @@ const UserManage = () => {
// 重新渲染树 // 重新渲染树
const updateTrees = () => { const updateTrees = () => {
setTreeLoading(true); setTreeLoading(true);
getUserTree(-1, -1) // getUserTree(-1, -1)
.then(res => { // .then(res => {
if (res.length > 0) { // if (res.length > 0) {
// setTreeLoading(false);
// setTreeData(res);
// setTreeDataCopy(res);
// // 第一次加载,默认选择第一个组织
// if (treeState) {
// onSelect([res[0].id], false);
// setTreeState(false);
// }
// } else {
// setTreeLoading(false);
// notification.error({
// message: '获取失败',
// description: res.message,
// });
// }
// })
// .catch(err => {
// setTreeLoading(false);
// message.error(err);
// });
GetOUTreeNew({selectOU:-1}).then(newres => {
if (newres.code == 0) {
let res = newres.data
setTreeLoading(false); setTreeLoading(false);
setTreeData(res); setTreeData(res);
setTreeDataCopy(res); setTreeDataCopy(res);
...@@ -544,6 +568,7 @@ const UserManage = () => { ...@@ -544,6 +568,7 @@ const UserManage = () => {
}; };
//用户鉴权 //用户鉴权
const authUser = record =>{ const authUser = record =>{
setCurrentUser(record);
setAuthUserVisible(true) setAuthUserVisible(true)
} }
// 查找用户 // 查找用户
......
...@@ -81,13 +81,6 @@ export default { ...@@ -81,13 +81,6 @@ export default {
authority: superAuthority, authority: superAuthority,
component: CurrentSolution, component: CurrentSolution,
}, },
{
path: '/authcontrol',
name: '数据鉴权',
icon: <SolutionOutlined style={iconStyle} />,
authority: superAuthority,
component: AuthControl,
},
{ {
path: '/dbm', path: '/dbm',
name: '数据库管理', name: '数据库管理',
...@@ -113,8 +106,15 @@ export default { ...@@ -113,8 +106,15 @@ export default {
authority: adminAuthority, authority: adminAuthority,
component: DatabaseConnectConfig, component: DatabaseConnectConfig,
}, },
{
path: '/dbm/authcontrol',
name: '数据鉴权',
authority: superAuthority,
component: AuthControl,
},
], ],
}, },
{ {
path: '/userCenter', path: '/userCenter',
name: '用户中心', name: '用户中心',
......
...@@ -196,5 +196,16 @@ export const editMySQLConnString = params => ...@@ -196,5 +196,16 @@ export const editMySQLConnString = params =>
export const GetConnTest = params => export const GetConnTest = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetConnectionTest`, params); get(`${PUBLISH_SERVICE}/DBManager/GetConnectionTest`, params);
//接口鉴权
export const AuthSetting = params =>
get(`${PUBLISH_SERVICE}/WebSite/AuthSetting`, params);
export const GetAuthSet = params =>
get(`${PUBLISH_SERVICE}/WebSite/GetAuthSet`, params);
export const AddUserAuthSetting = params =>
get(`${PUBLISH_SERVICE}/WebSite/AddUserAuthSetting`, params);
export const GetUserAuthSet = params =>
get(`${PUBLISH_SERVICE}/WebSite/GetUserAuthSet`, params);
...@@ -174,5 +174,7 @@ export const setOrgArea = params => ...@@ -174,5 +174,7 @@ export const setOrgArea = params =>
get(`${CITY_SERVICE}/OMS.svc/SetOrgUserArea`, params) get(`${CITY_SERVICE}/OMS.svc/SetOrgUserArea`, params)
export const getOrgArea = params => export const getOrgArea = params =>
get(`${CITY_SERVICE}/OMS.svc/GetOrgUserArea`, params) get(`${CITY_SERVICE}/OMS.svc/GetOrgUserArea`, params)
export const GetMapSetByGroupID = params => export const GetMapSetByGroupID = params =>
get(`${PUBLISH_SERVICE}/GetMapSetByGroupID`, params) get(`${PUBLISH_SERVICE}/GetMapSetByGroupID`, params)
export const GetOUTreeNew = params =>
get(`${PUBLISH_SERVICE}/UserCenter/GetOUTree`, 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