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
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
import React, { Component } from "react";
import { Form, Input, Modal, Select } from "antd";
import {expertFuncMap, expertTypeMap} from "../../common/constants";
import BaseForm from "../../common/edit-form-base";
const { Option } = Select
class EditSystemExpertForm extends BaseForm {
 
  initEditableData () {
    return {
      name: '',
      type: expertTypeMap.firstKey,
      model: null,
      contact: '',
      expertFuncs: null,
      matrixWeight: 1,
      membershipWeight: 1,
      expertInquiryWeight: 1
    }
  }
  render() {
    const { visible, onCancel, onOk, form, systemList } = this.props;
    // console.log(this.props)
    const { getFieldDecorator } = form;
    const { name, model, expertFuncs, contact, matrixWeight, membershipWeight, expertInquiryWeight } = this.state.editableData;
    return (
      <Modal
        title={this.state.isEdit ? "编辑专家信息" : "添加专家"}
        visible={visible}
        onCancel={onCancel}
        onOk={onOk}
        destroyOnClose
      >
        <Form>
          <Form.Item style={{marginBottom: '2px'}} label="模型:">
            {getFieldDecorator("model", {
              initialValue: model ? {key: model.id, label: model.name} : undefined,
              onChange: this.handleEntitySelectChange('model'),
              rules: [{ required: true, message: "请选择体系" }]
            })(
              <Select
                labelInValue
                disabled={this.state.isEdit}
              >
                {systemList.map((item, index) => (
                  <Option value={item.value} key={index}>{item.label}</Option>
                ))}
              </Select>
            )}
          </Form.Item>
          <Form.Item style={{marginBottom: '2px'}} label="专家名称:">
            {getFieldDecorator("name", {
              initialValue: name,
              onChange: this.handleFieldChange('name'),
              rules: [{ required: true, message: '请输入专家名称!'}]
            })(<Input placeholder="请输入专家名称" />)}
          </Form.Item>
          <Form.Item style={{marginBottom: '2px'}} label="联系方式:">
            {getFieldDecorator("contact", {
                initialValue: contact,
                onChange: this.handleFieldChange('contact'),
            })(<Input placeholder="请输入联系方式" />)}
          </Form.Item>
          <Form.Item style={{marginBottom: '2px'}} label="专家类型:">
            {getFieldDecorator("expertFuncs", {
              initialValue: expertFuncs ? expertFuncs.map(item => ({key: item, label: expertFuncMap[item]})) : undefined,
              onChange: this.handleMultipleSelectChange('expertFuncs'),
              rules: [{ required: true, message: "请选择专家类型" }]
            })(
                <Select
                    labelInValue
                    mode={"multiple"}
                >
                  {expertFuncMap.toOptions().map((item, index) => (
                      <Option value={item.value} key={index}>{item.label}</Option>
                  ))}
                </Select>
            )}
          </Form.Item>
          <Form.Item style={{marginBottom: '2px'}} label="矩阵权重:">
            {getFieldDecorator("matrixWeight", {
                initialValue: matrixWeight,
                onChange: this.handleFieldChange('matrixWeight'),
                rules: [{ required: true, message: '请输入矩阵权重!'}]
            })(<Input placeholder="请输入矩阵权重" />)}
          </Form.Item>
          <Form.Item style={{marginBottom: '2px'}} label="隶属度权重:">
            {getFieldDecorator("membershipWeight", {
                initialValue: membershipWeight,
                onChange: this.handleFieldChange('membershipWeight'),
                rules: [{ required: true, message: '请输入隶属度权重!'}]
            })(<Input placeholder="请输入隶属度权重" />)}
          </Form.Item>
          <Form.Item style={{marginBottom: '2px'}} label="专家调查权重:">
            {getFieldDecorator("expertInquiryWeight", {
                initialValue: expertInquiryWeight,
                onChange: this.handleFieldChange('expertInquiryWeight'),
                rules: [{ required: true, message: '请输入专家调查权重!'}]
            })(<Input placeholder="请输入专家调查权重" />)}
          </Form.Item>
        </Form>
      </Modal>
    );
  }
}
 
export default Form.create({ name: "EditSystemExpertForm" })(EditSystemExpertForm);