fix: disabled
parent
ac62d805c6
commit
4e1d6812ff
|
@ -1,13 +1,12 @@
|
||||||
import type { OnActionClickFn } from '#/adapter/vxe-table';
|
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
|
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import { getDictOptions } from '#/utils/dict';
|
|
||||||
import { DICT_TYPE } from '#/utils/dict';
|
|
||||||
import { useAccess } from '@vben/access';
|
import { useAccess } from '@vben/access';
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
import { CommonStatusEnum } from '#/utils/constants';
|
|
||||||
import { getSimpleDictTypeList } from '#/api/system/dict/type';
|
import { getSimpleDictTypeList } from '#/api/system/dict/type';
|
||||||
|
import { CommonStatusEnum } from '#/utils/constants';
|
||||||
|
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
const { hasAccessByCodes } = useAccess();
|
||||||
|
|
||||||
|
@ -44,10 +43,8 @@ export function useTypeFormSchema(): VbenFormSchema[] {
|
||||||
// TODO @芋艿:disable 不生效
|
// TODO @芋艿:disable 不生效
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: [''],
|
triggerFields: [''],
|
||||||
componentProps: {
|
disabled: ({ values }) => values.id,
|
||||||
disabled: ({ values }) => values.id,
|
},
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'status',
|
fieldName: 'status',
|
||||||
|
@ -81,7 +78,7 @@ export function useTypeGridFormSchema(): VbenFormSchema[] {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入字典名称',
|
placeholder: '请输入字典名称',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'status',
|
fieldName: 'status',
|
||||||
|
@ -104,18 +101,18 @@ export function useTypeGridColumns<T = any>(
|
||||||
{
|
{
|
||||||
field: 'id',
|
field: 'id',
|
||||||
title: '字典编号',
|
title: '字典编号',
|
||||||
minWidth: 100
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
title: '字典名称',
|
title: '字典名称',
|
||||||
minWidth: 180
|
minWidth: 180,
|
||||||
},
|
},
|
||||||
// TODO @芋艿:disable的;
|
// TODO @芋艿:disable的;
|
||||||
{
|
{
|
||||||
field: 'type',
|
field: 'type',
|
||||||
title: '字典类型',
|
title: '字典类型',
|
||||||
minWidth: 220
|
minWidth: 220,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
|
@ -124,12 +121,12 @@ export function useTypeGridColumns<T = any>(
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellDict',
|
name: 'CellDict',
|
||||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'remark',
|
field: 'remark',
|
||||||
title: '备注',
|
title: '备注',
|
||||||
minWidth: 180
|
minWidth: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
|
@ -202,21 +199,20 @@ export function useDataFormSchema(): VbenFormSchema[] {
|
||||||
fieldName: 'dictType',
|
fieldName: 'dictType',
|
||||||
label: '字典类型',
|
label: '字典类型',
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: (values) => {
|
||||||
api: getSimpleDictTypeList,
|
return {
|
||||||
placeholder: '请输入字典类型',
|
api: getSimpleDictTypeList,
|
||||||
class: 'w-full',
|
placeholder: '请输入字典类型',
|
||||||
labelField: 'name',
|
class: 'w-full',
|
||||||
valueField: 'type',
|
labelField: 'name',
|
||||||
|
valueField: 'type',
|
||||||
|
disabled: !!values.id,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
// TODO @芋艿:disable 不生效
|
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: [''],
|
triggerFields: [''],
|
||||||
componentProps: {
|
},
|
||||||
disabled: ({ values }) => values.id,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'label',
|
fieldName: 'label',
|
||||||
|
@ -242,7 +238,7 @@ export function useDataFormSchema(): VbenFormSchema[] {
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入显示排序',
|
placeholder: '请输入显示排序',
|
||||||
class: 'w-full'
|
class: 'w-full',
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
|
@ -253,7 +249,7 @@ export function useDataFormSchema(): VbenFormSchema[] {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||||
placeholder: '请选择状态',
|
placeholder: '请选择状态',
|
||||||
buttonStyle:'solid',
|
buttonStyle: 'solid',
|
||||||
optionType: 'button',
|
optionType: 'button',
|
||||||
},
|
},
|
||||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||||
|
@ -298,7 +294,7 @@ export function useDataGridFormSchema(): VbenFormSchema[] {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请输入字典标签',
|
placeholder: '请输入字典标签',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'status',
|
fieldName: 'status',
|
||||||
|
@ -323,22 +319,22 @@ export function useDataGridColumns<T = any>(
|
||||||
{
|
{
|
||||||
field: 'id',
|
field: 'id',
|
||||||
title: '字典编码',
|
title: '字典编码',
|
||||||
minWidth: 100
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'label',
|
field: 'label',
|
||||||
title: '字典标签',
|
title: '字典标签',
|
||||||
minWidth: 180
|
minWidth: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'value',
|
field: 'value',
|
||||||
title: '字典键值',
|
title: '字典键值',
|
||||||
minWidth: 100
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'sort',
|
field: 'sort',
|
||||||
title: '字典排序',
|
title: '字典排序',
|
||||||
minWidth: 100
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
|
@ -347,17 +343,17 @@ export function useDataGridColumns<T = any>(
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellDict',
|
name: 'CellDict',
|
||||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'colorType',
|
field: 'colorType',
|
||||||
title: '颜色类型',
|
title: '颜色类型',
|
||||||
minWidth: 120
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'cssClass',
|
field: 'cssClass',
|
||||||
title: 'CSS Class',
|
title: 'CSS Class',
|
||||||
minWidth: 120
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
|
|
Loading…
Reference in New Issue