king
2024-04-29 50b49c1b760489c3430fc382656d57c5fbbab07c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input } from 'antd'
// import { QuestionCircleOutlined } from '@ant-design/icons'
 
// import './index.scss'
const { TextArea } = Input
 
class BaseForm extends Component {
  static propTpyes = {
    verify: PropTypes.object,
    onChange: PropTypes.func
  }
 
  state = {}
 
  handleConfirm = () => {
    const { verify } = this.props
    
    if (verify.type === 'billout') {
      return new Promise((resolve, reject) => {
        this.props.form.validateFieldsAndScroll((err, values) => {
          if (!err) {
            resolve(values)
          }
        })
      })
    } else {
      return Promise.resolve()
    }
  }
 
  // onOptionChange = (value, key) => {
  //   const { verify } = this.props
 
  //   let _verify = {...verify, [key]: value}
 
  //   this.props.onChange(_verify)
  // }
 
  render() {
    const { getFieldDecorator } = this.props.form
    const { verify } = this.props
 
    return (
      <Form className="base-form">
        <Row gutter={24}>
          <Col span={8}>
            <Form.Item label="按钮名称">
              <Input value={verify.label} disabled={true}/>
            </Form.Item>
          </Col>
          {/* <Col span={8}>
            <Form.Item label={
              <Tooltip placement="bottomLeft" title="">
                <QuestionCircleOutlined className="mk-form-tip" />
                接口类型
              </Tooltip>
            }>
              <Radio.Group value={verify.intertype} disabled={true}>
                <Radio value="system">系统</Radio>
                <Radio value="custom">自定义</Radio>
              </Radio.Group>
            </Form.Item>
          </Col> */}
          {/* {verify.type === 'billout' ? <Col span={8}>
            <Form.Item label={
              <Tooltip placement="bottomLeft" title="">
                <QuestionCircleOutlined className="mk-form-tip" />
                参数处理
              </Tooltip>
            }>
              {getFieldDecorator('procMode', {
                initialValue: verify.procMode || 'system',
              })(
                <Radio.Group onChange={(e) => {this.onOptionChange(e.target.value, 'procMode')}}>
                  <Radio value="system">系统函数</Radio>
                  <Radio value="none">无</Radio>
                </Radio.Group>
              )}
            </Form.Item>
          </Col> : null} */}
          {verify.type === 'billout' ? <Col span={24}>
            <Form.Item label="测试地址">
              {getFieldDecorator('interface', {
                initialValue: verify.interface || '',
                rules: [
                  { required: true, message: '请输入测试地址!' }
                ]
              })(
                <TextArea rows={2}/>
              )}
            </Form.Item>
          </Col> : null}
          {verify.type === 'billout' ? <Col span={24}>
            <Form.Item label="正式地址">
              {getFieldDecorator('proInterface', {
                initialValue: verify.proInterface || '',
              })(
                <TextArea rows={2}/>
              )}
            </Form.Item>
          </Col> : null}
        </Row>
      </Form>
    )
  }
}
 
export default Form.create()(BaseForm)