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