From 109a8073840cd1e9748f9fe36268edd5288f80d2 Mon Sep 17 00:00:00 2001
From: bin <719488417@qq.com>
Date: Wed, 12 Nov 2025 17:02:15 +0800
Subject: [PATCH] =?UTF-8?q?refactor=20:=20=E6=A8=A1=E5=9D=97=E5=8C=96?=
=?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=AE=A1=E7=90=86=E8=A1=A8=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ModelForms/BehaviorRecommendForm.tsx | 41 ++
.../ModelForms/CompetitivenessForm.tsx | 66 +++
.../ModelForms/LocationMatchForm.tsx | 71 +++
.../ModelForms/MatchDegreeForm.tsx | 66 +++
.../ModelForms/PreciseMatchForm.tsx | 105 ++++
.../Application/ModelManagement/index.tsx | 520 +-----------------
.../ModelManagement/modelStyle.less | 19 -
7 files changed, 379 insertions(+), 509 deletions(-)
create mode 100644 src/pages/Application/ModelManagement/ModelForms/BehaviorRecommendForm.tsx
create mode 100644 src/pages/Application/ModelManagement/ModelForms/CompetitivenessForm.tsx
create mode 100644 src/pages/Application/ModelManagement/ModelForms/LocationMatchForm.tsx
create mode 100644 src/pages/Application/ModelManagement/ModelForms/MatchDegreeForm.tsx
create mode 100644 src/pages/Application/ModelManagement/ModelForms/PreciseMatchForm.tsx
delete mode 100644 src/pages/Application/ModelManagement/modelStyle.less
diff --git a/src/pages/Application/ModelManagement/ModelForms/BehaviorRecommendForm.tsx b/src/pages/Application/ModelManagement/ModelForms/BehaviorRecommendForm.tsx
new file mode 100644
index 0000000..75dde59
--- /dev/null
+++ b/src/pages/Application/ModelManagement/ModelForms/BehaviorRecommendForm.tsx
@@ -0,0 +1,41 @@
+import React from 'react';
+import { Form, Row, Col, Card, Slider } from 'antd';
+
+const BehaviorRecommendForm: React.FC = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default BehaviorRecommendForm;
diff --git a/src/pages/Application/ModelManagement/ModelForms/CompetitivenessForm.tsx b/src/pages/Application/ModelManagement/ModelForms/CompetitivenessForm.tsx
new file mode 100644
index 0000000..951e6ac
--- /dev/null
+++ b/src/pages/Application/ModelManagement/ModelForms/CompetitivenessForm.tsx
@@ -0,0 +1,66 @@
+import React from 'react';
+import { Form, Row, Col, Card, Slider } from 'antd';
+
+const CompetitivenessForm: React.FC = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default CompetitivenessForm;
diff --git a/src/pages/Application/ModelManagement/ModelForms/LocationMatchForm.tsx b/src/pages/Application/ModelManagement/ModelForms/LocationMatchForm.tsx
new file mode 100644
index 0000000..6a5d687
--- /dev/null
+++ b/src/pages/Application/ModelManagement/ModelForms/LocationMatchForm.tsx
@@ -0,0 +1,71 @@
+import React from 'react';
+import { Form, Row, Col, Card, InputNumber, Select } from 'antd';
+
+const { Option } = Select;
+
+const LocationMatchForm: React.FC = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default LocationMatchForm;
diff --git a/src/pages/Application/ModelManagement/ModelForms/MatchDegreeForm.tsx b/src/pages/Application/ModelManagement/ModelForms/MatchDegreeForm.tsx
new file mode 100644
index 0000000..415df69
--- /dev/null
+++ b/src/pages/Application/ModelManagement/ModelForms/MatchDegreeForm.tsx
@@ -0,0 +1,66 @@
+import React from 'react';
+import { Form, Row, Col, Card, Slider } from 'antd';
+
+const MatchDegreeForm: React.FC = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default MatchDegreeForm;
diff --git a/src/pages/Application/ModelManagement/ModelForms/PreciseMatchForm.tsx b/src/pages/Application/ModelManagement/ModelForms/PreciseMatchForm.tsx
new file mode 100644
index 0000000..ce55c9d
--- /dev/null
+++ b/src/pages/Application/ModelManagement/ModelForms/PreciseMatchForm.tsx
@@ -0,0 +1,105 @@
+import React from 'react';
+import { Form, Row, Col, Card, Divider, InputNumber, Slider } from 'antd';
+
+const PreciseMatchForm: React.FC = () => {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default PreciseMatchForm;
diff --git a/src/pages/Application/ModelManagement/index.tsx b/src/pages/Application/ModelManagement/index.tsx
index 3432866..8a0e133 100644
--- a/src/pages/Application/ModelManagement/index.tsx
+++ b/src/pages/Application/ModelManagement/index.tsx
@@ -1,22 +1,7 @@
import React, { Fragment, useState, useEffect } from 'react';
import { useAccess } from '@umijs/max';
import { getModelConfig, saveModelConfig } from '@/services/application/modelManagement';
-import {
- Card,
- Row,
- Col,
- Form,
- InputNumber,
- Slider,
- Button,
- message,
- Divider,
- Menu,
- Space,
- Typography,
- Select,
- Modal,
-} from 'antd';
+import { Card, Row, Col, Form, Button, message, Menu, Space, Modal } from 'antd';
import {
SaveOutlined,
ReloadOutlined,
@@ -28,8 +13,12 @@ import {
EnvironmentOutlined,
} from '@ant-design/icons';
-const { Title, Text } = Typography;
-const { Option } = Select;
+// 导入表单组件
+import PreciseMatchForm from './ModelForms/PreciseMatchForm'; //人岗精准匹配模型
+import MatchDegreeForm from './ModelForms/MatchDegreeForm'; //人岗匹配度计算模型
+import BehaviorRecommendForm from './ModelForms/BehaviorRecommendForm'; //基于求职者行为的推荐模型
+import CompetitivenessForm from './ModelForms/CompetitivenessForm'; //竞争力计算模型
+import LocationMatchForm from './ModelForms/LocationMatchForm'; //位置匹配模型
function ModelManagement() {
const access = useAccess();
@@ -104,14 +93,12 @@ function ModelManagement() {
const weights = weightConfigs[modelKey] || [];
const total = weights.reduce((sum: number, key: string) => {
const value = formValues[key] || 0;
-
return sum + Math.round(value * 100);
}, 0);
setTotalWeight(total / 100);
};
- //
const handleFormChange = (changedValues: any, allValues: any) => {
calculateTotalWeight(selectedModel, allValues);
};
@@ -187,7 +174,6 @@ function ModelManagement() {
calculateTotalWeight(modelKey, values);
};
-
const handleSaveConfig = async (values: any) => {
setLoading(true);
try {
@@ -208,7 +194,7 @@ function ModelManagement() {
}
};
-
+ // 重置
const handleResetConfig = async () => {
Modal.confirm({
title: '重置确认',
@@ -221,26 +207,44 @@ function ModelManagement() {
});
};
-
+ // 模型切换
const handleModelChange = (key: string) => {
setSelectedModel(key);
loadConfigData(key);
};
-
+ //颜色
const getWeightColor = () => {
if (totalWeight == 1) return '#52c41a';
if (totalWeight > 1) return '#ff4d4f';
return '#faad14';
};
-
+ // 状态文本
const getWeightStatusText = () => {
if (totalWeight == 1) return '权重分配合理';
if (totalWeight > 1) return '权重超出范围';
return '权重分配不足';
};
+ // 渲染表单组件
+ const renderFormComponent = () => {
+ switch (selectedModel) {
+ case 'preciseMatch':
+ return ;
+ case 'matchDegree':
+ return ;
+ case 'behaviorRecommend':
+ return ;
+ case 'competitiveness':
+ return ;
+ case 'locationMatch':
+ return ;
+ default:
+ return null;
+ }
+ };
+
useEffect(() => {
loadConfigData(selectedModel);
}, []);
@@ -366,471 +370,7 @@ function ModelManagement() {
onValuesChange={handleFormChange}
style={{ height: '100%' }}
>
- {/* 人岗精准匹配模型 */}
- {selectedModel === 'preciseMatch' && (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )}
-
- {/* 人岗匹配度计算模型 */}
- {selectedModel === 'matchDegree' && (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )}
-
- {/* 基于求职者行为的推荐模型 */}
- {selectedModel === 'behaviorRecommend' && (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )}
-
- {/* 竞争力计算模型 */}
- {selectedModel === 'competitiveness' && (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )}
-
- {/* 位置匹配模型 */}
- {selectedModel === 'locationMatch' && (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )}
+ {renderFormComponent()}
diff --git a/src/pages/Application/ModelManagement/modelStyle.less b/src/pages/Application/ModelManagement/modelStyle.less
deleted file mode 100644
index 69239ab..0000000
--- a/src/pages/Application/ModelManagement/modelStyle.less
+++ /dev/null
@@ -1,19 +0,0 @@
-.cards {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- grid-row-gap: 30px;
-
- .card {
- display: flex;
- align-items: center;
- margin-right: 80px;
-
- .label {
- margin-right: 10px;
- white-space: nowrap;
- }
-
- .input {
- }
- }
-}