/*
 * Create:      柿子
 * CreateDate:  2024/01/24
 * Describe：   积分规则维护
 * */
import React, { Component } from 'react';
import { Row, Col, Button, Input, Select, message, Icon, Drawer, Tabs, Popconfirm, Menu, Dropdown } from 'antd';
import { Util } from 'tools';
import store from 'store';
import PublicModalFormHooks from 'pages/common/PublicModalFormHooks';
import DynamicRenderingForm from 'pages/common/DynamicRenderingForm';
import PublicTablePagination from 'pages/common/PubilcTablePagination';
import PublicModalQueryTable from 'pages/common/PublicModalQueryTable';
import './style/index.less';

const { TabPane } = Tabs;

class MaintenanceOfPointsRules extends Component {
  constructor(props) {
    super(props);
    this.state = {
      userData: React.$getSessionData(),
      queryParams: {
        alias: undefined, // 名称
        statusID: undefined, // 状态
      },
      loading: false,
      columns: [],
      tableData: [],
      totalWidth: 0,
      rowID: '',
      selectData: {},
      formData: [],
      selectedRowKeys: [],
      selectedRows: [],
      visible: false,
      activeKey: '1', // 默认选中
      rowData: {},
      baseRowData: {}, // 基本信息表单数据回显
      paginationFlag: 'Y', // 从字典选择弹窗是否展示分页
      inclusionRulesColumns: [], // 纳入规则初始化数据
      inclusionRulesTotalWidth: 0,
      inclusionRulesFormData: [],
      inclusionRulesLoading: false,
      inclusionRulesTableData: [],
      inclusionRulesCopyTableData: [],
      inclusionRulesRowKeys: [],
      inclusionRulesRowData: [],
      inclusionRulesRecordData: {}, // 纳入规则记录数据
      dictionaryLibraryType: '', // 弹窗类型 - 规则类型 | 除外类型l
      dictionaryLibraryTitle: '选择项目', // 选择项目弹窗描述 - 规则类型 | 除外类型
      exclusionRulesFormData: [], // 除外规则初始化数据
      exclusionRulesTableData: [],
      exclusionRulesCopyTableData: [],
      exclusionRulesTotalWidth: 0,
      exclusionRulesColumns: [],
      exclusionRulesRowKeys: [],
      exclusionRulesRowData: [],
      exclusionRulesRecordData: {}, // 除外规则记录数据
      exclusionRulesLoading: false,
      batchSettingTimeFormData: [], // 批量设置时间表单数据
      authorizeRecordData: {},
      authorizeFormData: [],
      authorizeColumns: [], // 授权对象
      authorizeTableData: [],
      authorizeCopyTableData: [],
      authorizeLoading: false,
      authorizeRowKeys: [],
      authorizeRowData: [],
    };
  };

  componentDidMount() {
    this.getSelectData();
    this.getTableData();
    this.getTableColumns();
  };

  componentWillUnmount() {
    this.setState = (state, callback) => { return; }
  };

  // 获取下拉数据
  getSelectData = async () => {
    try {
      let data = {
        params: [{}]
      }
      let res = await React.$asyncPost(this, '13000004', data);
      this.setState({
        selectData: res?.result || {}
      });
    } catch (error) {
      console.log(error);
    }
  };

  // 获取表头数据
  getTableColumns = async () => {
    try {
      let data = {
        params: [{
          compontName: 'MaintenanceOfPointsRules',
          type: 'C',
        }]
      }
      let res = await React.$asyncPost(this, '01040073', data);
      let columns = res.result?.C || [];
      let formData = res?.result?.formData || [];
      for (let i = 0; i < formData.length; i++) {
        if (formData[i].typeCode === 'Text' && formData[i].labelCol === '24') { // 文本框
          formData[i].labelStyle = { textAlign: 'center', color: '#1890ff', paddingRight: '12px' };
        }
        if (formData[i].typeCode === 'Button' && formData[i].dataIndex === 'saveBtn') { // 保存按钮
          formData[i].type = 'primary';
          formData[i].ghost = true;
          formData[i].btnStyle = { margin: '12px 0 0 6px' };
          formData[i].onClick = this.handleSave;
        }
        if (formData[i].typeCode === 'Button' && formData[i].dataIndex === 'resetBtn') { // 重置按钮
          formData[i].btnStyle = { margin: '12px 0 0 -12px' };
          formData[i].onClick = this.handleReset;
        }
      }
      this.setState({
        columns,
        totalWidth: res.totalWidth,
        formData,
      });
    } catch (error) {
      console.log(error)
    }
  };

  // 请求列表数据
  getTableData = async (isClear) => {
    try {
      this.setState({ loading: true })
      let { queryParams } = this.state;
      let data = {
        params: [{
          ...queryParams,
        }],
      }
      let res = await React.$asyncPost(this, '13000002', data);
      let tableData = Util.addKeyValueToDataSource(res?.result?.data || res?.result?.rows || []);
      this.setState({ tableData, total: res.result?.totalCount || 0, loading: false }, () => {
        isClear !== 'N' && this.handleClear();
      });
    } catch (error) {
      console.log(error);
      this.setState({ loading: false });
    }
  };

  // 修改操作框数据
  handleModifyInputValue = (e, dataIndex) => {
    this.state.queryParams[dataIndex] = e;
    this.setState({}, () => {
      if (dataIndex === 'useFlag') {
        this.getTableData();
      }
    })
  };

  // 操作行
  onClickRowPublic = (record) => {
    return {
      // 单击行选中
      onClick: () => {
        if (this.state.rowID === '' || (this.state.rowID && (this.state.rowID !== record.key))) {
          this.setState({
            rowID: record.key,
          })
        } else {
          this.handleClear();
        }
      }
    }
  };

  handleClear = () => {
    this.setState({ rowID: '' });
  };

  // 选中行操作
  setRowClassNamePublic = (record) => {
    return record.key === this.state.rowID ? 'clickRowStyle' : '';
  };

  getOperationObj = () => {
    // 列表操作
    const operationObj = {
      width: 80,
      key: 'operation',
      title: '操作',
      align: 'center',
      fixed: 'right',
      render: (text, record, index) => {
        return (
          <span className="span" onClick={(e) => this.handleViewDetails(e, record)}>详情</span>
        )
      }
    };
    return operationObj;
  };

  // 查看详情
  handleViewDetails = (e, record) => {
    React.$stopPropagation(e);
    this.setState({ activeKey: '1' }, () => { // 先将tab页签还原为默认页签
      this.modifyVisible(true);
      setTimeout(() => {
        this.setState({ rowData: record, baseRowData: record });
      }, 100)
    })
  };

