/*
 * Create:      柿子
 * CreateDate:  2022/11/04
 * Describe：   添加范例病历
 * */
import React, { Component } from 'react';
import { Modal, Row, Col, Card, Button, Input, Radio, Icon, Tree, Dropdown, Menu, Select, message } from 'antd';
import { Util } from 'tools';
import ElectronicCaseTemplate from 'pages/common/ElectronicCaseTemplate.jsx';
import PublicModalFormHooks from 'pages/common/PublicModalFormHooks';
import './style/index.less';
const { TreeNode } = Tree;

class AddSampleTemplate extends Component {
  constructor(props) {
    super(props);
    var userData = React.$getSessionData('userData');
    var recordData = React.$getSessionData('patientData');
    var titleData = JSON.parse(sessionStorage.getItem('titleData'));
    this.state = {
      userData,
      recordData,
      titleData,
      visible: false,
      templateParams: [],
      selectData: {},
      typeID: undefined,
      expandedKeys: [],
      selectedKeys: [],
      treeSelectData: {},
      treeData: [],
      templateName: '', // 模板名称
      autoExpandParent: true,
      formData: [],
      rowData: {},
      saveLoading: false,
      transferVisible: false,
      modalExamListID: undefined,
      defaultSelectedKeys: '', // 修改跳转标识
    }
  }

  componentDidMount() {
    this.props.onRef && this.props.onRef(this);
  }

  // 修改弹窗状态
  modifyVisible = (visible, templateParams = [], treeSelectData = {}, defaultSelectedKeys) => {
    let { selectData, typeID } = this.state;
    if (defaultSelectedKeys) {
      this.setState({
        selectedKeys: [defaultSelectedKeys],
        sampleTemplateName: treeSelectData?.examTempDesc || '',
        expandedKeys: [treeSelectData?.examListID || ''],
      }, () => {
        this.handleLoadingMedicalRecordTemplate();
      });
    }
    this.setState({ visible, treeSelectData, defaultSelectedKeys }, () => {
      if (visible) {
        if ((templateParams && templateParams.length > 0) && !defaultSelectedKeys) {
          this.setState({ templateParams }, () => {
            this.handleMedicalRecordLoading();
          })
        }
        if (JSON.stringify(selectData) === '{}') {
          this.getSelectData(defaultSelectedKeys ? 'N' : 'Y');
        }
        if (typeID) {
          this.getTreeData(defaultSelectedKeys ? 'N' : 'Y');
        }
      } else {
        this.setState({ sampleTemplateName: undefined, templateName: '', selectedKeys: [] });
      }
    });
  }

  // 获取范例病历类型
  getSelectData = async (isDefaultKey) => {
    try {
      let res = await React.$asyncPost(this, '06050100');
      this.setState({ selectData: res.result, typeID: res.result?.defaultExamListTypeID || this.state.typeID }, () => {
        this.getTreeData(isDefaultKey);
        this.getFormData();
      });
    } catch (error) {
      console.log(error)
    }
  }

  // 获取明细表头数据
  getFormData = async () => {
    try {
      let data = {
        params: [{
          compontName: 'AddSampleTemplate',
          type: 'C',
        }]
      }
      let res = await React.$asyncPost(this, '01040073', data);
      // 表单操作数据
      let formData = res.result?.formData || [];
      this.setState({ formData });
    } catch (error) {
      this.setState({ formData: [] });
    }
  }

  // 加载病历
  handleMedicalRecordLoading = () => {
    let { treeSelectData, templateParams } = this.state;
    this.caseTemplateChild && this.caseTemplateChild.handleLoadXML(treeSelectData.xml, 'Y', templateParams);
  }

  // 模板查询
  getTreeData = async (isDefaultKey, isSave) => {
    try {
      const { typeID, treeSelectData } = this.state;
      let data = {
        params: [{
          examListType: typeID, // 主表ID
          groupTemplateID: treeSelectData?.wTempCataID || treeSelectData?.ID,
          templateID: treeSelectData?.examTemplateID || treeSelectData?.templateID || '',
        }]
      }
      let res = await React.$asyncPost(this, '06050104', data);
      let treeData = this.filterTreeData(res.result?.examListData || []);
      if (isDefaultKey !== 'N' && treeData && treeData.length > 0) {
        let selectedKeys = [];
        selectedKeys.push(treeData[0].examListID);
        this.setState({ selectedKeys, treeSelectData: { ...this.state.treeSelectData, ...treeData[0] } }, () => {
          isSave === 'Y' ? this.handleSave() : '';
        });
      }
      this.setState({ treeData }, () => {
        this.generateList(this.state.treeData);
      });
    } catch (error) {
      this.setState({ saveLoading: false });
    }
  }

