fix: 字典管理-配置:无搜索框问题(https://gitee.com/huge-dream/django-vue3-admin/issues/I6ZGNK)
This commit is contained in:
@@ -1,25 +1,34 @@
|
|||||||
import * as api from './api';
|
import * as api from './api';
|
||||||
import { dict, UserPageQuery, AddReq, DelReq, EditReq, CrudOptions, CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud';
|
import {
|
||||||
import { dictionary } from '/@/utils/dictionary';
|
dict,
|
||||||
|
UserPageQuery,
|
||||||
|
AddReq,
|
||||||
|
DelReq,
|
||||||
|
EditReq,
|
||||||
|
CrudOptions,
|
||||||
|
CreateCrudOptionsProps,
|
||||||
|
CreateCrudOptionsRet
|
||||||
|
} from '@fast-crud/fast-crud';
|
||||||
|
import {dictionary} from '/@/utils/dictionary';
|
||||||
|
|
||||||
export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
export const createCrudOptions = function ({crudExpose, context}: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query: UserPageQuery) => {
|
const pageRequest = async (query: UserPageQuery) => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }: EditReq) => {
|
const editRequest = async ({form, row}: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }: DelReq) => {
|
const delRequest = async ({row}: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
const addRequest = async ({ form }: AddReq) => {
|
const addRequest = async ({form}: AddReq) => {
|
||||||
const data = crudExpose.getSearchFormData()
|
const data = crudExpose.getSearchFormData()
|
||||||
const parent = data.parent
|
const parent = data.parent
|
||||||
form.parent = parent
|
form.parent = parent
|
||||||
if(parent){
|
if (parent) {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
}else{
|
} else {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +63,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
columns: {
|
columns: {
|
||||||
_index: {
|
_index: {
|
||||||
title: '序号',
|
title: '序号',
|
||||||
form: { show: false },
|
form: {show: false},
|
||||||
column: {
|
column: {
|
||||||
//type: 'index',
|
//type: 'index',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
@@ -72,7 +81,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
label: {
|
label: {
|
||||||
title: '名称',
|
title: '名称',
|
||||||
search: {
|
search: {
|
||||||
disabled: false,
|
show: true,
|
||||||
component: {
|
component: {
|
||||||
props: {
|
props: {
|
||||||
clearable: true,
|
clearable: true,
|
||||||
@@ -83,7 +92,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
form: {
|
form: {
|
||||||
rules: [
|
rules: [
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
{ required: true, message: '名称必填项' },
|
{required: true, message: '名称必填项'},
|
||||||
],
|
],
|
||||||
component: {
|
component: {
|
||||||
props: {
|
props: {
|
||||||
@@ -107,20 +116,20 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
show: false,
|
show: false,
|
||||||
dict: dict({
|
dict: dict({
|
||||||
data: [
|
data: [
|
||||||
{ label: 'text', value: 0 },
|
{label: 'text', value: 0},
|
||||||
{ label: 'number', value: 1 },
|
{label: 'number', value: 1},
|
||||||
{ label: 'date', value: 2 },
|
{label: 'date', value: 2},
|
||||||
{ label: 'datetime', value: 3 },
|
{label: 'datetime', value: 3},
|
||||||
{ label: 'time', value: 4 },
|
{label: 'time', value: 4},
|
||||||
{ label: 'file', value: 5 },
|
{label: 'file', value: 5},
|
||||||
{ label: 'boolean', value: 6 },
|
{label: 'boolean', value: 6},
|
||||||
{ label: 'images', value: 7 },
|
{label: 'images', value: 7},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
form: {
|
form: {
|
||||||
rules: [
|
rules: [
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
{ required: true, message: '数据值类型必填项' },
|
{required: true, message: '数据值类型必填项'},
|
||||||
],
|
],
|
||||||
value: 0,
|
value: 0,
|
||||||
component: {
|
component: {
|
||||||
@@ -183,7 +192,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
value: {
|
value: {
|
||||||
title: '数据值',
|
title: '数据值',
|
||||||
search: {
|
search: {
|
||||||
disabled: true,
|
show: true,
|
||||||
component: {
|
component: {
|
||||||
props: {
|
props: {
|
||||||
clearable: true,
|
clearable: true,
|
||||||
@@ -191,7 +200,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
view: {
|
view: {
|
||||||
component: { props: { height: 100, width: 100 } },
|
component: {props: {height: 100, width: 100}},
|
||||||
},
|
},
|
||||||
/* // 提交时,处理数据
|
/* // 提交时,处理数据
|
||||||
valueResolve(row: any, col: any) {
|
valueResolve(row: any, col: any) {
|
||||||
@@ -229,7 +238,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
form: {
|
form: {
|
||||||
rules: [
|
rules: [
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
{ required: true, message: '数据值必填项' },
|
{required: true, message: '数据值必填项'},
|
||||||
],
|
],
|
||||||
component: {
|
component: {
|
||||||
props: {
|
props: {
|
||||||
@@ -243,7 +252,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
title: '状态',
|
title: '状态',
|
||||||
width: 80,
|
width: 80,
|
||||||
search: {
|
search: {
|
||||||
disabled: false,
|
show: true
|
||||||
},
|
},
|
||||||
type: 'dict-radio',
|
type: 'dict-radio',
|
||||||
dict: dict({
|
dict: dict({
|
||||||
@@ -253,7 +262,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
value: true,
|
value: true,
|
||||||
rules: [
|
rules: [
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
{ required: true, message: '状态必填项' },
|
{required: true, message: '状态必填项'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -266,7 +275,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
component: {},
|
component: {},
|
||||||
rules: [
|
rules: [
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
{ required: true, message: '排序必填项' },
|
{required: true, message: '排序必填项'},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -279,11 +288,11 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
type: 'dict-select',
|
type: 'dict-select',
|
||||||
dict: dict({
|
dict: dict({
|
||||||
data: [
|
data: [
|
||||||
{ label: 'success', value: 'success', color: 'success' },
|
{label: 'success', value: 'success', color: 'success'},
|
||||||
{ label: 'primary', value: 'primary', color: 'primary' },
|
{label: 'primary', value: 'primary', color: 'primary'},
|
||||||
{ label: 'info', value: 'info', color: 'info' },
|
{label: 'info', value: 'info', color: 'info'},
|
||||||
{ label: 'danger', value: 'danger', color: 'danger' },
|
{label: 'danger', value: 'danger', color: 'danger'},
|
||||||
{ label: 'warning', value: 'warning', color: 'warning' },
|
{label: 'warning', value: 'warning', color: 'warning'},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
form: {
|
form: {
|
||||||
|
|||||||
Reference in New Issue
Block a user