  // 保存
  handleSave = async () => {
    try {
      const { rowData, userData } = this.state;
      let values = await this.formRef.handleSave();
      if (values.error) {
        message.error('请完善必填信息');
        return;
      }
      let data = {
        params: [{
          pointsRuleID: rowData?.pointsRuleID || '',
          userCode: userData?.userCode || '',
          userName: userData?.userName || '',
          ...values
        }]
      }
      let res = await React.$asyncPost(this, '13000001', data);
      message.success(res?.errorMessage || '保存成功');
      this.setState({ rowData: { ...rowData, ...values, pointsRuleID: res?.result?.pointsRuleID || '' } });
      this.getTableData();
    } catch (error) {
      console.log(error);
    }
  };

  // 批量授权
  handleVolumeLicenseKeys = () => {

  };

  // 弹窗状态修改
  modifyVisible = (visible) => {
    this.setState({ visible });
  };

  // 页签切换
  handleActiveChange = (activeKey) => {
    const { inclusionRulesColumns, exclusionRulesColumns, rowData, authorizeColumns } = this.state;
    if (!(rowData && 'pointsRuleID' in rowData && rowData.pointsRuleID)) {
      message.error('请先填写基本信息并保存');
      return;
    }
    this.setState({ activeKey }, () => {
      if (activeKey === '2') { // 纳入规则
        this.inclusionRulesFormRef && this.inclusionRulesFormRef.handleDefaultAssignment();
        if (!(inclusionRulesColumns && inclusionRulesColumns.length > 0)) {
          this.getInclusionRulesColumns();
        }
        this.getInclusionRulesData();
      } else if (activeKey === '3') { // 除外规则
        this.exclusionRulesFormRef && this.exclusionRulesFormRef.handleDefaultAssignment();
        if (!(exclusionRulesColumns && exclusionRulesColumns.length > 0)) {
          this.getExclusionRulesColumns();
        }
        this.getExclusionRulesData();
      } else if (activeKey === '4') { // 授权对象
        this.authorizeFormRef && this.authorizeFormRef.handleDefaultAssignment();
        if (!(authorizeColumns && authorizeColumns.length > 0)) {
          this.getAuthorizeColumns();
        }
        setTimeout(() => {
          this.getAuthorizeData();
        }, 500)
      }
    });
  };

  // 新增
  handleAdd = () => {
    const { rowData } = this.state;
    if (rowData && 'pointsRuleID' in rowData && rowData.pointsRuleID) {
      this.handleResetModalData();
    };
    this.setState({
      rowID: '',
      rowData: {},
      activeKey: '1',
    }, () => {
      this.modifyVisible(true);
    });
  };

  // 清空弹窗操作数据
  handleResetModalData = () => {
    this.setState({
      baseRowData: {},
      inclusionRulesTableData: [],
      inclusionRulesCopyTableData: [],
      inclusionRulesRowKeys: [],
      inclusionRulesRowData: [],
      inclusionRulesRecordData: {},
      exclusionRulesTableData: [],
      exclusionRulesCopyTableData: [],
      exclusionRulesRowKeys: [],
      exclusionRulesRowData: [],
      authorizeRowKeys: [],
      authorizeRowData: [],
    }, () => {
      setTimeout(() => {
        this.formRef && this.formRef.handleDefaultAssignment(); // 初始化数据
      }, 300)
    });
  };

  // 重置
  handleReset = () => {
    this.setState({ baseRowData: {} }, () => {
      this.formRef && this.formRef?.resetFields();
    });
  };

  // 纳入规则
  getInclusionRulesColumns = async () => {
    try {
      let data = {
        params: [{
          compontName: 'IntegralRuleInclusionRules',
          type: 'C',
        }]
      }
      let res = await React.$asyncPost(this, '01040073', data);
      let columns = res.result?.C || [];
      if (columns && columns.length > 0) {
        for (let i = 0; i < columns.length; i++) {
          let colItem = columns[i];
          columns[i].render = (text, record, index) => this.handleRenderInput(text, record, index, colItem);
        }
      }
      this.setState({
        inclusionRulesColumns: columns,
        inclusionRulesTotalWidth: res.totalWidth,
        inclusionRulesFormData: res?.result?.formData || [],
      });
    } catch (error) {
      console.log(error)
    }
  };

  // 纳入规则数据查询
  getInclusionRulesData = async () => {
    try {
      const { rowData, userData } = this.state;
      if (!(rowData && 'pointsRuleID' in rowData && rowData.pointsRuleID)) return;
      this.setState({ inclusionRulesLoading: true });
      let data = {
        params: [{
          pointsRuleID: rowData?.pointsRuleID || '',
          userCode: userData?.userCode || '',
          userName: userData?.userName || '',
        }]
      }
      let res = await React.$asyncPost(this, '13000005', data);
      let inclusionRulesTableData = Util.addKeyValueToDataSource(res?.result?.data || [])
      this.setState({
        inclusionRulesRecordData: res?.result || {},
        inclusionRulesTableData,
        inclusionRulesCopyTableData: inclusionRulesTableData,
        inclusionRulesLoading: false,
        inclusionRulesRowKeys: [],
        inclusionRulesRowData: [],
      });
    } catch (error) {
      console.log(error)
      this.setState({ inclusionRulesLoading: false });
    }
  };

  handleRenderInput = (text, record, index, colItem) => {
    const { selectData } = this.state;
    let dataIndex = colItem?.dataIndex || '';
    let linkService = colItem?.linkService || '';
    let typeCode = colItem?.linkMethod || '';
    if (colItem?.linkMethod === 'Switch') {
      return (
        <Switch
          checkedChildren="是"
          unCheckedChildren="否"
          checked={record[dataIndex] === 'Y' ? true : false}
          onClick={e => React.$stopPropagation(e)}
          onChange={(e) => this.handleInputChange(index, dataIndex, e ? 'Y' : 'N', e, record)}
        />
      )
    } else if (colItem?.linkMethod === 'Checkbox') {
      return (
        <Checkbox
          checked={record[dataIndex] === 'Y' ? true : false}
          onClick={e => React.$stopPropagation(e)}
          onChange={(e) => this.handleInputChange(index, dataIndex, e.target.checked ? 'Y' : 'N', e, record)}
        />
      )
    } if (typeCode === 'Input') {
      return (
        <Input
          allowClear
          style={{ width: '90%' }}
          placeholder={linkService && linkService.indexOf('placeholder') > -1 ? Util.getValueByUrlStr(linkService, 'placeholder') : '请输入'}
          value={record[dataIndex] || undefined}
          onClick={e => React.$stopPropagation(e)}
          onChange={(e) => this.handleInputChange(index, dataIndex, e.target.value, e, record)}
        />
      )
    } else if (typeCode === 'Select') {
      return (
        <Select
          allowClear
          showSearch
          style={{ width: '90%' }}
          placeholder="请选择"
          optionFilterProp="search"
          value={record[dataIndex] || undefined}
          onClick={e => React.$stopPropagation(e)}
          onChange={(e) => this.handleInputChange(index, dataIndex, e, e, record)}
        >
          {React.$SelectOptions(selectData && linkService in selectData && Array.isArray(selectData[linkService]) ? selectData[linkService] : [])}
        </Select>
      )
    } else {
      return text;
    }
  };

