Commit 0240df2c by fengzhaoyu

初步

parent c99d1fed
......@@ -12,6 +12,7 @@
},
"dependencies": {
"ant-design-vue": "^1.3.8",
"axios": "^0.19.0",
"core-js": "^2.6.5",
"dingtalk-jsapi": "^2.6.44",
"echarts": "^4.5.0",
......
......@@ -117,7 +117,7 @@ const config = {
})
},
ddchooseTen: (hasSelect) => {
console.log(hasSelect.userHasRoles, 'hasSelect')
console.log(hasSelect, 'hasSelect')
return new Promise((resolve, reject) => {
dd.biz.contact.complexPicker({
title: '人员选择', // 标题
......@@ -125,7 +125,7 @@ const config = {
multiple: true, // 是否多选
limitTips: '超出了', // 超过限定人数返回提示
maxUsers: 10, // 最大可选人数
pickedUsers: hasSelect, // 已选用户
pickedUsers: hasSelect || [], // 已选用户
pickedDepartments: [], // 已选部门
disabledUsers: [], // 不可选用户
disabledDepartments: [], // 不可选部门
......
......@@ -12,7 +12,7 @@
<a-tag v-for="(userHasRole, index) in userHasRoles" :key="index">{{userHasRole}}</a-tag>
</span>
<span slot="action" slot-scope="text, record, index">
<a href="javascript:;" @click="selectSuperAdministrator(record, text, index)">编辑</a>
<a href="javascript:;" @click="selectSuperAdministrator(record, text, index, superAdministratorListId)">编辑</a>
</span>
</a-table>
</div>
......@@ -22,12 +22,12 @@
<div class="roleTitle">2.创建角色</div>
<div class="roleTable">
<a-button type="primary" icon="plus" class="addRole" @click="addRole" key="key">添加</a-button>
<a-table :columns="roleColumns" :dataSource="roleList" size="default" rowKey="id" :pagination="false">
<a-table :columns="roleColumns" :dataSource="roleList" size="default" rowKey="key" :pagination="false">
<span slot="userHasRoles" slot-scope="userHasRoles">
<a-tag v-for="(userHasRole, index) in userHasRoles" :key="index">{{userHasRole}}</a-tag>
</span>
<span slot="action" slot-scope="text, record, index">
<a href="javascript:;" @click="selectSuperAdministrator(record, text, index)">编辑</a>
<a href="javascript:;" @click="editRoles(record, text, index)">编辑</a>
<a href="javascript:;" class="delete" @click="delectRoles(record, text, index)">删除</a>
</span>
</a-table>
......@@ -46,7 +46,8 @@ export default {
return {
columns: [{
title: '角色名称',
dataIndex: 'administratorName'
dataIndex: 'administratorName',
width: '30%'
}, {
title: '拥有该角色的员工',
dataIndex: 'userHasRoles',
......@@ -85,21 +86,45 @@ export default {
},
methods: {
// 编辑超级管理员
selectSuperAdministrator (superAdministratorListId) {
selectSuperAdministrator (record, text, index, superAdministratorListId) {
console.log(record, 'sssss')
config.ddready('ddchooseTen', superAdministratorListId).then((res) => {
console.log(res, 'res')
console.log(res)
let roleId = record.key
let roleName = record.administratorName
let roleDesc = ''
let ddUserIds = []
let menuIds = []
let roleCode = record.roleCode
res.users.forEach((item, index) => {
ddUserIds.push(item.emplId)
})
let data = {
roleId: roleId,
roleName: roleName,
roleDesc: roleDesc,
ddUserIds: ddUserIds,
menuIds: menuIds,
roleCode: roleCode
}
$http.post(`/admin/manager/modifyFullRole`, data).then(success => {
return this.getAllAdminisgtrator()
})
})
},
// 删除角色
delectRoles (record) {
console.log(record, 1111)
const _that = this
this.$confirm({
title: '确认要删除该角色吗?',
content: '删除后,拥有该角色员工自动接触',
okText: '确定',
cancelText: '取消',
onOk () {
// _that.deleteCashier(record)
let data = { roleId: record.key }
$http.post(`/admin/role/del`, data).then(res => {
_that.getAllAdminisgtrator()
})
}
})
},
......@@ -115,30 +140,45 @@ export default {
item: 'e-card'
}
$http.post(`/admin/role/page1`, data).then(res => {
this.superAdministratorList = []
this.roleList = []
this.superAdministratorListId = []
res.data.data.forEach((item, index) => {
if (item.roleCode === 'ROLE_SUPER_ADMIN') {
let userHasRoles = []
debugger
item.userList.forEach((userItem, userIndex) => {
userHasRoles.push(userItem.username)
this.superAdministratorListId.push(userItem.ddUserId)
})
this.superAdministratorList.push({
roleCode: item.roleCode,
key: item.roleId,
administratorName: item.roleName,
userHasRoles: userHasRoles
})
} else {
let userHasRoles = []
let ddUserId = []
item.userList.forEach((userItem, userIndex) => {
userHasRoles.push(userItem.username)
ddUserId.push(userItem.ddUserId)
})
this.roleList.push({
key: item.roleId,
roleName: item.roleName,
userHasRoles: ['朱阅悦', '韩佳佳'],
userHasRoles: userHasRoles,
roleDes: item.roleDesc,
creatTime: item.createTime
creatTime: item.createTime,
action: { ddUserId: ddUserId, name: userHasRoles }
})
}
})
})
},
// 编辑角色
editRoles (record) {
this.$router.push({ name: 'addOrRights', params: { roleId: record.key, record: record } })
let data = { roleId: record.key }
}
},
watch: {
......
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