feat: 优化 dict
This commit is contained in:
@@ -5,7 +5,7 @@ import { ref } from 'vue';
|
||||
|
||||
import { Form, Input, Select } from 'ant-design-vue';
|
||||
|
||||
import { DICT_TYPE, getIntDictOptions } from '#/utils';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
||||
|
||||
// 创建本地数据副本
|
||||
const modelData = defineModel<any>();
|
||||
@@ -57,7 +57,7 @@ defineExpose({ validate });
|
||||
placeholder="请选择状态"
|
||||
>
|
||||
<Select.Option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS, 'number')"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
>
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Button, message, Textarea } from 'ant-design-vue';
|
||||
import {
|
||||
AiWriteTypeEnum,
|
||||
DICT_TYPE,
|
||||
getIntDictOptions,
|
||||
getDictOptions,
|
||||
WriteExample,
|
||||
} from '#/utils';
|
||||
|
||||
@@ -211,22 +211,22 @@ function submit() {
|
||||
<ReuseLabel label="长度" />
|
||||
<Tag
|
||||
v-model="formData.length"
|
||||
:tags="getIntDictOptions(DICT_TYPE.AI_WRITE_LENGTH)"
|
||||
:tags="getDictOptions(DICT_TYPE.AI_WRITE_LENGTH, 'number')"
|
||||
/>
|
||||
<ReuseLabel label="格式" />
|
||||
<Tag
|
||||
v-model="formData.format"
|
||||
:tags="getIntDictOptions(DICT_TYPE.AI_WRITE_FORMAT)"
|
||||
:tags="getDictOptions(DICT_TYPE.AI_WRITE_FORMAT, 'number')"
|
||||
/>
|
||||
<ReuseLabel label="语气" />
|
||||
<Tag
|
||||
v-model="formData.tone"
|
||||
:tags="getIntDictOptions(DICT_TYPE.AI_WRITE_TONE)"
|
||||
:tags="getDictOptions(DICT_TYPE.AI_WRITE_TONE, 'number')"
|
||||
/>
|
||||
<ReuseLabel label="语言" />
|
||||
<Tag
|
||||
v-model="formData.language"
|
||||
:tags="getIntDictOptions(DICT_TYPE.AI_WRITE_LANGUAGE)"
|
||||
:tags="getDictOptions(DICT_TYPE.AI_WRITE_LANGUAGE, 'number')"
|
||||
/>
|
||||
|
||||
<div class="mt-3 flex items-center justify-center">
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
|
||||
import { DeptSelectModal, UserSelectModal } from '#/components/select-modal';
|
||||
import { ImageUpload } from '#/components/upload';
|
||||
import { DICT_TYPE, getBoolDictOptions, getIntDictOptions } from '#/utils';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
||||
|
||||
const props = defineProps({
|
||||
categoryList: {
|
||||
@@ -295,7 +295,7 @@ defineExpose({ validate });
|
||||
<Radio.Group v-model:value="modelData.type">
|
||||
<!-- TODO BPMN 流程类型需要整合,暂时禁用 -->
|
||||
<Radio
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.BPM_MODEL_TYPE)"
|
||||
v-for="dict in getDictOptions(DICT_TYPE.BPM_MODEL_TYPE, 'number')"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
:disabled="dict.value === 10"
|
||||
@@ -307,10 +307,11 @@ defineExpose({ validate });
|
||||
<Form.Item label="是否可见" name="visible" class="mb-5">
|
||||
<Radio.Group v-model:value="modelData.visible">
|
||||
<Radio
|
||||
v-for="(dict, index) in getBoolDictOptions(
|
||||
v-for="dict in getDictOptions(
|
||||
DICT_TYPE.INFRA_BOOLEAN_STRING,
|
||||
'boolean',
|
||||
)"
|
||||
:key="index"
|
||||
:key="dict.label"
|
||||
:value="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
|
||||
@@ -139,8 +139,6 @@ const quickNavItems: WorkbenchQuickNavItem[] = [
|
||||
];
|
||||
|
||||
const router = useRouter();
|
||||
// 这是一个示例方法,实际项目中需要根据实际情况进行调整
|
||||
// This is a sample method, adjust according to the actual project requirements
|
||||
function navTo(nav: WorkbenchProjectItem | WorkbenchQuickNavItem) {
|
||||
if (nav.url?.startsWith('http')) {
|
||||
openWindow(nav.url);
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeGridPropTypes } from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
DICT_TYPE,
|
||||
getDictOptions,
|
||||
getIntDictOptions,
|
||||
getRangePickerDefaultProps,
|
||||
} from '#/utils';
|
||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
@@ -72,7 +67,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择状态',
|
||||
options: getIntDictOptions(DICT_TYPE.COMMON_STATUS),
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeGridPropTypes } from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
DICT_TYPE,
|
||||
getDictOptions,
|
||||
getIntDictOptions,
|
||||
getRangePickerDefaultProps,
|
||||
} from '#/utils';
|
||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
@@ -99,7 +94,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择状态',
|
||||
options: getIntDictOptions(DICT_TYPE.COMMON_STATUS),
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { MallSeckillConfigApi } from '#/api/mall/promotion/seckill/seckillConfig';
|
||||
|
||||
import { DICT_TYPE, getDictOptions, getIntDictOptions } from '#/utils';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
@@ -83,7 +83,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择状态',
|
||||
options: getIntDictOptions(DICT_TYPE.COMMON_STATUS),
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -2,12 +2,7 @@ import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { getAppList } from '#/api/pay/app';
|
||||
import {
|
||||
DICT_TYPE,
|
||||
getIntDictOptions,
|
||||
getRangePickerDefaultProps,
|
||||
getStrDictOptions,
|
||||
} from '#/utils';
|
||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
@@ -34,7 +29,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getStrDictOptions(DICT_TYPE.PAY_CHANNEL_CODE),
|
||||
options: getDictOptions(DICT_TYPE.PAY_CHANNEL_CODE, 'string'),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -63,7 +58,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getIntDictOptions(DICT_TYPE.PAY_REFUND_STATUS),
|
||||
options: getDictOptions(DICT_TYPE.PAY_REFUND_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user