diff --git a/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx b/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx index c7df593c..c194fbfa 100644 --- a/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx +++ b/frontend/src/pages/Deploy/Deployment/List/components/DeploymentConfigModal.tsx @@ -205,17 +205,23 @@ const DeploymentConfigModal: React.FC = ({ wrapperCol: 24, layout: 'vertical', colon: false, - labelAlign: 'left' + labelAlign: 'left', + style: { + marginBottom: '16px' + } }, 'x-component': 'ArrayTable', 'x-component-props': { pagination: { pageSize: 10 }, - scroll: { x: '100%' } + scroll: { x: '100%' }, + style: { + minHeight: '120px' + } }, items: { type: 'object', properties: { - column1: { + key: { type: 'void', 'x-component': 'ArrayTable.Column', 'x-component-props': { @@ -230,15 +236,19 @@ const DeploymentConfigModal: React.FC = ({ pattern: '^[a-zA-Z][a-zA-Z0-9_]*$', message: '键名只能包含字母、数字和下划线,且必须以字母开头' }, - 'x-component': 'Input', + 'x-component': 'Select', 'x-component-props': { - placeholder: '请输入键', - allowClear: true - } + placeholder: '请输入或选择键', + allowClear: true, + showSearch: true, + mode: 'tags', + style: { width: '100%' } + }, + 'x-reactions': '{{useAsyncDataSource(api.environment.getKeyOptions)}}' } } }, - column2: { + value: { type: 'void', 'x-component': 'ArrayTable.Column', 'x-component-props': { @@ -249,14 +259,26 @@ const DeploymentConfigModal: React.FC = ({ value: { type: 'string', 'x-decorator': 'FormItem', - 'x-component': 'Input', + 'x-component': 'Select', 'x-component-props': { - placeholder: '请输入值' - } + placeholder: '请输入或选择值', + allowClear: true, + showSearch: true, + mode: 'tags', + style: { width: '100%' } + }, + 'x-reactions': [ + { + dependencies: ['.key'], + fulfill: { + run: '{{useAsyncDataSource(api.environment.getValueOptions, {key: $deps[0]})}}' + } + } + ] } } }, - column3: { + operations: { type: 'void', 'x-component': 'ArrayTable.Column', 'x-component-props': { @@ -296,13 +318,24 @@ const DeploymentConfigModal: React.FC = ({ } }; + const handleSubmit = async () => { + try { + const values = await form.submit() + console.log('表单提交的值:', values) + console.log('环境变量数组:', values.envvAR) + onSuccess?.(values as DeploymentConfig) + } catch (e) { + console.error('表单提交出错:', e) + } + } + return ( <> form.submit(onSuccess)} + onOk={handleSubmit} width={800} styles={{ body: {