修复字典管理新增值时is_value错误的bug

This commit is contained in:
阿辉
2024-12-17 10:58:13 +08:00
parent a36dcfa1e5
commit 15c87ddd26
3 changed files with 313 additions and 303 deletions

View File

@@ -308,7 +308,7 @@ class ExportSerializerMixin:
async_export_data.delay( async_export_data.delay(
data, data,
str(f"导出{get_verbose_name(queryset)}-{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}.xlsx"), str(f"导出{get_verbose_name(queryset)}-{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}.xlsx"),
DownloadCenter.objects.create(creator=request.user, task_name=f'{get_verbose_name(queryset)}数据导出任务', dept_belong_id=request.user.dept).pk, DownloadCenter.objects.create(creator=request.user, task_name=f'{get_verbose_name(queryset)}数据导出任务', dept_belong_id=request.user.dept_id).pk,
self.export_field_label self.export_field_label
) )
return SuccessResponse(msg="导入任务已创建,请前往‘下载中心’等待下载") return SuccessResponse(msg="导入任务已创建,请前往‘下载中心’等待下载")

View File

@@ -4,7 +4,7 @@ import { DictionaryStore } from '/@/stores/dictionary';
/** /**
* @method 获取指定name字典 * @method 获取指定name字典
*/ */
export const dictionary = (name: string,key:string|number|undefined) => { export const dictionary = (name: string,key?:string|number|undefined) => {
const dict = DictionaryStore() const dict = DictionaryStore()
const dictionary = toRaw(dict.data) const dictionary = toRaw(dict.data)
if(key!=undefined){ if(key!=undefined){

View File

@@ -9,20 +9,20 @@ import {
CreateCrudOptionsProps, CreateCrudOptionsProps,
CreateCrudOptionsRet CreateCrudOptionsRet
} from '@fast-crud/fast-crud'; } from '@fast-crud/fast-crud';
import {dictionary} from '/@/utils/dictionary'; 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
@@ -63,7 +63,7 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
columns: { columns: {
_index: { _index: {
title: '序号', title: '序号',
form: {show: false}, form: { show: false },
column: { column: {
//type: 'index', //type: 'index',
align: 'center', align: 'center',
@@ -92,7 +92,7 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
form: { form: {
rules: [ rules: [
// 表单校验规则 // 表单校验规则
{required: true, message: '名称必填项'}, { required: true, message: '名称必填项' },
], ],
component: { component: {
props: { props: {
@@ -116,20 +116,20 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
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: {
@@ -200,7 +200,7 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
}, },
}, },
view: { view: {
component: {props: {height: 100, width: 100}}, component: { props: { height: 100, width: 100 } },
}, },
/* // 提交时,处理数据 /* // 提交时,处理数据
valueResolve(row: any, col: any) { valueResolve(row: any, col: any) {
@@ -238,7 +238,7 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
form: { form: {
rules: [ rules: [
// 表单校验规则 // 表单校验规则
{required: true, message: '数据值必填项'}, { required: true, message: '数据值必填项' },
], ],
component: { component: {
props: { props: {
@@ -262,7 +262,7 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
value: true, value: true,
rules: [ rules: [
// 表单校验规则 // 表单校验规则
{required: true, message: '状态必填项'}, { required: true, message: '状态必填项' },
], ],
}, },
}, },
@@ -275,7 +275,7 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
component: {}, component: {},
rules: [ rules: [
// 表单校验规则 // 表单校验规则
{required: true, message: '排序必填项'}, { required: true, message: '排序必填项' },
], ],
}, },
}, },
@@ -288,11 +288,11 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
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: {
@@ -303,6 +303,16 @@ export const createCrudOptions = function ({crudExpose, context}: CreateCrudOpti
}, },
}, },
}, },
is_value: {
title: '是否值',
column: {
show: false
},
form: {
show: false,
value: true
}
}
}, },
}, },
}; };