  handleInputChange = (index, dataIndex, val, e, record) => {
    React.$stopPropagation(e);
    let { inclusionRulesTableData, inclusionRulesCopyTableData } = this.state;
    // 展示数据
    for (let i = 0; i < inclusionRulesTableData.length; i++) {
      if (inclusionRulesTableData[i].key === record.key) {
        inclusionRulesTableData[i][dataIndex] = val;
      }
    }
    // 复制数据
    for (let i = 0; i < inclusionRulesCopyTableData.length; i++) {
      if (inclusionRulesCopyTableData[i].key === record.key) {
        inclusionRulesCopyTableData[i][dataIndex] = val;
      }
    }
    this.setState({});
  };

  handleInclusionRulesPressEnter = (e) => {
    let val = e.target.value;
    let { inclusionRulesCopyTableData } = this.state;
    let inclusionRulesTableData = inclusionRulesCopyTableData && inclusionRulesCopyTableData.filter(item => item.chargeItemCode.indexOf(val) > -1 || item.chargeItemDesc.indexOf(val) > -1);
    this.setState({ inclusionRulesTableData });
  }

  // 从字典库选择
  handleDictionaryLibrarySelection = (refDataIndex) => {
    const { selectData } = this.state;
    let values = this[refDataIndex] && this[refDataIndex]?.getFieldsValue();
    let disCountConfigTypeObj = {};
    if (!(values && 'disCountConfigTypeID' in values && values.disCountConfigTypeID)) {
      message.warn(refDataIndex === 'inclusionRulesFormRef' ? '请选择规则类型！' : '请选择除外类型！');
      return;
    }
    disCountConfigTypeObj = Util.returnDataCccordingToAttributes(selectData?.disCountConfigType || [], values?.disCountConfigTypeID || '');
    this.setState({ dictionaryLibraryType: refDataIndex, dictionaryLibraryTitle: disCountConfigTypeObj?.descripts || '', paginationFlag: 'Y' }, () => {
      this.dictionaryLibraryRef && this.dictionaryLibraryRef.modifyVisible(true, { dynamicParams: disCountConfigTypeObj });
    });
  };

  // 上移
  handleMoveUp = (tableDataDataIndex, rowKeysDataIndex) => {
    let keys = this.state[rowKeysDataIndex];
    let data = this.state[tableDataDataIndex];
    let newKeys = []
    keys = keys.sort(function (m, n) {
      if (m < n) return -1
      else if (m > n) return 1
      else return 0
    });
    for (let i = 0; i < keys.length; i++) {
      if (keys[i] === 0) {
        newKeys.push(keys[i])
        message.warn('已经到顶了，无法再移动！')
        return
      }
      let curRowData = data[keys[i]]
      let curRowKey = curRowData.key
      let upRowData = data[keys[i] - 1]
      let upRowKey = upRowData.key
      upRowData.key = curRowKey
      curRowData.key = upRowKey
      data[keys[i]] = upRowData
      data[keys[i] - 1] = curRowData
      newKeys.push(keys[i] - 1)
    }
    this.state[rowKeysDataIndex] = newKeys;
    this.state[tableDataDataIndex] = data;
    this.setState({});
  };

  //下移
  handleMoveDown = (tableDataDataIndex, rowKeysDataIndex) => {
    let keys = this.state[rowKeysDataIndex];
    let data = this.state[tableDataDataIndex];
    let newKeys = []
    keys = keys.sort(function (m, n) {
      if (m < n) return -1
      else if (m > n) return 1
      else return 0
    });
    for (let i = keys.length - 1; i >= 0; i--) {
      if (keys[i] === data.length - 1) {
        newKeys.push(keys[i])
        message.warn('已经到底了，无法再移动！')
        return
      }
      let curRowData = data[keys[i]]
      let upRowData = data[keys[i] + 1]
      let curRowKey = curRowData.key
      let upRowKey = upRowData.key
      upRowData.key = curRowKey
      curRowData.key = upRowKey
      data[keys[i]] = upRowData
      data[keys[i] + 1] = curRowData
      newKeys.push(keys[i] + 1)
    }
    this.state[rowKeysDataIndex] = newKeys;
    this.state[tableDataDataIndex] = data;
    this.setState({});
  };

  // 纳入规则保存
  handleInclusionRulesSave = async () => {
    try {
      const { rowData, userData, inclusionRulesTableData, selectData } = this.state;
      let values = await this.inclusionRulesFormRef.handleSave();
      if (values.error) {
        message.error('请完善必填信息');
        return;
      }
      let admReasonObj = Util.returnDataCccordingToAttributes(selectData?.admReason || [], values?.admReasonDr || '');
      console.log('admReasonObj', admReasonObj)
      let data = {
        params: [{
          pointsRuleID: rowData?.pointsRuleID || '',
          userCode: userData?.userCode || '',
          userName: userData?.userName || '',
          item: inclusionRulesTableData, // 规则数据
          admReasonInfo: admReasonObj?.admReasonInfo || '', // 就诊类型相关数据
          ...values,
        }]
      }
      let res = await React.$asyncPost(this, '13000003', data);
      message.success(res?.errorMessage || '保存成功');
      this.getInclusionRulesData();
    } catch (error) {
      console.log(error);
    }
  };

  // 获取删除操作按钮
  getModalOperationObj = (deleteCode, dataIndex, idIndex) => {
    const operationObj = {
      width: 80,
      title: '操作',
      align: 'center',
      key: 'operation',
      fixed: 'right',
      render: (text, record) => (
        <>
          <Icon type="delete" className="common-record-delete-span"></Icon>
          <Popconfirm title="删除不可恢复，你确定要删除吗?" onConfirm={(e) => this.handleDelete(deleteCode, dataIndex, idIndex, 'inLine', [{ ...record }])} >
            <span className="span common-record-delete-span">删除</span>
          </Popconfirm>
        </>
      ),
    };
    return operationObj;
  };

