| | |
| | | |
| | | <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> |
| | |
| | | |
| | | <script setup> |
| | | import ArtForm from '@/components/core/forms/art-form/index.vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { buildConfigDialogModel, createConfigFormState, getConfigTypeOptions } from '../configPage.helpers' |
| | | |
| | | const props = defineProps({ |
| | |
| | | }) |
| | | |
| | | const emit = defineEmits(['update:visible', 'submit']) |
| | | const { t } = useI18n() |
| | | const formRef = ref() |
| | | const form = reactive(createConfigFormState()) |
| | | |
| | | const isEdit = computed(() => Boolean(form.id)) |
| | | const dialogTitle = computed(() => (isEdit.value ? '编辑配置' : '新增配置')) |
| | | const dialogTitle = computed(() => |
| | | isEdit.value ? t('pages.system.config.dialog.titleEdit') : t('pages.system.config.dialog.titleCreate') |
| | | ) |
| | | |
| | | const rules = computed(() => ({ |
| | | name: [{ required: true, message: '请输入配置名称', trigger: 'blur' }], |
| | | flag: [{ required: true, message: '请输入配置标识', trigger: 'blur' }] |
| | | name: [{ required: true, message: t('pages.system.config.validation.name'), trigger: 'blur' }], |
| | | flag: [{ required: true, message: t('pages.system.config.validation.flag'), trigger: 'blur' }] |
| | | })) |
| | | |
| | | const formItems = computed(() => [ |
| | | { |
| | | label: '编号', |
| | | label: t('table.code'), |
| | | key: 'uuid', |
| | | type: 'input', |
| | | props: { |
| | | disabled: true, |
| | | placeholder: '新增后自动生成' |
| | | placeholder: t('pages.system.config.placeholders.uuid') |
| | | } |
| | | }, |
| | | { |
| | | label: '名称', |
| | | label: t('table.name'), |
| | | key: 'name', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入配置名称' |
| | | placeholder: t('pages.system.config.placeholders.name') |
| | | } |
| | | }, |
| | | { |
| | | label: '标识', |
| | | label: t('pages.system.config.table.flag'), |
| | | key: 'flag', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入配置标识' |
| | | placeholder: t('pages.system.config.placeholders.flag') |
| | | } |
| | | }, |
| | | { |
| | | label: '类型', |
| | | label: t('pages.system.config.table.type'), |
| | | key: 'type', |
| | | type: 'select', |
| | | props: { |
| | | options: getConfigTypeOptions(), |
| | | placeholder: '请选择类型' |
| | | options: getConfigTypeOptions(t), |
| | | placeholder: t('pages.system.config.placeholders.type') |
| | | } |
| | | }, |
| | | { |
| | | label: '值', |
| | | label: t('pages.system.config.table.value'), |
| | | key: 'val', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入配置值' |
| | | placeholder: t('pages.system.config.placeholders.value') |
| | | } |
| | | }, |
| | | { |
| | | 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.config.placeholders.status') |
| | | } |
| | | }, |
| | | { |
| | | label: '文本', |
| | | label: t('pages.system.config.table.content'), |
| | | key: 'content', |
| | | type: 'input', |
| | | span: 24, |
| | | props: { |
| | | type: 'textarea', |
| | | rows: 3, |
| | | placeholder: '请输入配置文本' |
| | | placeholder: t('pages.system.config.placeholders.content') |
| | | } |
| | | }, |
| | | { |
| | | label: '备注', |
| | | label: t('table.memo'), |
| | | key: 'memo', |
| | | type: 'input', |
| | | span: 24, |
| | | props: { |
| | | type: 'textarea', |
| | | rows: 3, |
| | | placeholder: '请输入备注' |
| | | placeholder: t('pages.system.config.placeholders.memo') |
| | | } |
| | | } |
| | | ]) |