  // 处理tree数据
  filterTreeData = (treeData, oldItem, isChild) => {
    let data = treeData && treeData.map(item => {
      return {
        title: isChild === 'Y' ? item.examTempDesc : item.examListDesc,
        key: isChild === 'Y' ? (item.examListID + '-' + item.examTempID) : item.examListID,
        ID: isChild === 'Y' ? (item.examListID + '-' + item.examTempID) : item.examListID,
        treeType: item && item.treeType ? item.treeType : (item && 'examListSubData' in item ? 'CATALOG' : 'TEMPLATE'),
        ...item,
        ...oldItem,
        children: this.filterTreeData(item.examListSubData, item && item.treeType && item.treeType === 'TEMPLATE' ? item : {}, 'Y')
      }
    });
    return data;
  }

  dataList = []; // 病历模板
  generateList = (data) => {
    for (let i = 0; i < data.length; i++) {
      const node = data[i];
      const key = node.key;
      this.dataList.push({ key, title: node.title });
      if (node.children) {
        this.generateList(node.children);
      }
    }

    // 默认进来tree全部加载
    // let treeData = this.state.treeData;
    // let dataList = this.dataList;
    // const expandedKeys = dataList.map((item) => {
    //   return this.getParentKey(item.key, treeData);
    // }).filter((item, i, self) => item && self.indexOf(item) === i);
    // this.setState({
    //   // expandedKeys,
    // });
  }

  getParentKey = (key, tree) => {
    let parentKey;
    for (let i = 0; i < tree.length; i++) {
      const node = tree[i];
      if (node.children) {
        if (node.children.some(item => item.key === key)) {
          parentKey = node.key;
        } else if (this.getParentKey(key, node.children)) {
          parentKey = this.getParentKey(key, node.children);
        }
      }
    }
    return parentKey;
  }

  // 类型切花
  handleTypeChange = e => {
    this.setState({
      typeID: e.target.value
    }, () => {
      this.getTreeData('N');
    })
  }

  // 目录操作菜单
  getOperationMenu = (item, index, data) => {
    let dataLen = data?.length - 1 || 0;
    if (item.treeType === 'CATALOG') {
      return (
        <Menu>
          {/* <Menu.Item>
            <span>前移</span>
          </Menu.Item>
          <Menu.Item>
            <span>后移</span>
          </Menu.Item> */}
          <Menu.Item>
            <span onClick={() => this.handleModify(item)}>编辑分类</span>
          </Menu.Item>
          {/* <Menu.Item>
            <span>删除</span>
          </Menu.Item> */}
        </Menu>
      )
    } else { // 模板操作菜单
      return (
        <Menu>
          <Menu.Item>
            <span
              style={{
                cursor: index === 0 ? 'no-drop' : 'pointer',
                color: index === 0 ? '#999' : '#000000a6'
              }}
              onClick={index === 0 ? '' : () => this.handleMove(item, 'up')}
            >
              前移
            </span>
          </Menu.Item>
          <Menu.Item>
            <span
              style={{
                cursor: index === dataLen ? 'no-drop' : 'pointer',
                color: index === dataLen ? '#999' : '#000000a6'
              }}
              onClick={index === dataLen ? '' : () => this.handleMove(item, 'down')}
            >
              后移
            </span>
          </Menu.Item>
          <Menu.Item>
            <span onClick={() => this.handleTransferClassification(item)}>转移分类</span>
          </Menu.Item>
          <Menu.Item>
            <span onClick={() => this.handleModifyTemplate(item)}>修改模板</span>
          </Menu.Item>
          <Menu.Item>
            <span onClick={() => this.handleDelete(item)}>删除</span>
          </Menu.Item>
        </Menu>
      )
    }
  }

  // 移动
  handleMove = async (item, type) => {
    try {
      let data = {
        params: [{
          examTempID: item?.examTempID || '',
          updown: type
        }]
      }
      let res = await React.$asyncPost(this, '06050108', data);
      message.success(res?.errorMessage || '操作成功');
      this.getTreeData('N');
    } catch (error) {
      console.log(error)
    }
  }

