This commit is contained in:
2023-05-25 20:29:25 +08:00
parent 91d73c483b
commit 439095df3c
6 changed files with 53 additions and 22 deletions

View File

@@ -67,9 +67,7 @@ export const usersAdd = (username, personName, gender, phone, rolesIds, password
// 1.3 修改用户、重置密码
export const usersEdit = (obj) => post('api/users/edit', obj)
// 1.4 删除用户
export const usersDelete = (userId) => post('api/users/delete', {
usersIds: userId
})
export const usersDelete = (userId) => post('api/users/delete', userId)
// 角色管理
// 1.1 角色列表
@@ -89,9 +87,7 @@ export const sysRoleEdit = (roleId, name, remark) => post('api/sysRole/edit', {
remark: remark
})
// 1.4 删除角色
export const sysRoleDelete = (roleId) => post('api/sysRole/delete', {
rolesIds: roleId
})
export const sysRoleDelete = (roleId) => post('api/sysRole/delete', roleId)
// 1.5 保存菜单
export const sysRoleMenu = (roleId, menus) => post('api/sysRole/menu', {
roleId: roleId,

View File

@@ -38,6 +38,15 @@ Vue.config.productionTip = false
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='
const privateKey = 'MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8\n' +
'mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9p\n' +
'B6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue\n' +
'/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZ\n' +
'UBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6\n' +
'vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha\n' +
'4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3\n' +
'tTbklZkD2A=='
// 加密
export function encrypt (txt) {
const encryptor = new JSEncrypt()
@@ -45,6 +54,13 @@ export function encrypt (txt) {
return encryptor.encrypt(txt) // 对需要加密的数据进行加密
}
// 解密
export function decrypt (txt) {
const encryptor = new JSEncrypt()
encryptor.setPrivateKey(privateKey)
return encryptor.decrypt(txt)
}
/* eslint-disable no-new */
new Vue({
el: '#app',

View File

@@ -9,16 +9,16 @@
<div class="grid_wrapper">
<table>
<tr>
<th width="56px">选中</th>
<th width="100px">角色名称</th>
<th>描述</th>
<th width="115px">创建日期</th>
<th width="75px">操作</th>
<!-- <th>选中</th> -->
<th width="20%">角色名称</th>
<th width="40%">描述</th>
<th width="20%">创建日期</th>
<th width="20%">操作</th>
</tr>
<tr v-for="(e, i) in datalist" :key="i">
<td>
<tr v-for="(e, i) in datalist" :key="i" :class="{'tr_selected': pkId === e.roleId}" @click="toCheck(e)">
<!-- <td>
<div class="radio__input icon_radio_checked"><i class="icon_radio"></i></div>
</td>
</td> -->
<td>{{ e.name }}</td>
<td>{{ e.remark }}</td>
<td>{{ e.createTime }}</td>
@@ -34,7 +34,7 @@
<div class="tree_wrapper">
<div class="tree_header">
<span>角色名称</span>
<button class="button button--primary grid_button button1" :disabled="disabled" @click="toSave">保存</button>
<button class="button button--primary grid_button button1" :class="{'button--info': pkId === ''}" :disabled="disabled" @click="toSave">保存</button>
</div>
<div class="tree_body_container">
<el-tree
@@ -100,6 +100,7 @@ export default {
label: 'title'
},
pkObj: {},
pkId: '',
unclick: false,
disabled: false
}
@@ -135,6 +136,8 @@ export default {
methods: {
async _sysRoleQuery () {
let res = await sysRoleQuery('0', '100')
this.pkId = ''
this.pkObj = {}
this.datalist = [...res]
},
async _menuQuery () {
@@ -237,7 +240,7 @@ export default {
async _sysRoleMenu (arr) {
this.disabled = true
try {
let res = await sysRoleMenu(arr)
let res = await sysRoleMenu(this.pkId, arr)
if (res.code === '1') {
this.toast(res.desc)
} else {
@@ -255,6 +258,9 @@ export default {
arr1.push({menuId: el})
})
this._sysRoleMenu(arr1)
},
toCheck (e) {
this.pkId = this.pkId === e.roleId ? '' : e.roleId
}
}
}
@@ -270,9 +276,6 @@ export default {
overflow-y auto
.grid_wrapper table td
white-space normal
.button+.button
margin-left 0
margin-top 10px
.tree_wrapper
_wh(calc(50% - 10px), 100%)
overflow-y auto
@@ -290,4 +293,6 @@ export default {
.tree_body_container
height calc(100% - 47px)
padding 12px 10px
.grid_wrapper table .row .button
margin 5px
</style>

View File

@@ -79,7 +79,7 @@
<div v-if="type === '1'" class="form_item">
<div class="form_item__label"><i>*</i>密码</div>
<div class="form_item__content">
<input type="text" class="form_item__input" v-model="password">
<input type="password" class="form_item__input" v-model="password">
</div>
</div>
<div class="form_item">
@@ -106,6 +106,7 @@
<script>
import jxDialog from '@components/dialog.vue'
import {usersQuery, sysRoleQuery, usersAdd, usersEdit, usersDelete} from '@config/getData2.js'
import {encrypt} from '../../../main.js'
export default {
components: {
jxDialog
@@ -256,7 +257,7 @@ export default {
rolesIds.push(el)
}
})
let res = await usersAdd(this.username, this.name, this.sex, this.phone, rolesIds, this.password)
let res = await usersAdd(this.username, this.name, this.sex, this.phone, rolesIds, encrypt(this.password))
if (res.code === '1') {
this._usersQuery()
}

View File

@@ -23,6 +23,7 @@
<div class="header_user_wraper_inn">
<div class="elec-qty-wrap">
<div class="elec-qty"></div>
<div class="elec-qty-top"></div>
</div>
<div class="elec-txt">90%</div>
</div>
@@ -262,6 +263,8 @@ export default {
height 32px
border 1px solid #dddddd
margin-right 5px
border-radius 2px
z-index 151
.elec-qty
position absolute
width 100%
@@ -270,6 +273,14 @@ export default {
bottom 0
background-color #54C0B3
// background-color #fa6400
.elec-qty-top
position absolute
_wh(8px, 3px)
top -3px
left 50%
transform translateX(-50%)
z-index 152
border 1px solid #ddd
.elec-txt
_font(18px, 32px, #909399,,left)
.icon_admin

View File

@@ -344,7 +344,9 @@
color: #323232;
background: #fff;
&:last-child
border-right: none;
border-right: none;
.grid_wrapper table .tr_selected td
background-color #ffc3a7
.grid_wrapper table th:first-child
position: sticky;
left: 0;