295c4118 by xiaomiao

角色管理人员配置功能编写

1 parent 979d30be
import request from "@/utils/request";
import SERVER from "./config";
import { getParams } from './util'
import {
api,
getAction,
postAction,
deleteAction,
putAction
} from './manageApi'
/** 角色管理开始 */
// 获取角色列表 by categoryId
export const getRolesById = categoryId => {
const conditionGroup = {
conditions: [
{
property: 'category',
value: categoryId,
operator: 'EQ'
}
],
queryRelation: 'AND'
}
const params = getParams(conditionGroup)
return getAction(api.roles, params)
}
// 人员列表
export const getUserRoles = (id) => {
return getAction(`${api.userRoles}/${id}/users`)
}
import request from '@/utils/request'
import SERVER from "./config";
const workflow = '/workflow'
const log = '/log'
const crud = '/crud'
export const api = {
userInfo: SERVER.MANAGEMENTAPI + '/rest/user-info', // 登录用户信息
permissionsUser: SERVER.MANAGEMENTAPI + '/rest/user-permissions', // 用户权限
baseDataCategory: SERVER.MANAGEMENTAPI + '/rest/base-data-category', // 数据字典类别
baseData: SERVER.MANAGEMENTAPI + '/rest/base-data', // 数据字典
districts: SERVER.MANAGEMENTAPI + '/rest/districts', // 行政区划
districtsAll: SERVER.MANAGEMENTAPI + '/rest/districts/parent-tree', // 条件查询所有行政区划
organizations: SERVER.MANAGEMENTAPI + '/rest/organizations', // 组织机构
departments: SERVER.MANAGEMENTAPI + '/rest/departments', // 部门
users: SERVER.MANAGEMENTAPI + '/rest/users', // 人员用户
roles: SERVER.MANAGEMENTAPI + '/rest/roles', // 角色
userRoles: SERVER.MANAGEMENTAPI + '/rest/user-roles', // 角色对应人员关系
productCategory: SERVER.MANAGEMENTAPI + '/rest/product-category', // 业务分类
resourceCategory: SERVER.MANAGEMENTAPI + '/rest/resource-category', // 资源分类
resources: SERVER.MANAGEMENTAPI + '/rest/resources', // 资源详情列表
subsystem: SERVER.MANAGEMENTAPI + '/rest/products', // 子系统管理
operations: SERVER.MANAGEMENTAPI + '/rest/operations', // 操作
menus: SERVER.MANAGEMENTAPI + '/rest/menus', // 菜单
organizationPermissions: SERVER.MANAGEMENTAPI + '/rest/organization-permissions', // 机构授权
departmentPermissions: SERVER.MANAGEMENTAPI + '/rest/department-permissions', // 部门授权
rolePermissions: SERVER.MANAGEMENTAPI + '/rest/role-permissions', // 角色授权
peoPermissions: SERVER.MANAGEMENTAPI + '/rest/user-permissions', // 用户授权
resourcePermissions: SERVER.MANAGEMENTAPI + '/rest/resource-permissions', // 资源授权查询
menuPermissions: SERVER.MANAGEMENTAPI + '/rest/menu-permissions', // 菜单授权查询
serviceCategory: SERVER.MANAGEMENTAPI + '/rest/service-category', // 服务分类
service: SERVER.MANAGEMENTAPI + '/rest/service', // 服务详情列表
databaseServer: workflow + '/rest/database-server', // 数据库服务器
materialCategory: workflow + '/rest/material-category', // 材料分类
material: workflow + '/rest/material', // 材料
function: workflow + '/rest/function', // 功能属性
eventCategory: workflow + '/rest/event-category', // 服务事件分类
event: workflow + '/rest/event', // 服务事件
formCategorys: workflow + '/rest/forms-category', // 表单分类
forms: workflow + '/rest/forms', // 表单
metadata: workflow + '/rest/metadata', // 元数据
dataObjectCategory: workflow + '/rest/data-object-category', // 对象管理类别
dataObject: workflow + '/rest/data-object', // 对象管理
workflowBusiness: workflow + '/rest/businesses', // 业务流程
// workflowModel: workflow+'/rest/workflow/model',//流程模型
modelcategorys: workflow + '/rest/model-categories', // 模型分类
models: workflow + '/rest/models', // 工作流模型表
businessesModels: workflow + '/rest/businesses-models', // 业务流程关系
pluginCategory: workflow + '/rest/plugin-category', // 流程插件分类管理
plugin: workflow + '/rest/plugins', // 流程插件分类管理
groups: workflow + '/rest/groups', // 用户组分类
groupUsers: workflow + '/rest/group-users', // 用户组人员
saveWorkflowGroupUser: workflow + '/rest/groups/sug', // 工作流设计器增加用户组
validate: workflow + '/rest/models/validate', // 流程验证
tokens: SERVER.MANAGEMENTAPI + '/rest/tokens', // token
session: '/rest/session', // session
pwdSetting: SERVER.MANAGEMENTAPI + '/rest/password-setting', //
singleSign: '/cas/rest/services', // 单点登录管理
attachments: SERVER.MANAGEMENTAPI + '/rest/attachments', // 文件上传服务
instances: workflow + '/rest/workflow/instances', // 实例
workflowTask: workflow + '/rest/workflow-task', // 任务
definitions: workflow + '/rest/workflow/definitions', // 流程实例
systemAccessLogs: log + '/rest/system-access-logs', // 系统访问日志
errorLogs: log + '/rest/common-log-statistics', // 错误日志
appAccess: log + '/rest/system-access-logs/count-app-access', // 系统访问数
userAccess: log + '/rest/system-access-logs/count-user-access', // 用户访问数
statisticMenus: log + '/rest/system-access-logs/statistic-menus', // 统计菜单访问数
statisticUsers: log + '/rest/system-access-logs/statistic-users', // 统计用户访问数
abnormal: log + '/rest/abnormal', // 统计平台报警
monitorConfig: log + '/rest/monitor-alert-config', // 监控预警配置
statisticTimes: log + '/rest/system-access-logs/statistic-times', // 监控预警配置
server: log + '/rest/server', // 服务器监控
serverStatistics: log + '/rest/server-statistics', // 服务器监控信息统计
avgTimes: log + '/rest/services-statistics/avg-times', // 根据时间查响应时间和访问次数
statisticDepts: log + '/rest/system-access-logs/statistic-depts', // 访问部门统计
crudHead: crud + '/rest/head', // crudhead
crudGet: crud + '/rest/get', // crudget
crudPost: crud + '/rest/post', // crudPost
crudPut: crud + '/rest/put', // crudPut
crudDel: crud + '/rest/delete', // crudDel
crudMetadata: crud + '/rest/metadata', //crudMetadata
crudBusiness : crud + '/rest/business', // crudBusiness
crudDatasources : crud + '/rest/datasources', // crudDatasources
}
// get公共方法
export function getAction(url, params = {}) {
return request({
url,
method: 'get',
params
})
}
// post公共方法
export function postAction(url, data = null) {
return request({
url,
method: 'post',
data
})
}
// method= {post | put}
export function httpAction(url, data, method) {
return request({
url,
method,
data
})
}
// put公共方法
export function putAction(url, data = null) {
return request({
url,
method: 'put',
data
})
}
// delete
export function deleteAction(url, data = null) {
return request({
url,
method: 'delete',
data
})
}
// 批量删除
export function deleteBranch(url, data) {
return request({
url,
method: 'delete',
data
})
}
// 默认生成参数
export const getParams = (
conditionGroup,
orderBys = [{ property: 'sort', direction: 'desc' }]
) => {
const params = {}
const queryOptions = {
conditionGroup,
orderBys
}
params.queryOptions = JSON.stringify(queryOptions)
return params
}
......@@ -11,77 +11,11 @@ export default {
cdata: {
legendItem: ['接入', '上报', '登簿'],
color: [
"#5324DA",
"#E873B2",
"#F4AF6F "
"#02D9FD",
"#FF7962",
"#F5C03D "
],
echartData: [{
name: "2017-11",
value1: 1351,
value2: 600,
value3: 568,
},
{
name: "2017-11",
value1: 980,
value2: 1245,
value3: 1100,
},
{
name: "2017-11",
value1: 1127,
value2: 398,
value3: 568,
},
{
name: "2017-11",
value1: 1046,
value2: 689,
value3: 479
},
{
name: "2018-02",
value1: 780,
value2: 396,
value3: 655
},
{
name: "2018-08",
value1: 359,
value2: 1220,
value3: 540,
},
{
name: "2018-07",
value1: 229,
value2: 836,
value3: 1234,
},
{
name: "2018-09",
value1: 1176,
value2: 478,
value3: 755,
},
{
name: "2018-11",
value1: 515,
value2: 911,
value3: 806,
},
{
name: "2019-01",
value1: 658,
value2: 979,
value3: 813,
},
{
name: "2019-03",
value1: 364,
value2: 839,
value3: 886,
},
]
echartData: []
}
}
},
......@@ -91,18 +25,6 @@ export default {
mounted() {
window.addEventListener("resize", () => {
this.cdata=[],
this.cdata= {
legendItem: ['接入', '上报', '登簿'],
color: [
"#5324DA",
"#E873B2",
"#F4AF6F "
],
echartData: []
}
});
window.addEventListener("resize", () => {
this.dataTrend()
});
this.dataTrend()
......@@ -113,8 +35,7 @@ export default {
let { result: res } = await work.dataTrend();
this.cdata.echartData = [];
this.cdata.echartData=res,
res.map((item) => {
});
this.cdata.echartData.reverse()
} catch (error) {
console.log(error);
}
......
......@@ -87,8 +87,7 @@ export default {
},
itemStyle: {
normal: {
// 这里设置圆角
color: "#16F4D2",
color: "#5fba7d",
},
},
data: newData.barData,
......@@ -113,7 +112,7 @@ export default {
itemStyle: {
normal: {
// 这里设置圆角
color: "#C99E68",
color: "#c97168",
},
},
data: newData.lineData,
......
......@@ -17,7 +17,7 @@ let mixin = {
...mapGetters(['dicData'])
},
created () {
this.featchData()
// this.featchData()
},
methods: {
// 表格索引得问题
......
......@@ -19,10 +19,6 @@ class data extends filter {
width: 260,
label: "链接路径"
},
{
prop: "icon",
label: "图标"
}
]
}
}
......
......@@ -232,13 +232,6 @@ export default {
tableData: {
columns: [].concat(data.columns()).concat([
{
label: "排序",
width: 380,
render: (h, scope) => {
return <div></div>;
},
},
{
label: "操作",
width: 380,
render: (h, scope) => {
......
......@@ -20,9 +20,9 @@
@size-change="handleSizeChange"
@p-current-change="handleCurrentChange"
:column="tableData.columns"
:data="tableData.data"
:data="listdata"
:expand-row-keys="keyList"
row-key="dictid"
row-key="id"
>
</lb-table>
</div>
......@@ -38,8 +38,10 @@ import {
findParents,
removeTreeListItem,
} from "@/utils/operation";
import { getRolesById, getUserRoles } from "@/api/Rolemanagement";
import data from "./data";
import sjsbTask from "@/api/sjsbTask.js";
import { api, getAction } from "@/api/manageApi";
import tableMixin from "@/mixins/tableMixin.js";
import EditDialog from "./edit-dialog.vue";
import Roleslistdiglog from "./roleslistdiglog.vue";
......@@ -52,8 +54,10 @@ export default {
},
data() {
return {
taskData: null,
personlist: null,
waitMemberList: [],
keyList: [],
listdata: [],
form: {
job_name: "",
currentPage: 1,
......@@ -141,7 +145,7 @@ export default {
size="mini"
icon="el-icon-video-pause"
onClick={() => {
this.personnel(scope.row);
this.getUserList(scope.row);
}}
>
人员
......@@ -182,9 +186,69 @@ export default {
};
},
created() {
this.featchData();
this.getTableData();
},
mounted() {},
methods: {
// 获取角色列表
getTableData() {
getRolesById()
.then((res) => {
this.listdata = res.content;
this.listdata = judgeSort(this.listdata);
})
.catch((e) => console.error(e));
},
getUserList(row) {
const params = {};
const queryOptions = {
conditionGroup: {
conditions: [
{
property: "organizationId",
value: row.organizationId,
operator: "EQ",
},
{
property: "departmentId",
value: row.departmentId,
operator: "EQ",
},
],
queryRelation: "AND",
},
orderBys: [{ property: "sort", direction: "desc" }],
};
params.queryOptions = JSON.stringify(queryOptions);
getUserRoles(row.id).then((res) => {
if (res.status === 1) {
this.personlist = res.content;
getAction(api.users, params).then((res) => {
if (res.status === 1) {
this.waitMemberList = res.content;
if (this.personlist) {
this.waitMemberList.forEach((item, i) => {
this.personlist.forEach((val) => {
if (item.id === val.id) {
this.waitMemberList[i].selectStatus = 0;
}
});
});
}
this.$refs.rolesForm.adds(this.waitMemberList,row.id);
} else {
this.$message.error({ message: res.message, showClose: true });
}
});
this.$refs.rolesForm.title = "人员配置";
} else this.$message.error({ message: res.message, showClose: true });
});
},
// 新增角色
handleAdd() {
// this.$refs.addEditDialog.roleId = value.id
......@@ -205,76 +269,20 @@ export default {
this.$refs.addEditDialog.showAddEditDialog = true;
this.$refs.addEditDialog.dialogTitle = "修改";
},
featchData() {
this.tableData.data = [
{
id: "2176e915-fdb4-414a-b8d6-6cf63171cffc",
isTop: true,
isBottom: false,
dictid: "51b9f487861671f77782c5a23b5fe52esasq",
createdAt: "2022-10-31T07:08:29.293+0000",
updatedAt: "2022-10-31T07:08:29.293+0000",
createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
sort: 29,
name: "材料管理员",
type: "信息员",
category: 2,
description: "1二点三s",
_X_ROW_KEY: "row_365",
},
{
id: "2176e915-fdb4-414a-b8d6-6cf63171c222ffc",
isTop: false,
isBottom: false,
dictid: "51b9f487861671f77782c5a23b5fe52e11",
createdAt: "2022-10-31T07:08:29.293+0000",
updatedAt: "2022-10-31T07:08:29.293+0000",
createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
sort: 29,
name: "人事管理员",
type: "管理",
category: 2,
description: "管qdq",
_X_ROW_KEY: "row_365",
},
{
id: "2176e915-fdb4-414a-b8324d6-6cf63171cffc",
isTop: false,
isBottom: true,
dictid: "51b9f487861671f72131ddd7782c5a23b5fe52e12ewsd",
createdAt: "2022-10-31T07:08:29.293+0000",
updatedAt: "2022-10-31T07:08:29.293+0000",
createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
sort: 29,
name: "管理员",
type: "材料",
category: 2,
description: "sadq",
_X_ROW_KEY: "row_365",
},
];
},
// 上移下移
moveUpward(index, row) {
realMove(row.dictid, "UP", this.tableData.data);
realMove(row.id, "UP", this.listdata);
this.key++;
let id = findParents(this.tableData.data, row.dictid);
let id = findParents(this.listdata, row.id);
this.keyList = id;
},
moveDown(index, row) {
realMove(row.dictid, "DOWN", this.tableData.data);
realMove(row.id, "DOWN", this.listdata);
this.key++;
let id = findParents(this.tableData.data, row.dictid);
let id = findParents(this.listdata, row.id);
this.keyList = id;
},
// 人员配置弹框
personnel() {
this.$refs.rolesForm.adds();
this.$refs.rolesForm.title = "人员配置";
},
// 删除
handleDel(row) {
this.$confirm("此操将进行删除操作, 是否继续?", "提示", {
......@@ -291,7 +299,7 @@ export default {
type: "success",
message: res.message,
});
this.featchData();
// this.featchData();
}
})
.catch((error) => {
......@@ -308,6 +316,7 @@ export default {
});
});
},
},
};
</script>
......
......@@ -30,25 +30,23 @@ import Dialog from "@/components/Dialog/";
export default {
name: "",
components: { Dialog },
props: {},
data() {
return {
title: "人员配置",
visible: false,
hasSelectList: [
{
name: "管理员",
loginName: "admin1",
departmentName: "研发部",
jobLevel: null,
},
{
name: "测试账号",
loginName: "admin2",
departmentName: "研发部",
jobLevel: null,
},
// {
// name: "管理员",
// loginName: "admin1",
// departmentName: "研发部",
// jobLevel: null,
// },
// {
// name: "测试账号",
// loginName: "admin2",
// departmentName: "研发部",
// jobLevel: null,
// },
], //已经选择的id组成的数组
tableData: {
column: [
......@@ -72,62 +70,23 @@ export default {
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,
code: "123324",
jobLevel: null,
telephone: "028-87720898",
address: "办公地点修改测试",
isLocked: false,
departmentName: "研发部",
_X_ROW_KEY: "row_276",
},
{
name: "管理员",
loginName: "admin1",
departmentName: "研发部",
jobLevel: null,
selectStatus: 0,
},
{
name: "测试账号",
loginName: "admin2",
departmentName: "研发部",
jobLevel: null,
selectStatus: 0,
},
],
data: [],
// 角色id
roleId:""
},
multipleSelection: [],
};
},
computed: {},
watch: {},
created() {},
mounted() {},
methods: {
adds() {
adds(a,roleId) {
this.roleId=roleId
this.visible = true;
console.log("a",a);
this.tableData.data=a
this.tableData.data.forEach((item, index) => {
if (item.selectStatus === 0) {
this.$nextTick(() => {
......@@ -142,21 +101,14 @@ export default {
close() {
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 })
// })
let arrlist= this.tableData.data.filter((item) => {
return item.selectStatus==0
})
const idList = arrlist.map((item) => {
return item.id
})
},
handleSelectionChange(val) {
this.multipleSelection = val;
......@@ -165,12 +117,11 @@ export default {
};
</script>
<style scoped lang="scss">
/deep/.el-dialog__header{
/deep/.el-dialog__header {
text-align: center;
margin-bottom: 10px;
.el-dialog__title{
.el-dialog__title {
color: white;
}
}
}
</style>
......
......@@ -24,7 +24,8 @@
@p-current-change="handleCurrentChange"
:column="tableData.columns"
:data="tableData.data"
:expand-row-keys="keyList" row-key="dictid"
:expand-row-keys="keyList"
row-key="dictid"
>
</lb-table>
</div>
......@@ -214,6 +215,7 @@ export default {
this.$refs.dialogForm.title = "添加";
},
featchData() {
this.tableData.data = [
{
"dictid": "51b9f487861671f77782c5a23b5fe52e",
......@@ -224,8 +226,6 @@ export default {
"DNAME": "小红",
"SORT": null,
"index": 1,
"isTop": true,
"isBottom": false
},
{
"dictid": "2291d9e298274c1ea1f40df63fbcff47",
......@@ -236,8 +236,6 @@ export default {
"DNAME": "小李",
"SORT": null,
"index": 2,
"isTop": false,
"isBottom": false
},
{
"dictid": "e6a5aeb8957b8029fa31586fb30dd5b8",
......@@ -248,11 +246,10 @@ export default {
"DNAME": "小田",
"SORT": null,
"index": 13,
"isTop": false,
"isBottom": true
}
];
},
]
this.tableData.data=judgeSort(this.tableData.data)
},
// 更新用户解锁状态
updateLock(id, name) {
......