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);
|