5 changed files with 259 additions and 134 deletions
			
			
		| @ -1,33 +0,0 @@ | |||||
| import React, { useEffect, useRef, useState } from 'react'; |  | ||||
| import moment from 'moment'; |  | ||||
| import { connect } from "react-redux"; |  | ||||
| import { Select, Modal, Form, Button } from "@douyinfe/semi-ui"; |  | ||||
| 
 |  | ||||
| const GatewayEditModal = (props) => { |  | ||||
|     const { dispatch, actions, user, onCancel, dataToModal } = props; |  | ||||
|     const { edition } = actions; |  | ||||
| 
 |  | ||||
|     //初始化 |  | ||||
|     useEffect(() => { |  | ||||
| 
 |  | ||||
|     }, []); |  | ||||
| 
 |  | ||||
|     return ( |  | ||||
|         <Modal title={dataToModal.name} |  | ||||
|             visible={true} destroyOnClose onCancel={onCancel} |  | ||||
|             footer={[<Button onClick={onCancel}>关闭</Button>]}> |  | ||||
|             <div></div> |  | ||||
|         </Modal> |  | ||||
|     ) |  | ||||
| } |  | ||||
| 
 |  | ||||
| function mapStateToProps(state) { |  | ||||
|     const { auth, global } = state; |  | ||||
|     return { |  | ||||
|         user: auth.user, |  | ||||
|         error: auth.error, |  | ||||
|         actions: global.actions, |  | ||||
|     }; |  | ||||
| } |  | ||||
| 
 |  | ||||
| export default connect(mapStateToProps)(GatewayEditModal); |  | ||||
| @ -0,0 +1,130 @@ | |||||
|  | import React, { useEffect, useRef, useState } from 'react'; | ||||
|  | import moment from 'moment'; | ||||
|  | import { connect } from "react-redux"; | ||||
|  | import { Select, Modal, Form, Button } from "@douyinfe/semi-ui"; | ||||
|  | 
 | ||||