  // 除外规则表头数据
  getExclusionRulesColumns = async () => {
    try {
      let data = {
        params: [{
          compontName: 'IntegralRuleExclusionRules',
          type: 'C',
        }]
      }
      let res = await React.$asyncPost(this, '01040073', data);
      let columns = res.result?.C || [];
      this.setState({
        exclusionRulesColumns: columns,
        exclusionRulesTotalWidth: res.totalWidth,
        exclusionRulesFormData: res?.result?.formData || [],
      });
    } catch (error) {
      console.log(error)
    }
  };

  // 纳入规则过滤change
  handleExclusionRulesPressEnter = e => {
    let val = e.target.value;
    let { exclusionRulesCopyTableData } = this.state;
    let exclusionRulesTableData = exclusionRulesCopyTableData && exclusionRulesCopyTableData.filter(item => item.chargeItemCode.indexOf(val) > -1 || item.chargeItemDesc.indexOf(val) > -1);
    this.setState({ exclusionRulesTableData });
  };

  // 除外规则保存
  handleExclusionRulesSave = async () => {
    try {
      const { rowData, userData, exclusionRulesCopyTableData } = this.state;
      let values = await this.exclusionRulesFormRef.handleSave();
      if (values.error) {
        message.error('请完善必填信息');
        return;
      }
      let data = {
        params: [{
          pointsRuleID: rowData?.pointsRuleID || '',
          userCode: userData?.userCode || '',
          userName: userData?.userName || '',
          item: exclusionRulesCopyTableData, // 规则数据
          ...values
        }]
      }
      let res = await React.$asyncPost(this, '13000009', data);
      message.success(res?.errorMessage || '保存成功');
      this.getExclusionRulesData();
    } catch (error) {
      console.log(error);
    }
  };

  // 确认选择
  handleDictionaryLibrarySave = ({ selectedRows = [] }) => {
    const { dictionaryLibraryType, inclusionRulesCopyTableData, exclusionRulesCopyTableData, authorizeCopyTableData } = this.state;
    let values = dictionaryLibraryType && this[dictionaryLibraryType] && this[dictionaryLibraryType]?.getFieldsValue();
    if (dictionaryLibraryType === 'inclusionRulesFormRef') { // 纳入规则
      let nData = selectedRows && selectedRows.map(item => {
        return {
          ...item,
          disCountConfigTypeID: values?.disCountConfigTypeID || '',
          disCountConfigTypeDesc: values?.disCountConfigTypeDesc || '',
          chargeItemID: item?.id || '',
          ruleTypeID: '1', // 积分入账时间
          chargeItemCode: item?.code || '',
          chargeItemDesc: item?.descripts || '',
        }
      });
      let inclusionRulesTableData = Util.addKeyValueToDataSource([...inclusionRulesCopyTableData, ...nData]);
      this.setState({ inclusionRulesTableData, inclusionRulesCopyTableData: inclusionRulesTableData });
    } else if (dictionaryLibraryType === 'exclusionRulesFormRef') { // 除外规则
      let nData = selectedRows && selectedRows.map(item => {
        return {
          ...item,
          disCountConfigTypeID: values?.disCountConfigTypeID || '',
          disCountConfigTypeDesc: values?.disCountConfigTypeDesc || '',
          chargeItemID: item?.id || '',
          chargeItemCode: item?.code || '',
          chargeItemDesc: item?.descripts || '',
        }
      });
      let exclusionRulesTableData = Util.addKeyValueToDataSource([...exclusionRulesCopyTableData, ...nData]);
      this.setState({ exclusionRulesTableData, exclusionRulesCopyTableData: exclusionRulesTableData });
    } else { // 授权对象
      const { userData, dictionaryLibraryRecord } = this.state;
      let nData = selectedRows && selectedRows.map(item => {
        return {
          ...item,
          ...values,
          itemID: item?.id || '',
          itemCode: item?.code || '',
          itemDesc: item?.descripts || '',
          itemInfo: item?.descriptsinfo || '',
          hospID: dictionaryLibraryRecord?.id === 'Hosp' ? (item?.id || '') : (userData?.hospID || ''),
          hospDesc: dictionaryLibraryRecord?.id === 'Hosp' ? (item?.descripts || '') : (userData?.hospDesc || ''),
          hospInfo: dictionaryLibraryRecord?.id === 'Hosp' ? (item?.descriptsinfo || '') : ((userData?.hospID || '') + ':' + (userData?.hospCode || '') + ':' + (userData?.hospDesc || '')),
          authorizeType: dictionaryLibraryRecord?.id || '',
          authorizeTypeDesc: dictionaryLibraryRecord?.descripts || '',
          error: undefined
        }
      });
      let authorizeTableData = Util.addKeyValueToDataSource([...authorizeCopyTableData, ...nData]);
      this.setState({ authorizeTableData, authorizeCopyTableData: authorizeTableData });
    }
    this.dictionaryLibraryRef && this.dictionaryLibraryRef?.handleCancel('Y');
  };

  // 删除
  handleDelete = async (deleteCode, dataIndex, idIndex, deleteType = 'multiple', deleteData) => {
    try {
      const { userData } = this.state;
      if (!(deleteData && deleteData.length > 0)) {
        message.error('请选择要删除的数据');
        return;
      }
      let deleteKey = [];
      let deleteIDArr = [];
      let isHttpDelete = 'N';
      // 获取是否调用接口标志
      for (let i = 0; i < deleteData.length; i++) {
        if (deleteData[i][idIndex]) {
          isHttpDelete = 'Y';
          break;
        }
      }
      // 获取删除相关数据
      for (let i = 0; i < deleteData.length; i++) {
        deleteKey.push(deleteData[i].key);
        if (deleteData[i][idIndex]) {
          deleteIDArr.push({
            [idIndex]: deleteData[i][idIndex] || ''
          });
        }
      }
      if (isHttpDelete === 'Y' && deleteIDArr && Array.isArray(deleteIDArr) && deleteIDArr.length > 0) { // 调用接口删除
        if (!deleteCode) {
          message.error('删除接口异常');
          return;
        }
        let data = {
          params: [{
            userCode: userData?.userCode || '',
            userName: userData?.userName || '',
            item: deleteIDArr
          }]
        };
        let res = await React.$asyncPost(this, deleteCode, data);
        message.success(res?.errorMessage || '删除成功');
      }
      this.handleStaticDelete(dataIndex, deleteType, deleteKey);
    } catch (error) {
      console.log(error);
    }
  };

