mirror of
https://github.com/chillzhuang/Saber.git
synced 2024-11-24 03:19:27 +08:00
🎉 3.2.0.RELEASE 新增灵活数据权限特性
This commit is contained in:
parent
76a8936028
commit
ae4af10205
@ -1,9 +1,9 @@
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/Release-V3.0.3-green.svg" alt="Downloads">
|
||||
<img src="https://img.shields.io/badge/Release-V3.2.0-green.svg" alt="Downloads">
|
||||
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status">
|
||||
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
|
||||
<img src="https://img.shields.io/badge/Spring%20Cloud-2020-blue.svg" alt="Coverage Status">
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.4.4-blue.svg" alt="Downloads">
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.5.6-blue.svg" alt="Downloads">
|
||||
<a target="_blank" href="https://bladex.vip">
|
||||
<img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads">
|
||||
</a>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "saber-admin",
|
||||
"version": "3.1.0",
|
||||
"version": "3.2.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
@ -46,3 +46,14 @@ export const getMenu = (id) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getLazyMenuList = (parentId, params) => {
|
||||
return request({
|
||||
url: '/api/blade-system/menu/lazy-menu-list',
|
||||
method: 'get',
|
||||
params: {
|
||||
...params,
|
||||
parentId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -18,13 +18,14 @@ export const grantTree = () => {
|
||||
})
|
||||
}
|
||||
|
||||
export const grant = (roleIds, menuIds) => {
|
||||
export const grant = (roleIds, menuIds, dataScopeIds) => {
|
||||
return request({
|
||||
url: '/api/blade-system/role/grant',
|
||||
method: 'post',
|
||||
data: {
|
||||
roleIds,
|
||||
menuIds
|
||||
menuIds,
|
||||
dataScopeIds
|
||||
}
|
||||
})
|
||||
}
|
||||
|
50
src/api/system/scope.js
Normal file
50
src/api/system/scope.js
Normal file
@ -0,0 +1,50 @@
|
||||
import request from '@/router/axios';
|
||||
|
||||
export const getListDataScope = (current, size, params) => {
|
||||
return request({
|
||||
url: '/api/blade-system/data-scope/list',
|
||||
method: 'get',
|
||||
params: {
|
||||
...params,
|
||||
current,
|
||||
size,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const removeDataScope = (ids) => {
|
||||
return request({
|
||||
url: '/api/blade-system/data-scope/remove',
|
||||
method: 'post',
|
||||
params: {
|
||||
ids,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const addDataScope = (row) => {
|
||||
return request({
|
||||
url: '/api/blade-system/data-scope/submit',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
||||
export const updateDataScope = (row) => {
|
||||
return request({
|
||||
url: '/api/blade-system/data-scope/submit',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
||||
export const getMenuDataScope = (id) => {
|
||||
return request({
|
||||
url: '/api/blade-system/data-scope/detail',
|
||||
method: 'get',
|
||||
params: {
|
||||
id,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ export default {
|
||||
route: {
|
||||
info: 'info',
|
||||
website: 'website',
|
||||
avuexwebsite: 'avuex',
|
||||
dashboard: 'dashboard',
|
||||
tags: 'tags',
|
||||
store: 'store',
|
||||
|
@ -50,7 +50,6 @@ export default {
|
||||
route: {
|
||||
info: '个人信息',
|
||||
website: 'bladex官网',
|
||||
avuexwebsite: 'avuex官网',
|
||||
dashboard: '首页',
|
||||
tags: '标签',
|
||||
store: '本地存储',
|
||||
|
@ -18,15 +18,6 @@ const top = [{
|
||||
path: "https://bladex.vip/#/",
|
||||
parentId: 1
|
||||
},
|
||||
{
|
||||
label: "avuex官网",
|
||||
icon: 'el-icon-document',
|
||||
meta: {
|
||||
i18n: 'avuexwebsite',
|
||||
},
|
||||
path: "https://avuex.avue.top",
|
||||
parentId: 2
|
||||
},
|
||||
{
|
||||
label: "测试",
|
||||
icon: 'el-icon-document',
|
||||
|
727
src/views/authority/datascope.vue
Normal file
727
src/views/authority/datascope.vue
Normal file
@ -0,0 +1,727 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud :option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
ref="crud"
|
||||
v-model="form"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
@tree-load="treeLoad">
|
||||
<template slot-scope="{row}" slot="menu">
|
||||
<el-button type="text"
|
||||
icon="el-icon-setting"
|
||||
size="small"
|
||||
v-if="permission.data_scope_setting"
|
||||
plain
|
||||
style="border: 0;background-color: transparent !important;"
|
||||
@click.stop="handleDataScope(row)">权限配置
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row}" slot="source">
|
||||
<div style="text-align:center">
|
||||
<i :class="row.source"/>
|
||||
</div>
|
||||
</template>
|
||||
</avue-crud>
|
||||
<el-drawer :title="`[${scopeMenuName}] 数据权限配置`" :visible.sync="drawerVisible" :direction="direction"
|
||||
append-to-body
|
||||
:before-close="handleDrawerClose" size="1000px">
|
||||
<basic-container>
|
||||
<avue-crud :option="optionScope"
|
||||
:data="dataScope"
|
||||
:page="pageScope"
|
||||
v-model="formScope"
|
||||
:table-loading="scopeLoading"
|
||||
ref="crudScope"
|
||||
@row-del="rowDelScope"
|
||||
@row-update="rowUpdateScope"
|
||||
@row-save="rowSaveScope"
|
||||
:before-open="beforeOpenScope"
|
||||
@search-change="searchChangeScope"
|
||||
@search-reset="searchResetScope"
|
||||
@selection-change="selectionChangeScope"
|
||||
@current-change="currentChangeScope"
|
||||
@size-change="sizeChangeScope"
|
||||
@on-load="onLoadScope">
|
||||
<template slot="menuLeft">
|
||||
<el-button type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
plain
|
||||
@click="handleDeleteScope">删 除
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row}"
|
||||
slot="scopeType">
|
||||
<el-tag>{{row.scopeTypeName}}</el-tag>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</el-drawer>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
add,
|
||||
remove,
|
||||
update,
|
||||
getLazyMenuList,
|
||||
getMenu
|
||||
} from "@/api/system/menu";
|
||||
import {
|
||||
addDataScope,
|
||||
removeDataScope,
|
||||
updateDataScope,
|
||||
getListDataScope,
|
||||
getMenuDataScope
|
||||
} from "@/api/system/scope";
|
||||
import {mapGetters} from "vuex";
|
||||
import iconList from "@/config/iconList";
|
||||
import func from "@/util/func";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
selectionList: [],
|
||||
query: {},
|
||||
loading: true,
|
||||
parentId: 0,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
drawerVisible: false,
|
||||
direction: 'rtl',
|
||||
scopeMenuId: 0,
|
||||
scopeMenuCode: '',
|
||||
scopeMenuName: "菜单",
|
||||
scopeLoading: false,
|
||||
menu: true,
|
||||
watchMode: true,
|
||||
option: {
|
||||
lazy: true,
|
||||
tip: false,
|
||||
simplePage: true,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
dialogWidth: "60%",
|
||||
tree: true,
|
||||
border: true,
|
||||
index: true,
|
||||
selection: true,
|
||||
viewBtn: false,
|
||||
editBtn: false,
|
||||
addBtn: false,
|
||||
delBtn: false,
|
||||
menuWidth: 150,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "菜单名称",
|
||||
prop: "name",
|
||||
search: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单名称",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "路由地址",
|
||||
prop: "path",
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入路由地址",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "上级菜单",
|
||||
prop: "parentId",
|
||||
type: "tree",
|
||||
dicUrl: "/api/blade-system/menu/tree",
|
||||
hide: true,
|
||||
props: {
|
||||
label: "title"
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: false,
|
||||
message: "请选择上级菜单",
|
||||
trigger: "click"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单图标",
|
||||
prop: "source",
|
||||
type: "icon",
|
||||
slot: true,
|
||||
width: 80,
|
||||
iconList: iconList,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单图标",
|
||||
trigger: "click"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单编号",
|
||||
prop: "code",
|
||||
search: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单编号",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单类型",
|
||||
prop: "category",
|
||||
type: "radio",
|
||||
dicData: [
|
||||
{
|
||||
label: "菜单",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: "按钮",
|
||||
value: 2
|
||||
}
|
||||
],
|
||||
hide: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择菜单类型",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单别名",
|
||||
prop: "alias",
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单别名",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "按钮功能",
|
||||
prop: "action",
|
||||
type: "radio",
|
||||
dicData: [
|
||||
{
|
||||
label: "工具栏",
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: "操作栏",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: "工具操作栏",
|
||||
value: 2
|
||||
}
|
||||
],
|
||||
hide: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择按钮功能",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单排序",
|
||||
prop: "sort",
|
||||
type: "number",
|
||||
width: 80,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单排序",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "新窗口",
|
||||
prop: "isOpen",
|
||||
type: "radio",
|
||||
dicData: [
|
||||
{
|
||||
label: "否",
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: "是",
|
||||
value: 1
|
||||
},
|
||||
],
|
||||
hide: true
|
||||
},
|
||||
{
|
||||
label: "菜单备注",
|
||||
prop: "remark",
|
||||
type: "textarea",
|
||||
span: 24,
|
||||
minRows: 6,
|
||||
hide: true
|
||||
}
|
||||
]
|
||||
},
|
||||
data: [],
|
||||
formScope: {},
|
||||
selectionListScope: [],
|
||||
pageScope: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
optionScope: {
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
viewBtn: true,
|
||||
selection: true,
|
||||
menuWidth: 200,
|
||||
dialogWidth: 900,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "权限名称",
|
||||
prop: "scopeName",
|
||||
search: true,
|
||||
value: "",
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入数据权限名称",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "权限编号",
|
||||
prop: "resourceCode",
|
||||
search: true,
|
||||
width: 100,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入数据权限编号",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "权限字段",
|
||||
prop: "scopeColumn",
|
||||
width: 130,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入数据权限编号",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "规则类型",
|
||||
type: "select",
|
||||
dicUrl: "/api/blade-system/dict/dictionary?code=data_scope_type",
|
||||
props: {
|
||||
label: "dictValue",
|
||||
value: "dictKey"
|
||||
},
|
||||
dataType: "number",
|
||||
slot: true,
|
||||
width: 140,
|
||||
prop: "scopeType",
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入通知类型",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "可见字段",
|
||||
prop: "scopeField",
|
||||
span: 24,
|
||||
hide: true,
|
||||
value: "*",
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入数据权限可见的字段",
|
||||
trigger: "blur"
|
||||
}],
|
||||
},
|
||||
{
|
||||
label: "权限类名",
|
||||
prop: "scopeClass",
|
||||
span: 24,
|
||||
hide: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入MybatisMapper对应方法的完整类名路径",
|
||||
trigger: "blur"
|
||||
}],
|
||||
},
|
||||
{
|
||||
label: "规则值",
|
||||
prop: "scopeValue",
|
||||
span: 24,
|
||||
minRows: 5,
|
||||
type: "textarea",
|
||||
display: true,
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
prop: "remark",
|
||||
span: 24,
|
||||
hide: true,
|
||||
},
|
||||
]
|
||||
},
|
||||
dataScope: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'formScope.scopeType'() {
|
||||
this.initScope();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.menu_add, false),
|
||||
viewBtn: this.vaildData(this.permission.menu_view, false),
|
||||
delBtn: this.vaildData(this.permission.menu_delete, false),
|
||||
editBtn: this.vaildData(this.permission.menu_edit, false)
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
},
|
||||
scopeIds() {
|
||||
let ids = [];
|
||||
this.selectionListScope.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initScope() {
|
||||
const scopeType = func.toInt(this.formScope.scopeType);
|
||||
const watchMode = this.watchMode;
|
||||
let column = "-", name = "暂无";
|
||||
if (scopeType === 1) {
|
||||
column = "-";
|
||||
name = "全部可见";
|
||||
} else if (scopeType === 2) {
|
||||
column = "create_user";
|
||||
name = "本人可见";
|
||||
} else if (scopeType === 3) {
|
||||
column = "create_dept";
|
||||
name = "所在机构可见";
|
||||
} else if (scopeType === 4) {
|
||||
column = "create_dept";
|
||||
name = "所在机构可见及子级可见";
|
||||
} else if (scopeType === 5) {
|
||||
column = "";
|
||||
name = "自定义";
|
||||
}
|
||||
this.$refs.crudScope.option.column.filter(item => {
|
||||
if (watchMode) {
|
||||
if (item.prop === "scopeName") {
|
||||
this.formScope.scopeName = `${this.scopeMenuName} [${name}]`;
|
||||
}
|
||||
if (item.prop === "resourceCode") {
|
||||
this.formScope.resourceCode = this.scopeMenuCode;
|
||||
}
|
||||
if (item.prop === "scopeColumn") {
|
||||
this.formScope.scopeColumn = column;
|
||||
}
|
||||
}
|
||||
if (item.prop === "scopeValue") {
|
||||
item.display = scopeType === 5;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 菜单管理模块
|
||||
rowSave(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.parentId = 0;
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.parentId = '';
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getMenu(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getLazyMenuList(this.parentId, Object.assign(params, this.query)).then(res => {
|
||||
this.data = res.data.data;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
},
|
||||
treeLoad(tree, treeNode, resolve) {
|
||||
const parentId = tree.id;
|
||||
getLazyMenuList(parentId).then(res => {
|
||||
resolve(res.data.data);
|
||||
});
|
||||
},
|
||||
// 数据权限模块
|
||||
handleDataScope(row) {
|
||||
this.drawerVisible = true;
|
||||
this.scopeMenuId = row.id;
|
||||
this.scopeMenuCode = row.code;
|
||||
this.scopeMenuName = row.name;
|
||||
this.onLoadScope(this.pageScope)
|
||||
},
|
||||
handleDrawerClose(hide) {
|
||||
hide();
|
||||
},
|
||||
rowSaveScope(row, done, loading) {
|
||||
row = {
|
||||
...row,
|
||||
menuId: this.scopeMenuId,
|
||||
};
|
||||
addDataScope(row).then(() => {
|
||||
this.onLoadScope(this.pageScope);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdateScope(row, index, done, loading) {
|
||||
row = {
|
||||
...row,
|
||||
menuId: this.scopeMenuId,
|
||||
};
|
||||
updateDataScope(row).then(() => {
|
||||
this.onLoadScope(this.pageScope);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDelScope(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return removeDataScope(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadScope(this.pageScope);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
handleDeleteScope() {
|
||||
if (this.selectionListScope.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return removeDataScope(this.scopeIds);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadScope(this.pageScope);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crudScope.toggleSelection();
|
||||
});
|
||||
},
|
||||
beforeOpenScope(done, type) {
|
||||
if (["add"].includes(type)) {
|
||||
this.watchMode = true;
|
||||
this.initScope();
|
||||
}
|
||||
if (["edit", "view"].includes(type)) {
|
||||
this.watchMode = false;
|
||||
getMenuDataScope(this.formScope.id).then(res => {
|
||||
this.formScope = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
searchResetScope() {
|
||||
this.onLoadScope(this.pageScope);
|
||||
},
|
||||
searchChangeScope(params, done) {
|
||||
this.onLoadScope(this.pageScope, params);
|
||||
done();
|
||||
},
|
||||
selectionChangeScope(list) {
|
||||
this.selectionListScope = list;
|
||||
},
|
||||
currentChangeScope(currentPage) {
|
||||
this.pageScope.currentPage = currentPage;
|
||||
},
|
||||
sizeChangeScope(pageSize) {
|
||||
this.pageScope.pageSize = pageSize;
|
||||
},
|
||||
onLoadScope(page, params = {}) {
|
||||
this.scopeLoading = true;
|
||||
const values = {
|
||||
...params,
|
||||
menuId: this.scopeMenuId,
|
||||
}
|
||||
getListDataScope(page.currentPage, page.pageSize, Object.assign(values, this.query)).then(res => {
|
||||
const data = res.data.data;
|
||||
this.pageScope.total = data.total;
|
||||
this.dataScope = data.records;
|
||||
this.selectionListScope = [];
|
||||
this.scopeLoading = false;
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -32,14 +32,27 @@
|
||||
</avue-crud>
|
||||
<el-dialog title="角色配置"
|
||||
:visible.sync="box"
|
||||
width="20%">
|
||||
<el-tree :data="list"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
ref="tree"
|
||||
:default-checked-keys="defaultObj"
|
||||
:props="props">
|
||||
</el-tree>
|
||||
width="345px">
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="菜单权限">
|
||||
<el-tree :data="menuGrantList"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
ref="treeMenu"
|
||||
:default-checked-keys="menuTreeObj"
|
||||
:props="props">
|
||||
</el-tree>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="数据权限">
|
||||
<el-tree :data="dataScopeGrantList"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
ref="treeDataScope"
|
||||
:default-checked-keys="dataScopeTreeObj"
|
||||
:props="props">
|
||||
</el-tree>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<span slot="footer"
|
||||
class="dialog-footer">
|
||||
<el-button @click="box = false">取 消</el-button>
|
||||
@ -64,8 +77,10 @@
|
||||
label: "title",
|
||||
value: "key"
|
||||
},
|
||||
list: [],
|
||||
defaultObj: [],
|
||||
menuGrantList: [],
|
||||
dataScopeGrantList: [],
|
||||
menuTreeObj: [],
|
||||
dataScopeTreeObj: [],
|
||||
selectionList: [],
|
||||
query: {},
|
||||
loading: true,
|
||||
@ -194,8 +209,9 @@
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
const menuLIst = this.$refs.tree.getCheckedKeys();
|
||||
grant(this.idsArray, menuLIst).then(() => {
|
||||
const menuList = this.$refs.treeMenu.getCheckedKeys();
|
||||
const dataScopeList = this.$refs.treeDataScope.getCheckedKeys();
|
||||
grant(this.idsArray, menuList, dataScopeList).then(() => {
|
||||
this.box = false;
|
||||
this.$message({
|
||||
type: "success",
|
||||
@ -203,6 +219,16 @@
|
||||
});
|
||||
this.onLoad(this.page);
|
||||
});
|
||||
|
||||
/*const menuLIst = this.$refs.tree.getCheckedKeys();
|
||||
grant(this.idsArray, menuLIst).then(() => {
|
||||
this.box = false;
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.onLoad(this.page);
|
||||
});*/
|
||||
},
|
||||
rowSave(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
@ -266,7 +292,21 @@
|
||||
this.$message.warning("只能选择一条数据");
|
||||
return;
|
||||
}
|
||||
this.defaultObj = [];
|
||||
this.menuTreeObj = [];
|
||||
this.dataScopeTreeObj = [];
|
||||
grantTree()
|
||||
.then(res => {
|
||||
this.menuGrantList = res.data.data.menu;
|
||||
this.dataScopeGrantList = res.data.data.dataScope;
|
||||
getRole(this.ids).then(res => {
|
||||
this.menuTreeObj = res.data.data.menu;
|
||||
this.dataScopeTreeObj = res.data.data.dataScope;
|
||||
this.box = true;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/*this.defaultObj = [];
|
||||
grantTree()
|
||||
.then(res => {
|
||||
this.list = res.data.data;
|
||||
@ -275,7 +315,7 @@
|
||||
.then(res => {
|
||||
this.defaultObj = res.data.data;
|
||||
this.box = true;
|
||||
});
|
||||
});*/
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
@ -3,10 +3,10 @@
|
||||
<basic-container>
|
||||
<third-register></third-register>
|
||||
<p style="text-align: center;">
|
||||
<img src="https://img.shields.io/badge/Release-V3.1.0-green.svg" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Release-V3.2.0-green.svg" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status"/>
|
||||
<img src="https://img.shields.io/badge/Spring%20Cloud-2020-blue.svg" alt="Coverage Status"/>
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.5.2.RELEASE-blue.svg" alt="Downloads"/>
|
||||
<img src="https://img.shields.io/badge/Spring%20Boot-2.5.6.RELEASE-blue.svg" alt="Downloads"/>
|
||||
<a target="_blank" href="https://bladex.vip">
|
||||
<img src="https://img.shields.io/badge/Saber%20Author-Small%20Chill-ff69b4.svg" alt="Downloads"/>
|
||||
</a>
|
||||
@ -125,6 +125,23 @@
|
||||
<el-row>
|
||||
<basic-container>
|
||||
<el-collapse v-model="logActiveNames" @change="handleChange">
|
||||
<el-collapse-item title="3.2.0发布 新增灵活数据权限特性" name="27">
|
||||
<div>1.升级 SpringBoot 至 2.5.6</div>
|
||||
<div>2.升级 SpringBootAdmin 至 2.5.3</div>
|
||||
<div>3.升级 SpringCloud 至 2020.0.4</div>
|
||||
<div>4.升级 Nacos 至 2.0.3</div>
|
||||
<div>5.升级 Knife4j 至 2.0.9</div>
|
||||
<div>6.升级 Mybatis-Plus 至 3.4.3.4</div>
|
||||
<div>7.新增注解配置数据权限特性</div>
|
||||
<div>8.新增Web在线配置数据权限特性</div>
|
||||
<div>9.新增自定义Sql配置数据权限特性</div>
|
||||
<div>10.新增懒加载表格树特性</div>
|
||||
<div>11.新增部门管理祖级节点字段</div>
|
||||
<div>12.新增CacheUtil工具类</div>
|
||||
<div>13.优化部门管理新增逻辑</div>
|
||||
<div>14.优化租户拦截器初始化逻辑</div>
|
||||
<div>15.优化适配各新版本API变动</div>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="3.1.0发布 底层架构升级适配" name="26">
|
||||
<div>1.升级 SpringBoot 至 2.5.2</div>
|
||||
<div>2.升级 SpringBootAdmin 至 2.4.2</div>
|
||||
@ -411,7 +428,7 @@
|
||||
data() {
|
||||
return {
|
||||
activeNames: ['1', '2', '3', '5'],
|
||||
logActiveNames: ['26']
|
||||
logActiveNames: ['27']
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
Loading…
Reference in New Issue
Block a user