hejianhao
2026-01-09 be5d0750301ebad72f9f7f94e3b878bce43d4ec8
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
import React, { Component } from "react";
import { Form, Input, Modal } from "antd";
import BaseForm from "../../common/edit-form-base";
class EditLayerForm extends BaseForm {
  initEditableData () {
    return {
        name: '',
        data: {
            score: 100,
            weight: 1
        }
    }
  }
  render() {
    const { visible, onCancel, onOk, form, confirmLoading } = this.props;
    const { getFieldDecorator } = form;
    const { name, data } = this.state.editableData;
    return (
      <Modal
        title={this.state.isEdit ? "编辑层级" : "添加层级"}
        visible={visible}
        onCancel={onCancel}
        onOk={onOk}
        destroyOnClose
        confirmLoading={confirmLoading}
      >
        <Form {...this.formItemLayout}>
            <div>
                <Form.Item label="名称:">
                    {getFieldDecorator("name", {
                    initialValue: name,
                    onChange: this.handleFieldChange('name'),
                    rules: [{ required: true, message: "请输入名称!" }],
                    })(<Input style={{marginLeft: '10px'}} placeholder="请输入名称" />)}
                </Form.Item>
            </div>
            <div>
                <Form.Item label="分数:">
                    {getFieldDecorator("data.score", {
                    initialValue: data && data.score,
                    onChange: this.handleEntityFieldSelectChange('data','score'),
                    rules: [{ required: true, message: "请输入分数!" }],
                    })(<Input style={{marginLeft: '10px'}} placeholder="请输入分数" />)}
                </Form.Item>
            </div>
            <div>
                <Form.Item label="国际权重:">
                    {getFieldDecorator("data.weight", {
                    initialValue: data && data.weight,
                    onChange: this.handleEntityFieldSelectChange('data','weight'),
                    rules: [{ required: true, message: "请输入权重!" }],
                    })(<Input style={{marginLeft: '10px'}} placeholder="请输入分数" />)}
                </Form.Item>
            </div>
        </Form>
      </Modal>
    );
  }
}
 
export default Form.create({ name: "EditLayerForm" })(EditLayerForm);