  // 本地删除数据
  handleStaticDelete = (dataIndex, deleteFlag, deleteKey) => {
    let filterTableData = this.state[dataIndex + 'TableData'];
    let filterCopyTableData = this.state[dataIndex + 'CopyTableData'];
    if (deleteKey && Array.isArray(deleteKey) && deleteKey.length > 0) {
      for (let i = 0; i < deleteKey.length; i++) {
        filterTableData = filterTableData.filter(item => item.key !== deleteKey[i]);
        filterCopyTableData = filterCopyTableData.filter(item => item.key !== deleteKey[i]);
      }
    } else {
      filterTableData = filterTableData.filter(item => item.key !== deleteKey);
      filterCopyTableData = filterCopyTableData.filter(item => item.key !== deleteKey);
    }
    filterTableData = Util.addKeyValueToDataSource(filterTableData, '', 0);
    filterCopyTableData = Util.addKeyValueToDataSource(filterCopyTableData, '', 0);
    if (deleteFlag === 'multiple') { // 多行删除删除后清除选中数据
      this.state[dataIndex + 'RowKeys'] = [];
      this.state[dataIndex + 'RowData'] = [];
    }
    this.state[dataIndex + 'TableData'] = filterTableData;
    this.state[dataIndex + 'CopyTableData'] = filterCopyTableData;
    this.setState({});
  };

  // 批量设置时间
  showBatchSettingTimeModal = () => {
    const { batchSettingTimeFormData } = this.state;
    if (!(batchSettingTimeFormData && batchSettingTimeFormData.length > 0)) {
      this.getBatchSettingTimeFormData();
    }
    this.batchSettingTimeRef && this.batchSettingTimeRef.modifyVisible(true, 'Y');
  };

  // 获取批量设置时间表单数据
  getBatchSettingTimeFormData = () => {
    const { selectData } = this.state;
    let formData = [{
      title: '积分入账时间',
      typeCode: 'Select',
      dataIndex: 'ruleTypeID',
      detailItem: selectData?.ruleType || [],
      col: 24,
      labelCol: 6,
      wrapperCol: 14,
    }];
    this.setState({ batchSettingTimeFormData: formData });

  };

  // 批量设置纳入规则时间类型
  handleBatchSettingTimeSave = (values) => {
    let { inclusionRulesCopyTableData } = this.state;
    inclusionRulesCopyTableData = inclusionRulesCopyTableData.map(item => {
      return {
        ...item,
        ...values,
        error: undefined
      }
    })
    this.setState({ inclusionRulesTableData: inclusionRulesCopyTableData });
    this.batchSettingTimeRef && this.batchSettingTimeRef.modifyVisible(false);
  };

  // 除外规则数据查询
  getExclusionRulesData = async () => {
    try {
      const { rowData, userData } = this.state;
      if (!(rowData && 'pointsRuleID' in rowData && rowData.pointsRuleID)) return;
      this.setState({ exclusionRulesLoading: true });
      let data = {
        params: [{
          pointsRuleID: rowData?.pointsRuleID || '',
          userCode: userData?.userCode || '',
          userName: userData?.userName || '',
        }]
      }
      let res = await React.$asyncPost(this, '13000008', data);
      let exclusionRulesTableData = Util.addKeyValueToDataSource(res?.result?.data || [])
      this.setState({
        exclusionRulesRecordData: res?.result || {},
        exclusionRulesTableData,
        exclusionRulesCopyTableData: exclusionRulesTableData,
        exclusionRulesLoading: false,
        exclusionRulesRowKeys: [],
        exclusionRulesRowData: [],
      });
    } catch (error) {
      console.log(error)
      this.setState({ exclusionRulesLoading: false });
    }
  };

  // 获取授权表头数据
  getAuthorizeColumns = async () => {
    try {
      let data = {
        params: [{
          compontName: 'IntegralRuleAuthorizedObjects',
          type: 'C',
        }]
      }
      let res = await React.$asyncPost(this, '01040073', data);
      let columns = res.result?.C || [];
      let authorizeFormData = res?.result?.formData || [];
      for (let i = 0; i < authorizeFormData.length; i++) {
        if (authorizeFormData[i]?.dataIndex === 'authorizeType') {
          authorizeFormData[i].callBackResult = 'Fn';
          authorizeFormData[i].changeCallBack = this.getAuthorizeData;
        }
      }
      this.setState({
        authorizeColumns: columns,
        authorizeHospColumns: columns,
        authorizeTotalWidth: res.totalWidth,
        authorizeHospTotalWidth: res.totalWidth,
        authorizeFormData,
      });
    } catch (error) {
      console.log(error)
    }
  };

  // 获取授权数据
  getAuthorizeData = async (e, dataIndex) => {
    try {
      const { rowData, userData } = this.state;
      if (!(rowData && 'pointsRuleID' in rowData && rowData.pointsRuleID)) return;
      this.setState({ authorizeLoading: true });
      let values = this.authorizeFormRef && this.authorizeFormRef?.getFieldsValue();
      let data = {
        params: [{
          pointsRuleID: rowData?.pointsRuleID || '',
          userCode: userData?.userCode || '',
          userName: userData?.userName || '',
          [dataIndex || 'authorizeType']: e !== undefined ? e : values[dataIndex || 'authorizeType'], // 授权类型
        }]
      }
      let res = await React.$asyncPost(this, '13000011', data);
      let authorizeTableData = Util.addKeyValueToDataSource(res?.result?.data || []);
      this.setState({
        authorizeTableData,
        authorizeCopyTableData: authorizeTableData,
        authorizeLoading: false,
        authorizeRowKeys: [],
        authorizeRowData: [],
      });
    } catch (error) {
      console.log(error)
      this.setState({ authorizeLoading: false });
    }
  };

  // 纳入规则过滤change
  handleAuthorizePressEnter = e => {
    let val = e.target.value;
    let { authorizeCopyTableData } = this.state;
    let authorizeTableData = authorizeCopyTableData && authorizeCopyTableData.filter(item => item.itemCode.indexOf(val) > -1 || item.itemDesc.indexOf(val) > -1);
    this.setState({ authorizeTableData });
  };

  handleAuthorizeSave = async () => {
    try {
      const { rowData, userData, authorizeCopyTableData } = this.state;
      let data = {
        params: [{
          pointsRuleID: rowData?.pointsRuleID || '',
          userCode: userData?.userCode || '',
          userName: userData?.userName || '',
          item: authorizeCopyTableData, // 规则数据
        }]
      }
      let res = await React.$asyncPost(this, '13000012', data);
      message.success(res?.errorMessage || '保存成功');
      this.getAuthorizeData();
    } catch (error) {
      console.log(error);
    }
  };

