This commit is contained in:
asp_ly 2025-01-17 21:52:19 +08:00
parent 6fbd00106c
commit ee14a4653a

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import {Modal, Button} from 'antd';
import {Modal, Button, message} from 'antd';
import { FullscreenOutlined, FullscreenExitOutlined } from '@ant-design/icons';
import type {DeploymentConfig} from '../types';
import './styles.less';
@ -270,7 +270,7 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
items: {
type: 'object',
properties: {
column1: {
key: {
type: 'void',
'x-component': 'ArrayTable.Column',
'x-component-props': { title: '键', width: '40%' },
@ -296,7 +296,7 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
}
}
},
column2: {
action: {
type: 'void',
'x-component': 'ArrayTable.Column',
'x-component-props': { title: '值', width: '40%' },
@ -391,40 +391,39 @@ const DeploymentConfigModal: React.FC<DeploymentConfigModalProps> = ({
try {
const values = await form.submit()
console.log('表单提交的值:', values)
console.log('环境变量数组:', values.envs)
onSuccess?.(values as DeploymentConfig)
onSuccess?.()
form.reset()
} catch (e) {
console.error('表单提交出错:', e)
message.error('提交失败,请检查表单数据是否正确')
}
}
return (
<>
<Modal
title="部署配置"
open={open}
onCancel={onCancel}
width={800}
centered
footer={[
<Button key="cancel" onClick={onCancel}>
</Button>,
<Button key="submit" type="primary" onClick={() => form.submit()}>
</Button>
]}
bodyStyle={{
padding: '24px',
maxHeight: '80vh',
overflow: 'auto'
}}
>
<FormProvider form={form}>
<SchemaField schema={schema}/>
</FormProvider>
</Modal>
</>
<Modal
title="部署配置"
open={open}
onCancel={onCancel}
width={800}
centered
footer={[
<Button key="cancel" onClick={onCancel}>
</Button>,
<Button key="submit" type="primary" onClick={handleSubmit}>
</Button>
]}
bodyStyle={{
padding: '24px',
maxHeight: '80vh',
overflow: 'auto'
}}
>
<FormProvider form={form}>
<SchemaField schema={schema}/>
</FormProvider>
</Modal>
);
};