|  | const GatewayModal = (props) => { | ||||
|  |     const { dispatch, actions, user, onCancel, dataToModal } = props; | ||||
|  |     const { edition } = actions; | ||||
|  |     const api = useRef() | ||||
|  |     //初始化 | ||||
|  |     useEffect(() => { | ||||
|  | 
 | ||||
|  |     }, []); | ||||
|  | 
 | ||||
|  |     return ( | ||||
|  |         <Modal | ||||
|  |             title={`${dataToModal ? '修改' : '新增'}网关`} | ||||
|  |             destroyOnClose visible={true} | ||||
|  |             onOk={() => { | ||||
|  |                 api.current.validate().then(r => { | ||||
|  |                     // for (let key in r) { | ||||
|  |                     //     if (['major', 'minor', 'patch', 'build'].includes(key)) { | ||||
|  |                     //         r[key] = Number(r[key]) | ||||
|  |                     //     } | ||||
|  |                     // } | ||||
|  |                     // dispatch(edition.postVersion({ ...r, createdAt: moment().format("YYYY-MM-DD HH:MM:SS") })).then(res => { | ||||
|  |                     //     if (res.success) { | ||||
|  |                     //         requestData() | ||||
|  |                     //         setaddVersion(false) | ||||
|  |                     //     } | ||||
|  |                     // }) | ||||
|  |                 }) | ||||
|  |             }} | ||||
|  |             width={610} | ||||
|  |             onCancel={() => onCancel(0)} | ||||
|  |         > | ||||
|  |             {/* <Form | ||||
|  |                 getFormApi={(formApi) => (api.current = formApi)} | ||||
|  |                 layout="horizontal" | ||||
|  |                 labelAlign="right" | ||||
|  |                 labelWidth="114px" | ||||
|  |                 style={{ display: 'flex', flexDirection: 'column' }} | ||||
|  |             > | ||||
|  |                 <Form.Input | ||||
|  |                     field='serialNo' | ||||
|  |                     label='序列号' | ||||
|  |                     labelPosition="left" | ||||
|  |                     hideButtons={true} | ||||
|  |                     placeholder='请输入序列号' | ||||
|  |                     style={{ width: 200, marginBottom: 10 }} | ||||
|  |                     rules={[{ required: true, message: "请输入序列号" }]} | ||||
|  |                 /> | ||||
|  |                 <Form.Input | ||||
|  |                     field='name' | ||||
|  |                     label='名称' | ||||
|  |                     labelPosition="left" | ||||
|  |                     hideButtons={true} | ||||
|  |                     placeholder='请输入名称' | ||||
|  |                     style={{ width: 200, marginBottom: 10 }} | ||||
|  |                     rules={[{ required: true, message: "请输入名称" }]} | ||||
|  |                 /> | ||||
|  |                 <Form.Input | ||||
|  |                     field='patch' | ||||
|  |                     label='属性' | ||||
|  |                     labelPosition="left" | ||||
|  |                     hideButtons={true} | ||||
|  |                     placeholder='请输入网关属性' | ||||
|  |                     style={{ width: 200, marginBottom: 10 }} | ||||
|  |                     rules={[{ required: true, message: "请输入网关属性" }]} | ||||
|  |                 /> | ||||
|  |                 <Form.Input | ||||
|  |                     field='build' label='构建号:' | ||||
|  |                     labelPosition="left" | ||||
|  |                     hideButtons={true} | ||||
|  |                     placeholder='请输入构建号' | ||||
|  |                     style={{ width: 200, marginBottom: 10 }} | ||||
|  |                     rules={[{ required: true, message: "请输入构建号" }, { pattern: "^[0-9]+$", message: "只能输入数字" },]} | ||||
|  |                 /> | ||||
|  |                 <Form.Select | ||||
|  |                     field="type" | ||||
|  |                     label='Type:' | ||||
|  |                     labelPosition="left" | ||||
|  |                     placeholder='请选择类型' | ||||
|  |                     style={{ width: 200, marginBottom: 10 }} | ||||
|  |                     rules={[{ required: true, message: "请选择类型" }]} | ||||
|  |                 > | ||||
|  |                     <Form.Select.Option value="beta">beta</Form.Select.Option> | ||||
|  |                     <Form.Select.Option value="alpha">alpha</Form.Select.Option> | ||||
|  |                     <Form.Select.Option value="release">release</Form.Select.Option> | ||||
|  |                     <Form.Select.Option value="LTS">LTS</Form.Select.Option> | ||||
|  |                 </Form.Select> | ||||
|  |                 <Form.Input | ||||
|  |                     field='imageBase' | ||||
|  |                     label='基础镜像地址:' | ||||
|  |                     labelPosition="left" | ||||
|  |                     placeholder='请输入基础镜像地址' | ||||
|  |                     style={{ width: 440, marginBottom: 10 }} | ||||
|  |                     rules={[{ required: true, message: "请输入基础镜像地址" }]} | ||||
|  |                 /> | ||||
|  |                 <Form.Input | ||||
|  |                     field='imageVersion' | ||||
|  |                     label='镜像版本:' | ||||
|  |                     labelPosition="left" | ||||
|  |                     placeholder='请输入镜像版本' | ||||
|  |                     style={{ width: 200, marginBottom: 10 }} | ||||
|  |                     rules={[{ required: true, message: "请输入镜像版本" }]} | ||||
|  |                 /> | ||||
|  |                 <Form.TextArea | ||||
|  |                     field='desc' | ||||
|  |                     label='描述:' | ||||
|  |                     labelPosition="left" | ||||
|  |                     placeholder='请输入描述' | ||||
|  |                     style={{ width: 440 }} | ||||
|  |                 /> | ||||
|  | 
 | ||||
|  |             </Form> */} | ||||
|  |         </Modal> | ||||
|  |     ) | ||||
|  | } | ||||
|  | 
 | ||||
|  | function mapStateToProps(state) { | ||||
|  |     const { auth, global } = state; | ||||
|  |     return { | ||||
|  |         user: auth.user, | ||||
|  |         error: auth.error, | ||||
|  |         actions: global.actions, | ||||
|  |     }; | ||||
|  | } | ||||
|  | 
 | ||||
|  | export default connect(mapStateToProps)(GatewayModal); | ||||
					Loading…
					
					
				
		Reference in new issue