  // 选择授权对象
  handleAuthorizeSelection = (record) => {
    const { selectData } = this.state;
    this.authorizeFormRef && this.authorizeFormRef.setFieldsValue({
      authorizeType: record?.id || '',
    });
    this.getAuthorizeData();
    if (record?.id === 'Doc') { // 医生|人员
      this.personnelRef && this.personnelRef.modifyVisible(true, { selectData });
      return;
    }
    let tableData = [];
    if (record?.id === 'Hosp') { // 医院
      tableData = selectData?.hisHosp || []
    } else if (record?.id.indexOf('Loc') > -1) { // 科室
      tableData = selectData?.hisLoc || [];
    }
    for (let i = 0; i < tableData.length; i++) { // 静态过滤
      tableData[i].staticFilter = (tableData[i]?.code || '') + '^' + (tableData[i]?.descripts || '')
    }
    this.setState({ paginationFlag: 'N', dictionaryLibraryType: 'authorizeFormRef', dictionaryLibraryTitle: '选择' + (record?.descripts || ''), dictionaryLibraryRecord: record }, () => {
      this.dictionaryLibraryRef && this.dictionaryLibraryRef.modifyVisible(true, {
        autoQueryFlag: 'N',
        // queryFormFlag: 'N', // 查询表单是否显示
        tableData,
        copyTableData: tableData,
      });
    });
  };

  // 插入人员
  handlePersonnelSave = ({ selectedRows = [], queryVal = {} }) => {
    const { userData, selectData, authorizeCopyTableData } = this.state;
    let values = this.authorizeFormRef && this.authorizeFormRef?.getFieldsValue();
    let locInfo = Util.returnDataCccordingToAttributes(selectData?.hisLoc || [], queryVal?.locID || '');
    let nData = selectedRows && selectedRows.map(item => {
      return {
        ...item,
        ...values,
        code: item?.userCode || '',
        descripts: item?.userDesc || '',
        itemID: item?.userID || '',
        itemCode: item?.userCode || '',
        itemDesc: item?.userDesc || '',
        itemInfo: (item?.userID || '') + ':' + (item?.userCode || '') + ':' + (item?.userDesc || ''),
        hospID: userData?.hospID || '',
        hospDesc: userData?.hospDesc || '',
        hospInfo: (userData?.hospID || '') + ':' + (userData?.hospCode || '') + ':' + (userData?.hospDesc || ''),
        locID: locInfo?.id || '',
        locDesc: locInfo?.descripts || '',
        locInfo: locInfo?.descriptsinfo || '',
        error: undefined
      }
    });
    let authorizeTableData = Util.addKeyValueToDataSource([...authorizeCopyTableData, ...nData])
    this.setState({ authorizeTableData, authorizeCopyTableData: authorizeTableData });
    this.personnelRef && this.personnelRef?.handleCancel('Y');
  }

