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,
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<DeploymentConfigModalProps> = ({
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<DeploymentConfigModalProps> = ({
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<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 (
<>
<Modal
title="部署配置"
open={open}
onCancel={onCancel}
onOk={() => form.submit(onSuccess)}
onOk={handleSubmit}
width={800}
styles={{
body: {