新功能: 角色授权页面,获取菜单

This commit is contained in:
猿小天
2023-02-03 20:58:00 +08:00
parent 2e94c88b63
commit 896398ac03
3 changed files with 270 additions and 256 deletions

View File

@@ -33,8 +33,8 @@ class MenuSerializer(CustomModelSerializer):
def get_hasChild(self, instance):
hasChild = Menu.objects.filter(parent=instance.id)
if hasChild:
return True
return False
return True
class Meta:
model = Menu

View File

@@ -43,7 +43,7 @@ function createService() {
//如果不需要解包
return dataAxios;
}
return dataAxios.data;
return dataAxios;
default:
// 不是正确的 code
errorCreate(`${dataAxios.msg}: ${response.config.url}`);

View File

@@ -1,12 +1,11 @@
import {CrudOptions, AddReq, DelReq, EditReq, dict,CrudExpose } from '@fast-crud/fast-crud';
import {CrudOptions, AddReq, DelReq, EditReq, dict, CrudExpose} from '@fast-crud/fast-crud';
import _ from 'lodash-es';
interface CreateCrudOptionsTypes {
crudOptions: CrudOptions;
}
//此处为crudOptions配置
export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose}): CreateCrudOptionsTypes {
export const createCrudOptions = function ({crudExpose,rolePermission}: {crudExpose: CrudExpose,rolePermission:any}): CreateCrudOptionsTypes {
//本地模拟后台crud接口方法 ----开始
const records = [
{
@@ -64,6 +63,8 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
return req.form;
};
//本地模拟后台crud接口方法 ----结束
return {
crudOptions: {
request: {
@@ -73,10 +74,23 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
delRequest,
},
rowHandle: {
buttons: {},
buttons: {
custom: {
text: "权限配置",
type:'warning',
tooltip: {
placement: "top",
content: "删除"
},
click: () => {
rolePermission.value.drawer=true
rolePermission.value.initGet()
}
}
},
},
form: {
col: { span: 24 },
col: {span: 24},
labelWidth: '100px',
wrapper: {
is: 'el-dialog',
@@ -86,7 +100,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
columns: {
_index: {
title: '序号',
form: { show: false },
form: {show: false},
column: {
//type: 'index',
align: 'center',
@@ -102,9 +116,9 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
},
search: {
title: '关键词',
column: { show: false },
column: {show: false},
type: 'text',
search: { show: true },
search: {show: true},
form: {
show: false,
component: {
@@ -115,20 +129,20 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
id: {
title: 'ID',
type: 'text',
column: { show: false },
search: { show: false },
form: { show: false },
column: {show: false},
search: {show: false},
form: {show: false},
},
name: {
title: '角色名称',
type: 'text',
search: { show: true },
search: {show: true},
column: {
minWidth: 120,
sortable: true,
},
form: {
rules: [{ required: true, message: '角色名称必填' }],
rules: [{required: true, message: '角色名称必填'}],
component: {
placeholder: '输入角色名称搜索',
},
@@ -137,19 +151,19 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
key: {
title: '权限标识',
type: 'text',
search: { show: false },
search: {show: false},
column: {
width: 120,
sortable: true,
},
form: {
rules: [{ required: true, message: '权限标识必填' }],
rules: [{required: true, message: '权限标识必填'}],
placeholder: '输入权限标识',
},
},
sort: {
title: '排序',
search: { show: false },
search: {show: false},
type: 'number',
column: {
width: 90,
@@ -161,7 +175,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
},
admin: {
title: '是否管理员',
search: { show: false },
search: {show: false},
type: 'dict-radio',
dict: dict({
data: [
@@ -187,7 +201,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
},
status: {
title: '状态',
search: { show: true },
search: {show: true},
type: 'dict-radio',
dict: dict({
data: [
@@ -214,7 +228,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
update_datetime: {
title: '更新时间',
type: 'text',
search: { show: false },
search: {show: false},
column: {
width: 170,
sortable: true,
@@ -229,7 +243,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
create_datetime: {
title: '创建时间',
type: 'text',
search: { show: false },
search: {show: false},
column: {
sortable: true,
width: 170,
@@ -245,7 +259,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
description: {
title: '备注',
type: 'textarea',
search: { show: false },
search: {show: false},
form: {
component: {
maxlength: 200,