  // 转移分类
  handleTransferClassification = (item) => {
    this.setState({ transferRowData: item }, () => {
      this.modifyTransferVisible(true);
    })
  }

  // 确认转移分类
  handleConfirmTransfer = async () => {
    try {
      const { transferRowData, modalExamListID } = this.state;
      let data = {
        params: [{
          examListID: modalExamListID,
          examTempID: transferRowData?.examTempID || ''
        }]
      }
      let res = await React.$asyncPost(this, '06050103', data);
      message.success(res?.errorMessage || '转移分类成功');
      this.setState({ transferVisible: false }, () => {
        this.getTreeData('N');
        this.setState({ modalExamListID: undefined });
      })
    } catch (error) {
      console.log(error)
    }
  }

  // 修改模板
  handleModifyTemplate = (item) => {
    let ID = item && item.ID ? item.ID : '';
    this.setState({ selectedKeys: [ID], treeSelectData: { ...this.state.treeSelectData, ...item }, sampleTemplateName: item?.examTempDesc || '' }, () => {
      this.handleLoadingMedicalRecordTemplate();
    });
  }

  // 删除
  handleDelete = (item) => {
    Modal.confirm({
      title: '删除（' + item.examTempDesc + '）提醒',
      content: '删除后不可恢复，您确定要删除吗???',
      okText: '取消',
      cancelText: '确定',
      onOk: () => { },
      onCancel: () => this.handleConfirmDetele(item),
    });
  }

  // 确认删除
  handleConfirmDetele = async (item) => {
    try {
      const { userData, treeSelectData } = this.state;
      let data = {
        params: [{
          userID: userData?.userID || '', // 用户ID
          examTempID: item?.examTempID || ''
        }]
      }
      let res = await React.$asyncPost(this, '06050107', data);
      message.success(res?.errorMessage || '删除成功');
      this.getTreeData(treeSelectData?.examTempID === item?.examTempID ? 'Y' : 'N');
    } catch (error) {
      console.log(error)
    }
  }

  renderTreeNodes = data => data.map((item, currentIndex, data) => {
    let { selectedKeys, currentMouseOverTreeID } = this.state;
    const index = item.title.indexOf(this.state.templateName);
    const beforeStr = item.title.substr(0, index);
    const afterStr = item.title.substr(index + this.state.templateName.length);
    const title = index > -1 ? (
      <div
        className="flex-between-center ast-tree-title"
        onMouseOver={() => this.handleTreeMouseOver(item)}
      >
        <span>
          {beforeStr}
          <span style={{ color: '#FF7F00' }}>{this.state.templateName}</span>
          {afterStr}
        </span>
        {currentMouseOverTreeID === item.ID || (selectedKeys && selectedKeys.length > 0 && selectedKeys[0] === item.ID) ? (
          <Dropdown placement="bottomRight" overlay={() => this.getOperationMenu(item, currentIndex, data)}>
            <Icon type="menu" />
          </Dropdown>
        ) : ''}
      </div>
    ) : (
      <div
        className="flex-between-center ast-tree-title"
        onMouseOver={() => this.handleTreeMouseOver(item)}
      >
        {item.title}
        {currentMouseOverTreeID === item.ID || (selectedKeys && selectedKeys.length > 0 && selectedKeys[0] === item.ID) ? (
          <Dropdown placement="bottomRight" overlay={() => this.getOperationMenu(item, currentIndex, data)}>
            <Icon type="menu" />
          </Dropdown>
        ) : ''}
      </div>
    );
    let type = item.treeType === 'CATALOG' ? 'folder-open' : (item.treeType === 'TEMPLATE' ? 'folder' : 'file');
    if (item.children) {
      return (
        <TreeNode icon={<Icon type={type} />} title={title} key={item.key} dataRef={item}>
          {this.renderTreeNodes(item.children)}
        </TreeNode>
      );
    }
    return <TreeNode icon={<Icon type={type} />} title={title} key={item.key} dataRef={item} />;
  })

  // 鼠标移入事件
  handleTreeMouseOver = item => {
    this.setState({ currentMouseOverTreeID: item?.ID || '' })
  }

  onExpand = (expandedKeys) => {
    this.setState({
      expandedKeys,
      autoExpandParent: false,
    });
  }

