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: [], // 不可选部门
......
<template>
<div class="addOrRights">
<a-button type="primary" @click="back()"><img style="margin-top:-4px;margin-right: 6px;width: 14px" src="../../../assets/back.png"/>返回</a-button>
<div class="title">查看津贴</div>
<div class="title">添加角色</div>
<a-form :form="form">
<a-form-item label="角色名称" v-bind="formItemLayout" >
{{roleName}}
<a-input
v-model="roleName"
placeholder="请填写角色名称"
v-decorator="['roleName',{rules: [{required: true, message: '角色名称不能为空'}]}]"
/>
</a-form-item>
<a-form-item label="角色描述" v-bind="formItemLayout" >
<a-input
v-model="roleDec"
placeholder="请填写角色描述"
v-decorator="['roleDec',{rules: [{required: false, message: '角色描述不能为空'}]}]"
v-decorator="['roleDec',{rules: [{required: false, message: '角色描述不能为空'}]}]"
/>
</a-form-item>
<a-form-item label="选择成员" v-bind="formItemLayout" >
<a-input
placeholder="选择成员"
@click="selectPeople"
v-decorator="['roleName',{rules: [{required: true, message: '成员不能为空'}]}]"
/>
<div class="selectPeople" @click="selectPeople">
<span v-show="!members.length">选择成员</span>
<span v-show="members.length" v-for='(item, index) in members' :key="index" :style="{'margin-left': '3px',color:'rgba(0,0,0,0.85)',width:'20%',overflow:'hidden'}">{{item.name}}</span>
</div>
</a-form-item>
<div class="permisson">
<div class="permissonLeft">分配权限:</div>
<div class="permissonRight">
<div>
<div class="permissonTitle">
<a-checkbox>
支付管理
</a-checkbox>
</div>
<a-row :style="{border: '1px solid #F8F8F8',display: 'flex',padding:'0 20px'}">
<a-col :span="4" :style="{borderRight: '1px solid #f8f8f8', padding:'22px 0'}"><a-checkbox>账户中心</a-checkbox></a-col>
<a-col :span="20" :style="{padding:'0px 0 22px 8px'}">
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看1</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>充值</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>绑定卡片</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>注销并界限</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看津贴</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看详情</a-checkbox></a-col>
</a-col>
</a-row>
<a-row :style="{border: '1px solid #F8F8F8',display: 'flex',padding:'0 20px'}">
<a-col :span="4" :style="{borderRight: '1px solid #f8f8f8', padding:'22px 0'}"><a-checkbox>充值记录</a-checkbox></a-col>
<a-col :span="20" :style="{padding:'0px 0 22px 8px'}">
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看1</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>充值</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>绑定卡片</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看详情</a-checkbox></a-col>
</a-col>
</a-row>
</div>
<div>
<div class="permissonTitle">
<div v-for="tree in trees" :key="tree.id">
<div class="permissonTitle" >
<a-checkbox>
支付管理
{{tree.name}}
</a-checkbox>
</div>
<a-row :style="{border: '1px solid #F8F8F8',display: 'flex',padding:'0 20px'}">
<a-col :span="4" :style="{borderRight: '1px solid #f8f8f8', padding:'22px 0'}"><a-checkbox>账户中心</a-checkbox></a-col>
<a-col :span="20" :style="{padding:'0px 0 22px 8px'}">
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看1</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>充值</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>绑定卡片</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>注销并界限</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看津贴</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看详情</a-checkbox></a-col>
</a-col>
</a-row>
<a-row :style="{border: '1px solid #F8F8F8',display: 'flex',padding:'0 20px'}">
<a-col :span="4" :style="{borderRight: '1px solid #f8f8f8', padding:'22px 0'}"><a-checkbox>充值记录</a-checkbox></a-col>
<a-col :span="20" :style="{padding:'0px 0 22px 8px'}">
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看1</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>充值</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>绑定卡片</a-checkbox></a-col>
<a-col :span="6" :style="{paddingTop:'22px'}"><a-checkbox>查看详情</a-checkbox></a-col>
<a-row :style="{border: '1px solid #F8F8F8',display: 'flex',padding:'0 20px'}" v-for="treeTwo in tree.children" :key="treeTwo.id">
<a-col :span="4" :style="{borderRight: '1px solid #f8f8f8', padding:'22px 0'}"><a-checkbox>{{treeTwo.name}}</a-checkbox></a-col>
<a-col :span="20" :style="{padding:'0px 0 22px 8px'}" >
<a-col :span="6" :style="{paddingTop:'22px'}" v-for="treeThree in treeTwo.children " :key="treeThree.id" ref="threeNode"><a-checkbox>{{treeThree.name}}</a-checkbox></a-col>
</a-col>
</a-row>
</div>
<!-- <div v-for="tree in trees" :key="tree.id">-->
<!-- <div class="permissonTitle" >-->
<!-- {{tree.name}}-->
<!-- </div>-->
<!-- <a-row :style="{border: '1px solid #F8F8F8',display: 'flex',padding:'0 20px'}" v-for="treeTwo in tree.children" :key="treeTwo.id">-->
<!-- <a-col :span="5" :style="{borderRight: '1px solid #f8f8f8', padding:'22px 0'}">{{treeTwo.name}}</a-col>-->
<!-- <a-col :span="19" :style="{padding:'0px 0 22px 8px'}" >-->
<!-- <a-checkbox-group :defaultValue="checkList">-->
<!-- <a-col :span="5" :style="{paddingTop:'22px'}" v-for="treeThree in treeTwo.children " :key="treeThree.id" >-->
<!-- <a-checkbox :value="treeThree.id" @change="handleChange" :id="treeThree.id" >{{treeThree.name}}</a-checkbox>-->
<!-- </a-col>-->
<!-- </a-checkbox-group>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!-- </div>-->
<a-button type="primary" @click="confirm" class="confirm">确定</a-button>
</div>
</div>
</a-form>
</div>
</template>
<script>
import { $http } from '../../../api/axios'
import { config } from '../../../api/config'
......@@ -103,21 +78,100 @@ export default {
xs: { span: 24 },
sm: { span: 8 }
}
},
trees: [],
roleName: '', // 角色名称
roleDec: '', // 角色描述
members: [], // 选择成员
ddUserIds: [],
indeterminate1: true,
checkList: []
}
},
created () {
this.getTree()
},
mounted () {
if (JSON.stringify(this.$route.params) === '{}') {
} else {
this.roleName = this.$route.params.record.roleName
console.log(this.roleName = this.$route.params.record.roleName)
this.roleName = this.$route.params.record.roleDec
// this.ddUserIds = this.$route.params.record.action.ddUserId
// this.ddUserIds = this.$route.params.record.action.name
let data = {
roleId: this.$route.params.roleId
}
$http.post('admin/menu/tree/roleById', data).then(res => {
this.checkList = res.data.data
})
}
},
methods: {
// 返回上一页
back () {
this.$router.go(-1)
this.$router.push({ name: 'rightsManagement' })
},
// 选人
selectPeople () {
config.ddready('ddchooseOne').then((res) => {
config.ddready('ddchooseTen', this.ddUserIds).then((res) => {
this.members = res.users
this.ddUserIds = []
// this.members = this.duplicateRemoval(this.members)
this.members.forEach((item, index) => {
this.ddUserIds.push(item.emplId)
})
})
},
// 确定 提交表单
confirm () {
if (this.ddUserIds.length === 0) {
this.$confirm({
content: '请先选择成员',
onOk () {
// that.changeData(record, index)
},
onCancel () {}
})
} else {
let data = {
roleName: this.roleName,
roleCode: 'b',
roleDesc: this.roleDesc,
item: 'e-card',
ddUserIds: this.ddUserIds,
menuIds: this.checkList
}
$http.post(`/admin/manager/addFullRole`, data).then(res => {
this.$router.push({ name: 'rightsManagement' })
})
}
},
getTree () {
let data = {
item: 'e-card'
}
$http.post(`/admin/menu/tree`, data).then(success => {
success.data.data.forEach((item, index) => {
if (item.code !== 'sys_super_admin') {
this.trees.push(item)
}
})
})
},
// 点击复选框
handleChange (event) {
let data = []
if (event.target.checked) {
this.checkList.push(event.target.value)
} else {
this.checkList.forEach((item, index) => {
if (event.target.value !== item) {
data.push(item)
}
})
this.checkList = data
}
}
}
}
......@@ -168,5 +222,23 @@ export default {
.confirm {
margin-top: 40px;
}
.addOrRights /deep/ .ant-checkbox-group {
width: 100% !important;
color: rgba(0,0,0,0.85);
}
.addOrRights /deep/.ant-row {
width: 100% !important;
}
.selectPeople {
width: 100%;
font-size: 14px;
color: #cccccc;
min-height: 40px;
line-height: 40px;
margin-left: 5px;
text-indent: 10px;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 5px;
}
</style>
......@@ -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