| | |
| | | |
| | | <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 { buildDeptDialogModel, createDeptFormState } from '../deptPage.helpers' |
| | | |
| | | const props = defineProps({ |
| | |
| | | }) |
| | | |
| | | const emit = defineEmits(['update:visible', 'submit']) |
| | | const { t } = useI18n() |
| | | const formRef = ref() |
| | | const form = reactive(createDeptFormState()) |
| | | |
| | | const isEdit = computed(() => Boolean(form.id)) |
| | | const dialogTitle = computed(() => (isEdit.value ? '编辑部门' : '新增部门')) |
| | | const dialogTitle = computed(() => |
| | | isEdit.value ? t('pages.system.dept.dialog.titleEdit') : t('pages.system.dept.dialog.titleCreate') |
| | | ) |
| | | |
| | | const rules = computed(() => ({ |
| | | name: [{ required: true, message: '请输入部门名称', trigger: 'blur' }] |
| | | name: [{ required: true, message: t('pages.system.dept.validation.name'), trigger: 'blur' }] |
| | | })) |
| | | |
| | | const formItems = computed(() => [ |
| | | { |
| | | label: '上级部门', |
| | | label: t('pages.system.dept.table.parent'), |
| | | key: 'parentId', |
| | | type: 'treeselect', |
| | | span: 24, |
| | |
| | | value: 'value', |
| | | children: 'children' |
| | | }, |
| | | placeholder: '请选择上级部门', |
| | | placeholder: t('pages.system.dept.placeholders.parentId'), |
| | | clearable: false, |
| | | checkStrictly: true, |
| | | defaultExpandAll: true |
| | | } |
| | | }, |
| | | { |
| | | label: '部门名称', |
| | | label: t('pages.system.dept.table.name'), |
| | | key: 'name', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入部门名称', |
| | | placeholder: t('pages.system.dept.placeholders.name'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '部门全称', |
| | | label: t('pages.system.dept.table.fullName'), |
| | | key: 'fullName', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入部门全称', |
| | | placeholder: t('pages.system.dept.placeholders.fullName'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '负责人', |
| | | label: t('pages.system.dept.table.leader'), |
| | | key: 'leader', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入负责人', |
| | | placeholder: t('pages.system.dept.placeholders.leader'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '排序', |
| | | label: t('table.sort'), |
| | | key: 'sort', |
| | | type: 'number', |
| | | props: { |
| | |
| | | } |
| | | }, |
| | | { |
| | | label: '状态', |
| | | label: t('table.status'), |
| | | key: 'status', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择状态', |
| | | placeholder: t('pages.system.dept.placeholders.status'), |
| | | options: [ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 } |
| | | { label: t('common.status.normal'), value: 1 }, |
| | | { label: t('common.status.disabled'), value: 0 } |
| | | ] |
| | | } |
| | | }, |
| | | { |
| | | label: '备注', |
| | | label: t('table.memo'), |
| | | key: 'memo', |
| | | type: 'input', |
| | | span: 24, |
| | | props: { |
| | | type: 'textarea', |
| | | rows: 3, |
| | | placeholder: '请输入备注', |
| | | placeholder: t('pages.system.dept.placeholders.memo'), |
| | | clearable: true |
| | | } |
| | | } |