| | |
| | | |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <ElButton @click="handleCancel">取消</ElButton> |
| | | <ElButton type="primary" @click="handleSubmit">确定</ElButton> |
| | | <ElButton @click="handleCancel">{{ t('common.cancel') }}</ElButton> |
| | | <ElButton type="primary" @click="handleSubmit">{{ t('common.confirm') }}</ElButton> |
| | | </span> |
| | | </template> |
| | | </ElDialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { useI18n } from 'vue-i18n' |
| | | import ArtForm from '@/components/core/forms/art-form/index.vue' |
| | | import { buildDictTypeDialogModel, createDictTypeFormState } from '../dictTypePage.helpers' |
| | | |
| | |
| | | const emit = defineEmits(['update:visible', 'submit']) |
| | | const formRef = ref() |
| | | const form = reactive(createDictTypeFormState()) |
| | | const { t } = useI18n() |
| | | |
| | | const isEdit = computed(() => Boolean(form.id)) |
| | | const dialogTitle = computed(() => (isEdit.value ? '编辑数据字典' : '新增数据字典')) |
| | | const dialogTitle = computed(() => |
| | | isEdit.value ? t('pages.system.dictType.dialog.titleEdit') : t('pages.system.dictType.dialog.titleCreate') |
| | | ) |
| | | |
| | | const rules = computed(() => ({ |
| | | code: [{ required: true, message: '请输入字典编码', trigger: 'blur' }], |
| | | name: [{ required: true, message: '请输入字典名称', trigger: 'blur' }] |
| | | code: [{ required: true, message: t('pages.system.dictType.validation.code'), trigger: 'blur' }], |
| | | name: [{ required: true, message: t('pages.system.dictType.validation.name'), trigger: 'blur' }] |
| | | })) |
| | | |
| | | const formItems = computed(() => [ |
| | | { |
| | | label: '编码', |
| | | label: t('table.code'), |
| | | key: 'code', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入字典编码' |
| | | placeholder: t('pages.system.dictType.placeholders.code') |
| | | } |
| | | }, |
| | | { |
| | | label: '名称', |
| | | label: t('table.name'), |
| | | key: 'name', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入字典名称' |
| | | placeholder: t('pages.system.dictType.placeholders.name') |
| | | } |
| | | }, |
| | | { |
| | | label: '状态', |
| | | label: t('table.status'), |
| | | key: 'status', |
| | | type: 'select', |
| | | props: { |
| | | options: [ |
| | | { label: '正常', value: 1 }, |
| | | { label: '冻结', value: 0 } |
| | | { label: t('common.status.normal'), value: 1 }, |
| | | { label: t('common.status.frozen'), value: 0 } |
| | | ], |
| | | placeholder: '请选择状态' |
| | | placeholder: t('pages.system.dictType.placeholders.status') |
| | | } |
| | | }, |
| | | { |
| | | label: '描述', |
| | | label: t('pages.system.dictType.table.description'), |
| | | key: 'description', |
| | | type: 'input', |
| | | span: 24, |
| | | props: { |
| | | type: 'textarea', |
| | | rows: 3, |
| | | placeholder: '请输入字典描述' |
| | | placeholder: t('pages.system.dictType.placeholders.description') |
| | | } |
| | | }, |
| | | { |
| | | label: '备注', |
| | | label: t('table.memo'), |
| | | key: 'memo', |
| | | type: 'input', |
| | | span: 24, |
| | | props: { |
| | | type: 'textarea', |
| | | rows: 3, |
| | | placeholder: '请输入备注' |
| | | placeholder: t('pages.system.dictType.placeholders.memo') |
| | | } |
| | | } |
| | | ]) |