feat(BD列表): 操作列表新增“权限分配”

This commit is contained in:
tianfeng 2026-04-01 11:41:51 +08:00
parent 68193b5ed6
commit b63f164bc5
3 changed files with 175 additions and 1 deletions

View File

@ -123,3 +123,28 @@ export function pageWorkStatistics(params) {
params
});
}
// 获取用户选中的权限信息
export function getSysBDAuthResourceByUserId(userId) {
return request({
url: `/team/bd/auth-resources?userId=${userId}`,
method: "get"
});
}
// APP权限列表
export function getBDAuthTable() {
return request({
url: "/team/bd/auth-resource",
method: "get"
});
}
// 修改权限
export function deleteAndAddBDAuth(data) {
return request({
url: "/team/bd/auth",
method: "put",
data
});
}

View File

@ -0,0 +1,126 @@
<template>
<el-dialog
title="权限设置"
:visible="true"
width="400px"
:before-close="handleClose"
>
<el-form ref="form" :model="form">
<el-checkbox-group
v-model="form.resourceList"
size="small"
class="flex-l flex-wrap"
>
<el-checkbox
v-for="item in sysResourceList"
:key="item.id"
style=" margin-bottom:20px"
:label="item.id"
>{{ item.resourceName }}
</el-checkbox>
</el-checkbox-group>
</el-form>
<div slot="footer">
<el-button type="primary" @click="submit()">提交</el-button>
</div>
</el-dialog>
</template>
<script>
import {
getSysBDAuthResourceByUserId,
getBDAuthTable,
deleteAndAddBDAuth
} from "@/api/room-anchor";
export default {
name: "AdministratorAuth",
props: {
userId: {
type: String,
default: ""
}
},
data() {
return {
sysResourceList: [],
activeUserId: "",
listLoading: false,
form: {
userId: "",
resourceList: []
}
};
},
watch: {
userId: {
immediate: true,
deep: true,
handler(newVal) {
if (newVal) {
this.form.userId = newVal;
return;
}
}
}
},
created() {
this.AdministratorAuthTable();
this.renderData();
},
methods: {
handleClose() {
this.$emit("close");
},
AdministratorAuthTable() {
const that = this;
that.listLoading = true;
getBDAuthTable()
.then(res => {
that.listLoading = false;
that.sysResourceList = res.body || [];
})
.catch(er => {
console.error(er);
that.listLoading = false;
});
},
renderData() {
const that = this;
that.listLoading = true;
getSysBDAuthResourceByUserId(that.form.userId)
.then(res => {
that.listLoading = false;
that.form.resourceList = res.body || [];
})
.catch(er => {
console.error(er);
that.listLoading = false;
});
},
submit() {
const that = this;
that.listLoading = true;
deleteAndAddBDAuth(that.form)
.then(res => {
that.listLoading = false;
that.$opsMessage.success();
that.$emit("success", Object.assign({}, that.form));
that.handleClose();
})
.catch(err => {
that.listLoading = false;
that.$emit("fial", err);
that.handleClose();
});
},
accountHandleSuccess(data) {
this.$message({
message: "Successful",
type: "success"
});
}
}
};
</script>

View File

@ -261,6 +261,13 @@
@click.native="changeBinding(scope.row, scope.$index)"
>换绑BD Leader</el-dropdown-item
>
<!-- 权限分配 -->
<el-dropdown-item
v-if="buttonPermissions.includes('bd:list:role:change')"
@click.native="AttributionSystem(scope.row)"
>权限分配</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</template>
@ -311,6 +318,13 @@
@close="teamBindDrawerVisible = false"
/>
<!-- 权限分配组件 -->
<auth-system
v-if="authSystemVisable"
:user-id="thatSelectedUserId"
@close="authSystemVisable = false"
/>
<!-- 绑定BDLeader 组件 -->
<bind-bd-leader
v-if="BDLeaderBindDrawerVisible"
@ -347,6 +361,7 @@ import AddBd from "./add-bd";
import TeamCreate from "./../components/TeamCreate";
import BindTeam from "./bind-team";
import bindBdLeader from "./bind-bd-leader";
import authSystem from "./auth";
export default {
name: "BusinessDevelopment",
@ -356,12 +371,14 @@ export default {
AddBd,
TeamCreate,
BindTeam,
bindBdLeader
bindBdLeader,
authSystem
},
data() {
return {
teamBindDrawerVisible: false,
BDLeaderBindDrawerVisible: false,
authSystemVisable: false,
thatRow: {},
bdOps: {},
teamCreateVisible: false,
@ -535,6 +552,12 @@ export default {
this.BDLeaderBindDrawerVisible = true;
},
AttributionSystem(row) {
const that = this;
this.thatSelectedUserId = row.userId;
that.authSystemVisable = true;
},
//
clickTeamMember(row) {
this.teamMemberVisible = true;