/*
 * Creator:     ML
 * CreatDate:   2019-10-09
 * descripts： 科室评估单配置 明细
 * */
import React from 'react';
import moment from 'moment';
import { Form, Row, Col, Input, Table, Select, DatePicker, Button, Modal, message, Divider, Tooltip, Icon, Card, Checkbox, Radio, Badge, Fragment, Pagination, Popconfirm, Switch } from 'antd';
import { $http } from '../../../containers/config/https';
import store from '../../../store';
import CommonPagination from 'components/pagination/index';


const paddRightCol = {
  paddingRight: "0px"
}
const formItemLayoutType = {
  labelCol: { span: 9 },
  wrapperCol: { span: 15 }
}
const FormItem = Form.Item;
const Option = Select.Option;
const DepAssDetailed = Form.create()(
  class DepAssDetailed extends React.Component {
    cacheOriginData = {};
    constructor() {
      super()
      this.state = {
        leftData: [],//左边查询到的表格数据
        rightData: [],//右边双击后的表格数据
        rightUnitDr: [],
        findInfo: '请输入查询条件',//查询提示信息
        isMod: -1,//是否点击编辑
        ordTempletID: "",//编辑行id
        ordTempletDesc: "",//模板名称
        ordTempletAlias: "",//模板别名
        ordTempletCat: "",//医嘱分类
        rowId: "",//表格行id 设置颜色
        ordShow: false,//当前模板显示
        baseParentType: [],//添加医嘱大类表维护类型选择  上级分类
        baseUnit: [],//添加医嘱明细单位类型选择
        selectedData: [],//医嘱明细选中
        selectedId: [],//医嘱明细选中
        tempChildDis: false,//左侧编辑 选择类型
        selectrow: "",//获取行 当前选中行
        deteleOrdId: "",//选中删除行
        leftDisRow: false,
        ordTempId: 1,//医嘱大类选择值
        isAdd: false,//是否点击添加
        ordDetailValue: "",//医嘱明细输入值
        ordDetailData: [],//医嘱项表格数据
        OrdDaShow: false,//医嘱项表格数据显隐
        OrdDaRowId: "",//医嘱项表格行id
        OrdCanType: "",//医嘱项允许录入类型
        ordTemPrice: 0,//医嘱项行单价
        editDis: true,//未选中

        nowRowID: "",//医嘱明细表格行id

        initRored: {},//原始右侧表格行
        ordTempletDetailItemDesc: "",
        ordTempletDetailQty: "",
        ordTempletDetailQtyUnitDr: "",
        ordTempletDetailID: "",
        disAdd: false,//是否可新增
        newOpen: [],


        searchCategoryName: "",//输入左侧搜索分类名称
        checkAll: false,//左侧全选
        checkedList: [],//左侧可选项
        plainOptions: [],
        rightTopTableData: [],//右上小表格数据
        cbiD: "",//自定义分类 区分触发场景
        radioValue: 0,//
        rowRightId: "",//右上小表格选中
        leftInfo: {},//左侧信息回显
        rightSearchInfo: "",//右侧搜索
        canDeleteStatus: true,//能否点击删除


        // 左侧表格
        checked: true,//默认选择生效
        total: 0,//医嘱项表格总数据
        page: 1,//页数
        pageSize: 10,//显示数
        //右侧表格
        totalRight: 0,
        pageRight: 1,
        pageSizeRight: 50,
        checkedRight: true,
        baseTempType: [],//添加医嘱大类表维护类型选择
        topInfo: {},
        centerInfo: {},
        isDefalult: false,
        canSave: true,
        rowIds: "",
        visible: false,
        btnStatus: true,
        canSaveStatus: true,//能否保存
        selectedRowKeys_right: [],//右侧勾选中行
        selectedRow_right: [],
        size: "large",
        search:""
      }
      this.detailDeInput = React.createRef();
    }
    componentDidMount = () => {
      this.props.onDetail(this)
      // 初始化设置table的高度以及表体的高度
      if (document.querySelector('.ant-table-body')) {
        document.querySelector('.ant-table-body').style.height = store.getState().tableHeight.y + 'px'
      }
      this.getLocTypeSelect()
      // this.getSize()
    }
    getSize=()=>{
      if(this.state.size=="small"){
        this.setState({
          pageSizeRight:10
        })
      }else{
        this.setState({
          pageSizeRight:50
        })
      }
    }

    //获取字段
    getFileArr = (fileArr) => {
      // debugger
      this.setState({
        fileArr
      })
    }
    //获取科室  字段  类型下拉框
    getLocTypeSelect = () => {
      let data = {}
      data = {
        params: [{
          userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
          hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
          locFlag: "N",
          fileFlag: "Y"
        }],
      }
      $http.post('urlS', this, {
        code: '03040029',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0 && res.result) {
            let arr = res.result.fileList && res.result.fileList.map((item, index) => {
              res.result.fileList[index].key = Number(index)
            })
            this.setState({
              fileArr: res.result.fileList
            })
          } else {

          }
        }
      })
    }
    getLast = (status, id) => {
      //定位到最后一条
      if (id) {
        let lastPage = Math.ceil((this.state.total + 1) / this.state.pageSize)
        this.setState({
          page: lastPage,
          rowId: id,
        })
        this.handleQuery(status)
        return
      }
    }
    //右侧
    // 显示分页总条数
    showTotalRight(total) {
      return `共 ${total} 条`;
    }
    // 页码改变的回调，参数是改变后的页码及每页条数
    PageChangeRight = (e) => {
      this.setState({ pageRight: e, pageSizeRight: this.state.pageSizeRight }, () => {
        // 重新调用查询方法
        this.getDetail(this.state.HBRVLSid)
      });
    }
    //下拉选择页数
    onShowSizeChangeRight = (page, pageSize) => {
      this.setState({ pageRight: 1, pageSizeRight: pageSize }, () => {
        // 重新调用查询方法
        this.getDetail(this.state.HBRVLSid,)
        this.setState({
          search:"search"
        })
      })
    }
    //点击是否生效
    changeChecked = (e) => {
      this.setState({
        checked: e.target.checked,
        page: 1,
        pageSize: 10
      }, () => {
        this.handleQuery()
      })
    }
    //点击是否生效 --右侧
    changeCheckedRight = (e) => {
      this.setState({
        checkedRight: e.target.checked,
        pageRight: 1,
        pageSizeRight: 50
      }, () => {
        this.getDetail(this.state.HBRVLSid)
      })
    }
    //取消时 重置状态
    initHBRVLSid = () => {
      this.setState({
        HBRVLSid: ""
      })
    }
    initPagination = () => {
      this.setState({
        pageRight: 1,
        pageSizeRight: 50
      })
    };
    //根据评估单科室列表id获取明细
    getDetail = (recordId, datas,e) => {
      let { pageRight, pageSizeRight } = this.state;
      this.setState({
        HBRVLSid: recordId,
        // rowIds: ""
      })
      if (datas && datas) {
        this.setState({
          record: datas
        })
      }
      let data = {}
      data = {
        params: [{
          userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
          hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
          groupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : "",
          HBRVLSid: recordId,
          active: this.state.checkedRight == true ? "Y" : " "
        }],
        pagination: [{
          pageSize: parseInt(pageSizeRight),
          currentPage: parseInt(pageRight),
        }]
      }
      $http.post('urlS', this, {
        code: '03040026',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0 && res.result.data) {
            res.result.data.map((item, i) => {
              res.result.data.key == Number(i)
            })
            this.setState({
              rightData: res.result.data,
              totalRight: res.result.totalCount,
            })
          }
          //  if (res.result.data && res.result.data.length == 0 && res.result.totalCount > 0) {
          //   let prevPage = this.state.page - 1
          //   this.onChangeRight(prevPage, this.state.pageSize)
          // }
        }
      })
    }

    //返回添加状态
    initOrigin = () => {
      this.setState({
        rowId: "",
        rowIds: "",
        isDefalult: false,
        centerInfo: {},
        rightData: []
      })
      this.props.form.resetFields()
    }
    //设置点击row颜色 --左侧表格
    setRowClassName = (record) => {
      return record.HBRVLSid === this.state.rowId ? 'clickRowStyle' : '';
    }

    //点击是否设置为默认
    handleSwithChange = (v) => {
      this.setState({
        isDefalult: v
      })
    }
    //是否默认
    onChangeSwith = (v, record) => {
      let flag = v == true ? "Y" : "N"
      this.state.rightData.map((item, i) => {
        if (record.id == item.id) {
          item.required = flag
        }
      })
      this.handleSave()
    }
    //点击右侧表格行
    onClickRightRow = (record) => {
      // const { rightData } = this.state
      // return {
      //   onClick: () => {
      //     // this.setState({
      //     //   centerInfo: {},
      //     //   isDefalult: false,
      //     // })
      //     // this.getPublicLocSelect(record.id)
      //     // this.props.form.resetFields();
      //     if (record.id) {
      //       if (this.state.rowIds === "") {
      //         this.setState({
      //           rowIds: record.id,
      //           centerInfo: record,
      //           isDefalult: record.required == "Y" ? true : false
      //         });
      //         //   this.getDetail(record.HBRVLSid)
      //       } else {
      //         if (this.state.rowIds !== record.id) {
      //           this.setState({
      //             rowIds: record.id,
      //             centerInfo: record,
      //           });
      //           // this.getDetail(record.HBRVLSid)
      //         } else {
      //           this.setState({
      //             rowIds: "",
      //             centerInfo: {},
      //             isDefalult: false
      //             //   ordShow:false
      //           });
      //           this.props.form.resetFields()
      //         }
      //       }
      //     }
      //   },
      // }
    }
    //点击右侧医院选项过滤开单科室
    handleHosp = (e, id) => {
      this.props.form.setFieldsValue({ getOpenLoc: undefined, getLoc: undefined })
      this.getPublicLocSelect(id)
    }
    setRowClassNames = (record) => {
      // return record.id === this.state.rowIds ? 'clickRowStyle' : '';

    }
    handleLeftOk = () => {
      this.props.form.validateFields((err, values) => {

      })
    }
    handleRightCancel = () => {
      this.setState({
        visible: false
      })
      // this.setState({
      //   centerInfo: {},
      //   visible:false
      // })
      // this.props.form.resetFields()
    }
    //单个保存
    handleRightOk = () => {
      const { HBRVLSid, isDefalult } = this.state
      this.props.form.validateFields((err, values) => {
        if (!err) {
          let data = {}
          data = {
            params: [{
              userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
              hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
              groupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : "",
              HBRVLSid: HBRVLSid,
              files: [
                {
                  id: this.state.rowIds && this.state.rowIds ? this.state.rowIds : "",
                  startDate: values.startDate ? moment(values.startDate).format('YYYY-MM-DD') : "", // 生效日期
                  stopDate: values.stopDate ? moment(values.stopDate).format('YYYY-MM-DD') : "",// 失效日期
                  seqNo: "",
                  fileID: values.fileID,
                  required: isDefalult == true ? "Y" : "N",
                }]
            }],
          }
          $http.post('urlS', this, {
            code: '03040024',
            data: data,
            success: function (res) {
              if (+res.errorCode === 0) {
                if (this.state.rowIds) {
                  message.success("修改成功")
                  if ((values.startDate && values.startDate) && (values.stopDate && values.stopDate)) {
                    if (moment(values.stopDate).format('YYYYMMDD') < moment().format('YYYYMMDD')) {
                      this.setState({
                        checkedRight: false,
                        isDefalult: false,
                        visible: false
                      })
                      this.getDetail(HBRVLSid)
                      return
                    }
                  }
                  this.setState({
                    checkedRight: true,
                    visible: false
                  })
                  this.getDetail(this.state.HBRVLSid)
                } else {
                  message.success("添加成功")
                  this.props.form.resetFields()
                  this.setState({
                    isDefalult: false,
                    visible: false
                  })
                  if ((values.startDate && values.startDate) && (values.stopDate && values.stopDate)) {
                    if (moment(values.stopDate).format('YYYYMMDD') < moment().format('YYYYMMDD')) {
                      this.setState({
                        checkedRight: false,
                        visible: false
                      })
                      this.getDetail(this.state.HBRVLSid)
                      return
                    }
                  }
                  this.setState({
                    checkedRight: true,
                  })
                  this.getDetail(this.state.HBRVLSid)
                }
              }
            }
          })
        }
      })
    }
    //多个保存
    handleSave = () => {
      const { HBRVLSid, isDefalult, rightData } = this.state
      let data = {}
      rightData.map((item, i) => {
        item.seqNo = Number(i)
      })
      data = {
        params: [{
          userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
          hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
          groupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : "",
          HBRVLSid: HBRVLSid,
          files: rightData,
        }],
      }
      $http.post('urlS', this, {
        code: '03040024',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0) {
            message.success("设置完成")
            this.setState({
              selectedRowKeys_right: [],
              btnStatus: true,
              canSaveStatus: true,
              disAdd: false,
              rowId: ""
            })
            this.getDetail(this.state.HBRVLSid)
          }
        }
      })
    }
    canSave = () => {
      this.setState({
        canSave: false
      })
    }
    handleTemDaCancel = () => {
      this.setState({
        OrdDaShow: false
      })
    }
    //编辑评估单明细
    handleEdit = (e, record) => {
      this.setState({
        isMod: 1,
        visible: true,
        rowIds: record.id,
        centerInfo: record,
        isDefalult: record.required == "Y" ? true : false
      })
    }
    //删除评估单明细
    delate = (e, record) => {
      // debugger
      let data = {}
      let idArr = []
      idArr.push(String(record.id))
      data = {
        params: [{
          userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
          hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
          groupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : "",
          id: idArr,
        }],
      }
      $http.post('urlS', this, {
        code: '03040025',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0) {
            message.success("删除成功")
            this.getDetail(this.state.HBRVLSid)
          }
        }
      })
    }
    //新增评估单明细
    addOrd = () => {
      this.setState({
        isMod: -1,
        rowIds: "",
        visible: true,
        centerInfo: {}
      })
      this.props.form.resetFields()
    }
    //删除多个评估单明细
    handleDetele = () => {

      const { selectedRow_right } = this.state
      let arr = []
      if (selectedRow_right && selectedRow_right.length > 0) {
        selectedRow_right.map(item => {
          arr.push(item.id)
        })
        let data = {
          params: [{
            userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
            hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
            groupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : "",
            id: arr,
          }]
        }
        $http.post('urlS', this, {
          code: '03040025',
          data: data,
          success: function (res) {
            if (+res.errorCode === 0) {
              message.success('删除成功');
              this.setState({
                selectedRowKeys_right: [],
                btnStatus: true,
                canSaveStatus: true,
                disAdd: false
              })
              //获取评估单明细
              this.getDetail(this.state.HBRVLSid)
            }
          },
          error: function (error) {
            message.error('删除失败：' + error);
          }
        })
      }
    }
    //移动评估单明细  上移
    handleMoveUp = () => {
      var keys = this.state.selectedRowKeys_right
      var data = this.state.rightData
      var newKeys = []
      keys = keys.sort(function (m, n) {
        if (m < n) return -1
        else if (m > n) return 1
        else return 0
      });
      for (var i = 0; i < keys.length; i++) {
        if (keys[i] === 0) {
          newKeys.push(keys[i])
          message.warn('已经到顶了，无法再移动！')
          return
        }
        var curRowData = data[keys[i]]
        var curRowKey = curRowData.key
        var upRowData = data[keys[i] - 1]
        var upRowKey = upRowData.key
        upRowData.key = curRowKey
        curRowData.key = upRowKey
        data[keys[i]] = upRowData
        data[keys[i] - 1] = curRowData
        newKeys.push(keys[i] - 1)
      }

      // console.log(data, newKeys)
      this.setState(
        {
          rightData: data,
          selectedRowKeys_right: newKeys
        }
      )
    }
    //移动评估单明细  下移
    handleMoveDown = () => {
      var keys = this.state.selectedRowKeys_right
      var data = this.state.rightData
      var newKeys = []
      keys = keys.sort(function (m, n) {
        if (m < n) return -1
        else if (m > n) return 1
        else return 0
      });
      for (var i = keys.length - 1; i >= 0; i--) {
        if (keys[i] === data.length - 1) {
          newKeys.push(keys[i])
          message.warn('已经到底了，无法再移动！')
          return
        }
        var curRowData = data[keys[i]]
        var upRowData = data[keys[i] + 1]
        var curRowKey = curRowData.key
        var upRowKey = upRowData.key
        upRowData.key = curRowKey
        curRowData.key = upRowKey
        data[keys[i]] = upRowData
        data[keys[i] + 1] = curRowData
        newKeys.push(keys[i] + 1)
      }
      this.setState(
        {
          rightData: data,
          selectedRowKeys_right: newKeys
        }
      )
    }
    //初始化信息
    initData = () => {
      this.setState({
        isMod: -1,
        ordShow: false,
        tempChildDis: false
      })
      this.props.form.setFieldsValue({ docMesName: undefined });
      this.props.form.setFieldsValue({ othName: undefined });
      this.props.form.setFieldsValue({ docMesType: undefined });
    }
    render() {
      const { getFieldDecorator } = this.props.form;
      let { plainOptions, baseParentType, baseTempType, baseUnit, tempChildDis, OrdDaShow, topInfo, centerInfo, HBRVLSid, record, visible } = this.state
      //右侧接收科室表格
      const rightColumns = [
        {
          align: "center",
          title: '字段ID',
          dataIndex: 'fileID',
          key: '0',
        },
        {
          align: "center",
          title: '描述',
          dataIndex: 'fileDesc',
          key: '0',
        }, {
          align: "center",
          title: '状态',
          dataIndex: 'status',
          key: '4',
          editable: true,
          render: (value, row, index) => {
            if (value == "Y") {
              return (
                "生效"
              )
            } else {
              return (
                "失效"
              )
            }
          },
        },
        {
          align: "center",
          title: '是否必填',
          dataIndex: 'required',
          key: '5',
          editable: true,
          render: (text, record, index) => {
            return (
              <Switch checkedChildren="是" unCheckedChildren="否" checked={record.required == "Y" ? true : false} onChange={(v) => { this.onChangeSwith(v, record) }} />
            )
          },
        },
        {
          title: '操作',
          dataIndex: '',
          key: '6',
          align: "center",
          width: 200,
          render: (text, record, index) => {
            return (
              <span>
                <span className='span' style={{ cursor: "pointer" }} onClick={(e) => this.handleEdit(e, record)}>编辑</span>
                {/* 分割线 */}
                <Divider type="vertical" />
                <Popconfirm title="删除不可恢复，你确定要删除吗?" onCancel={this.handlePopcon} onConfirm={(e) => this.delate(e, record)} >
                  <span className='span' style={{ cursor: "pointer" }} style={{ color: 'rgba(240,65,52,1)' }}>删除</span>
                </Popconfirm>
              </span>
            )


          }
        }
      ];
      const rowSelection_right = {
        selectedRowKeys: this.state.selectedRowKeys_right,
        onChange: (selectedRowKeys, selectedRows) => {
          // console.log("k", selectedRowKeys, selectedRows)
          let btnStatus = false;
          let canSaveStatus = false;
          let selectrow = "";
          if (selectedRowKeys.length === 0) {
            btnStatus = true;
            canSaveStatus = true;
          } else {
            selectrow = selectedRowKeys[selectedRowKeys.length - 1];
          }
          this.setState({ btnStatus: btnStatus, canSaveStatus: canSaveStatus, selectrow: selectrow, selectedRow_right: selectedRows, selectedRowKeys_right: selectedRowKeys });
        },
        onSelectAll: (selected, selectedRows, changeRows) => {
          if (selectedRows.length > 0) {
            this.setState({
              btnStatus: false,
              canSaveStatus: false,
            })
          } else {
            this.setState({
              btnStatus: true,
              canSaveStatus: true,
            })
          }
          this.setState({ selectedRow_right: selectedRows });
        }
      };

      //字段类型
      let fileOp = []
      this.state.fileArr && this.state.fileArr.map(item => {
        fileOp.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
      })

      return (
        <div>
          <div>
            <Card title="科室评估单及科室评估单明细列表" bordered={false} className="moreInfoCard" style={{ paddingRight: "0" }}>
              <div style={{ display: (HBRVLSid && HBRVLSid ? "none" : "block"), height: "48px", lineHeight: "48px", marginLeft: "20px" }}>
                <p>暂无明细项，请先添加模板或者选择左侧评估单列表</p>
              </div>
              <div style={{ display: (HBRVLSid && HBRVLSid ? "block" : "none"), height: "48px", lineHeight: "48px", background: "rgb(202, 227, 247)" }}>
                <span style={{ display: "inline-block", height: "38px", lineHeight: "38px", paddingLeft: "20px" }}>当前评估单：{record && record ? record.descripts : ""}<Divider style={{ background: "#9e9a9a" }} type="vertical" />{record && record ? record.locDesc : ""}</span>
              </div>
              <Row style={{ display: (HBRVLSid && HBRVLSid ? "block" : "none"), marginTop: "12px" }} className="editSpan">
                <Button disabled={this.state.disAdd} onClick={this.addOrd} size="small" type="primary" style={{ marginRight: '10px' }}><Icon type="plus-circle" />新增</Button>
                <Button onClick={this.handleDetele} disabled={this.state.btnStatus} size="small" type="danger" style={{ marginRight: '10px' }}><Icon type="delete" />删除</Button>
                <Button disabled={this.state.btnStatus} size="small" type="dashed" onClick={this.handleMoveUp} style={{ marginRight: '10px' }}><Icon type="up-circle" />上移</Button>
                <Button disabled={this.state.btnStatus} size="small" type="dashed" onClick={this.handleMoveDown} style={{ marginRight: '10px' }}><Icon type="down-circle" />下移</Button>
                <Button disabled={this.state.canSaveStatus} onClick={this.handleSave} size="small" type="primary" style={{ marginRight: '10px' }}><Icon type="printer" />保存</Button>
              </Row>
              <Modal
                title={this.state.isMod && this.state.isMod == 1 ? "编辑评估单科室" : "添加评估单科室"}
                visible={visible}
                onOk={this.handleRightOk}
                onCancel={this.handleRightCancel}
                width={1246}
              >
                <div style={{ width: '100%', height: '200px' }}>
                  <Form>
                    <Row gutter={60} style={{ position: "relative", margin: "0" }}>
                      <Col span={5} style={paddRightCol}>
                        <FormItem label='字段ID' {...formItemLayoutType}>
                          {getFieldDecorator('fileID', {
                            initialValue: centerInfo && centerInfo.fileID ? centerInfo.fileID : "",
                            rules: [{ required: true, message: '请选择字段ID' }],
                          })(
                            < Select
                              style={{ width: "100%" }}
                              allowClear={true}
                              showSearch={true}
                              optionFilterProp="role"
                            >
                              {fileOp}
                            </Select>
                          )}
                        </FormItem>
                      </Col>
                      <Col span={5} style={paddRightCol}>
                        <FormItem label='生效日期' {...formItemLayoutType}>
                          {getFieldDecorator('startDate', {
                            initialValue: centerInfo.startDate ? moment(centerInfo.startDate, "YYYY-MM-DD") : moment(),
                            rules: [{ required: true, message: '请选择生效日期' }],
                          })(
                            <DatePicker style={{ width: '100%' }} placeholder={'生效日期'} disabledDate={(curDate) => {
                              return curDate && curDate > moment().endOf('day');
                            }} />
                          )}
                        </FormItem>
                      </Col>
                      <Col span={5} style={paddRightCol}>
                        <FormItem label='失效日期' {...formItemLayoutType}>
                          {getFieldDecorator('stopDate', {
                            initialValue: centerInfo.stopDate ? moment(centerInfo.stopDate, "YYYY-MM-DD") : undefined,
                            rules: [{ required: false, message: '' }],
                          })(
                            <DatePicker style={{ width: '100%' }} placeholder={'失效日期'} disabledDate={(curDate) => {
                              return curDate < moment(this.props.form.getFieldValue('getDateTo')).format('YYYY-MM-DD');
                            }} />
                          )}
                        </FormItem>
                      </Col >
                      <Col span={5}>
                        <FormItem label="是否必填" {...formItemLayoutType}>
                          {getFieldDecorator('isDefalult', {
                            initialValue: centerInfo && centerInfo.required ? centerInfo.required : undefined,
                            rules: [{ required: false, message: '' }],
                          })(
                            <Switch checkedChildren="是" unCheckedChildren="否" checked={this.state.isDefalult} onChange={(val) => this.handleSwithChange(val)} />
                          )}
                        </FormItem>
                      </Col>
                    </Row>
                  </Form>
                </div>
              </Modal>
            </Card>
          </div>
          <div style={{ display: (HBRVLSid && HBRVLSid ? "block" : "none") }}>
            <Checkbox checked={this.state.checkedRight} disabled={this.state.rightData && this.state.rightData.length == 0} onChange={this.changeCheckedRight} style={{ marginRight: "50px", float: "right" }}>仅显示生效</Checkbox>
            <Table
              columns={rightColumns}
              pagination={false}
              rowClassName={this.setRowClassNames}
              onRow={this.onClickRightRow}
              dataSource={this.state.rightData}
              rowSelection={rowSelection_right}
              className="clearBackground"
            />
            <CommonPagination size={this.state.size} current={this.state.pageRight} total={this.state.totalRight} search={this.state.search}
              onShowSizeChange={this.onShowSizeChangeRight.bind(this)} complete={true} dataSource={this.state.rightData}
              onChange={this.PageChangeRight.bind(this)} />
            {/* {
              this.state.rightData && this.state.rightData.length > 0 ? <Pagination
                size="small"
                showQuickJumper
                showSizeChanger
                defaultCurrent={1}
                current={this.state.pageRight}
                total={this.state.totalRight}
                onChange={this.PageChangeRight}
                // onRow={this.selectID}
                onShowSizeChange={this.onShowSizeChangeRight}
                style={{ textAlign: "right", marginTop: '10px' }}
                showTotal={() => this.showTotalRight(this.state.totalRight)}
              /> : ""
            } */}
          </div>
        </div >
      )
    }
  })
export default DepAssDetailed
