From 3f75e9626015d9d6a7cdac59562cb089189e074e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cls=5F=E5=AE=81=E6=B3=A2=E6=9C=AC=E6=9C=BA?= <908705107@qq.com> Date: Wed, 10 Jun 2026 08:43:13 +0800 Subject: [PATCH] Restore full post management page --- web/apps/web-ele/src/locales/index.ts | 1 + web/apps/web-ele/src/views/_core/post/data.ts | 187 +++++++ .../web-ele/src/views/_core/post/index.vue | 492 +++++------------- .../_core/post/modules/post-form-modal.vue | 84 +++ .../views/_core/post/modules/post-list.vue | 291 +++++++++++ 5 files changed, 686 insertions(+), 369 deletions(-) create mode 100644 web/apps/web-ele/src/views/_core/post/data.ts create mode 100644 web/apps/web-ele/src/views/_core/post/modules/post-form-modal.vue create mode 100644 web/apps/web-ele/src/views/_core/post/modules/post-list.vue diff --git a/web/apps/web-ele/src/locales/index.ts b/web/apps/web-ele/src/locales/index.ts index 356c06a..454cf38 100644 --- a/web/apps/web-ele/src/locales/index.ts +++ b/web/apps/web-ele/src/locales/index.ts @@ -32,6 +32,7 @@ const modules = import.meta.glob([ './langs/*/message.json', './langs/*/page.json', './langs/*/permission.json', + './langs/*/post.json', './langs/*/role.json', './langs/*/system-config.json', './langs/*/system.json', diff --git a/web/apps/web-ele/src/views/_core/post/data.ts b/web/apps/web-ele/src/views/_core/post/data.ts new file mode 100644 index 0000000..a4999b2 --- /dev/null +++ b/web/apps/web-ele/src/views/_core/post/data.ts @@ -0,0 +1,187 @@ +import type { VxeTableGridOptions } from '@vben/plugins/vxe-table'; + +import type { VbenFormSchema } from '#/adapter/form'; +import type { OnActionClickFn } from '#/adapter/vxe-table'; +import type { Post } from '#/api/core/post'; + +import { $t } from '@vben/locales'; + +import { z } from '#/adapter/form'; + +/** + * 获取搜索表单的字段配置 + */ +export function useSearchFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'name', + label: $t('system.user.userName'), + }, + { + component: 'Input', + fieldName: 'username', + label: $t('system.user.account'), + }, + ]; +} + +/** + * 获取岗位类型选项 + */ +export function getPostTypeOptions() { + return [ + { label: $t('post.types.management'), value: 0 }, + { label: $t('post.types.technical'), value: 1 }, + { label: $t('post.types.business'), value: 2 }, + { label: $t('post.types.functional'), value: 3 }, + { label: $t('post.types.other'), value: 4 }, + ]; +} + +/** + * 获取岗位级别选项 + */ +export function getPostLevelOptions() { + return [ + { label: $t('post.levels.senior'), value: 0 }, + { label: $t('post.levels.middle'), value: 1 }, + { label: $t('post.levels.basic'), value: 2 }, + { label: $t('post.levels.staff'), value: 3 }, + ]; +} + +/** + * 获取岗位树列配置 + */ +export function usePostTreeColumns( + onActionClick?: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + field: 'name', + title: $t('post.postName'), + minWidth: 150, + }, + ]; +} + +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'name', + label: $t('post.postName'), + rules: z + .string() + .min(2, $t('ui.formRules.minLength', [$t('post.postName'), 2])) + .max(64, $t('ui.formRules.maxLength', [$t('post.postName'), 64])), + }, + { + component: 'Input', + fieldName: 'code', + label: $t('post.postCode'), + rules: z + .string() + .min(2, $t('ui.formRules.minLength', [$t('post.postCode'), 2])) + .max(32, $t('ui.formRules.maxLength', [$t('post.postCode'), 32])) + .regex(/^[\w-]+$/, $t('post.codeFormatError')), + }, + { + component: 'Select', + componentProps: { + options: getPostTypeOptions(), + }, + defaultValue: 4, + fieldName: 'post_type', + label: $t('post.postType'), + }, + { + component: 'Select', + componentProps: { + options: getPostLevelOptions(), + }, + defaultValue: 3, + fieldName: 'post_level', + label: $t('post.postLevel'), + }, + { + component: 'DeptSelector', + componentProps: { + placeholder: $t('post.selectDepartment'), + }, + fieldName: 'dept_id', + label: $t('post.department'), + }, + { + component: 'Textarea', + componentProps: { + placeholder: $t('post.descriptionPlaceholder'), + rows: 3, + }, + fieldName: 'description', + label: $t('post.description'), + }, + { + component: 'RadioGroup', + componentProps: { + options: [ + { label: $t('common.enabled'), value: true }, + { label: $t('common.disabled'), value: false }, + ], + }, + defaultValue: true, + fieldName: 'status', + label: $t('post.status'), + }, + ]; +} + +/** + * 获取用户表格列配置 + */ +export function useUserColumns( + onActionClick?: OnActionClickFn, +): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + minWidth: 60, + align: 'center', + fixed: 'left', + }, + { + field: 'username', + title: $t('system.user.account'), + minWidth: 120, + }, + { + field: 'name', + title: $t('system.user.userName'), + minWidth: 120, + }, + { + field: 'email', + title: $t('system.user.email'), + minWidth: 180, + }, + { + align: 'right', + cellRender: { + attrs: { + nameField: 'name', + nameTitle: $t('system.user.userName'), + onClick: onActionClick, + }, + name: 'CellOperation', + options: ['edit', 'delete'], + }, + field: 'operation', + fixed: 'right', + headerAlign: 'center', + showOverflow: false, + title: $t('system.user.operation'), + minWidth: 150, + }, + ]; +} diff --git a/web/apps/web-ele/src/views/_core/post/index.vue b/web/apps/web-ele/src/views/_core/post/index.vue index c9311da..0012988 100644 --- a/web/apps/web-ele/src/views/_core/post/index.vue +++ b/web/apps/web-ele/src/views/_core/post/index.vue @@ -1,406 +1,160 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web/apps/web-ele/src/views/_core/post/modules/post-form-modal.vue b/web/apps/web-ele/src/views/_core/post/modules/post-form-modal.vue new file mode 100644 index 0000000..89cf4d7 --- /dev/null +++ b/web/apps/web-ele/src/views/_core/post/modules/post-form-modal.vue @@ -0,0 +1,84 @@ + + + diff --git a/web/apps/web-ele/src/views/_core/post/modules/post-list.vue b/web/apps/web-ele/src/views/_core/post/modules/post-list.vue new file mode 100644 index 0000000..555a9f2 --- /dev/null +++ b/web/apps/web-ele/src/views/_core/post/modules/post-list.vue @@ -0,0 +1,291 @@ + + + + +