新功能: 角色授权页面,获取菜单
This commit is contained in:
@@ -33,8 +33,8 @@ class MenuSerializer(CustomModelSerializer):
|
|||||||
def get_hasChild(self, instance):
|
def get_hasChild(self, instance):
|
||||||
hasChild = Menu.objects.filter(parent=instance.id)
|
hasChild = Menu.objects.filter(parent=instance.id)
|
||||||
if hasChild:
|
if hasChild:
|
||||||
return True
|
|
||||||
return False
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Menu
|
model = Menu
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ function createService() {
|
|||||||
//如果不需要解包
|
//如果不需要解包
|
||||||
return dataAxios;
|
return dataAxios;
|
||||||
}
|
}
|
||||||
return dataAxios.data;
|
return dataAxios;
|
||||||
default:
|
default:
|
||||||
// 不是正确的 code
|
// 不是正确的 code
|
||||||
errorCreate(`${dataAxios.msg}: ${response.config.url}`);
|
errorCreate(`${dataAxios.msg}: ${response.config.url}`);
|
||||||
|
|||||||
@@ -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';
|
import _ from 'lodash-es';
|
||||||
|
|
||||||
interface CreateCrudOptionsTypes {
|
interface CreateCrudOptionsTypes {
|
||||||
crudOptions: CrudOptions;
|
crudOptions: CrudOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
//此处为crudOptions配置
|
//此处为crudOptions配置
|
||||||
export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose}): CreateCrudOptionsTypes {
|
export const createCrudOptions = function ({crudExpose,rolePermission}: {crudExpose: CrudExpose,rolePermission:any}): CreateCrudOptionsTypes {
|
||||||
//本地模拟后台crud接口方法 ----开始
|
//本地模拟后台crud接口方法 ----开始
|
||||||
const records = [
|
const records = [
|
||||||
{
|
{
|
||||||
@@ -64,6 +63,8 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
return req.form;
|
return req.form;
|
||||||
};
|
};
|
||||||
//本地模拟后台crud接口方法 ----结束
|
//本地模拟后台crud接口方法 ----结束
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
request: {
|
request: {
|
||||||
@@ -73,10 +74,23 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
delRequest,
|
delRequest,
|
||||||
},
|
},
|
||||||
rowHandle: {
|
rowHandle: {
|
||||||
buttons: {},
|
buttons: {
|
||||||
|
custom: {
|
||||||
|
text: "权限配置",
|
||||||
|
type:'warning',
|
||||||
|
tooltip: {
|
||||||
|
placement: "top",
|
||||||
|
content: "删除"
|
||||||
|
},
|
||||||
|
click: () => {
|
||||||
|
rolePermission.value.drawer=true
|
||||||
|
rolePermission.value.initGet()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
col: { span: 24 },
|
col: {span: 24},
|
||||||
labelWidth: '100px',
|
labelWidth: '100px',
|
||||||
wrapper: {
|
wrapper: {
|
||||||
is: 'el-dialog',
|
is: 'el-dialog',
|
||||||
@@ -86,7 +100,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
columns: {
|
columns: {
|
||||||
_index: {
|
_index: {
|
||||||
title: '序号',
|
title: '序号',
|
||||||
form: { show: false },
|
form: {show: false},
|
||||||
column: {
|
column: {
|
||||||
//type: 'index',
|
//type: 'index',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
@@ -102,9 +116,9 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
title: '关键词',
|
title: '关键词',
|
||||||
column: { show: false },
|
column: {show: false},
|
||||||
type: 'text',
|
type: 'text',
|
||||||
search: { show: true },
|
search: {show: true},
|
||||||
form: {
|
form: {
|
||||||
show: false,
|
show: false,
|
||||||
component: {
|
component: {
|
||||||
@@ -115,20 +129,20 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
id: {
|
id: {
|
||||||
title: 'ID',
|
title: 'ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
column: { show: false },
|
column: {show: false},
|
||||||
search: { show: false },
|
search: {show: false},
|
||||||
form: { show: false },
|
form: {show: false},
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
title: '角色名称',
|
title: '角色名称',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
search: { show: true },
|
search: {show: true},
|
||||||
column: {
|
column: {
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
rules: [{ required: true, message: '角色名称必填' }],
|
rules: [{required: true, message: '角色名称必填'}],
|
||||||
component: {
|
component: {
|
||||||
placeholder: '输入角色名称搜索',
|
placeholder: '输入角色名称搜索',
|
||||||
},
|
},
|
||||||
@@ -137,19 +151,19 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
key: {
|
key: {
|
||||||
title: '权限标识',
|
title: '权限标识',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
search: { show: false },
|
search: {show: false},
|
||||||
column: {
|
column: {
|
||||||
width: 120,
|
width: 120,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
rules: [{ required: true, message: '权限标识必填' }],
|
rules: [{required: true, message: '权限标识必填'}],
|
||||||
placeholder: '输入权限标识',
|
placeholder: '输入权限标识',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sort: {
|
sort: {
|
||||||
title: '排序',
|
title: '排序',
|
||||||
search: { show: false },
|
search: {show: false},
|
||||||
type: 'number',
|
type: 'number',
|
||||||
column: {
|
column: {
|
||||||
width: 90,
|
width: 90,
|
||||||
@@ -161,7 +175,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
title: '是否管理员',
|
title: '是否管理员',
|
||||||
search: { show: false },
|
search: {show: false},
|
||||||
type: 'dict-radio',
|
type: 'dict-radio',
|
||||||
dict: dict({
|
dict: dict({
|
||||||
data: [
|
data: [
|
||||||
@@ -187,7 +201,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
title: '状态',
|
title: '状态',
|
||||||
search: { show: true },
|
search: {show: true},
|
||||||
type: 'dict-radio',
|
type: 'dict-radio',
|
||||||
dict: dict({
|
dict: dict({
|
||||||
data: [
|
data: [
|
||||||
@@ -214,7 +228,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
update_datetime: {
|
update_datetime: {
|
||||||
title: '更新时间',
|
title: '更新时间',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
search: { show: false },
|
search: {show: false},
|
||||||
column: {
|
column: {
|
||||||
width: 170,
|
width: 170,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
@@ -229,7 +243,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
create_datetime: {
|
create_datetime: {
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
search: { show: false },
|
search: {show: false},
|
||||||
column: {
|
column: {
|
||||||
sortable: true,
|
sortable: true,
|
||||||
width: 170,
|
width: 170,
|
||||||
@@ -245,7 +259,7 @@ export const createCrudOptions = function ({crudExpose}: {crudExpose: CrudExpose
|
|||||||
description: {
|
description: {
|
||||||
title: '备注',
|
title: '备注',
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
search: { show: false },
|
search: {show: false},
|
||||||
form: {
|
form: {
|
||||||
component: {
|
component: {
|
||||||
maxlength: 200,
|
maxlength: 200,
|
||||||
|
|||||||
Reference in New Issue
Block a user