This commit is contained in:
asp_ly 2025-01-17 21:07:00 +08:00
parent 9fa33ff3da
commit 9118e9dfd9

View File

@ -205,17 +205,23 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
wrapperCol: 24, wrapperCol: 24,
layout: 'vertical', layout: 'vertical',
colon: false, colon: false,
labelAlign: 'left' labelAlign: 'left',
style: {
marginBottom: '16px'
}
}, },
'x-component': 'ArrayTable', 'x-component': 'ArrayTable',
'x-component-props': { 'x-component-props': {
pagination: { pageSize: 10 }, pagination: { pageSize: 10 },
scroll: { x: '100%' } scroll: { x: '100%' },
style: {
minHeight: '120px'
}
}, },
items: { items: {
type: 'object', type: 'object',
properties: { properties: {
column1: { key: {
type: 'void', type: 'void',
'x-component': 'ArrayTable.Column', 'x-component': 'ArrayTable.Column',
'x-component-props': { 'x-component-props': {
@ -230,15 +236,19 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
pattern: '^[a-zA-Z][a-zA-Z0-9_]*$', pattern: '^[a-zA-Z][a-zA-Z0-9_]*$',
message: '键名只能包含字母、数字和下划线,且必须以字母开头' message: '键名只能包含字母、数字和下划线,且必须以字母开头'
}, },
'x-component': 'Input', 'x-component': 'Select',
'x-component-props': { 'x-component-props': {
placeholder: '请输入键', placeholder: '请输入或选择键',
allowClear: true allowClear: true,
} showSearch: true,
mode: 'tags',
style: { width: '100%' }
},
'x-reactions': '{{useAsyncDataSource(api.environment.getKeyOptions)}}'
} }
} }
}, },
column2: { value: {
type: 'void', type: 'void',
'x-component': 'ArrayTable.Column', 'x-component': 'ArrayTable.Column',
'x-component-props': { 'x-component-props': {
@ -249,14 +259,26 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
value: { value: {
type: 'string', type: 'string',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-component': 'Input', 'x-component': 'Select',
'x-component-props': { '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', type: 'void',
'x-component': 'ArrayTable.Column', 'x-component': 'ArrayTable.Column',
'x-component-props': { 'x-component-props': {
@ -296,13 +318,24 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
} }
}; };
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 ( return (
<> <>
<Modal <Modal
title="部署配置" title="部署配置"
open={open} open={open}
onCancel={onCancel} onCancel={onCancel}
onOk={() => form.submit(onSuccess)} onOk={handleSubmit}
width={800} width={800}
styles={{ styles={{
body: { body: {