  handleTemplateNameChange = e => {
    const templateName = e.target.value;
    let dataList = this.dataList;
    let treeData = JSON.parse(JSON.stringify(this.state.treeData));
    const expandedKeys = dataList.map((item) => {
      if (templateName.length === 0) return null;
      if (item.title && item.title.indexOf(templateName) > -1) {
        return this.getParentKey(item.key, treeData);
      }
      return null;
    }).filter((item, i, self) => item && self.indexOf(item) === i);
    this.setState({
      expandedKeys: expandedKeys && expandedKeys.length > 0 ? expandedKeys : [],
      templateName: e.target.value,
      autoExpandParent: true,
    });
  }

  // 病历模板树选中操作
  onSelect = (keys, event) => {
    if (!(keys && keys.length > 0)) {
      return;
    }
    let selectData = event.node.props.dataRef;
    if (selectData && !(selectData.treeType === 'CATALOG')) { // 树类型不为CATALOG时不给予选中及其他操作
      return;
    }
    this.setState({ selectedKeys: keys, treeSelectData: { ...this.state.treeSelectData, ...selectData } });
  }

  dblclickTreeNodes = (status, record) => {
    let selectData = record.props.dataRef;
    let treeType = selectData?.treeType || '';
    // if (selectData && !(selectData.treeType === 'CATALOG')) { // 树类型不为CATALOG时不给予选中及其他操作
    //   return;
    // }
    let ID = selectData && selectData.ID ? selectData.ID : '';
    this.setState({ selectedKeys: [ID], treeSelectData: { ...this.state.treeSelectData, ...selectData } }, () => {
      if (treeType === 'TEMPLATE') {
        this.setState({ sampleTemplateName: selectData?.examTempDesc || '' });
        this.handleLoadingMedicalRecordTemplate();
      }
    });
  }

  // 记录表单的值
  recordFormInput = record => {
    this.setState({ rowData: { ...this.state.rowData, ...record } })
  }

  // 获取病历相关数据
  handleLoadingMedicalRecordTemplate = async () => {
    try {
      let { recordData, treeSelectData, titleData } = this.state;
      if (treeSelectData.examTempID === undefined) return;
      let data = {
        params: [{
          patEMRRecordID: '',
          admID: this.props && this.props.historyAdmID ? this.props.historyAdmID : (recordData && recordData.admID ? recordData.admID : ''),
          groupTemplateID: treeSelectData?.examTemplateID || '',
          power: this.props.medicalType == 'Z' ? 'OutHospRecord' : '',
          examTempID: treeSelectData.examTempID
        }]
      }
      let res = await React.$asyncPost(this, '06050106', data);
      let templatePath = res.result && res.result.templatePath ? res.result.templatePath : '';
      let progressID = treeSelectData && treeSelectData.progressID ? treeSelectData.progressID : ''; // 病程记录ID
      let templateParams = [templatePath, res.result.dataSource, 'N', 'boolFalse', titleData && titleData.patSexDesc ? titleData.patSexDesc : '', { ...treeSelectData, releaseVersion: treeSelectData.examTempVerID }, treeSelectData.examTemplateID, progressID];
      this.caseTemplateChild && this.caseTemplateChild.setElementTextByID(...templateParams);
    } catch (error) {
      console.log(error)
    }
  }

  // 保存
  handleFormSave = async (values, isDefaultKey) => {
    try {
      let { rowData, treeSelectData } = this.state;
      let data = {
        params: [{
          ...values,
          examListID: rowData?.examListID || '',
          templateID: treeSelectData?.examTemplateID || treeSelectData?.templateID || ''
        }]
      }
      let res = await React.$asyncPost(this, '06050101', data);
      isDefaultKey === 'Y' ? '' : message.success(res.errorMessage || '保存成功'); // 自动保存不提示
      this.modalFormRef && this.modalFormRef.modifyVisible(false, 'Y');
      this.getTreeData(isDefaultKey === 'Y' ? 'Y' : 'N', isDefaultKey);
    } catch (error) {
      console.log(error)
    }
  }

  // 新建分类
  handleAdd = () => {
    let { rowData, typeID } = this.state;
    if (rowData && rowData.examListID) {
      rowData = { examListType: typeID };
    } else {
      rowData = { ...rowData, examListType: typeID };
    }
    this.setState({ rowData }, () => {
      this.modalFormRef && this.modalFormRef.modifyVisible(true);
    })
  }

  handleModify = (item) => {
    this.setState({ rowData: item }, () => {
      this.modalFormRef && this.modalFormRef.modifyVisible(true);
    })
  }

