From dc1d067c566bbde1c7170186960a8bd27f210a47 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 09 九月 2026 13:45:58 +0800
Subject: [PATCH] feat(bi): 新增决策总览仪表盘并优化预测分析功能
---
src/views/hrm/training/data.ts | 243 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 243 insertions(+), 0 deletions(-)
diff --git a/src/views/hrm/training/data.ts b/src/views/hrm/training/data.ts
new file mode 100644
index 0000000..e00aac7
--- /dev/null
+++ b/src/views/hrm/training/data.ts
@@ -0,0 +1,243 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { HrmTrainingApi } from '#/api/hrm/training';
+
+/** 鍩硅绫诲瀷閫夐」 */
+export const trainingTypeOptions = [
+ { label: '瀹夊叏鍩硅', value: 1 },
+ { label: '鎶�鑳藉煿璁�', value: 2 },
+ { label: '绠$悊鍩硅', value: 3 },
+ { label: '鍏朵粬', value: 4 },
+];
+
+/** 鍩硅鐘舵�侀�夐」 */
+export const trainingStatusOptions = [
+ { label: '鑽夌', value: 0 },
+ { label: '寰呭紑灞�', value: 10 },
+ { label: '宸插畬鎴�', value: 20 },
+ { label: '宸插彇娑�', value: 30 },
+];
+
+/** 琛ㄥ崟绫诲瀷 */
+export type FormType = 'create' | 'edit' | 'detail';
+
+/** 琛ㄥ崟鐨勯厤缃」 */
+export function useFormSchema(formType: FormType): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'id',
+ component: 'Input',
+ dependencies: {
+ triggerFields: [''],
+ show: () => false,
+ },
+ },
+ {
+ fieldName: 'name',
+ label: '鍩硅鍚嶇О',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ煿璁悕绉�',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'trainingType',
+ label: '鍩硅绫诲瀷',
+ component: 'Select',
+ componentProps: {
+ options: trainingTypeOptions,
+ placeholder: '璇烽�夋嫨鍩硅绫诲瀷',
+ },
+ rules: 'selectRequired',
+ },
+ {
+ fieldName: 'trainer',
+ label: '璁插笀',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ヨ甯�',
+ },
+ },
+ {
+ fieldName: 'location',
+ label: '鍩硅鍦扮偣',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ煿璁湴鐐�',
+ },
+ },
+ {
+ fieldName: 'hours',
+ label: '鍩硅瀛︽椂',
+ component: 'InputNumber',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ煿璁鏃�',
+ min: 0,
+ precision: 1,
+ style: { width: '100%' },
+ },
+ },
+ {
+ fieldName: 'startDate',
+ label: '寮�濮嬫棩鏈�',
+ component: 'DatePicker',
+ componentProps: {
+ placeholder: '閫夋嫨寮�濮嬫棩鏈�',
+ valueFormat: 'YYYY-MM-DD',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'endDate',
+ label: '缁撴潫鏃ユ湡',
+ component: 'DatePicker',
+ componentProps: {
+ placeholder: '閫夋嫨缁撴潫鏃ユ湡',
+ valueFormat: 'YYYY-MM-DD',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'issueCertificate',
+ label: '鑷姩鍙戣瘉',
+ component: 'Select',
+ componentProps: {
+ options: [
+ { label: '鏄�', value: 1 },
+ { label: '鍚�', value: 0 },
+ ],
+ placeholder: '鏄惁鑷姩鍙戣瘉',
+ },
+ },
+ {
+ fieldName: 'certValidityMonths',
+ label: '璇佷功鏈夋晥鏈�(鏈�)',
+ component: 'InputNumber',
+ componentProps: {
+ placeholder: '鑷姩鍙戣瘉鏃跺~鍐�',
+ min: 0,
+ precision: 0,
+ style: { width: '100%' },
+ },
+ },
+ {
+ fieldName: 'remark',
+ label: '澶囨敞',
+ component: 'Textarea',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ娉�',
+ autoSize: { minRows: 1, maxRows: 2 },
+ },
+ formItemClass: 'col-span-2',
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'trainingNo',
+ label: '鍩硅缂栧彿',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ煿璁紪鍙�',
+ },
+ },
+ {
+ fieldName: 'name',
+ label: '鍩硅鍚嶇О',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ煿璁悕绉�',
+ },
+ },
+ {
+ fieldName: 'trainingType',
+ label: '鍩硅绫诲瀷',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: trainingTypeOptions,
+ placeholder: '璇烽�夋嫨鍩硅绫诲瀷',
+ },
+ },
+ {
+ fieldName: 'status',
+ label: '鐘舵��',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: trainingStatusOptions,
+ placeholder: '璇烽�夋嫨鐘舵��',
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勫瓧娈� */
+export function useGridColumns(): VxeTableGridOptions<HrmTrainingApi.Training>['columns'] {
+ return [
+ {
+ field: 'trainingNo',
+ title: '鍩硅缂栧彿',
+ width: 140,
+ },
+ {
+ field: 'name',
+ title: '鍩硅鍚嶇О',
+ minWidth: 180,
+ },
+ {
+ field: 'trainingTypeName',
+ title: '鍩硅绫诲瀷',
+ width: 100,
+ },
+ {
+ field: 'trainer',
+ title: '璁插笀',
+ width: 100,
+ },
+ {
+ field: 'location',
+ title: '鍩硅鍦扮偣',
+ minWidth: 120,
+ },
+ {
+ field: 'hours',
+ title: '瀛︽椂',
+ width: 80,
+ },
+ {
+ field: 'startDate',
+ title: '寮�濮嬫棩鏈�',
+ width: 105,
+ formatter: 'formatDate',
+ },
+ {
+ field: 'endDate',
+ title: '缁撴潫鏃ユ湡',
+ width: 105,
+ formatter: 'formatDate',
+ },
+ {
+ field: 'participantCount',
+ title: '鍙傝浜烘暟',
+ width: 90,
+ },
+ {
+ field: 'statusName',
+ title: '鐘舵��',
+ width: 90,
+ slots: { default: 'status' },
+ },
+ {
+ field: 'action',
+ title: '鎿嶄綔',
+ width: 240,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
\ No newline at end of file
--
Gitblit v1.9.3