增加用户组的资产授权
This commit is contained in:
@ -1,19 +1,19 @@
|
||||
// prod
|
||||
let wsPrefix;
|
||||
if (window.location.protocol === 'https:') {
|
||||
wsPrefix = 'wss:'
|
||||
} else {
|
||||
wsPrefix = 'ws:'
|
||||
}
|
||||
|
||||
export const server = '';
|
||||
export const wsServer = wsPrefix + window.location.host;
|
||||
export const prefix = window.location.protocol + '//' + window.location.host;
|
||||
// let wsPrefix;
|
||||
// if (window.location.protocol === 'https:') {
|
||||
// wsPrefix = 'wss:'
|
||||
// } else {
|
||||
// wsPrefix = 'ws:'
|
||||
// }
|
||||
//
|
||||
// export const server = '';
|
||||
// export const wsServer = wsPrefix + window.location.host;
|
||||
// export const prefix = window.location.protocol + '//' + window.location.host;
|
||||
|
||||
// dev
|
||||
// export const server = '//127.0.0.1:8088';
|
||||
// export const wsServer = 'ws://127.0.0.1:8088';
|
||||
// export const prefix = '';
|
||||
export const server = '//127.0.0.1:8088';
|
||||
export const wsServer = 'ws://127.0.0.1:8088';
|
||||
export const prefix = '';
|
||||
|
||||
export const PROTOCOL_COLORS = {
|
||||
'rdp': 'red',
|
||||
|
@ -602,7 +602,6 @@ class User extends Component {
|
||||
>
|
||||
<UserShareAsset
|
||||
sharer={this.state.sharer}
|
||||
owner={this.state.owner}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
|
@ -8,6 +8,7 @@ import {message} from "antd/es";
|
||||
import {DeleteOutlined, ExclamationCircleOutlined, PlusOutlined, SyncOutlined, UndoOutlined} from '@ant-design/icons';
|
||||
import Logout from "./Logout";
|
||||
import UserGroupModal from "./UserGroupModal";
|
||||
import UserShareAsset from "./UserShareAsset";
|
||||
|
||||
const confirm = Modal.confirm;
|
||||
const {Search} = Input;
|
||||
@ -250,6 +251,13 @@ class UserGroup extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
handleAssetCancel = () => {
|
||||
this.loadTableData()
|
||||
this.setState({
|
||||
assetVisible: false
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
const columns = [{
|
||||
@ -263,11 +271,16 @@ class UserGroup extends Component {
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
}, {
|
||||
title: '成员人数',
|
||||
dataIndex: 'memberCount',
|
||||
key: 'memberCount',
|
||||
title: '授权资产',
|
||||
dataIndex: 'assetCount',
|
||||
key: 'assetCount',
|
||||
render: (text, record, index) => {
|
||||
return <Button type='link' onClick={() => this.showModal('更新用户组', record['id'], index)}>{text}</Button>
|
||||
return <Button type='link' onClick={async () => {
|
||||
this.setState({
|
||||
assetVisible: true,
|
||||
userGroupId: record['id']
|
||||
})
|
||||
}}>{text}</Button>
|
||||
}
|
||||
}, {
|
||||
title: '创建日期',
|
||||
@ -417,6 +430,24 @@ class UserGroup extends Component {
|
||||
</UserGroupModal> : undefined
|
||||
}
|
||||
|
||||
<Modal
|
||||
width={window.innerWidth * 0.8}
|
||||
title='已授权资产'
|
||||
visible={this.state.assetVisible}
|
||||
maskClosable={false}
|
||||
destroyOnClose={true}
|
||||
onOk={() => {
|
||||
|
||||
}}
|
||||
onCancel={this.handleAssetCancel}
|
||||
okText='确定'
|
||||
cancelText='取消'
|
||||
footer={null}
|
||||
>
|
||||
<UserShareAsset
|
||||
userGroupId={this.state.userGroupId}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
</Content>
|
||||
</>
|
||||
|
@ -24,7 +24,7 @@ import {message} from "antd/es";
|
||||
|
||||
import {DeleteOutlined, ExclamationCircleOutlined, PlusOutlined, SyncOutlined, UndoOutlined} from '@ant-design/icons';
|
||||
import {PROTOCOL_COLORS} from "../../common/constants";
|
||||
import UserShareChooseAsset from "./UserShareSelectAsset";
|
||||
import UserShareSelectedAsset from "./UserShareSelectedAsset";
|
||||
|
||||
const confirm = Modal.confirm;
|
||||
const {Search} = Input;
|
||||
@ -61,7 +61,8 @@ class UserShareAsset extends Component {
|
||||
|
||||
async componentDidMount() {
|
||||
let sharer = this.props.sharer;
|
||||
this.loadTableData({sharer: sharer});
|
||||
let userGroupId = this.props.userGroupId;
|
||||
this.loadTableData({sharer: sharer, userGroupId: userGroupId});
|
||||
|
||||
let result = await request.get('/tags');
|
||||
if (result['code'] === 1) {
|
||||
@ -132,10 +133,6 @@ class UserShareAsset extends Component {
|
||||
};
|
||||
|
||||
handleTagsChange = tags => {
|
||||
console.log(tags)
|
||||
// this.setState({
|
||||
// tags: tags
|
||||
// })
|
||||
let query = {
|
||||
...this.state.queryParams,
|
||||
'pageIndex': 1,
|
||||
@ -375,11 +372,12 @@ class UserShareAsset extends Component {
|
||||
visible={this.state.chooseAssetVisible}
|
||||
width={window.innerWidth * 0.8}
|
||||
>
|
||||
<UserShareChooseAsset
|
||||
<UserShareSelectedAsset
|
||||
sharer={this.state.queryParams.sharer}
|
||||
userGroupId={this.state.queryParams.userGroupId}
|
||||
>
|
||||
|
||||
</UserShareChooseAsset>
|
||||
</UserShareSelectedAsset>
|
||||
</Drawer> : undefined
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ const {Search} = Input;
|
||||
const {Content} = Layout;
|
||||
const {Title} = Typography;
|
||||
|
||||
class UserShareAsset extends Component {
|
||||
class UserShareSelectedAsset extends Component {
|
||||
|
||||
inputRefOfName = React.createRef();
|
||||
changeOwnerFormRef = React.createRef();
|
||||
@ -45,16 +45,17 @@ class UserShareAsset extends Component {
|
||||
async componentDidMount() {
|
||||
|
||||
this.setState({
|
||||
sharer: this.props.sharer
|
||||
sharer: this.props.sharer,
|
||||
userGroupId: this.props.userGroupId
|
||||
})
|
||||
|
||||
this.loadTableData();
|
||||
this.init(this.props.sharer)
|
||||
this.init(this.props.sharer, this.props.userGroupId)
|
||||
}
|
||||
|
||||
async init(sharer) {
|
||||
async init(sharer, userGroupId) {
|
||||
let q1 = request.get('/tags');
|
||||
let q2 = request.get('/assets/paging?pageIndex=1&pageSize=1000&sharer=' + sharer);
|
||||
let q2 = request.get(`/assets/paging?pageIndex=1&pageSize=1000&sharer=${sharer}&userGroupId=${userGroupId}`);
|
||||
|
||||
let r1 = await q1;
|
||||
let r2 = await q2;
|
||||
@ -168,7 +169,9 @@ class UserShareAsset extends Component {
|
||||
|
||||
unSelectRow = async (assetId) => {
|
||||
let userId = this.state.sharer;
|
||||
let userGroupId = this.state.userGroupId;
|
||||
let result = await request.post(`/resource-sharers/remove-resources`, {
|
||||
userGroupId: userGroupId,
|
||||
userId: userId,
|
||||
resourceType: 'asset',
|
||||
resourceIds: [assetId]
|
||||
@ -368,7 +371,9 @@ class UserShareAsset extends Component {
|
||||
}
|
||||
|
||||
let userId = this.state.sharer;
|
||||
let userGroupId = this.state.userGroupId;
|
||||
let result = await request.post(`/resource-sharers/add-resources`, {
|
||||
userGroupId: userGroupId,
|
||||
userId: userId,
|
||||
resourceType: 'asset',
|
||||
resourceIds: newRowKeys
|
||||
@ -412,4 +417,4 @@ class UserShareAsset extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default UserShareAsset;
|
||||
export default UserShareSelectedAsset;
|
Reference in New Issue
Block a user