bdde9e93 by 任超
2 parents 019ca4a5 692e8fc1
......@@ -16,7 +16,7 @@ export const getRolesById = categoryId => {
conditions: [
{
property: 'category',
value:categoryId,
value: categoryId,
operator: 'EQ'
}
],
......@@ -81,3 +81,43 @@ export const getParentMenuListAction = (id) => {
const params = getParams(conditionGroup)
return getAction(api.menus, params)
}
// 获取权限列表
export const getAuthorityListAction = (productId, subsystemCode) => {
const conditionGroup = {
conditions: [
{
property: 'productId',
value: productId,
operator: 'EQ'
},
{
property: 'code',
value: subsystemCode + '_MENU',
operator: 'EQ'
}
],
queryRelation: 'AND'
}
const params = getParams(conditionGroup)
return getAction(api.resourceCategory, params)
}
/**
* 获取角色的权限 id operationCodes resourceCategoryCode
* id 授权id
* operationCodes 操作符集合
* resourceCategoryCode 菜单默认MENU
*/
export const getRoleAuthorityList = (
id,
operationCodes,
resourceCategoryCode
) => {
return getAction(`${api.rolePermissions}/${id}`, {
operationCodes: operationCodes,
resourceCategoryCode: resourceCategoryCode
})
}
// 角色授权
export const roleAuthority = (id, permissionDtos) => {
return putAction(`${api.rolePermissions}/${id}`, permissionDtos)
}
......
......@@ -64,7 +64,7 @@ export default {
})
},
beforeDestroy () {
this.chart.dispose();
// this.chart.dispose();
this.chart = null;
},
methods: {
......
import Vue from 'vue'
// 下载,导出
Vue.prototype.$download = function(name, href) {
Vue.prototype.$download = function (name, href) {
var a = document.createElement('a') // 创建a标签
var e = document.createEvent('MouseEvents') // 创建鼠标事件对象
e.initEvent('click', false, false) // 初始化事件对象
......@@ -10,7 +10,7 @@ Vue.prototype.$download = function(name, href) {
a.dispatchEvent(e) // 给指定的元素,执行事件click事件
}
// 导出json文件
Vue.prototype.$downloadJson = function(data, name) {
Vue.prototype.$downloadJson = function (data, name) {
// 1 生成文件的 blob 对象
const blobData = new Blob([JSON.stringify(data)], {
type: 'application/octet-stream'
......@@ -84,7 +84,7 @@ const checkCode = (rule, value, callback) => {
// }
// }
// 日期格式转换 "yyyy-MM-dd HH:mm:ss"
Vue.prototype.$formdate = function(date) {
Vue.prototype.$formdate = function (date) {
if (!date) {
return ""
}
......@@ -95,22 +95,22 @@ Vue.prototype.$formdate = function(date) {
var hh = (d.getHours() < 10 ? '0' + d.getHours() : d.getHours()) + ':';
var mm = (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes()) + ':';
var ss = (d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds());
return YY + MM + DD +" "+hh + mm + ss
return YY + MM + DD + " " + hh + mm + ss
}
// 时间格式过滤
Vue.filter('timeFilter', function(timeStr) {
Vue.filter('timeFilter', function (timeStr) {
if (timeStr) {
return timeStr.substring(0, 10)
}
})
export function getType(o) {
export function getType (o) {
return Object.prototype.toString.call(o).slice(8, -1)
}
export function isKeyType(o, type) {
export function isKeyType (o, type) {
return getType(o).toLowerCase() === type.toLowerCase()
}
// 深拷贝全局挂载
Vue.prototype.$deepCopy = function(sth) {
Vue.prototype.$deepCopy = function (sth) {
// 深度复制数组
// if (Object.prototype.toString.call(obj) === "[object Array]") {
// const object = [];
......@@ -196,7 +196,7 @@ Vue.prototype.$dealArrNotDisabled = arr => {
}
}
}
function nodeDeal(arr) {
function nodeDeal (arr) {
arr.forEach(item => {
delete item.disabled
if (item.children) {
......@@ -222,7 +222,7 @@ Vue.prototype.$dealArrDisabled = (arr, id) => {
}
}
}
function nodeDeal(arr) {
function nodeDeal (arr) {
arr.forEach(item => {
item['disabled'] = true
if (item.children) {
......@@ -249,10 +249,9 @@ Vue.prototype.$getNodeRoute = (val, id) => {
}
}
})
function nodefun(newVal, newId, newCid_list) {
function nodefun (newVal, newId, newCid_list) {
let flag = false
newVal.forEach(j => {
// console.log(j)
if (j.id === newId) {
newCid_list.push(j.id)
flag = true
......@@ -272,7 +271,7 @@ Vue.prototype.$getNodeRoute = (val, id) => {
return newCid_list
}
}
function result(cid_list) {
function result (cid_list) {
const arr = cid_list.concat()
arr.pop()
return arr
......@@ -325,7 +324,7 @@ Vue.prototype.$findParent = (list, id) => {
Vue.prototype.$findChildren = (list, nodeId) => {
let newArray = []
let flag = false
function dealList(list, nodeId) {
function dealList (list, nodeId) {
if (list.length !== 0) {
list.forEach(item => {
if (!flag) {
......
<template>
<Dialog :title="title" class="tableClass" :show.sync="visible" :width="'715px'" @close="close()">
<template slot="content">
<lb-table ref="multipleTable"
:pagination="false"
:column="tableData.column"
:data="tableData.data"
@selection-change="handleSelectionChange">
</lb-table>
</template>
<template slot="footer">
<el-button type="primary" class="save" @click="handleSaveMember()"
>保存</el-button
>
<el-button class="cancel-button" @click="close()">取消</el-button>
</template>
</Dialog>
</template>
<script>
import Dialog from "@/components/Dialog/";
export default {
name: "",
components: { Dialog },
props: {},
data() {
return {
title: "人员配置",
visible: false,
tableData: {
column: [
{
type: 'selection'
},
{
prop: 'name',
label: '角色名称'
},
{
prop: 'type',
label: '角色类型'
},
{
prop: 'departmentName',
label: '角色描述'
},
],
data: [
{
id: "3127e455-43ba-45ff-9326-0e02ef89485e",
createdAt: null,
updatedAt: "2022-08-04T03:38:27.626+0000",
createdBy: null,
updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
sort: 1,
name: "超级管理员",
loginName: "admin",
password: "05eb15777e8fd1d61c840472e7267f61d432f63340d86b59",
passwordSalt: "5178114777136485",
email: null,
lastLoginTime: null,
mobilePhone: "18291003568",
status: "ACTIVE",
passwordChangeTime: "2021-12-10T08:01:01.569+0000",
idCard: "612725202111021521",
departmentId: "2eae5304-544f-4f5b-b354-8f5d47433c9b",
organizationId: "0bca67ae-1d9e-4b41-b057-f165586d24aa",
sex: "0",
isDuty: true,
type:"",
code: "123324",
jobLevel: null,
telephone: "028-87720898",
address: "办公地点修改测试",
isLocked: false,
departmentName: "研发部",
_X_ROW_KEY: "row_276",
},
{
name: '数据管理员',
type:"1",
},
{
name: '数据管理员2',
type:"d",
}
]
},
multipleSelection: []
}
},
computed: {},
watch: {},
created() {},
mounted() {},
methods: {
authorization() {
this.visible = true;
},
close() {
// this.resetForm()
this.visible = false;
},
// 保存事件
handleSaveMember() {
// if (this.memberList.length === 0) {
// this.$message.warning("请添加待选人员");
// return false;
// }
// const idList = this.memberList.map(item => item.id)
// updateUser(this.roleId, idList).then(res => {
// if (res.status === 1) {
// this.$message.success({ message: '保存成功', showClose: true })
// this.showMemberConfigDialog = false
// this.$emit('setUsers', this.roleId)
// this.resetMemberConfig()
// } else this.$message.error({ message: res.message, showClose: true })
// })
},
handleSelectionChange (val) {
this.multipleSelection = val
}
}
};
</script>
<style scoped lang="scss">
/deep/.el-dialog__header{
text-align: center;
margin-bottom: 10px;
.el-dialog__title{
color: white;
}
}
</style>
......@@ -166,6 +166,7 @@ export default {
methods: {
// 获取父级菜单
getParentMenuList(id) {
getParentMenuListAction(id).then((res) => {
if (res.status === 1) {
const list = this.$dealArrChildren(res.content)
......@@ -195,7 +196,7 @@ export default {
},
// 新增菜单
add() {
this.getParentMenuList(this.productId)
this.getParentMenuList("2925fdeb-ddeb-4c15-8ee0-7bc3aa75ec2b")
this.visible = true
this.type = 0
this.form.jumpMode = 1
......
......@@ -19,33 +19,32 @@
:data="tablelistData"
row-key="id"
default-expand-all
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
</lb-table>
</div>
<edit-dialog ref="dialogForm"
:product-id="productId"
:resource-category-id="resourceCategoryId"
@ok="reloadTableData"/>
@ok="reloadTableData" />
<!-- <authorizationdiglog ref="rolesForm" /> -->
</div>
</template>
<script>
// 定时任务
import data from "./data";
import { deleteAction, getAction, api } from "@/api/manageApi";
import EditDialog from "./edit-dialog.vue";
// import authorizationdiglog from "./authorizationdiglog.vue";
export default {
// 定时任务
import data from "./data";
import { deleteAction, getAction, api } from "@/api/manageApi";
import EditDialog from "./edit-dialog.vue";
// import authorizationdiglog from "./authorizationdiglog.vue";
export default {
name: "menus",
components: {
EditDialog,
// authorizationdiglog,
},
data() {
data () {
return {
tablelistData: [],
resourceCategoryId:"",
resourceCategoryId: "",
taskData: null,
form: {
job_name: "",
......@@ -106,15 +105,15 @@ export default {
},
tableUrl: api.menus, // 菜单接口地址
meumurlid: api.subsystem,// 项目id接口地址
productId:""//项目id
productId: ""//项目id
};
},
created() {
created () {
this.getTableList();
},
methods: {
// 加载表格数据
getTableList() {
getTableList () {
const queryOptionsid = {
conditionGroup: {
......@@ -134,7 +133,7 @@ export default {
// 获取系统id
getAction(this.meumurlid, params)
.then((res) => {
this.productId=res.content[0].id;
this.productId = res.content[0].id;
let queryOptions = {
conditionGroup: {
conditions: [
......@@ -161,34 +160,33 @@ export default {
if (res.status === 1) {
this.loading = false;
this.tablelistData = res.content;
console.log("this.tablelistData", this.tablelistData);
} else {
this.$message.error({ message: res.message, showClose: true });
this.loading = false;
}
})
.catch((error) => {
console.log("errrrrrorrrrr", error);
console.log("er", error);
this.loading = false;
});
})
.catch((error) => {
console.log("errrrrrorrrrr", error);
console.log("er", error);
});
},
// 新增菜单
handleAdd() {
handleAdd () {
this.$refs.dialogForm.add();
this.$refs.dialogForm.title = "添加";
},
// 修改
handleEdit(record) {
handleEdit (record) {
this.$refs.dialogForm.edit(record);
this.$refs.dialogForm.title = "修改";
},
// 删除
handleDelete(id,content) {
handleDelete (id, content) {
this.$confirm(
`<div class="customer-message-wrapper">
<h5 class="title">您确认要执行该操作用于以下信息:</h5>
......@@ -225,22 +223,22 @@ export default {
}
})
})
.catch(() => {})
.catch(() => { })
},
// 新增、编辑回显
reloadTableData() {
reloadTableData () {
this.getTableList()
},
},
};
};
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/public.scss";
.btnColRight {
@import "~@/styles/mixin.scss";
@import "~@/styles/public.scss";
.btnColRight {
margin-top: 20px;
}
/deep/.el-table__expand-icon {
}
/deep/.el-table__expand-icon {
color: #fff;
}
}
</style>
......
......@@ -22,8 +22,7 @@
:column="tableData.columns"
:data="listdata"
:expand-row-keys="keyList"
row-key="id"
>
row-key="id">
</lb-table>
</div>
<EditDialog ref="addEditDialog" @ok="reloadTableData" />
......@@ -31,28 +30,35 @@
</div>
</template>
<script>
import {
import {
getUuid,
judgeSort,
realMove,
findParents,
removeTreeListItem,
} from "@/utils/operation";
import { getRolesById, getUserRoles } from "@/api/quanxianmanagement";
import data from "./data";
import sjsbTask from "@/api/sjsbTask.js";
import { api, getAction,deleteAction } from "@/api/manageApi";
import tableMixin from "@/mixins/tableMixin.js";
import EditDialog from "./edit-dialog.vue";
import Roleslistdiglog from "./roleslistdiglog.vue";
export default {
} from "@/utils/operation";
import { getRolesById, getUserRoles, getAuthorityListAction } from "@/api/quanxianmanagement";
import data from "./data";
// import {
// getOrganizationAuthorityList,
// getDepartmentAuthorityList,
// getRoleAuthorityList,
// getUserAuthorityList,
// getAuthorityListAction
// } from '@/api/authorityManage'
import sjsbTask from "@/api/sjsbTask.js";
import { api, getAction, deleteAction } from "@/api/manageApi";
import tableMixin from "@/mixins/tableMixin.js";
import EditDialog from "./edit-dialog.vue";
import Roleslistdiglog from "./roleslistdiglog.vue";
export default {
name: "menus",
mixins: [tableMixin],
components: {
EditDialog,
Roleslistdiglog,
},
data() {
data () {
return {
personlist: null,
waitMemberList: [],
......@@ -67,6 +73,11 @@ export default {
roleId: "",
title: "",
queryParam: {},
multipleSelection: [],
// 菜单列表
menutablelistData: [],
tableUrl: api.menus, // 菜单接口地址
meumurlid: api.subsystem, // 项目id接口地址
selectType: "0",
queryName: "",
organizationId: "", // 组织机构ID
......@@ -74,6 +85,8 @@ export default {
departmentList: [], // 部门列表
levelList: [], // 职务级别
sexList: [],
operationCodes: null, // 操作符对象
operationList: [], // 获取授权列表需要提交的操作符数组
typeOptions: [
{
value: "0",
......@@ -141,10 +154,16 @@ export default {
render: (h, scope) => {
return (
<div>
<el-tooltip class="item" effect="dark" disabled={scope.row.type !== 'Everyone'} content="没有点击的权限" placement="top">
<el-tooltip
class="item"
effect="dark"
disabled={scope.row.type !== "Everyone"}
content="没有点击的权限"
placement="top"
>
<span>
<el-button
disabled={scope.row.type === 'Everyone'}
disabled={scope.row.type === "Everyone"}
type="text"
size="mini"
icon="el-icon-video-pause"
......@@ -156,7 +175,13 @@ export default {
</el-button>
</span>
</el-tooltip>
<el-tooltip class="item" effect="dark" disabled={scope.row.category !== 1} content="系统内置角色 不允许修改" placement="top">
<el-tooltip
class="item"
effect="dark"
disabled={scope.row.category !== 1}
content="系统内置角色 不允许修改"
placement="top"
>
<span>
<el-button
disabled={scope.row.category === 1}
......@@ -171,7 +196,13 @@ export default {
</el-button>
</span>
</el-tooltip>
<el-tooltip class="item" effect="dark" disabled={scope.row.category !== 1} content="系统内置角色 不允许删除" placement="top">
<el-tooltip
class="item"
effect="dark"
disabled={scope.row.category !== 1}
content="系统内置角色 不允许删除"
placement="top"
>
<span>
<el-button
type="text"
......@@ -201,15 +232,16 @@ export default {
},
};
},
created() {
created () {
this.getTableData();
this.getTableList()
},
mounted() {},
mounted () { },
methods: {
// 获取角色列表
getTableData() {
let Builtinrole=[]
let Publicrole=[]
getTableData () {
let Builtinrole = [];
let Publicrole = [];
getRolesById(1)
.then((res) => {
......@@ -225,11 +257,93 @@ export default {
.catch((e) => console.error(e));
})
.catch((e) => console.error(e));
},
// 获取菜单列表
getTableList () {
const queryOptionsid = {
conditionGroup: {
queryRelation: "AND",
conditions: [
{
property: "code",
value: "BDCJGPT",
operator: "EQ",
},
],
},
// 人员配置
getUserList(row) {
};
const params = {
queryOptions: queryOptionsid,
};
// 获取系统id
getAction(this.meumurlid, params)
.then((res) => {
this.productId = res.content[0].id;
this.getAuthorityList(res.content[0].id, res.content[0].code)
this.selectedSubsystemCode = res.content[0].code
let queryOptions = {
conditionGroup: {
conditions: [
{
property: "productId",
value: this.productId,
operator: "EQ",
},
],
queryRelation: "AND",
},
orderBys: [{ property: "sort", direction: "desc" }],
};
if (!this.tableUrl) {
console.log("请设置tableUrl属性为接口地址!");
return;
}
if (this.queryOptions !== "") {
this.queryParam.queryOptions = JSON.stringify(queryOptions);
}
// 查询系统菜单
getAction(this.tableUrl, this.queryParam)
.then((res) => {
if (res.status === 1) {
this.loading = false;
this.menutablelistData = res.content;
} else {
this.$message.error({ message: res.message, showClose: true });
this.loading = false;
}
})
.catch((error) => {
console.log("er", error);
this.loading = false;
});
})
.catch((error) => {
console.log("er", error);
});
},
// 获取权限列表
getAuthorityList (productId, code) {
getAuthorityListAction(productId, code).then(
res => {
if (res.status === 1) {
if (res.content.length !== 0) {
this.operationCodes = res.content[0].operations
this.operationList = []
for (var k in this.operationCodes) {
this.operationList.push(k)
}
}
} else {
this.$message.error({ message: res.message, showClose: true })
}
}
)
},
// 配置
getUserList (row) {
this.getTableList()
const params = {};
const queryOptions = {
conditionGroup: {
......@@ -250,6 +364,7 @@ export default {
orderBys: [{ property: "sort", direction: "desc" }],
};
params.queryOptions = JSON.stringify(queryOptions);
getUserRoles(row.id).then((res) => {
if (res.status === 1) {
this.personlist = res.content;
......@@ -266,7 +381,10 @@ export default {
});
}
this.$refs.rolesForm.adds(this.waitMemberList, row.id);
this.$refs.rolesForm.personlist(this.waitMemberList, row.id);
// this.$refs.rolesForm.getMenuData();
this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes);
} else {
this.$message.error({ message: res.message, showClose: true });
}
......@@ -276,7 +394,7 @@ export default {
});
},
// 新增、修改角色
handleAddEdit(value) {
handleAddEdit (value) {
this.$refs.addEditDialog.menuType = this.menuType;
this.$refs.addEditDialog.roleId = value.id;
this.roleSort = value.sort ? value.sort : 0;
......@@ -289,13 +407,13 @@ export default {
this.$refs.addEditDialog.dialogTitle = value.id ? "修改" : "新增";
},
// 上移下移
moveUpward(index, row) {
moveUpward (index, row) {
realMove(row.id, "UP", this.listdata);
this.key++;
let id = findParents(this.listdata, row.id);
this.keyList = id;
},
moveDown(index, row) {
moveDown (index, row) {
realMove(row.id, "DOWN", this.listdata);
this.key++;
let id = findParents(this.listdata, row.id);
......@@ -303,7 +421,7 @@ export default {
},
// 删除
handleDelete: function(id, content = '') {
handleDelete: function (id, content = "") {
this.$confirm(
`<div class="customer-message-wrapper">
<h5 class="title">您确认要执行该操作用于以下信息:</h5>
......@@ -313,47 +431,47 @@ export default {
<span >无法恢复</span>
</p>
</div>`,
'执行确认',
"执行确认",
{
dangerouslyUseHTMLString: true,
customClass: 'customer-delete',
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
customClass: "customer-delete",
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(() => {
if (!this.tableUrl) {
this.$message.error({
message: '请设置tableUrl属性为接口地址!',
showClose: true
})
return
message: "请设置tableUrl属性为接口地址!",
showClose: true,
});
return;
}
const url = this.tableUrl + '/' + id
deleteAction(url).then(res => {
const url = this.tableUrl + "/" + id;
deleteAction(url).then((res) => {
if (res.status === 1) {
this.$message.success({ message: res.message, showClose: true })
this.getTableData()
this.$message.success({ message: res.message, showClose: true });
this.getTableData();
} else {
this.$message.error({ message: res.message, showClose: true })
this.$message.error({ message: res.message, showClose: true });
}
});
})
})
.catch(() => {})
.catch(() => { });
},
// 新增回显
reloadTableData() {
this.getTableData()
reloadTableData () {
this.getTableData();
},
},
};
};
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/public.scss";
.btnColRight {
@import "~@/styles/mixin.scss";
@import "~@/styles/public.scss";
.btnColRight {
margin-left: -30px;
margin-top: 20px;
}
}
</style>
......
......@@ -5,8 +5,7 @@
@click="close()"
custom-class="dialogBox editDialogBox mainCenter"
:visible.sync="visible"
width="85%"
>
width="85%">
<div slot="title" class="dialog_title" ref="dialogTitle">
{{ title || "标题" }}
</div>
......@@ -15,69 +14,89 @@
<el-tab-pane label="人员配置" name="first"></el-tab-pane>
<el-tab-pane label="菜单配置" name="second"></el-tab-pane>
</el-tabs>
<!-- <div class="editDialogBox-box" v-if="activeName == 'first'"> -->
<lb-table
v-if="activeName == 'first'"
v-show="activeName == 'first'"
ref="multipleTable"
:pagination="false"
:column="usertableData.column"
:data="usertableData.data"
@selection-change="handleSelectionChange"
@row-click="handleClickTableRow"
>
@row-click="handleClickTableRow">
>
</lb-table>
<!-- </div> -->
<!-- <div class="editDialogBox-box" v-else="activeName !== 'first'"> -->
<lb-table
v-else="activeName !== 'first'"
:key="menukey"
v-show="activeName == 'second'"
ref="multipleTable1"
:pagination="false"
:column="menutableData.columns"
:data="menutableData"
:column="menutableData.column"
:data="lastMenuList"
row-key="id"
default-expand-all
@selection-change="handleSelectionChanges"
@row-click="handleClickTableRows"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
</lb-table>
<!-- </div> -->
</div>
<template slot="footer">
<el-button type="primary" class="save" @click="handleSaveMember()"
>保存</el-button
>
<el-button type="primary" class="save" @click="handleSaveMember()">保存</el-button>
<el-button class="cancel-button" @click="close()">取消</el-button>
</template>
</el-dialog>
</template>
<script>
import { updateUser } from "@/api/quanxianmanagement";
export default {
import { api } from "@/api/manageApi";
import { updateUser, getRoleAuthorityList, roleAuthority } from "@/api/quanxianmanagement";
export default {
name: "",
data() {
data () {
return {
title: "人员配置",
visible: false,
menutableData: {
column: [
{
type: "selection",
label: "序号",
type: "index",
width: "50",
// index: this.indexMethod,
},
{
prop: "name",
width: 330,
label: "菜单名称",
}
].concat([
{
label: "权限",
render: (h, scope) => {
return (
<div>
<el-checkbox v-model={scope.row.checkArr[0].value}
disabled={scope.row.checkArr[0].disabled}
label={scope.row.checkArr[0].name} onChange={(checked) => {
this.changeCheck(checked, scope.row.checkArr[0].id, scope);
}} />
<el-checkbox v-model={scope.row.checkArr[1].value}
disabled={scope.row.checkArr[0].disabled}
label={scope.row.checkArr[1].name}
onChange={(checked) => {
this.changeCheck(checked, scope.row.checkArr[1].id, scope);
}} />
</div>
);
},
],
},
]),
},
usertableData: {
column: [
{
type: "selection",
width: 330,
},
{
prop: "name",
width: 330,
label: "姓名",
},
{
......@@ -85,101 +104,212 @@ export default {
label: "用户名",
},
],
data: []
},
// 角色id
roleId: "",
menuList: [], // 菜单列表
queryParam: {},
menukey: 0,
activeName: "first",
multipleSelection: [],
lastMenuList: [], // 重构完成的菜单表格数据
usermultipleSelection: [],
// 选中菜单列表
menumultipleSelection: [],
tableUrl: api.menus, // 菜单接口地址
meumurlid: api.subsystem,// 项目id接口地址
checkArr: [], // 重构操作符列表
authorityList: [], // 授权回显数组
checklistbor: [],
// 授权对象数据
menuprams: {},
// 系统code
selectedSubsystemCode: ""
};
},
computed: {},
created() {},
mounted() {},
created () {
},
mounted () {
},
methods: {
// 人员配置点击行勾选数据
handleClickTableRow(row, event) {
this.checkNum = 0;
this.isCheck = false;
handleClickTableRow (row, event) {
this.checkNum1 = 0;
this.isCheck1 = false;
if (event.label == "操作") {
return;
} else {
if (row.status == "0") {
return;
} else {
if (this.multipleSelection.length > 0) {
if (this.usermultipleSelection.length > 0) {
if (
JSON.stringify(this.multipleSelection).indexOf(
JSON.stringify(this.usermultipleSelection).indexOf(
JSON.stringify(row)
) == -1
) {
this.multipleSelection.push(row);
this.usermultipleSelection.push(row);
this.$refs.multipleTable.toggleRowSelection(row, true);
} else {
this.multipleSelection.map((item, index) => {
this.usermultipleSelection.map((item, index) => {
if (item.id == row.id) {
this.multipleSelection.splice(index, 1);
this.usermultipleSelection.splice(index, 1);
this.$refs.multipleTable.toggleRowSelection(row, false);
}
});
}
} else {
this.multipleSelection.push(row);
this.usermultipleSelection.push(row);
this.$refs.multipleTable.toggleRowSelection(row, true);
}
}
}
if (this.multipleSelection.length > 0) {
this.checkNum = this.multipleSelection.length;
this.isCheck = true;
if (this.usermultipleSelection.length > 0) {
this.checkNum1 = this.usermultipleSelection.length;
this.isCheck1 = true;
} else {
this.isCheck = false;
this.isCheck1 = false;
}
},
// 菜单配置点击行勾选数据
handleClickTableRow(row, event) {
this.checkNum = 0;
this.isCheck = false;
if (event.label == "操作") {
return;
} else {
if (row.status == "0") {
return;
// 获取授权主体的菜单权限
// getMenuAuthorityList
menulist (operationList, id, Code, menutablelistData, operationCodes) {
this.selectedSubsystemCode = Code
this.menuList = menutablelistData;
getRoleAuthorityList(
id,
operationList.toString(),
Code + '_MENU'
).then(res => {
if (res.status === 1) {
this.authorityList = res.content
this.getRecursionTreeData(this.menuList, this.authorityList, operationCodes)
this.getAuthorizedInfo()
// this.setCheckAllArr()
// this.getAuthorizedInfo()
} else {
if (this.multipleSelection.length > 0) {
this.$message.error({ message: res.message, showClose: true })
}
})
},
/**
* 递归渲染列表数据
* list:原始数组
* authorityList:已授权数组
*/
getRecursionTreeData (list, authorityList, operationCodes) {
++this.menukey
this.checkArr = []
for (const k in operationCodes) {
const obj = {}
obj.name = operationCodes[k]
obj.id = k
obj.value = false
obj.disabled = false
// obj.isAll = false;
this.checkArr.push(obj)
}
for (const [index, item] of Object.entries(list)) {
this.setAuthorizedConditions(
authorityList,
this.$deepCopy(this.checkArr),
item
)
if (
JSON.stringify(this.multipleSelection).indexOf(
JSON.stringify(row)
) == -1
item.children &&
item.children !== null &&
item.children.length !== 0
) {
this.multipleSelection.push(row);
this.$refs.multipleTable.toggleRowSelection(row, true);
} else {
this.multipleSelection.map((item, index) => {
if (item.id == row.id) {
this.multipleSelection.splice(index, 1);
this.$refs.multipleTable.toggleRowSelection(row, false);
item.children.forEach((child, j) => {
this.setAuthorizedConditions(
authorityList,
this.$deepCopy(this.checkArr),
child
)
})
this.getRecursionTreeData(item.children, authorityList, operationCodes)
}
});
}
this.lastMenuList = list
// this.setCheckAllArr(list)
},
// 授权条件
setAuthorizedConditions (authorityList, checkArr, item) {
if (this.roleId === '') {
checkArr.forEach(ele => {
ele.disabled = true
ele.value = false
})
} else {
this.multipleSelection.push(row);
this.$refs.multipleTable.toggleRowSelection(row, true);
if (authorityList.length !== 0) {
if (authorityList[0].superPermission === true) {
checkArr.forEach(ele => {
ele.value = true
ele.disabled = true
})
} else {
const repeatArr = authorityList.filter(authorityItem => {
return authorityItem.resourceUri === item.id
})
repeatArr.forEach(element => {
checkArr.forEach(ele => {
if (element.operationCode === ele.id) {
ele.value = true
if (this.roleId !== element.subjectId) {
ele.disabled = true
}
}
})
})
}
}
if (this.multipleSelection.length > 0) {
this.checkNum = this.multipleSelection.length;
this.isCheck = true;
} else {
this.isCheck = false;
}
this.$set(item, 'checkArr', this.$deepCopy(checkArr))
},
// 获取拼接授权信息
getAuthorizedInfo () {
const lastArr = []
const authorizedList = []
const wholeArr = this.$deepCopy(this.lastMenuList)
const arr = this.$treeConvertToArr(wholeArr)
arr.forEach(ele => {
ele.checkArr.forEach(val => {
if (val.value === true && val.disabled === false) {
const obj = {
operationCode: val.id,
name: ele.name,
id: ele.id
}
lastArr.push(obj)
}
})
})
lastArr.forEach(element => {
authorizedList.push({
operationCode: element.operationCode, // 标识符
productCode: this.selectedSubsystemCode, // 子系统code
resourceCategoryCode: this.selectedSubsystemCode + '_MENU', // 资源类别code默认为MENU
resourceName: element.name,
resourceUri: element.id, // 授权菜单id
subjectId: this.roleId, // 授权对象id
subjectType: 'ROLE' // 授权对象类别
})
})
this.menuprams = {
subjectId: this.roleId,
authorizedList: authorizedList
}
},
// 获取人员列表做筛选
adds(a, rid) {
personlist (a, rid) {
this.roleId = rid;
this.visible = true;
this.usertableData.data = a;
this.usertableData.data.forEach((item, index) => {
if (item.selectStatus === 0) {
......@@ -191,41 +321,81 @@ export default {
});
}
});
},
// 关闭事件
close() {
close () {
this.visible = false;
},
// 保存事件
handleSaveMember() {
const idList = this.multipleSelection.map((item) => {
handleSaveMember () {
// 人员授权
const idList = this.usermultipleSelection.map((item) => {
return item.id;
});
})
updateUser(this.roleId, idList).then((res) => {
if (res.status === 1) {
this.$message.success({ message: "保存成功", showClose: true });
this.visible = false;
// this.$emit("setUsers", this.roleId);
// this.resetMemberConfig();
} else this.$message.error({ message: res.message, showClose: true });
});
// 菜单授权
roleAuthority(
this.menuprams.subjectId,
this.menuprams.authorizedList
).then((res) => {
if (res.status === 1) {
this.$message.success({
message: res.message,
})
// this.authorizedContChange()
} else {
this.$message.error({ message: res.message, showClose: true })
}
})
},
// 勾选人员事件
handleSelectionChange(val) {
this.multipleSelection = val;
handleSelectionChange (val) {
this.usermultipleSelection = val;
},
// 数据筛选
setarrdata (scope, arr) {
arr.forEach((item, index, arr) => {
if (item.id == scope.row.id) {
this.checklistbor = [...arr]
} else if (item.id !== scope.row.id && item.children) {
this.setarrdata(scope, item.children)
}
})
},
// 勾选菜单事件
handleSelectionChanges(val) {
this.multipleSelection = val;
changeCheck (flag, checkId, scope) {
this.checklistbor = []
this.setarrdata(scope, this.lastMenuList)
const parents = this.$findParent(this.lastMenuList, scope.row.parentId)
const childs = this.$findChildren(this.lastMenuList, scope.row.id)
this.$setChildArr(
this.lastMenuList,
scope.row.id,
checkId,
flag,
this.checklistbor,
parents,
childs
)
this.getAuthorizedInfo()
},
},
};
};
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/dialogBox.scss";
@import "~@/styles/mixin.scss";
@import "~@/styles/dialogBox.scss";
.editForm {
.editForm {
/deep/.el-textarea__inner {
border: 1px solid #224c7c !important;
margin: 0 0 10px 0 !important;
......@@ -241,25 +411,25 @@ export default {
color: #dadde3 !important;
background: transparent !important;
}
}
}
/deep/.el-dialog__body {
/deep/.el-dialog__body {
display: flex;
flex-direction: column;
}
}
/deep/ .el-tabs {
/deep/ .el-tabs {
color: #cef8ff;
}
}
.sjmx {
.sjmx {
/deep/.el-tabs__item {
height: 50px;
padding-top: 6px;
}
}
}
/deep/.el-tabs__item {
/deep/.el-tabs__item {
color: #cef8ff !important;
display: flex;
......@@ -268,75 +438,75 @@ export default {
background: url("~@/image/tabitem.png") no-repeat;
background-size: 100% 100%;
border: none !important;
}
}
.obligee-item-name {
.obligee-item-name {
background: #05275b;
color: #ffffff;
background: url("~@/image/itembg.png") no-repeat;
background-size: 100% 100%;
}
}
/deep/.el-tabs__nav-scroll {
/deep/.el-tabs__nav-scroll {
background: none;
}
}
/deep/.el-tabs__nav {
/deep/.el-tabs__nav {
display: flex;
border: none !important;
}
}
/deep/.el-tabs__item.is-top {
/deep/.el-tabs__item.is-top {
border: 1px solid #dfe4ed;
border-top: 1px solid #dfe4ed;
border-bottom: 1px solid transparent;
}
}
/deep/.el-tabs__header {
/deep/.el-tabs__header {
border: none;
margin-bottom: 0;
}
}
/deep/.el-tabs__item.is-top:not(:last-child) {
/deep/.el-tabs__item.is-top:not(:last-child) {
margin-right: 5px;
}
}
/deep/.el-tabs__item.is-top {
/deep/.el-tabs__item.is-top {
background-color: none !important;
}
}
/deep/.el-tabs__item.is-active {
/deep/.el-tabs__item.is-active {
background: url("~@/image/tabitemse.png") no-repeat;
background-size: 100% 100%;
}
}
.success-images {
.success-images {
width: 30px;
height: 30px;
position: relative;
top: 10px;
right: 3px;
}
}
.tab-pane-item {
.tab-pane-item {
line-height: 20px;
color: #02d9fd;
p {
text-align: center;
}
}
}
.edit-content {
.edit-content {
height: 450px;
overflow-y: auto;
overflow-x: hidden;
padding-right: 1px;
margin-bottom: 10px;
border-top: none;
}
}
/deep/.editDialogBox {
/deep/.editDialogBox {
border-radius: 8px;
overflow: hidden;
min-width: 1228px;
......@@ -414,12 +584,12 @@ export default {
width: 100%;
border-bottom: 1px solid #ccc;
}
}
}
.el-dialog__wrapper {
.el-dialog__wrapper {
overflow: hidden;
}
/deep/.el-table {
}
/deep/.el-table {
background: none;
th.el-table__cell {
background-color: #073781;
......@@ -432,7 +602,7 @@ export default {
color: white;
}
}
}
}
// #08346F !important;
// #08346F !important;
</style>
......