  render() {
    const { queryParams, loading, columns, tableData, totalWidth, selectData, visible, activeKey, formData, baseRowData, inclusionRulesFormData, inclusionRulesTableData, inclusionRulesTotalWidth, inclusionRulesColumns,
      inclusionRulesRowKeys, inclusionRulesRowData, dictionaryLibraryTitle, exclusionRulesFormData, exclusionRulesTableData, exclusionRulesTotalWidth, exclusionRulesColumns, exclusionRulesRowKeys, exclusionRulesRowData,
      inclusionRulesLoading, inclusionRulesRecordData, exclusionRulesLoading, exclusionRulesRecordData, batchSettingTimeFormData, authorizeRecordData, authorizeFormData, authorizeLoading, authorizeTableData,
      authorizeColumns, authorizeTotalWidth, authorizeRowData, authorizeRowKeys, paginationFlag
    } = this.state;

    return (
      <div className="maintenance-of-points-rules">
        <div style={{ marginBottom: 12 }}>
          <span className="common-input-label">规则名称：</span>
          <Input
            allowClear
            title="输入内容后可回车检索"
            placeholder="请输入名称检索"
            className="common-query-input"
            value={queryParams?.alias}
            onChange={(e) => this.handleModifyInputValue(e.target.value, 'alias')}
            onPressEnter={this.getTableData}
          />
          <span className="common-input-label">状态：</span>
          <Select
            allowClear
            placeholder="请选择"
            className="common-query-input"
            value={queryParams?.statusID}
            onChange={(e) => this.handleModifyInputValue(e, 'statusID')}
          >
            {React.$SelectOptions(selectData?.status || [])}
          </Select>
          <Button type="primary" style={{ marginRight: 12 }} onClick={this.getTableData}>查询</Button>
          {/* <Button ghost type="primary" disabled={!(selectedRowKeys && selectedRowKeys.length > 0)} onClick={this.handleVolumeLicenseKeys}>
            <Icon type="hourglass" style={{ marginRight: '-4px' }} />
            批量授权
          </Button> */}
          <div style={{ float: 'right' }}>
            <Button icon="plus" className="add-btn add-btn-noHover" onClick={this.handleAdd}>新增</Button>
          </div>
        </div>
        <div className="table-body-height">
          <PublicTablePagination
            param={{
              loading,
              componentName: 'MaintenanceOfPointsRules',
              data: tableData, // 表格数据
              x: totalWidth, // 表格的宽度
              y: store.getState().tableHeight.y + 110,
              height: store.getState().tableHeight.y + 155 + 'px',
              columns: columns && columns.length > 0 ? [...columns, this.getOperationObj()] : [], // 表头配置
            }}
            // rowSelectionPublic={{
            //   selectedRowKeys,
            //   selectedRows,
            //   onChange: (selectedRowKeys, selectedRows) => {
            //     this.setState({
            //       selectedRowKeys,
            //       selectedRows,
            //     })
            //   },
            // }}
            getColumns={this.getTableColumns}
            onClickRowPublic={this.onClickRowPublic}
            setRowClassNamePublic={this.setRowClassNamePublic}
          />
        </div>

        {/* 详情 */}
        <Drawer
          title="查看详情"
          placement="right"
          width="45%"
          bodyStyle={{ padding: '0 12px' }}
          onClose={() => this.modifyVisible(false)}
          visible={visible}
        >
          <Tabs activeKey={activeKey} onChange={this.handleActiveChange}>
            <TabPane tab="基本信息" key="1">
              <DynamicRenderingForm
                rowData={baseRowData}
                formData={formData}
                onRef={ref => this.formRef = ref}
              />
            </TabPane>
            <TabPane tab="纳入规则" key="2">
              <div>
                <DynamicRenderingForm
                  rowData={inclusionRulesRecordData}
                  selectData={selectData}
                  formData={inclusionRulesFormData}
                  onRef={ref => this.inclusionRulesFormRef = ref}
                />
                <Row>
                  <Col span={parseInt(inclusionRulesFormData && inclusionRulesFormData.length > 0 ? inclusionRulesFormData[0]?.labelCol : 3)}></Col>
                  <Col span={parseInt(inclusionRulesFormData && inclusionRulesFormData.length > 0 ? inclusionRulesFormData[0]?.wrapperCol : 20)}>
                    <div style={{ padding: '10px', border: '1px solid #e8e8e8' }} className="table-body-height">
                      <Input
                        style={{ width: '100%' }}
                        placeholder="请输入代码/名称回车检索"
                        onPressEnter={this.handleInclusionRulesPressEnter}
                      />
                      <div className="flex-between-center" style={{ margin: '10px 0' }}>
                        <div className="flex-align-items">
                          <span style={{ marginRight: '12px', cursor: 'pointer' }} onClick={this.showBatchSettingTimeModal}>
                            <Icon
                              style={{ margin: '4px 4px 0 0' }}
                              type="clock-circle"
                              className="common-record-span-icon"
                            />
                            批量设置时间
                          </span>
                          <span
                            style={{ marginRight: '12px' }}
                            className={!(inclusionRulesRowKeys && inclusionRulesRowKeys.length > 0) ? 'common-color999' : 'common-color333'}
                            onClick={() => this.handleDelete('13000006', 'inclusionRules', 'pointsRuleItemID', 'multiple', inclusionRulesRowData)}
                          >
                            <Icon
                              style={{ margin: '4px 4px 0 0' }}
                              type="delete"
                              className={!(inclusionRulesRowKeys && inclusionRulesRowKeys.length > 0) ? 'common-color999' : 'common-record-delete-span'}
                            />
                            批量删除
                          </span>
                          {/* <span
                            style={{ marginRight: '12px', cursor: 'pointer' }}
                            onClick={(e) => this.handleMoveUp('inclusionRulesTableData', 'inclusionRulesRowKeys')}
                          >
                            <Icon
                              style={{ margin: '4px 4px 0 0' }}
                              type="up-square"
                              className="common-record-span-icon"
                            />
                            上移
                          </span>
                          <span
                            style={{ cursor: 'pointer' }}
                            onClick={(e) => this.handleMoveDown('inclusionRulesTableData', 'inclusionRulesRowKeys')}
                          >
                            <Icon style={{ margin: '4px 4px 0 0' }} className="common-record-span-icon" type="down-square" />
                            下移
                          </span> */}
                        </div>
                        <Button ghost type="primary" onClick={() => this.handleDictionaryLibrarySelection('inclusionRulesFormRef')}>从字典库选择项目</Button>
                      </div>
                      <PublicTablePagination
                        param={{
                          componentName: 'IntegralRuleInclusionRules',
                          loading: inclusionRulesLoading,
                          data: inclusionRulesTableData, // 表格数据
                          x: inclusionRulesTotalWidth, // 表格的宽度
                          y: store.getState().tableHeight.y - 200,
                          height: store.getState().tableHeight.y - 150 + 'px',
                          columns: [...inclusionRulesColumns, this.getModalOperationObj('13000006', 'inclusionRules', 'pointsRuleItemID')], // 表头配置
                        }}
                        rowSelectionPublic={{
                          selectedRowKeys: inclusionRulesRowKeys,
                          selectedRows: inclusionRulesRowData,
                          onChange: (selectedRowKeys, selectedRows) => {
                            this.setState({
                              inclusionRulesRowKeys: selectedRowKeys,
                              inclusionRulesRowData: selectedRows,
                            })
                          },
                        }}
                        getColumns={this.getInclusionRulesColumns}
                      />
                    </div>
                    <div style={{ textAlign: 'center', marginTop: '24px' }}>
                      <Button type="primary" onClick={this.handleInclusionRulesSave}>保存</Button>
                    </div>
                  </Col>
                </Row>
              </div>
            </TabPane>
            <TabPane tab="除外规则" key="3">
              <div>
                <DynamicRenderingForm
                  rowData={exclusionRulesRecordData}
                  selectData={selectData}
                  formData={exclusionRulesFormData}
                  onRef={ref => this.exclusionRulesFormRef = ref}
                />
                <Row>
                  <Col span={parseInt(exclusionRulesFormData && exclusionRulesFormData.length > 0 ? exclusionRulesFormData[0]?.labelCol : 3)}></Col>
                  <Col span={parseInt(exclusionRulesFormData && exclusionRulesFormData.length > 0 ? exclusionRulesFormData[0]?.wrapperCol : 20)}>
                    <div style={{ padding: '10px', border: '1px solid #e8e8e8' }} className="table-body-height">
                      <Input
                        style={{ width: '100%' }}
                        placeholder="请输入代码/名称回车检索"
                        onPressEnter={this.handleExclusionRulesPressEnter}
                      />
                      <div className="flex-between-center" style={{ margin: '10px 0' }}>
                        <div className="flex-align-items">
                          <span
                            style={{ marginRight: '12px' }}
                            className={!(exclusionRulesRowKeys && exclusionRulesRowKeys.length > 0) ? 'common-color999' : 'common-color333'}
                            onClick={() => this.handleDelete('13000010', 'exclusionRules', 'pointsRuleItemExceptID', 'multiple', exclusionRulesRowData)}
                          >
                            <Icon
                              type="delete"
                              style={{ margin: '4px 4px 0 0' }}
                              className={!(exclusionRulesRowKeys && exclusionRulesRowKeys.length > 0) ? 'common-color999' : 'common-record-delete-span'}
                            />
                            批量删除
                          </span>
                          {/* <span
                            style={{ marginRight: '12px', cursor: 'pointer' }}
                            onClick={(e) => this.handleMoveUp('exclusionRulesTableData', 'exclusionRulesRowKeys')}
                          >
                            <Icon style={{ margin: '4px 4px 0 0' }} className="common-record-span-icon" type="up-square" />
                            上移
                          </span>
                          <span
                            style={{ cursor: 'pointer' }}
                            onClick={(e) => this.handleMoveDown('exclusionRulesTableData', 'exclusionRulesRowKeys')}
                          >
                            <Icon style={{ margin: '4px 4px 0 0' }} className="common-record-span-icon" type="down-square" />
                            下移
                          </span> */}
                        </div>
                        <Button ghost type="primary" onClick={() => this.handleDictionaryLibrarySelection('exclusionRulesFormRef')}>从字典库选择项目</Button>
                      </div>
                      <PublicTablePagination
                        param={{
                          loading: exclusionRulesLoading,
                          componentName: 'IntegralRuleExclusionRules',
                          data: exclusionRulesTableData, // 表格数据
                          x: exclusionRulesTotalWidth, // 表格的宽度
                          y: store.getState().tableHeight.y - 150,
                          height: store.getState().tableHeight.y - 100 + 'px',
                          columns: [...exclusionRulesColumns, this.getModalOperationObj('13000010', 'exclusionRules', 'pointsRuleItemExceptID')], // 表头配置
                        }}
                        rowSelectionPublic={{
                          selectedRowKeys: exclusionRulesRowKeys,
                          selectedRows: exclusionRulesRowData,
                          onChange: (selectedRowKeys, selectedRows) => {
                            this.setState({
                              exclusionRulesRowKeys: selectedRowKeys,
                              exclusionRulesRowData: selectedRows,
                            })
                          },
                        }}
                        getColumns={this.getExclusionRulesColumns}
                      />
                    </div>
                    <div style={{ textAlign: 'center', marginTop: '24px' }}>
                      <Button type="primary" onClick={this.handleExclusionRulesSave}>保存</Button>
                    </div>
                  </Col>
                </Row>
              </div>
            </TabPane>
            <TabPane tab="授权对象" key="4">
              <div>
                <DynamicRenderingForm
                  rowData={authorizeRecordData}
                  selectData={selectData}
                  formData={authorizeFormData}
                  onRef={ref => this.authorizeFormRef = ref}
                />
                <Row>
                  <Col span={parseInt(authorizeFormData && authorizeFormData.length > 0 ? authorizeFormData[0]?.labelCol : 3)}></Col>
                  <Col span={parseInt(authorizeFormData && authorizeFormData.length > 0 ? authorizeFormData[0]?.wrapperCol : 20)}>
                    <div style={{ padding: '10px', border: '1px solid #e8e8e8' }} className="table-body-height">
                      <Input
                        style={{ width: '100%' }}
                        placeholder="请输入代码/描述回车检索"
                        onPressEnter={this.handleAuthorizePressEnter}
                      />
                      <div className="flex-between-center" style={{ margin: '10px 0' }}>
                        <div className="flex-align-items">
                          <span
                            style={{ marginRight: '12px' }}
                            className={!(authorizeRowKeys && authorizeRowKeys.length > 0) ? 'common-color999' : 'common-color333'}
                            onClick={() => this.handleDelete('13000013', 'authorize', 'pointsRuleAuthorizeTypeItemID', 'multiple', authorizeRowData)}
                          >
                            <Icon
                              type="delete"
                              style={{ margin: '4px 4px 0 0' }}
                              className={!(authorizeRowKeys && authorizeRowKeys.length > 0) ? 'common-color999' : 'common-record-delete-span'}
                            />
                            批量删除
                          </span>
                        </div>
                        <Dropdown overlay={(
                          <Menu>
                            {selectData && 'authorizeType' in selectData && Array.isArray(selectData.authorizeType) && selectData.authorizeType.filter(item => !!(item.id)).map((item, index) => {
                              return (
                                <Menu.Item key={index} onClick={() => this.handleAuthorizeSelection(item)}>
                                  <span>
                                    {item?.descripts || ''}
                                  </span>
                                </Menu.Item>
                              )
                            })}
                          </Menu>
                        )}>
                          <span className="span">
                            从字典库选择项目
                            <Icon style={{ fontWeight: 600, fontSize: '15px' }} type="down" />
                          </span>
                        </Dropdown>
                      </div>
                      <PublicTablePagination
                        param={{
                          loading: authorizeLoading,
                          componentName: 'IntegralRuleAuthorizedObjects',
                          data: authorizeTableData, // 表格数据
                          x: authorizeTotalWidth, // 表格的宽度
                          y: store.getState().tableHeight.y - 90,
                          height: store.getState().tableHeight.y - 40 + 'px',
                          columns: [...authorizeColumns, this.getModalOperationObj('13000013', 'authorize', 'pointsRuleAuthorizeTypeItemID')], // 表头配置
                        }}
                        rowSelectionPublic={{
                          selectedRowKeys: authorizeRowKeys,
                          selectedRows: authorizeRowData,
                          onChange: (selectedRowKeys, selectedRows) => {
                            this.setState({
                              authorizeRowKeys: selectedRowKeys,
                              authorizeRowData: selectedRows,
                            })
                          },
                        }}
                        getColumns={this.getAuthorizeColumns}
                      />
                    </div>
                    <div style={{ textAlign: 'center', marginTop: '24px' }}>
                      <Button type="primary" onClick={this.handleAuthorizeSave}>保存</Button>
                    </div>
                  </Col>
                </Row>
              </div>
            </TabPane>
          </Tabs>
        </Drawer>

        {/* 从字典库选择项目 */}
        <PublicModalQueryTable
          okText="确定"
          title={dictionaryLibraryTitle}
          queryCode="13100007"
          width="60vw"
          doubleRecordFlag="N"
          idIndex="id"
          multipleFlag="Y"
          paginationFlag={paginationFlag || 'Y'}
          autoClose="N"
          tableHeight={store.getState().tableHeight.y - 148}
          componentName="IntegralRuleDictionaryLibrarySelection"
          onRef={ref => this.dictionaryLibraryRef = ref}
          handleOk={this.handleDictionaryLibrarySave}
        />

        {/* 从字典库选择人员 */}
        <PublicModalQueryTable
          okText="确定"
          title="选择授权人员"
          queryCode="01040106"
          width="60vw"
          doubleRecordFlag="N"
          idIndex="userID"
          multipleFlag="Y"
          paginationFlag="Y"
          autoClose="N"
          tableHeight={store.getState().tableHeight.y - 148}
          componentName="IntegralRuleAuthorizedObjectsByPersonnel"
          onRef={ref => this.personnelRef = ref}
          handleOk={this.handlePersonnelSave}
        />

        {/* 批量设置时间 */}
        <PublicModalFormHooks
          width="500px"
          okText="确定"
          title="批量设置时间"
          selectData={{}}
          rowData={{}}
          formData={batchSettingTimeFormData}
          onRef={ref => this.batchSettingTimeRef = ref}
          handleSave={this.handleBatchSettingTimeSave}
        />
      </div >
    )
  }
};

export default MaintenanceOfPointsRules;