diff --git a/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx b/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx index 9f74e4de..7cec4c1b 100644 --- a/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx +++ b/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx @@ -1,6 +1,6 @@ import React, {useEffect, useState, useCallback} from 'react'; import {Modal, Form, Select, message, Switch, InputNumber, Input} from 'antd'; -import type {DeploymentConfig, DeployConfigTemplate} from '../types'; +import type {DeploymentConfig, DeployConfigTemplate, CreateDeploymentConfigRequest} from '../types'; import {createDeploymentConfig, updateDeploymentConfig, getDeployConfigTemplates} from '../service'; import {getApplicationList} from '../../../Application/List/service'; import type {Application} from '../../../Application/List/types'; @@ -118,12 +118,12 @@ const DeploymentConfigModal: React.FC = ({ } // 构建提交数据 - const submitData = { + const submitData: CreateDeploymentConfigRequest = { environmentId: envId, applicationId: values.applicationId, buildType: template.buildType, languageType: selectedApp.language, - buildVariables, // 动态表单的值都在这里 + buildVariables, enabled: values.enabled }; @@ -149,6 +149,22 @@ const DeploymentConfigModal: React.FC = ({ } }; + // 处理富文本编辑器的值变化 + const handleEditorChange = (key: string, value: string | undefined) => { + setBuildVariables(prev => ({ + ...prev, + [key]: value || '' + })); + }; + + // 处理普通输入框的值变化 + const handleInputChange = (key: string, value: string) => { + setBuildVariables(prev => ({ + ...prev, + [key]: value + })); + }; + // 渲染表单项 const renderFormItems = () => { if (!selectedTemplate?.buildVariablesSchema?.properties) return null; @@ -171,10 +187,7 @@ const DeploymentConfigModal: React.FC = ({ defaultLanguage={property.editorConfig.language || 'shell'} theme={property.editorConfig.theme || 'vs-dark'} value={buildVariables[key] || property.default || ''} - onChange={(value) => setBuildVariables(prev => ({ - ...prev, - [key]: value - }))} + onChange={(value) => handleEditorChange(key, value)} options={{ minimap: { enabled: property.editorConfig.minimap ?? false }, fontSize: property.editorConfig.fontSize || 14, @@ -215,10 +228,7 @@ const DeploymentConfigModal: React.FC = ({ > ) => setBuildVariables(prev => ({ - ...prev, - [key]: e.target.value - }))} + onChange={(e: React.ChangeEvent) => handleInputChange(key, e.target.value)} placeholder={`请输入${property.title || key}`} />