新增按钮权限,增加redis可独立配置 (#923)

* fix jwt to golang-jwt, gin to 1.7.0

* 增加按钮权限功能

* 增加redis可独立配置

Co-authored-by: helight <helight@helight.info>
This commit is contained in:
奇淼(piexlmax
2022-02-22 00:26:21 +08:00
committed by GitHub
parent f389ff701a
commit 6a97f39f66
33 changed files with 5024 additions and 542 deletions

View File

@@ -177,6 +177,42 @@
</template>
</el-table-column>
</el-table>
<el-button
style="margin-top:12px"
size="small"
type="primary"
icon="edit"
@click="addBtn(form)"
>新增可控按钮</el-button>
<el-table :data="form.menuBtn" style="width: 100%">
<el-table-column align="left" prop="name" label="按钮名称" width="180">
<template #default="scope">
<div>
<el-input v-model="scope.row.name" />
</div>
</template>
</el-table-column>
<el-table-column align="left" prop="name" label="备注" width="180">
<template #default="scope">
<div>
<el-input v-model="scope.row.desc" />
</div>
</template>
</el-table-column>
<el-table-column align="left">
<template #default="scope">
<div>
<el-button
type="danger"
size="small"
icon="delete"
@click="deleteBtn(form.menuBtn,scope.$index)"
>删除</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
<template #footer>
<div class="dialog-footer">
@@ -198,6 +234,7 @@ import {
} from '@/api/menu'
import icon from '@/view/superAdmin/menu/icon.vue'
import warningBar from '@/components/warningBar/warningBar.vue'
import { canRemoveAuthorityBtnApi } from '@/api/authorityBtn'
import { reactive, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
@@ -232,7 +269,7 @@ getTableData()
// 新增参数
const addParameter = (form) => {
if (!form.parameters) {
form.value.parameters = []
form.parameters = []
}
form.parameters.push({
type: 'query',
@@ -245,6 +282,31 @@ const deleteParameter = (parameters, index) => {
parameters.splice(index, 1)
}
// 新增可控按钮
const addBtn = (form) => {
console.log(form)
if (!form.menuBtn) {
form.menuBtn = []
}
form.menuBtn.push({
name: '',
desc: '',
})
}
// 删除可控按钮
const deleteBtn = async(btns, index) => {
const btn = btns[index]
if (btn.ID === 0) {
btns.splice(index, 1)
return
}
const res = await canRemoveAuthorityBtnApi({ id: btn.ID })
if (res.code === 0) {
btns.splice(index, 1)
return
}
}
const form = ref({
ID: 0,
path: '',
@@ -259,7 +321,8 @@ const form = ref({
closeTab: false,
keepAlive: false
},
parameters: []
parameters: [],
menuBtn: []
})
const changeName = () => {
form.value.path = form.value.name