Commit c40fbb91 authored by mayongxin's avatar mayongxin

数据鉴权

parent 73d07fda
# 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为转发前缀,后面为代理转发的地址
# PROXY2 = test : http://localhost:8006/
......
import React, { useEffect, useState } from 'react'
import PageContainer from '@/components/BasePageContainer';
import { Card, Form, Input, Button, Switch, message } from 'antd'
import { GetAuthSet, AuthSetting } from '@/services/database/api'
import styles from './index.less'
import { useTheme } from 'bizcharts';
const AuthControl = () => {
const [checked,setChecked] = useState()
const [flag,setFlag] = useState(0)
const [auChecked, setAuChecked] = useState()
const [cacheChecked, setCacheAuChecked] = useState()
useEffect(() => {
GetAuthSet().then(
res => {
if (res.code === 0) {
setAuChecked(res.IsOpenAuth)
setCacheAuChecked(res.IsUseCache)
}
}
)
}, [])
}, [flag])
const loadConfig = () => {
}
const operateControl = ()=>{
const operateControl = value => {
AuthSetting({
IsOpenAuth:value
}).then(
res =>{
if(res.code === 0){
setFlag(flag + 1)
message.success("设置成功!")
}
}
)
}
return (
<>
<PageContainer>
<div style={{display:"flex",flexWrap:"wrap"}}>
<Card title="数据管理" style={{ width: 350, marginLeft: 15 }}>
<div className={styles.auth_container}>
<div className={styles.operate_item}>
<div>数据库鉴权</div>
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={checked} onChange={operateControl} />
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={auChecked} onChange={operateControl} />
</div>
</div>
</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>
</>
)
......
import React, { useState } from 'react'
import { Modal, Form, Input, notification, message, Radio,Checkbox } from 'antd';
import React, { useEffect, useState } from 'react'
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 plainOptions = ['新增', '编辑', '删除'];
const plainOptions = ['访客', '普通用户', '管理员',"超级管理员"];
const [form] = Form.useForm();
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 = () => {
}
......@@ -17,17 +31,19 @@ const AuthModal = props => {
return (
<Modal
<SiteModal
title={title}
visible={visible}
onCancel={onCancel}
onOk={onSubmit}
okText="确认"
cancelText="取消"
width="800px"
>
<Form form={form} labelCol={{ span: 4 }}>
<div style={{width:'800px'}}>
<Form form={form}>
<Item
label="允许操作"
label="数据权限"
name="operate_type"
>
<Checkbox.Group
......@@ -36,7 +52,8 @@ const AuthModal = props => {
/>
</Item>
</Form>
</Modal>
</div>
</SiteModal>
)
}
......
......@@ -46,7 +46,8 @@ import {
multiDeleteUsers,
setOrgArea,
getOrgArea,
GetMapSetByGroupID
GetMapSetByGroupID,
GetOUTreeNew
} from '@/services/userCenter/userManage/api';
import Tree from '@/components/ExpendableTree';
import classnames from 'classnames';
......@@ -323,9 +324,32 @@ const UserManage = () => {
// 重新渲染树
const updateTrees = () => {
setTreeLoading(true);
getUserTree(-1, -1)
.then(res => {
if (res.length > 0) {
// getUserTree(-1, -1)
// .then(res => {
// 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);
setTreeData(res);
setTreeDataCopy(res);
......@@ -544,6 +568,7 @@ const UserManage = () => {
};
//用户鉴权
const authUser = record =>{
setCurrentUser(record);
setAuthUserVisible(true)
}
// 查找用户
......
......@@ -81,13 +81,6 @@ export default {
authority: superAuthority,
component: CurrentSolution,
},
{
path: '/authcontrol',
name: '数据鉴权',
icon: <SolutionOutlined style={iconStyle} />,
authority: superAuthority,
component: AuthControl,
},
{
path: '/dbm',
name: '数据库管理',
......@@ -113,8 +106,15 @@ export default {
authority: adminAuthority,
component: DatabaseConnectConfig,
},
{
path: '/dbm/authcontrol',
name: '数据鉴权',
authority: superAuthority,
component: AuthControl,
},
],
},
{
path: '/userCenter',
name: '用户中心',
......
......@@ -196,5 +196,16 @@ export const editMySQLConnString = params =>
export const GetConnTest = 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 =>
get(`${CITY_SERVICE}/OMS.svc/SetOrgUserArea`, params)
export const getOrgArea = params =>
get(`${CITY_SERVICE}/OMS.svc/GetOrgUserArea`, params)
export const GetMapSetByGroupID = params =>
export const 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