  // 保存
  handleSave = async () => {
    this.setState({ saveLoading: true });
    try {
      let { sampleTemplateName, selectedKeys, typeID, treeSelectData, expandedKeys, defaultSelectedKeys, treeData } = this.state;
      if (!(selectedKeys && selectedKeys.length > 0)) {
        if (!(treeData && treeData.length > 0)) {
          this.handleFormSave({
            examListDesc: '未指定分类',
            examListType: typeID
          }, 'Y')
        } else {
          this.setState({ saveLoading: false });
          message.error('请选择目录保存');
        }
        return;
      }
      if (!sampleTemplateName) {
        message.error('范例病历名称不能为空，请录入后再保存');
        this.setState({ saveLoading: false });
        return;
      }
      let templateData = this.caseTemplateChild && this.caseTemplateChild.getTemplateXml ? this.caseTemplateChild.getTemplateXml('form') : {};
      if (!(templateData && templateData.status)) {
        this.setState({ saveLoading: false });
        return;
      }
      let data = {
        params: [{
          examListType: typeID,
          examTempDesc: sampleTemplateName,
          examTempID: treeSelectData?.examTempID || '',
          examListID: treeSelectData?.examListID || selectedKeys[0],
          examTempDataSource: this.caseTemplateChild && this.caseTemplateChild.getMedicalRecordFileIDAndValue(),
          recordData: templateData && templateData.xmlStr ? templateData.xmlStr : '', // 病历记录数据 --- 模板xml
          examTempRecDataID: templateData && templateData.allRecordID ? templateData.allRecordID : [], // 病历记录数据 --- 病程记录ID
          examTempVerID: treeSelectData?.examTempVerID || treeSelectData?.eMRReleaseVersion || treeSelectData?.releaseVersion || '', // 病历版本ID
          examTempCataLogID: treeSelectData?.examTempCataLogID || treeSelectData?.wTempCataID || treeSelectData?.ID || '', // 分组目录ID
          templateID: treeSelectData?.examTemplateID || treeSelectData?.templateID || ''
        }]
      }
      let res = await React.$asyncPost(this, '06050102', data);
      let examTempID = res.result?.examTempID || '';
      message.success(res.errorMessage || '保存成功');
      this.setState({ saveLoading: false, selectedKeys: [treeSelectData?.examListID + '-' + examTempID], treeSelectData: { ...this.state.treeSelectData, examTempID }, expandedKeys: [...expandedKeys, treeSelectData?.examListID] });
      this.getTreeData('N');
      if (defaultSelectedKeys) {
        this.modifyVisible(false);
        this.props.handleGoToQuote && this.props.handleGoToQuote(treeSelectData?.examTempID || '');
      }
    } catch (error) {
      this.setState({ saveLoading: false });
    }
  }

  // 转移分类弹窗
  modifyTransferVisible = visible => {
    this.setState({ transferVisible: visible });
  }

  // 获取转移分类下拉数据
  getExamListSelectData = (selectData) => {
    const { transferRowData } = this.state;
    let examListSelectData = JSON.parse(JSON.stringify(selectData));
    for (var i = 0; i < examListSelectData.length; i++) {
      if (examListSelectData[i].examListID === transferRowData?.examListID) {
        examListSelectData[i].disabled = 'Y';
      }
    }
    return examListSelectData;
  }

