From 895f483e19154752bae98ad29342b6555c5b614b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 06 十一月 2026 16:32:50 +0800
Subject: [PATCH] feat(hrm/transfer): 调岗申请支持选择员工并自动带出原部门原岗位
---
src/views/hrm/transfer/data.ts | 46 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/src/views/hrm/transfer/data.ts b/src/views/hrm/transfer/data.ts
index c0e1cf3..9852637 100644
--- a/src/views/hrm/transfer/data.ts
+++ b/src/views/hrm/transfer/data.ts
@@ -7,13 +7,18 @@
import { getDeptList } from '#/api/system/dept';
import { getSimplePostList } from '#/api/system/post';
+import { getEmployeePage } from '#/api/hrm/employee';
+import type { HrmEmployeeApi } from '#/api/hrm/employee';
import { handleTree } from '#/packages/utils/src';
/** 琛ㄥ崟绫诲瀷 */
export type FormType = 'create' | 'detail' | 'update';
/** 鏂板/淇敼璋冨矖鐢宠鐨勮〃鍗� */
-export function useFormSchema(formType: FormType): VbenFormSchema[] {
+export function useFormSchema(
+ formType: FormType,
+ onApplicantChange?: (option?: HrmEmployeeApi.Employee) => void,
+): VbenFormSchema[] {
return [
{
fieldName: 'id',
@@ -40,12 +45,45 @@
},
},
{
+ fieldName: 'userId',
+ label: '鐢宠浜�',
+ component: 'ApiSelect',
+ componentProps: {
+ // 閫夋嫨鍛樺伐鍚庯紝value 鍙栧叧鑱旂殑绯荤粺鐢ㄦ埛 ID锛堝悗绔寜 userId 鍏宠仈鍛樺伐妗f锛�
+ api: getEmployeePage,
+ // 鍒嗛〉鎺ュ彛涓婇檺 200锛岃秴鍑轰細鎶モ�滄瘡椤垫潯鏁版渶澶у�间负 200鈥�
+ params: { pageNo: 1, pageSize: 200 },
+ resultField: 'list',
+ labelField: 'name',
+ valueField: 'userId',
+ // 鏈叧鑱旂郴缁熻处鍙锋垨宸茬鑱岀殑鍛樺伐涓嶈兘浣滀负璋冨矖瀵硅薄
+ afterFetch: (res: { list?: HrmEmployeeApi.Employee[] }) => ({
+ list: (res?.list ?? []).filter(
+ (item) => item.userId != null && item.employeeStatus !== 3,
+ ),
+ }),
+ placeholder: '璇烽�夋嫨璋冨矖鍛樺伐',
+ showSearch: true,
+ optionFilterProp: 'label',
+ // 浠呮柊澧炴椂鍙�夋嫨锛涗慨鏀�/鏌ョ湅鏃堕攣瀹氳皟宀楀璞�
+ disabled: formType !== 'create',
+ onChange: (_value: unknown, option: unknown) => {
+ onApplicantChange?.(option as HrmEmployeeApi.Employee);
+ },
+ },
+ help:
+ formType === 'create'
+ ? '閫夋嫨鍚庤嚜鍔ㄥ甫鍑鸿鍛樺伐鐨勬墍鍦ㄩ儴闂ㄤ笌宀椾綅'
+ : undefined,
+ rules: 'selectRequired',
+ },
+ {
fieldName: 'currentDeptName',
label: '鍘熼儴闂�',
component: 'Input',
componentProps: {
disabled: true,
- placeholder: '鑷姩鑾峰彇',
+ placeholder: '閫夋嫨鍛樺伐鍚庤嚜鍔ㄥ甫鍑�',
},
},
{
@@ -54,7 +92,7 @@
component: 'Input',
componentProps: {
disabled: true,
- placeholder: '鑷姩鑾峰彇',
+ placeholder: '閫夋嫨鍛樺伐鍚庤嚜鍔ㄥ甫鍑�',
},
},
{
@@ -175,7 +213,7 @@
export function useGridColumns(): VxeTableGridOptions<HrmTransferApi.Transfer>['columns'] {
return [
{ field: 'id', title: '鐢宠缂栧彿', width: 80 },
- { field: 'employeeName', title: '鐢宠浜�', minWidth: 100 },
+ { field: 'userName', title: '鐢宠浜�', minWidth: 100 },
{ field: 'currentDeptName', title: '鍘熼儴闂�', minWidth: 120 },
{ field: 'currentPostName', title: '鍘熷矖浣�', minWidth: 120 },
{ field: 'targetDeptName', title: '鐩爣閮ㄩ棬', minWidth: 120 },
--
Gitblit v1.9.3