功能变化: 菜单管理按钮配置优化
This commit is contained in:
@@ -2,15 +2,20 @@ import {CrudOptions, AddReq, DelReq, EditReq, dict, CrudExpose} from '@fast-crud
|
|||||||
import _ from 'lodash-es';
|
import _ from 'lodash-es';
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import {dictionary} from '/@/utils/dictionary';
|
import {dictionary} from '/@/utils/dictionary';
|
||||||
|
|
||||||
interface CreateCrudOptionsTypes {
|
interface CreateCrudOptionsTypes {
|
||||||
crudOptions: CrudOptions;
|
crudOptions: CrudOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
import {request} from '/@/utils/service';
|
import {request} from '/@/utils/service';
|
||||||
//此处为crudOptions配置
|
//此处为crudOptions配置
|
||||||
export const createCrudOptions = function ({crudExpose,selectOptions}: {crudExpose: CrudExpose,selectOptions:any}): CreateCrudOptionsTypes {
|
export const createCrudOptions = function ({
|
||||||
|
crudExpose,
|
||||||
|
selectOptions
|
||||||
|
}: { crudExpose: CrudExpose, selectOptions: any }): CreateCrudOptionsTypes {
|
||||||
|
|
||||||
const pageRequest = async (query: any) => {
|
const pageRequest = async (query: any) => {
|
||||||
return await api.GetList({...query,menu:selectOptions.value.id});
|
return await api.GetList({ menu: selectOptions.value.id});
|
||||||
};
|
};
|
||||||
const editRequest = async ({form, row}: EditReq) => {
|
const editRequest = async ({form, row}: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
@@ -86,10 +91,22 @@ export const createCrudOptions = function ({crudExpose,selectOptions}: {crudExpo
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
rules: [{required: true, message: '角色名称必填'}],
|
rules: [{required: true, message: '权限名称必填'}],
|
||||||
component: {
|
component: {
|
||||||
placeholder: '输入角色名称搜索',
|
placeholder: '输入权限名称搜索',
|
||||||
|
props: {
|
||||||
|
clearable: true,
|
||||||
|
allowCreate: true,
|
||||||
|
filterable: true,
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
helper: {
|
||||||
|
render (h) {
|
||||||
|
return (< el-alert title="可手动输入不在列表中的新值" type="warning" description="比较常用的建议放在字典管理中"/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
@@ -103,28 +120,37 @@ export const createCrudOptions = function ({crudExpose,selectOptions}: {crudExpo
|
|||||||
form: {
|
form: {
|
||||||
rules: [{required: true, message: '权限标识必填'}],
|
rules: [{required: true, message: '权限标识必填'}],
|
||||||
placeholder: '输入权限标识',
|
placeholder: '输入权限标识',
|
||||||
|
helper: {
|
||||||
|
render (h) {
|
||||||
|
return (< el-alert title="用于前端按钮权限的判断展示" type="warning" description="使用方法:vm.hasPermissions(权限值)"/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
method: {
|
method: {
|
||||||
title: '请求方式',
|
title: '请求方式',
|
||||||
search: {show: false},
|
search: {show: false},
|
||||||
type: 'dict-select',
|
type: 'dict-select',
|
||||||
column: {
|
column: {
|
||||||
width: 100,
|
width: 120,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
dict: dict({
|
dict: dict({
|
||||||
data: [
|
data: [
|
||||||
{label: 'GET', value: 0},
|
{label: 'GET', value: 0},
|
||||||
{label: 'POST', value: 1, color: 'success'},
|
{label: 'POST', value: 1, color: 'success'},
|
||||||
{ label: 'PUT', value: 2 },
|
{label: 'PUT', value: 2, color: 'warning'},
|
||||||
{label: 'DELETE', value: 3, color: 'danger'}
|
{label: 'DELETE', value: 3, color: 'danger'}
|
||||||
]
|
]
|
||||||
})
|
}),
|
||||||
|
form:{
|
||||||
|
rules: [{required: true, message: '必填项'}],
|
||||||
|
}
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
title: '接口地址',
|
title: '接口地址',
|
||||||
minWidth:200,
|
|
||||||
search: {show: false},
|
search: {show: false},
|
||||||
type: 'dict-select',
|
type: 'dict-select',
|
||||||
dict: dict({
|
dict: dict({
|
||||||
@@ -143,81 +169,26 @@ export const createCrudOptions = function ({crudExpose,selectOptions}: {crudExpo
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
column: {
|
column: {
|
||||||
width: 130,
|
minWidth: 200,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
value: false,
|
rules: [{required: true, message: '必填项'}],
|
||||||
},
|
|
||||||
},
|
|
||||||
status: {
|
|
||||||
title: '状态',
|
|
||||||
search: {show: true},
|
|
||||||
type: 'dict-radio',
|
|
||||||
dict: dict({
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
label: '启用',
|
|
||||||
value: true,
|
|
||||||
color: 'success',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '禁用',
|
|
||||||
value: false,
|
|
||||||
color: 'danger',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
column: {
|
|
||||||
width: 90,
|
|
||||||
sortable: true,
|
|
||||||
},
|
|
||||||
form: {
|
|
||||||
value: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
update_datetime: {
|
|
||||||
title: '更新时间',
|
|
||||||
type: 'text',
|
|
||||||
search: {show: false},
|
|
||||||
column: {
|
|
||||||
width: 170,
|
|
||||||
sortable: true,
|
|
||||||
},
|
|
||||||
form: {
|
|
||||||
show: false,
|
|
||||||
component:{
|
component:{
|
||||||
placeholder: '输入关键词搜索',
|
props:{
|
||||||
},
|
allowCreate: true,
|
||||||
},
|
filterable: true,
|
||||||
},
|
clearable: true
|
||||||
create_datetime: {
|
}
|
||||||
title: '创建时间',
|
|
||||||
type: 'text',
|
|
||||||
search: {show: false},
|
|
||||||
column: {
|
|
||||||
sortable: true,
|
|
||||||
width: 170,
|
|
||||||
},
|
|
||||||
form: {
|
|
||||||
show: false,
|
|
||||||
component: {
|
|
||||||
placeholder: '输入关键词搜索',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
description: {
|
|
||||||
title: '备注',
|
|
||||||
type: 'textarea',
|
|
||||||
search: {show: false},
|
|
||||||
form: {
|
|
||||||
component: {
|
|
||||||
maxlength: 200,
|
|
||||||
placeholder: '输入备注',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
helper: {
|
||||||
|
render (h) {
|
||||||
|
return (< el-alert title="请正确填写,以免请求时被拦截。匹配单例使用正则,例如:/api/xx/.*?/" type="warning" />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user