  render() {
    const { visible, selectData, templateName, typeID, treeData, expandedKeys, selectedKeys, autoExpandParent, sampleTemplateName, treeSelectData, formData, rowData, saveLoading, transferVisible, modalExamListID,
    } = this.state;

    let param = {
      isDelete: false,
      setChapter: 'show',
      isInsert: 'hidden',
      formView: 'Normal',
      saveBtnFlag: true,
      headerFooterEditable: 'noEditable',
      isFont: true,
      isAllElection: true,
      isClearFormat: true,
      isSetTemplateSize: true,
      isSaveAnother: true,
      comments: true,
      isShear: true,
      isReload: false,
      self: false,
      original: false,
      isBindingKnowledgeBase: true,
      updateMedicalRecordLockStatus: false, // 解锁按钮操作状态
      isBasicOperation: false
    }

    return (
      <div>
        <Modal
          width="1200px"
          title={'范例病历' + (treeSelectData && (treeSelectData.templateDesc || treeSelectData.examTempDesc) ? '（' + (treeSelectData?.templateDesc || treeSelectData?.examTempDesc || '') + '）' : '')}
          footer={false}
          visible={visible}
          className="add-sample-template"
          onCancel={() => this.modifyVisible(false)}
        >
          <div className="common-query-split-line" style={{ height: 2 }}></div>
          <Row>
            <Col span={7}>
              <div style={{ paddingRight: '6px', position: 'relative' }}>
                <Card
                  size="small"
                  className="ast-left-extra-btn"
                  bordered={false}
                  title={(
                    <div className="card-title-left-icon">
                      <div></div>
                      请选择保存位置
                    </div>
                  )}
                  extra={(
                    <Button
                      icon="plus"
                      type="link"
                      onClick={this.handleAdd}
                    >
                      新建分类
                    </Button>
                  )}
                >
                  <Input
                    value={templateName}
                    title="回车触发信息查询"
                    style={{ width: '100%' }}
                    placeholder="请输入名称后回车查询"
                    prefix={<Icon type="search" style={{ color: '#999' }} />}
                    onChange={this.handleTemplateNameChange}
                  />
                  <Radio.Group style={{ lineHeight: '32px' }} value={typeID} onChange={this.handleTypeChange}>
                    {selectData && 'examListType' in selectData && Array.isArray(selectData.examListType) ? selectData.examListType.map((item, index) => {
                      return <Radio value={item.id} key={index}>{item.descripts}</Radio>
                    }) : ''}
                  </Radio.Group>
                  <div
                    className="ast-tree"
                    style={{ height: 'calc(60vh - 24px)' }}
                  >
                    <Tree
                      showIcon
                      className="scroll-bar-style"
                      style={{ height: '100%', paddingRight: '6px', overflow: 'auto' }}
                      expandedKeys={expandedKeys}
                      selectedKeys={selectedKeys}
                      autoExpandParent={autoExpandParent}
                      onSelect={this.onSelect}
                      onExpand={this.onExpand}
                      onDoubleClick={this.dblclickTreeNodes}
                    >
                      {this.renderTreeNodes(treeData)}
                    </Tree>
                  </div>

                </Card>
                <div className='common-card-right-split-line' style={{ width: 6 }}></div>
              </div>
            </Col>
            <Col span={17}>
              <Card
                size="small"
                bordered={false}
                title={(
                  <div className="card-title-left-icon">
                    <div></div>
                    病历内容
                  </div>
                )}
                onMouseOver={() => this.handleTreeMouseOver({})}
              >
                <div className="ast-content" style={{ marginBottom: 6 }}>
                  <span className="formRequired">范例病历名称：</span>
                  <Input
                    value={sampleTemplateName}
                    style={{ width: '300px', marginRight: '24px' }}
                    placeholder="请输入模板名称"
                    className="common-query-input"
                    onChange={e => this.setState({ sampleTemplateName: e.target.value })}
                  />
                  <Button
                    type="primary"
                    loading={saveLoading}
                    onClick={this.handleSave}
                  >
                    {treeSelectData && 'examTempID' in treeSelectData && treeSelectData.examTempID ? '确认修改' : '保存'}
                  </Button>
                </div>
                <div style={{ height: '60vh' }}>
                  {visible ? (
                    <ElectronicCaseTemplate
                      param={param}
                      editorID="addSampleTemplate"
                      onRef={ref => this.caseTemplateChild = ref}
                      handleSave={() => { }}
                    />
                  ) : ''}
                </div>
              </Card>
            </Col>
          </Row>
        </Modal>

        {/* 主表新增弹窗 */}
        <PublicModalFormHooks
          title="新建分类"
          idField='examListID'
          formData={formData}
          rowData={rowData}
          selectData={selectData}
          onRef={ref => this.modalFormRef = ref}
          recordFormInput={this.recordFormInput}
          handleSave={this.handleFormSave}
        />

        <Modal
          width="800px"
          title="转移分类"
          visible={transferVisible}
          onOk={this.handleConfirmTransfer}
          onCancel={() => this.modifyTransferVisible(false)}
        >
          <div style={{ minHeight: '120px' }}>
            选择分类：<Select
              allowClear
              showSearch
              optionFilterProp="seachprop"
              placeholder="请选择"
              value={modalExamListID}
              onChange={Util.handleSelectChange.bind(this, 'modalExamListID')}
              style={{ width: '90%' }}
            >
              {React.$SelectOptions(this.getExamListSelectData(treeData), 'examListID', 'examListDesc')}
            </Select>
          </div>
        </Modal>
      </div>
    )
  }
};

export default AddSampleTemplate;