/* eslint-disable */
/* eslint-disable react/no-multi-comp,key-spacing,space-in-parens */
/* eslint-disable guard-for-in */
/* eslint-disable no-undef,import/first,prefer-destructuring,jsx-a11y/alt-text */
/* eslint-disable react/no-array-index-key */
/* eslint-disable react/jsx-closing-tag-location */
/* eslint-disable */
import React, { useEffect, useRef, useState } from 'react';
import {
  CheckCircleFilled,
  ClockCircleFilled,
  CloseCircleFilled,
  DownloadOutlined,
  ExclamationCircleFilled,
  RightOutlined,
  SearchOutlined,
  StopFilled,
  UploadOutlined,
  EyeOutlined,
  FilePdfOutlined,
  FileWordOutlined,
  FileExcelOutlined,
  ExportOutlined,
  FileOutlined,
  FileSearchOutlined,
  ClearOutlined,
  CaretUpOutlined,
  CaretDownOutlined,
  PlaySquareOutlined
} from '@ant-design/icons';
import { Icon as LegacyIcon } from '@ant-design/compatible';
// import '@ant-design/compatible/assets/index.css';
import lodash from 'lodash';
import { Table, Input, Checkbox, Button, Upload, message, Popover, Spin, Space, Form, Tooltip, Row, Progress, Modal, Col, Pagination } from 'antd-v4';
import { DndProvider, DropTarget, DragSource } from 'react-dnd';
import {
  sortableContainer,
  sortableElement,
  sortableHandle,
} from 'react-sortable-hoc';
import { MenuOutlined } from '@ant-design/icons';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { Resizable } from 'react-resizable';
import styles from './index.less';
import * as commonUtils from '@/utils/utils';
import ShowTypeNew from '@/components/Common/CommonComponent';
import Highlighter from 'react-highlight-words';
import commonConfig from '@/utils/config';
import update from 'immutability-helper';
import * as commonFunc from '@/components/Common/commonFunc';
import moment from 'moment';
import ParamIcon from '@/assets/param.svg';
import sAlumiteIcon from '@/assets/sAlumite.svg';
import ReplaceIcon from '@/assets/extract.svg';
import DisReplaceIcon from '@/assets/disableExtract.svg';
import DisAlumiteIcon from '@/assets/disabledsAlumite.svg';
import ShowImg from '@/components/Common/ShowImage/ShowImage';
import ShowImgStyle from '@/components/Common/ShowImage/ShowImage.less';
import AntdDraggableModal from '@/components/Common/AntdDraggableModal';
import CommonListSelectTree from '@/components/Common/CommonListSelectTree';
import CommonListSelect from '@/components/Common/CommonListSelect';
import CommonList from '@/components/Common/CommonList';
import CommonListTreeSelect from '@/components/Common/CommonListTreeSelect';
import AntdDraggableDiv from '@/components/Common/AntdDraggableDiv';
import SlaveMemo from '@/components/Common/SlaveMemo';
import { VList } from '@/components/Vlist';
import { VList as VListNew } from '@/components/VlistNew';
import SvgIcon from "../../SvgIcon";
import PrintPdf from '@/components/PrintPdf/PrintPdf';
import OfficePreview from '@/components/Common/OfficePreview';
import EditTableCommonListSelectFlex from '@/components/Common/CommonListSelectFlex/EditTableCommonListSelectFlex';
import ColorInfo from './colorInfo';
// import { VList } from 'virtuallist-antd';


/* 获取配置及数据 */
const FormItem = Form.Item;
const { confirm } = Modal;
const ResizeableTitle = (props) => {
  const { onResize, width, ...restProps } = props;
  if (!width) {
    return <th {...restProps} key={lodash.uniqueId()} />;
  }
  return (
    <Resizable
      width={width}
      height={0}
      handle={
        <span
          className="react-resizable-handle"
          onClick={(e) => {
            e.stopPropagation();
          }}
          key={lodash.uniqueId()}
        />
      }
      onResize={onResize}
      draggableOpts={{ enableUserSelectHack: false }}
    >
      <th width={width} {...restProps} />
    </Resizable>
  );
};

let dragingIndex = -1; // 用于设置拖拽Row时样式
let moverow = null; // 定义move事件，解决warn
const BodyRow = (props) => {
  const {
    isOver, connectDragSource, connectDropTarget, move, ...restProps
  } = props;
  moverow = move;
  const ref = useRef(null);
  const style = { ...restProps.style, cursor: 'move' };
  let { className } = restProps;
  if (isOver) {
    if (restProps.index > dragingIndex) {
      className += ' drop-over-downward';
    }
    if (restProps.index < dragingIndex) {
      className += ' drop-over-upward';
    }
  }
  connectDragSource(connectDropTarget(ref));
  return <tr {...restProps} ref={ref} className={className} style={style} />;
};
// DragSource 拖拽事件的方法对象
const rowSource = {
  beginDrag(props) {
    const dragingKey = props["data-row-key"]
    dragingIndex = props.index;
    return {
      'data-row-key': dragingKey,
      index: props.index,
    }
    // dragingIndex = props.index;
    // return {
    //     index: props.index,
    // };
  },
};
// DropTarget 拖拽事件的方法对象
const rowTarget = {
  drop(props, monitor) {
    const dragIndex = monitor.getItem().index;
    const hoverIndex = props.index;
    const dragKey = monitor.getItem()["data-row-key"];
    const hoverKey = props["data-row-key"];
    if (dragKey === hoverKey) {
      return;
    }
    props.moveRow(dragIndex, hoverIndex, dragKey, hoverKey);
    monitor.getItem().index = hoverIndex;
    monitor.getItem()["data-row-key"] = hoverKey;
  },
};

const DragableBodyRow = DropTarget('row', rowTarget, (connect, monitor) => ({
  connectDropTarget: connect.dropTarget(),
  isOver: monitor.isOver(),
}))(
  DragSource('row', rowSource, connect => ({
    connectDragSource: connect.dragSource(),
  }))(BodyRow),
);
/* ================================================================== */
class CommonTableRc extends React.Component {
  /**   构造函数   */
  constructor(props) {
    super(props);
    this.state = {
      navigation: 'navigation',
      previewVisible: false, /* 图片预览弹窗 */
      previewImage: '', /* 预览图片地址 */
      headerColumn: [], /*   表头信息(数据类型:数组对象)   */
      slaveInfoHeaderColumn: [], /*   表头信息(数据类型:数组对象)   */
      tableColumn: [], /*   table的表头信息(数据类型:数组对象)   */
      tableInfoColumn: [],
      slaveInfoTableColumn: [],
      selectedRowKeys: [], /*   已选择的数据行(数据格式:数组)   */
      slaveInfoSelectedRowKeys: [],
      dataSource: [], /*   数据(数据格式:数组对象)   */
      totalData: [], /* 总计数据 */
      totalData1: [], /* 总计数据1 */
      enabled: false, /* 是否为编辑 */
      filteredValue: [], /* 过滤数据值 */
      expKeys: [], /*   展开数据行(数据格式:数组)   */
      showimgs: false, // 必须字段控制弹框显示隐藏
      firstIndex: 0, // 点击时默认下标
      commonPopupVisible: false,
      commonFieldPopupVisible: false,
      openNewTabFlag: false, // 是否因在弹窗中打开新页签离开本页;
      randomId: commonUtils.createSid(),
      realizeHeight: 0,
      tableClassName: 'table_' + commonUtils.createSid(),
      commonFileDownloadVisible: false, // 多文件下载弹窗
      commonFileDownloadList: [], // 多文件列表
      pdfFileVisible: false, // pdf文件弹窗
      bOperateMoreVisible: false, /* 复制更多弹窗 */
      pdfFileUrl: '',
      currentHoverSid: '',
      simpleModalVisible: false,
      simpleModalWord: '',
    };
    this.rowKey = commonUtils.isNotEmptyObject(props.tableProps) && !commonUtils.isEmpty(props.tableProps.rowKey) ? props.tableProps.rowKey : 'sId'; /*   表格主键  */
    this.config = {}; /*   配置信息(基础)(数据格式:对象)   */
    this.tableColumn = []; /*   table的表头信息(数据类型:数组对象)  */
    this.tableInfoColumn = [];
    this.scrollX = 0; /*   表格宽度统计值(数据格式:整形)  */
    this.scrollY = this.props.tableProps ? this.props.tableProps.AutoTableHeight ? this.props.tableProps.AutoTableHeight : 0 : 0;
    this.scrollInfoX = 0; /*   表格宽度统计值(数据格式:整形)   */
    this.formId = ''; /*   窗体Id(数据格式:字符串)   */
    this.sId = ''; /*   表格Id(数据格式:字符串)   */
    this.isUploadShow = false; /*   是否显示上传控件(数据格式:布尔)   */
    this.isDownloadShow = false; /*   是否显示上传控件(数据格式:布尔)   */
    this.isLookShow = false; /*   是否显示查看控件(数据格式:布尔)   */
    this.isAddShow = false; /*   是否显示添加控件(数据格式:布尔)   */
    this.isModalShow = false; /*   是否显示modal控件(数据格式:布尔)   */
    this.isModalRemarkShow = false;/*   是否显示材料备注控件(数据格式:布尔)   */
    this.isChooseProcessShow = false; /*   是否显示选择工序控件(数据格式:布尔)   */
    this.isCopyShow = false; /*   是否显示复制控件(数据格式:布尔)   */
    this.isCopyAllShow = false; /*   是否显示复制全部控件(数据格式:布尔)   */
    this.isDelShow = false; /*   是否显示删除控件(数据格式:布尔)   */
    this.isCopyMoreShow = false; /* 是否显示删除多行控件(数据格式:布尔)   */
    this.isPopupShow = false; /* 是否显示弹窗控件(数据格式:布尔)   */
    this.isParamShow = false; /* 是否显示弹窗控件(数据格式:布尔)   */
    this.isChooseProductProcess = false; /* 是否显示成品工序控件(数据格式:布尔)   */
    this.isChooseProductMaterials = false; /* 是否显示成品材料控件(数据格式:布尔)   */
    // this.onUploadChange = () => {}; /*   上传后执行函数(数据格式:函数)   */
    this.initColumn = null;
    this.finalColumn = null;
    this.droping = false;
    this.resize = false;
    this.isDragAndDrop = false;
    this.tableContentWidth = 0;
    this.tableInfoContentWidth = 0;
    this.mergeCellListMap = {}; // 合并单元格map;
    this.mergeCellStateMap = {}; // 是否合并单元格map
    this.mergeInfoCellListMap = {};
    this.mergeInfoCellStateMap = {};
    // this.beSelectDropdownOpen = false;
    this.uniqueId = null; // 虚拟列表vid
    this.hasMergeHeader = false; // 判断是否包含合并表头
    this.sticky = this.props.tableProps.sticky ? this.props.tableProps.sticky : false;
    this.sortRendered = false;
    this.tableHeight = 0;
    this.DraggableContainer = null;
    this.DraggableBodyRow = null;
    this.curSlaveInfoData = [];
    this.slaveInfoHeaderMap = {};
    this.mergeCellList = [];
    this.tableFilterData = [];
    this.pathname = '';
    this.hasSpanBgColor = false; // 是否有span背景色
    this.curPagination = {}; // 当前分页数据
    this.selectedRowKeysOld = []; // 记录选中数据
    this.tableId = this.props.tableId;
    this.isAllowConExpendKeys = ['19211681019715708440774010'].includes(props.formId);
  }

  /**   渲染前只执行一次   */
  componentWillMount() {
    /*   state和this属性赋值s   */
    this.mounted = true;
    this.assignmentWillProps(this.props);
  }

  componentDidMount() {
    /* 获取ant-table-body宽度 */
    if (!commonUtils.isEmptyObject(this.mydiv)) {
      if (!this.tableContentWidth) {
        this.tableContentWidth = this.mydiv.offsetWidth;
      }
    }
    // 处理表单详情的tableWidth
    if (!commonUtils.isEmptyObject(this.myInfoDiv)) {
      if (!this.tableInfoContentWidth) {
        this.tableInfoContentWidth = this.myInfoDiv.offsetWidth;
      }
    }
    if (this.props.onRenderFinish) {
      this.props.onRenderFinish();
    }

    window.addEventListener('resize', () => {
      this.computedTableHeight();
      this.computedTdWidth(true);
      this.forceUpdate();
    });

    if (this.tableId) {
      window[`${this.tableId}FieldPopupModal`] = this.handleFieldPopupModal;
    }

    document.addEventListener('mouseover', this.handleLastTdMouseOver);

    // 监听鼠标右击事件
    this.mydiv.addEventListener('contextmenu', this.handleContextMenu);
  }

  componentDidUpdate() {
    if (
      this.props.app && this.props.app.currentPane && (this.props.app.currentPane.route.indexOf('commonList') !== -1
        ||
        this.props.app.currentPane.route.indexOf('productionScheduleTree') !== -1)
    ) {
      if (this.tableHeight !== '100%' && this.tableHeight !== 0) {
        if (this.props.name !== 'report') {
          this.mydiv.getElementsByClassName('ant-table-body')[0].style.height = this.tableHeight ? this.tableHeight + 'px' : 80 + 'px';
        }
      }
    }

    let divs = document.getElementsByClassName('noInputInsert');
    if (divs.length) {
      Array.prototype.forEach.call(divs, item => {
        item.parentNode.parentNode.parentNode.parentNode.classList.add('insertTd');
      });
    }

    // 判断树形表格展开/收起全部按钮是否在第一个column上
    const { tableClassName } = this.state;
    const oTable = document.querySelectorAll(`.${tableClassName}`)[0];
    if (this.showExpAll && oTable) {
      const getTh = (dom) => {
        if (!dom) {
          return false;
        }
        if (dom.nodeName === 'TH') {
          return dom;
        } else {
          return getTh(dom.parentNode);
        }
      }
      const oHeader = oTable.querySelector('.ant-table-header');
      const oThDivs = oHeader.querySelectorAll('.th-div');
      const oThs = Array.from(oThDivs).map(item => getTh(item));
      // const oThs = oHeader.querySelectorAll('th[tabindex]');
      const oExpAllIcon = oHeader.querySelector('.table-expAllIcon');
      if (oExpAllIcon) {
        const oTh = getTh(oExpAllIcon);
        if (oTh) {
          const index = [].indexOf.call(oThs, oTh);
          if (index > 0) {
            const oFirstThDiv = oHeader.querySelector('.th-div');
            oFirstThDiv && oFirstThDiv.prepend(oExpAllIcon);
          }
        }
      }
    }
    if (this.simpleModalRef.current) this.simpleModalRef.current.innerHTML = this.state.simpleModalWord || '';
  }

  /**   props改变的时候触发s   */
  componentWillReceiveProps(nextProps) {
    /*   state和this属性赋值   */
    this.assignmentWillProps(nextProps);
    // 等待加载完成后计算宽度s
    if (!commonUtils.isEmptyObject(this.mydiv)) {
      if (!this.tableContentWidth) {
        this.tableContentWidth = this.mydiv.offsetWidth;
      }
    }
    if (!commonUtils.isEmptyObject(this.myInfoDiv)) {
      if (!this.tableInfoContentWidth) {
        this.tableInfoContentWidth = this.myInfoDiv.offsetWidth;
      }
    }
    if (this.state.openNewTabFlag && this.pathname === location.pathname) {
      const dom = document.getElementsByClassName(`${this.state.randomId}-CommonListSelectTree`)[0];
      dom.parentElement.parentElement.style.display = 'block';
      this.setState({
        openNewTabFlag: false,
      });
    }
  }

  /**   返回true执行渲染,返回false不渲染  */
  shouldComponentUpdate(nextProps, nextState) {
    const {
      headerColumn, tableColumn, dataSource, totalData, totalData1, selectedRowKeys, enabled, filteredValue,
      previewVisible, previewImage, slaveInfoSelectedRowKeys, slaveInfo, expKeys, commonPopupVisible, commonFieldPopupVisible, realizeHeight,
      bOperateMoreVisible,
    } = this.state;
    return enabled !== nextState.enabled ||
      this.props.updateRowNumTime !== nextState.updateRowNumTime ||
      JSON.stringify(this.props.isDragAndDrop) !== JSON.stringify(nextProps.isDragAndDrop) ||
      // JSON.stringify(headerColumn) !== JSON.stringify(nextState.headerColumn) ||
      JSON.stringify(this.props.config) !== JSON.stringify(nextProps.config) ||
      JSON.stringify(tableColumn) !== JSON.stringify(nextState.tableColumn) ||
      JSON.stringify(dataSource) !== JSON.stringify(nextState.dataSource) ||
      JSON.stringify(totalData) !== JSON.stringify(nextState.totalData) ||
      JSON.stringify(totalData1) !== JSON.stringify(nextState.totalData1) ||
      JSON.stringify(selectedRowKeys) !== JSON.stringify(nextState.selectedRowKeys) ||
      JSON.stringify(slaveInfoSelectedRowKeys) !== JSON.stringify(nextState.slaveInfoSelectedRowKeys) ||
      JSON.stringify(expKeys) !== JSON.stringify(nextState.expKeys) ||
      JSON.stringify(previewVisible) !== JSON.stringify(nextState.previewVisible) ||
      JSON.stringify(commonPopupVisible) !== JSON.stringify(nextState.commonPopupVisible) ||
      JSON.stringify(bOperateMoreVisible) !== JSON.stringify(nextState.bOperateMoreVisible) ||
      JSON.stringify(commonFieldPopupVisible) !== JSON.stringify(nextState.commonFieldPopupVisible) ||
      JSON.stringify(previewImage) !== JSON.stringify(nextState.previewImage) ||
      JSON.stringify(filteredValue) !== JSON.stringify(nextState.filteredValue) ||
      JSON.stringify(this.props.tableProps.pagination) !== JSON.stringify(nextProps.tableProps.pagination) ||
      // JSON.stringify(this.props.tableProps.AutoTableHeight) !== JSON.stringify(nextProps.tableProps.AutoTableHeight) ||
      JSON.stringify(nextProps.slaveInfo) !== slaveInfo ||
      JSON.stringify(nextProps.realizeHeight) !== realizeHeight ||
      this.props.tableProps.newButton !== nextProps.tableProps.newButton ||
      this.state.simpleModalVisible !== nextState.simpleModalVisible;
  }

  componentWillUnmount() {
    this.mounted = false;
    window.removeEventListener('resize', () => {
      this.computedTableHeight();
      this.forceUpdate();
    });
    document.removeEventListener('mouseover', this.handleLastTdMouseOver);
    this.mydiv.removeEventListener('contextmenu', this.handleContextMenu);
    if (this.tableId && window[`${this.tableId}FieldPopupModal`]) {
      delete window[`${this.tableId}FieldPopupModal`];
    }
  }

  simpleModalRef = React.createRef();

  handleLastTdMouseOver = (event) => {
    try {
      if (event.target.classList.contains('react-resizable-handle') && event.target.parentNode.getAttribute('bnotresize') === 'bNotResize') {
        const oBody = this.mydiv.querySelector('.ant-table-body');
        const { scrollWidth, clientWidth } = oBody;
        const oResizable = event.target;
        if (scrollWidth === clientWidth) {
          oResizable.style.cursor = 'default';
          return;
        }
        this.lastTdMouseOver = true;
        let minLeft, maxLeft, diffx;
        oResizable.style.cursor = 'col-resize';
        const tempDom = document.createElement('div');
        const mask = document.createElement('div');
        mask.style = "position: absolute; width: 100%; height: 100%; left: 0; top: 0; z-index: 9999;"
        const resizableMousemove = (e) => {
          const { clientX } = e;
          const left = Math.min(Math.max(minLeft, clientX), maxLeft + 200);
          diffx = left - maxLeft;
          if (diffx < 0) {
            diffx = Math.max(diffx, clientWidth - scrollWidth);
          }
          Object.assign(tempDom.style, {
            left: left + 'px',
          });
        }
        const resizableMouseup = () => {
          this.lastTdMouseOver = false;
          document.body.removeChild(mask);
          document.body.removeChild(tempDom);
          document.removeEventListener('mouseup', resizableMouseup);
          document.removeEventListener('mousemove', resizableMousemove);

          const { tableColumn, headerColumn } = this.state;
          const sessionColumn = sessionStorage.getItem(`${this.props.formId}_${this.props.config.sId}`);
          const column = sessionColumn ? JSON.parse(sessionColumn) : tableColumn;
          const lastIndex = column.findIndex(item => item.dataIndex === 'tableLastEmpty') - 1;
          if (lastIndex > -1 && diffx !== 0) {
            const headerColumnNew = [...headerColumn];
            const columnNew = [...column];
            if (commonUtils.isNotEmptyArr(columnNew[lastIndex].children)) {
              const lastChildIndex = columnNew[lastIndex].children.length - 1;
              columnNew[lastIndex].children[lastChildIndex].width += diffx;
              if (columnNew[lastIndex].children[lastChildIndex].widthExtra) {
                columnNew[lastIndex].children[lastChildIndex].widthExtra += diffx;
              } else {
                columnNew[lastIndex].children[lastChildIndex].widthExtra = diffx;
              }
              if (columnNew[lastIndex].children[lastChildIndex].widthExtra < 0) {
                columnNew[lastIndex].children[lastChildIndex].widthExtra = 0;
              }
              const headerIndex = headerColumnNew.findIndex(item => item.dataIndex === columnNew[lastIndex].children[lastChildIndex].dataIndex);
              if (headerIndex !== -1) {
                headerColumnNew[headerIndex].width = columnNew[lastIndex].children[lastChildIndex].width;
                headerColumnNew[headerIndex].widthExtra = columnNew[lastIndex].children[lastChildIndex].widthExtra;
              }
            } else {
              columnNew[lastIndex].width += diffx;
              if (columnNew[lastIndex].widthExtra) {
                columnNew[lastIndex].widthExtra += diffx;
              } else {
                columnNew[lastIndex].widthExtra = diffx;
              }
              if (columnNew[lastIndex].widthExtra < 0) {
                columnNew[lastIndex].widthExtra = 0;
              }
              const headerIndex = headerColumnNew.findIndex(item => item.dataIndex === columnNew[lastIndex].dataIndex);
              if (headerIndex !== -1) {
                headerColumnNew[headerIndex].width = columnNew[lastIndex].width;
                headerColumnNew[headerIndex].widthExtra = columnNew[lastIndex].widthExtra;
              }
            }

            sessionStorage.setItem(`${this.props.formId}_${this.props.config.sId}`, JSON.stringify(columnNew));
            this.props.onSaveState({
              headerColumn: headerColumnNew,
              tableColumn: columnNew
            });
          }
        }
        oResizable.onmousedown = () => {
          const { y, height } = event.target.getBoundingClientRect();
          minLeft = event.target.parentNode.getBoundingClientRect().x + 50;
          maxLeft = event.target.parentNode.getBoundingClientRect().x + event.target.parentNode.getBoundingClientRect().width;
          Object.assign(tempDom.style, {
            width: '2px',
            height: height + 'px',
            background: '#1990ff',
            top: y + 'px',
            left: maxLeft + 'px',
            position: 'absolute',
            zIndex: 9999,
            cursor: 'col-resize'
          });
          document.body.append(mask);
          document.body.append(tempDom);
          document.removeEventListener('mouseup', resizableMouseup);
          document.addEventListener('mouseup', resizableMouseup);
          document.removeEventListener('mousemove', resizableMousemove);
          document.addEventListener('mousemove', resizableMousemove);
        };
      }
    } catch (error) { }
  }

  /**   列拖动s   */
  onHeaderCell = (isSlaveInfo, index, column) => {
    let columns;
    if (isSlaveInfo) {
      columns = this.state.tableInfoColumn.slice(0);
    } else {
      columns = this.state.tableColumn.slice(0);
    }
    // 最后一列禁止拖动
    let bNotResize = false;
    const lastIndex = columns.findIndex(item => item.dataIndex === 'tableLastEmpty') - 1;
    if (lastIndex > -1) {
      if (commonUtils.isNotEmptyArr(columns[lastIndex].children)) {
        if (columns[lastIndex].children[columns[lastIndex].children.length - 1].dataIndex === column.dataIndex) {
          bNotResize = true;
        }
      } else if (columns[lastIndex].dataIndex === column.dataIndex) {
        bNotResize = true;
      }
    }

    return {
      width: column.width,
      onResize: !bNotResize ? this.handleResize(index, column, isSlaveInfo) : null,
      bnotresize: bNotResize ? 'bNotResize' : null,
      onClick: () => { },
      onMouseDown: () => {
        if (this.lastTdMouseOver) {
          return;
        }
        const tableColumn = isSlaveInfo ? this.state.tableInfoColumn : this.state.tableColumn;
        for (const m in tableColumn) {
          if (commonUtils.isNotEmptyArr(columns[m].children)) {
            // 如果是双层表头
            const initColumnIndex = columns[m].children.findIndex(item => item.dataIndex === column.dataIndex);
            if (initColumnIndex !== -1) {
              this.initColumn = columns[m].children[initColumnIndex];
              this.droping = true;
              this.bInitColumnMuti = true; // 拖动对象是多表头下的子表头
              break;
            }
          } else if (columns[m].dataIndex === column.dataIndex) {
            this.initColumn = columns[m];
            this.droping = true;
            this.bInitColumnMuti = false;
            break;
          }
        }
      },
      onMouseEnter: () => {
        if (this.resize) {
          this.droping = false;
          return false;
        } else if (this.resize === false) {
          if (!commonUtils.isEmpty(this.initColumn) && this.droping) {
            this.setState(() => {
              for (const i in columns) {
                if (commonUtils.isNotEmptyArr(columns[i].children)) {
                  for (const j in columns[i].children) {
                    if (columns[i].children[j].dataIndex === column.dataIndex) {
                      columns[i].children[j] = {
                        ...columns[i].children[j],
                        className: 'hover-droping-cell',
                      };
                    } else {
                      columns[i].children[j] = {
                        ...columns[i].children[j],
                        className: '',
                      };
                    }
                  }
                } else if (columns[i].dataIndex === column.dataIndex) {
                  columns[i] = {
                    ...columns[i],
                    className: 'hover-droping-cell',
                  };
                } else {
                  columns[i] = {
                    ...columns[i],
                    className: '',
                  };
                }
              }
              // const sortArr = columns.map(item => item.dataIndex);
              let sortArr = [];
              columns.forEach(item => {
                if (item.children) {
                  item.children.forEach(child => {
                    sortArr.push(child.dataIndex);
                  })
                } else {
                  sortArr.push(item.dataIndex);
                }
              });
              if (isSlaveInfo) {
                sessionStorage.setItem(`${this.props.formId}_${this.props.config.sId}_info_headerColumns`, JSON.stringify(sortArr));
                return { tableInfoColumn: columns };
              } else {
                sessionStorage.setItem(`${this.props.formId}_${this.props.config.sId}_headerColumns`, JSON.stringify(sortArr));
                return { tableColumn: columns };
              }
            });
          } else {
            this.droping = false;
          }
        }
      },
      onMouseUp: () => {
        let spliceIndex = null;
        const sortItems = [];
        if (this.droping && !commonUtils.isEmpty(this.initColumn) && this.initColumn.dataIndex !== column.dataIndex) {
          const bTargetMuti = columns.findIndex(item => item.dataIndex === column.dataIndex) === -1; // 移动到的目标是否是多表头
          if (!this.bInitColumnMuti && !bTargetMuti) { // 拖拽对象【单表头】、移动到的目标【单表头】
            for (const i in columns) {
              columns[i].className = '';
              if (columns[i].dataIndex === this.initColumn.dataIndex) {
                columns.splice(i, 1);
                spliceIndex = columns.findIndex(item => item.dataIndex === column.dataIndex);
                columns.splice(spliceIndex, 0, this.initColumn);
                sortItems.push(this.initColumn.dataIndex);
                sortItems.push(column.dataIndex);
              }
            }
          } else if (!this.bInitColumnMuti && bTargetMuti) { // 拖拽对象【单表头】、移动到的目标【双表头】
            let iIndexArr = [];
            // 获取拖拽对象index
            const initColumnIndex = columns.findIndex(item => item.dataIndex === this.initColumn.dataIndex);
            // 获取目标index
            for (const i in columns) {
              const children = columns[i].children;
              if (commonUtils.isNotEmptyArr(children)) {
                const iIndex = children.findIndex(item => item.dataIndex === column.dataIndex);
                if (iIndex !== -1) {
                  columns[i].children[iIndex].className = '';
                  iIndexArr = [i, iIndex];
                  break;
                }
              }
            }
            if (initColumnIndex !== -1) {
              // 去除拖拽对象数组
              columns.splice(initColumnIndex, 1);
              // 目标对象index
              spliceIndex = iIndexArr[0];
              if (spliceIndex >= initColumnIndex) {
                spliceIndex -= 1;
              }
              if (iIndexArr[1] === 0) { //如果目标对象是第一个
                // 将拖拽对象插入到目标对象前面
                columns.splice(spliceIndex, 0, this.initColumn);
              } else if (iIndexArr[1] > 0) { // 如果目标对象不是第一个
                // 取出目标对象数组
                const targetColumn = columns.splice(spliceIndex, 1)[0];
                const column1 = { ...targetColumn, children: targetColumn.children.filter((item, index) => index < iIndexArr[1]) };
                const column2 = { ...targetColumn, children: targetColumn.children.filter((item, index) => index >= iIndexArr[1]) };
                columns.splice(spliceIndex, 0, column1, this.initColumn, column2);
              }
            }
          } else if (this.bInitColumnMuti && !bTargetMuti) { // 拖拽对象【双表头】、移动到的目标【单表头】
            // 获取拖拽对象index
            let initColumnIndexArr = [];
            for (const i in columns) {
              if (commonUtils.isNotEmptyArr(columns[i].children)) {
                const iIndex = columns[i].children.findIndex(child => child.dataIndex === this.initColumn.dataIndex);
                if (iIndex !== -1) {
                  initColumnIndexArr = [i, iIndex];
                  break;
                }
              }
            }
            if (commonUtils.isNotEmptyArr(initColumnIndexArr)) {
              spliceIndex = columns.findIndex(item => item.dataIndex === column.dataIndex);
              columns[spliceIndex].className = '';
              if (columns[initColumnIndexArr[0]].children.length === 1) {
                const initColumnParent = columns.splice(initColumnIndexArr[0], 1)[0];
                columns.splice(spliceIndex, 0, initColumnParent);
              } else {
                const newColumn = {
                  ...columns[initColumnIndexArr[0]],
                  children: [columns[initColumnIndexArr[0]].children[initColumnIndexArr[1]]]
                };
                columns[initColumnIndexArr[0]].children = columns[initColumnIndexArr[0]].children.filter(item => item.dataIndex !== newColumn.children[0].dataIndex);
                columns.splice(spliceIndex, 0, newColumn);
              }
            }
          } else { // 拖拽对象【双表头】、移动到的目标【双表头】
            // 获取拖拽对象index
            let initColumnIndexArr = [];
            for (const i in columns) {
              if (commonUtils.isNotEmptyArr(columns[i].children)) {
                const iIndex = columns[i].children.findIndex(child => child.dataIndex === this.initColumn.dataIndex);
                if (iIndex !== -1) {
                  initColumnIndexArr = [i, iIndex];
                  break;
                }
              }
            }

            let iIndexArr = [];
            // 获取目标index
            for (const i in columns) {
              const children = columns[i].children;
              if (commonUtils.isNotEmptyArr(children)) {
                const iIndex = children.findIndex(item => item.dataIndex === column.dataIndex);
                if (iIndex !== -1) {
                  columns[i].children[iIndex].className = '';
                  iIndexArr = [i, iIndex];
                  break;
                }
              }
            }

            if (commonUtils.isNotEmptyArr(initColumnIndexArr) && commonUtils.isNotEmptyArr(iIndexArr)) {
              if (initColumnIndexArr[0] === iIndexArr[0]) { // 同一个一级表头
                columns[initColumnIndexArr[0]].children.splice(initColumnIndexArr[1], 1);
                spliceIndex = columns[initColumnIndexArr[0]].children.findIndex(item => item.dataIndex === column.dataIndex);
                columns[initColumnIndexArr[0]].children.splice(spliceIndex, 0, this.initColumn);
              } else { // 不同的一级表头
                const newColumn = {
                  ...columns[initColumnIndexArr[0]],
                  children: [columns[initColumnIndexArr[0]].children[initColumnIndexArr[1]]]
                };
                if (iIndexArr[1] === 0) { // 最前面
                  columns[initColumnIndexArr[0]].children.splice(initColumnIndexArr[1], 1);
                  spliceIndex = iIndexArr[0];
                  if (columns[initColumnIndexArr[0]].children.length === 0) { // 剩下的二层表头为空
                    columns.splice(initColumnIndexArr[0], 1);
                    spliceIndex = initColumnIndexArr[0] < spliceIndex ? spliceIndex - 1 : spliceIndex;
                  }
                  columns.splice(spliceIndex, 0, newColumn);
                } else { // 插到其它二级表头中间
                  columns[initColumnIndexArr[0]].children.splice(initColumnIndexArr[1], 1);
                  spliceIndex = iIndexArr[0];
                  if (columns[initColumnIndexArr[0]].children.length === 0) { // 剩下的二层表头为空
                    columns.splice(initColumnIndexArr[0], 1);
                    spliceIndex = initColumnIndexArr[0] < spliceIndex ? spliceIndex - 1 : spliceIndex;
                  }
                  const targetColumn = columns.splice(spliceIndex, 1)[0];
                  const column1 = { ...targetColumn, children: targetColumn.children.filter((item, index) => index < iIndexArr[1]) };
                  const column2 = { ...targetColumn, children: targetColumn.children.filter((item, index) => index >= iIndexArr[1]) };
                  columns.splice(spliceIndex, 0, column1, newColumn, column2);
                }
              }
            }

          }
          // 合并一级表头相同的相邻的column
          columns = columns.reduce((prev, cur) => {
            if (prev.length) {
              const prevColumn = prev[prev.length - 1];
              if (commonUtils.isNotEmptyArr(prevColumn.children) && commonUtils.isNotEmptyArr(cur.children) && prevColumn.title === cur.title) {
                prevColumn.children = [...prevColumn.children, ...cur.children];
                prev[prev.length - 1] = prevColumn;
                return prev;
              } else {
                prev.push(cur);
                return prev;
              }
            } else {
              prev.push(cur);
              return prev;
            }
          }, []);
          this.tableInfoColumn = columns;
          let sortArr = [];
          columns.forEach(item => {
            if (item.children) {
              item.children.forEach(child => {
                sortArr.push(child.dataIndex);
              })
            } else {
              sortArr.push(item.dataIndex);
            }
          });
          if (isSlaveInfo) {
            this.setState({ tableInfoColumn: columns }, () => {
              sessionStorage.setItem(`${this.props.formId}_${this.props.config.sId}_info_headerColumns`, JSON.stringify(sortArr));
              this.initColumn = null;
              this.droping = false;
            });
            this.handleSaveOrder(sortItems, isSlaveInfo);
          } else {
            this.setState({ tableColumn: columns }, () => {
              sessionStorage.setItem(`${this.props.formId}_${this.props.config.sId}_headerColumns`, JSON.stringify(sortArr));
              this.initColumn = null;
              this.droping = false;
            });
            this.handleSaveOrder(sortItems);
          }
        } else {
          this.resize = false;
          this.droping = false;
        }
      },
      onContextMenu: (event) => {
        window.event.returnValue = false;
      },
    };
  };

  handleContextMenu = (event) => {
    try {
      // 判断右键位置是否有选中文本
      if (!window.getSelection().toString()) {
        const { target } = event;
        const { tagName } = target;
        const oDiv = {
          'span': target.getAttribute('data-name') ? target : target.parentNode,
          'td': target?.childNodes[0]?.childNodes[0],
          'div': target.getAttribute('data-name') ? target : target.childNodes[0],
          'input': target,
        }[tagName.toLowerCase()];

        if (!oDiv) return;
        if (!oDiv.getAttribute('data-control-name')?.includes('_Sum')) return;
        // 阻止右键菜单
        event.preventDefault();
        this.setState({ totalDataNew: undefined, sumGroup: {} });
      }
    } catch (error) {}

  }

  onRowMouseEnter = (record) => { // recor
    if (this.props.enabled && this.props.tableBelone !== 'list' && commonUtils.isNotEmptyObject(this.props.tableProps) &&
      !this.beSelectDropdownOpen && commonUtils.isEmptyObject(this.props.tableProps.rowSelection) && this.state.currentHoverSid !== record.sId) {
      if (this.timerSelectRowChange) {
        clearTimeout(this.timerSelectRowChange);
      }
      this.timerSelectRowChange = setTimeout(() => {
        this.setState({
          currentHoverSid: record.sId,
        });
        // console.log('=====record', record);
        // this.handleSelectRowChange(this.props.name, [record[this.rowKey]]);
      }, 150);
    }
  }

  onRowMouseLeave = () => {
    if (this.timerSelectRowChange) {
      this.setState({
        currentHoverSid: '',
      });
      clearTimeout(this.timerSelectRowChange);
    }
  }


  rowClickRef = React.createRef();

  /**   行选择   */
  onRowClick = (record, index, type, name, tabType) => {
    if (this.handleCellClick(record)) return;

    if (this.stopRowClick) {
      this.stopRowClick = false;
      return;
    }
    const {
      bMutiSelect, tableProps, bMutiSelect1, bRowClick, bContinueClick,
    } = this.props;
    const { rowSelection } = tableProps;
    // let { selectedRowKeys } = this.props;
    this.rowClickRef.current = index;

    const bSlaveInfo = tabType && tabType.includes('slave') && tabType.includes('Info');

    const rowKey = bSlaveInfo && commonUtils.isNotEmptyObject(this.props.slaveInfo.tableProps) ? this.props.slaveInfo.tableProps.rowKey : this.rowKey;
    let selectedRowKeys = bSlaveInfo && commonUtils.isNotEmptyObject(this.props.slaveInfo.tableProps) ?
      this.props.slaveInfo.selectedRowKeys === undefined ? undefined : [...this.props.slaveInfo.selectedRowKeys] :
      this.props.selectedRowKeys === undefined ? undefined : [...this.props.selectedRowKeys];
    // bMutiSelect1默认都为false,如果想点击整行时勾选框不勾选，props里面设置bMutiSelect1为true即可
    if (selectedRowKeys && selectedRowKeys.indexOf(record[rowKey]) !== -1 && name !== 'slave' && !this.props.bRowClickRepeat) {
      return;
    }
    if (selectedRowKeys && selectedRowKeys.indexOf(record[rowKey]) !== -1 && name !== 'slave' && !this.props.enabled && !this.props.bRowClickRepeat) {
      this.handleSelectRowChange(name, []);
      return;
    }
    if (bMutiSelect && rowSelection !== null && !bMutiSelect1) { /*  有多选、复选框情况下 */
      if (commonUtils.isEmptyArr(selectedRowKeys) || bContinueClick) {
        const keys = [];
        keys.push(record[rowKey]);
        selectedRowKeys = keys;
      } else {
        const indexKey = selectedRowKeys.indexOf(record[rowKey]);
        if (indexKey === -1) {
          selectedRowKeys.push(record[rowKey]);
        } else if (indexKey !== -1 && type !== 'drag') {
          if (!bRowClick) {
            selectedRowKeys.splice(indexKey, 1); /* 可输入行，行内点击时 不去除selectedRowKeys */
          }
        }
      }
      this.handleSelectRowChange(name, selectedRowKeys);
    } else {
      this.handleSelectRowChange(name, [record[rowKey]]);
    }
  };

  // 数据扁平化
  getDataAll = (data, parentRowKeyPath = []) => {
    let res = data.map(item => {
      return {
        ...item,
        parentRowKeyPath,
      }
    });
    res.forEach(item => {
      if (commonUtils.isNotEmptyArr(item.children)) {
        res = [...res, ...this.getDataAll(item.children, [...parentRowKeyPath, item[this.rowKey]])];
      }
    })
    return res;
  }

  // 处理树形表格多选父子联动
  handleMutiSelectRowKeys = (selectedRowKeys) => {
    const {
      bMutiSelect, tableProps, bMutiSelect1,
    } = this.props;
    const { rowSelection } = tableProps;
    if (bMutiSelect && rowSelection !== null && !bMutiSelect1) { /*  有多选、复选框情况下 */
      // 判断是选中还是取消
      const type = selectedRowKeys.length > this.selectedRowKeysOld.length ? 'add' : 'del';
      // 找出变化的数据
      const diffArr = this.selectedRowKeysOld.concat(selectedRowKeys)
        .filter(v => !this.selectedRowKeysOld.includes((v)) || !selectedRowKeys.includes((v)));
      if (diffArr.length === 1) {
        // 将数据扁平化
        let { data } = this.props;
        const dataAll = this.getDataAll(data);
        // 额外的选中行（当前选中行的子数据）
        const selectedRowKeysExtra = dataAll.reduce((result, cur) => {
          if (cur.parentRowKeyPath.includes(diffArr[0])) {
            result.push(cur[this.rowKey]);
          }
          return result;
        }, []);
        if (type === 'add') {
          // 合并选中行
          selectedRowKeys = Array.from(new Set([...selectedRowKeys, ...selectedRowKeysExtra]));
        } else {
          // 删除当前行子数据
          selectedRowKeys = selectedRowKeys.reduce((result, cur) => {
            if (!selectedRowKeysExtra.includes(cur)) {
              result.push(cur);
            }
            return result;
          }, []);
        }
      }
    }
    this.selectedRowKeysOld = selectedRowKeys;
    return selectedRowKeys;
  };

  /**   行选择   */
  onDoubleClick = (name, record) => {
    const picArrConfig = this.props.config.gdsconfigformslave.find(item => item.sName === 'picArr');
    if (picArrConfig?.sActiveId === "172129113112117442504826460") {
      // 自动拼版
      if (record.bMakeUpEnd) {
        this.props.onSaveState({
          makeUpPDFRecord: { ...record, picArrConfig },
        });
      } else {
        message.info("请先完成拼版！");
      }
      return;
    }
    if (this.props.onDoubleClick !== undefined) {
      this.props.onDoubleClick(record);
    }
  };

  onKeyDownDiv = (e, sName) => {
    if (e.key === 'F10') {
      message.info(sName);
    } else if (e.ctrlKey && e.keyCode === 67) {
      console.log('复制成功！');
    } else if (e.ctrlKey && e.keyCode === 65) {
      console.log('全选成功！');
    } else if (e.ctrlKey && (e.altKey || e.metaKey) && e.keyCode === 71) { /* CTRL+ALT+G F7 设置界面 */
      const { name, config, data, configName } = this.props;
      const { sType } = this.props?.app?.userinfo || {};
      if (!['sysadmin'].includes(sType)) {
        return;
      }
      if (commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.config) && commonUtils.isNotEmptyObject(this.props.data)) {
        const bInModal = (el) => {
          if (commonUtils.isEmpty(el) || commonUtils.isEmpty(el.classList)) {
            return false;
          } else if (el.classList.contains('ant-modal-root')) {
            return true;
          } else {
            return bInModal(el.parentNode);
          }
        }
        if (bInModal(e.target)) { // 如果是在modal里的表格，不允许跳转
          return;
        }
        const myTableConfig = JSON.parse(JSON.stringify(config));
        myTableConfig.sActiveId = '16411004790004762980820285096000';
        myTableConfig.sName = sName;
        const myTableConfigArr = [];
        myTableConfigArr.push(myTableConfig);
        this.props.onViewClick(name, 'myTableConfig', data[0], 0, myTableConfigArr, configName);
      }
    } else if (e.key !== 'F12') {
      e.preventDefault();
      return false;
    }
  }

  onExpand = (expanded, record) => {
    if (this.props.onExpand !== undefined) {
      this.props.onExpand(expanded, record);
    }
  }

  onOpenNewTab = () => {
    const dom = document.getElementsByClassName(`${this.state.randomId}-CommonListSelectTree`)[0];
    dom.parentElement.parentElement.style.display = 'none';
    this.pathname = location.pathname;
    this.setState({
      openNewTabFlag: true,
    });
  };

  onChange = (pagination, filters, sorter, extra) => {
    if (this.showExpAll) {
      this.showExpAll = false;
      this.setState({
        expKeys: []
      });
    }
    if (commonUtils.isNotEmptyObject(filters)) {
      const filterValueArr = Object.values(filters);
      if (filterValueArr.join('') !== '' && commonUtils.isNotEmptyArr(extra.currentDataSource)) { // 过滤了数据
        this.tableFilterData = extra.currentDataSource;
      } else { // 没有过滤数据
        this.tableFilterData = [];
      }
      // 生成cell list
      this.genMergeListStateMap();
    }
    if (sorter?.column) {
      sorter.columnKey = sorter.column.dataIndex;
    } else {
      sorter = {};
    }
    if (this.props.slaveInfo && this.props.slaveInfo.tableProps && this.props.slaveInfo.tableProps.onChange) {
      this.props.slaveInfo.tableProps.onChange(pagination, filters, sorter, extra);
    }
    if (this.props && this.props.tableProps && this.props.tableProps.onChange) {
      this.props.tableProps.onChange(pagination, filters, sorter, extra);
    }
    this.props.onSaveState({ sortedInfo: sorter });
  }

  /* 动态参数全选、取消全选 */
  onParamChange = (e) => {
    this.props.onCheckChange(this.props.name);
  }

  setRowClassName = (tabType, record, index) => {
    const styleColor = this.getColorStyle(record, true);
    /* 消息列表未读的消息，整行文字加粗 */
    let newslistStyle = '';
    if (commonUtils.isNotEmptyObject(this.props.formId) && this.props.formId === '15669750700007338351055957774000') {
      if (record.bIsView === false) {
        newslistStyle = 'newsNoRead';
      }
    }
    const bSlaveInfo = tabType && tabType.includes('slave') && tabType.includes('Info');
    const selectedRowKeys = bSlaveInfo ? this.state.slaveInfoSelectedRowKeys : this.props.selectedRowKeys;
    const rowKey = bSlaveInfo && commonUtils.isNotEmptyObject(this.props.slaveInfo.tableProps) ? this.props.slaveInfo.tableProps : this.rowKey;
    const rowClassName = commonUtils.isNotEmptyArr(selectedRowKeys) && selectedRowKeys.indexOf(record[rowKey]) > -1 ? `${styleColor} selected-record-row` : commonUtils.isNotEmptyObject(styleColor) ? styleColor : (index % 2 === 1 && this.props.tableBelone === 'list') ? 'dark-record-row' : '';
    let allRowClassName = commonUtils.isNotEmptyObject(newslistStyle) ? `${rowClassName} ${newslistStyle}` : rowClassName;
    if (tabType === 'slave' && commonUtils.isNotEmptyArr(this.mergeCellList)) { // 如果有合并单元格
      allRowClassName = record.sColor;
    } else {
      if (commonUtils.isEmptyObject(allRowClassName) || commonUtils.isEmptyObject(allRowClassName.trim())) { /* 设置奇 偶行背景色 */
        allRowClassName = (index % 2 === 1) ? 'dark-record-row' : '';
      }
    }
    /* 如果行字段的sDivRow有值 则做成特殊样式 */
    if (commonUtils.isNotEmptyObject(record) && commonUtils.isNotEmptyObject(record.sDivRowNew) && record.bInsert) {
      allRowClassName = 'split-record-row';
      if (this.props.skipSlaveInfo) {
        allRowClassName = 'split-record-row-skip';
      }
    }

    if (record?.costomRowColor) {
      allRowClassName = `SetRow_${record.costomRowColor}`
    }

    return allRowClassName;
  };

  /**   获取复选框对象的props   */
  getRowSelection = (name, type) => {
    const { bMutiSelect, bisMutiSelect } = this.props;
    if (name === 'control' || (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.indexOf('commonAuto') > -1)) { // 控制表中可以通过bisMutiSelect显示或者隐藏勾选框
      if (bisMutiSelect) {
        return {
          preserveSelectedRowKeys: true,
          selectedRowKeys: type === 'slaveInfo' ? this.state.slaveInfoSelectedRowKeys : this.state.selectedRowKeys, /*   已选择的数据集   */
          onChange: this.handleSelectRowChange.bind(this, name), /*   选择行发生改变时调用的函数   */
          getCheckboxProps: record => ({
            style: record.bSum && commonConfig.hasSum ? { display: 'none' } : { display: 'checkbox' },
          }), /*   过滤合计的选择框   */
          type: bMutiSelect ? this.props.rowSelectionType : 'radio', /* checkbox or radio */
          columnWidth: 37,
        };
      } else {
        return null;
      }
    } else {
      return {
        preserveSelectedRowKeys: true,
        selectedRowKeys: type === 'slaveInfo' ? this.state.slaveInfoSelectedRowKeys : this.state.selectedRowKeys, /*   已选择的数据集   */
        onChange: (value) => {
          this.handleSelectRowChange(name, value, true);
        }, /*   选择行发生改变时调用的函数   */
        getCheckboxProps: record => ({
          style: record.bSum && commonConfig.hasSum ? { display: 'none' } : { display: 'checkbox' },
        }), /*   过滤合计的选择框   */
        type: bMutiSelect ? this.props.rowSelectionType : 'radio', /* checkbox or radio */
        columnWidth: 37,
      };
    }
  };

  /**   获取table对象的props   */
  getTableProps = () => {
    /*   给数据都添加上key   */
    const { tableColumn, dataSource } = this.state;
    // 二级表头
    const subTableColumn = tableColumn.reduce((result, item) => {
      if (commonUtils.isNotEmptyArr(item.children)) {
        result = [...result, ...item.children];
      }
      return result;
    }, []);
    const sPartNameStatus = [...tableColumn, ...subTableColumn].filter(item => item.dataIndex === 'sPartNameStatus');
    const sPicturePath = [...tableColumn, ...subTableColumn].filter(item => item.dataIndex === 'sPicturePath');
    const sMaterialsStatus = [...tableColumn, ...subTableColumn].filter(item => item.dataIndex === 'sMaterialsStatus' || (commonUtils.isNotEmptyArr(item.children) && item.children.findIndex(itemChild => itemChild.dataIndex && itemChild.dataIndex === 'sMaterialsStatus') > -1));
    const dynamicColumn = [...tableColumn, ...subTableColumn].filter(item => (commonUtils.isNotEmptyObject(item.dataIndex) && item.dataIndex.includes('_json')) || (commonUtils.isNotEmptyArr(item.children) && item.children.findIndex(itemChild => itemChild.dataIndex && itemChild.dataIndex.includes('_json')) > -1)); /* 动态列JSON解析 */
    const sTimeStatus = [...tableColumn, ...subTableColumn].filter(item => item.dataIndex === 'sTimeStatus'); /* 时间进度条状态 */
    const sDownload = [...tableColumn, ...subTableColumn].filter(item => item.dataIndex === 'sDownload');
    const sScheduleStatusJson = [...tableColumn, ...subTableColumn].filter(item => item.dataIndex && item.dataIndex.includes('sScheduleStatusJson')); // 拼版状态
    const sMakeUpPath = [...tableColumn, ...subTableColumn].filter(item => item.dataIndex?.toLowerCase().includes('makeuppath'));

    if (commonUtils.isNotEmptyArr(sPicturePath)) {
      sPicturePath[0].render = (value = '') => {
        const picHref = value.includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${encodeURIComponent(value)}&sModelsId=100&token=${encodeURIComponent(this.props.app.token)}` : value;
        return <a target="_blank" key="sPicturePath" href={picHref}>{value}</a>;
      }
    }

    if (commonUtils.isNotEmptyArr(sDownload)) {
      sDownload[0].render = (value) => {
        if (commonUtils.isEmpty(value)) return '';
        const fileList = value.split(',');
        if (fileList.length === 1) {
          let fileName = fileList[0].substring(fileList[0].lastIndexOf('/') + 1);
          fileName = fileName.substring(fileName.indexOf('_') + 1);
          const picHref = `${commonConfig.file_host}file/download?savePathStr=${encodeURIComponent(value)}&sModelsId=100&token=${encodeURIComponent(this.props.app.token)}`;
          const fileType = fileName.split('.').pop().toLowerCase();
          const previewFileList = ['jpg', 'png', 'jepg', 'webp', 'svg', 'bmp', 'apng', 'pdf'];
          return <div>
            <a style={!previewFileList.includes(fileType) ? { visibility: 'hidden' } : {}} onClick={e => {
              if (fileType === 'pdf') {
                this.setState({
                  pdfFileVisible: true,
                  pdfFileUrl: fileList[0],
                });
              } else {
                this.handlePreviewImage(e, fileList);
              }
            }} title="预览"><EyeOutlined /></a>
            <a target="_blank" key="sDownload" href={picHref} title="下载"><DownloadOutlined /></a>
            <span>{fileName}</span>
          </div>
        } else {
          return <a target="_blank" key="sDownload" title="附件列表" onClick={() => {
            this.setState({
              commonFileDownloadVisible: true,
              commonFileDownloadList: fileList.map(item => { return { url: item, checked: false } }),
            })
          }}
          >{`附件（${fileList.length}）`}</a>;
        }
      }
    }

    if (commonUtils.isNotEmptyArr(sMakeUpPath)) {
      sMakeUpPath.forEach(item => {
        item.render = (value = '', record) => {
          const { formId, name, enabled, config } = this.props;
          const { token } = this.props.app;
          const divProps = {
            action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`,
            onChange: (info) => {
              this.handleUploadChange(info, () => { });
              const savePathStr = info?.file?.response?.dataset?.rows?.[0]?.savePathStr;
              this.props.onDataChange(name, item.dataIndex, { [item.dataIndex]: savePathStr }, record.sId, []);
            },
            accept: '*/*',
            showUploadList: false,
            multiple: false,
          };

          return <div className={styles.makeUpPath}>
            {
              value && [''].map(() => {
                const iconProps = {
                  className: styles.imgPDf,
                  onClick: () => {
                    this.setState({
                      officePreviewVisible: true,
                      officeFileUrl: value,
                    })
                  }
                };
                const removeExtension = (filename) => {
                  const lastDotIndex = filename.lastIndexOf('.');
                  if (lastDotIndex === -1) {
                    // 如果字符串中没有点，则返回原字符串
                    return filename;
                  }
                  return filename.substring(0, lastDotIndex);
                }
                const getImageUrl = (sName) => {
                  const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`;
                  return imageUrlNew
                }
                const picAddr = commonUtils.isNotEmptyObject(value) ? value.split(',') : '';
                let dataUrl = picAddr[0].includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` : picAddr[0]; /* 缩略图 */
                if (config.sTbName === "sisboxcomponent") {
                  dataUrl = getImageUrl(removeExtension(picAddr[0]));
                }
                // const picAddr = commonUtils.isNotEmptyObject(value) ? value.split(',') : '';
                // const dataUrl = picAddr[0].includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` : picAddr[0]; /* 缩略图 */

                const officeFileTypeList = ['PDF', 'DOCX', 'XLSX', 'MP4', 'WEBM', 'OGG'];
                const imgTypeList = ['PNG', 'SVG', 'JPG', 'JPEG', 'GIF', 'BMP', 'TIFF', 'ICO'];
                const officeFileType = picAddr[0].split('.').pop().toUpperCase();
                let fileIcon = <FilePdfOutlined {...iconProps} />;

                if (officeFileType === 'DOCX') {
                  fileIcon = <FileWordOutlined {...iconProps} />;
                } else if (officeFileType === 'XLSX') {
                  fileIcon = <FileExcelOutlined {...iconProps} />;
                } else if (['MP4', 'WEBM', 'OGG'].includes(officeFileType)) {
                  fileIcon = <PlaySquareOutlined {...iconProps} />;
                }

                let imgBox = <FileOutlined />;

                if (officeFileTypeList.includes(officeFileType)) {
                  imgBox = fileIcon;
                } else if (imgTypeList.includes(officeFileType)) {
                  imgBox = <span style={{ cursor: 'pointer' }}> <img src={dataUrl} alt="img" onFocus={() => 0} onClick={e => this.handlePreviewImage(e, picAddr)} style={{ width: '30px', height: '20px' }} /></span>;
                }

                return imgBox;
              })
            }
            {
              enabled && <Upload {...divProps}><UploadOutlined className={styles.imgUpload} /></Upload>
            }
          </div>;
        }
      })
    }

    this.props.onCostomColums?.([
      ...tableColumn,
      ...subTableColumn
    ]);

    // 判断工序状态
    if (commonUtils.isNotEmptyArr(sPartNameStatus) && commonUtils.isNotEmptyArr(dataSource)) {
      this.useVListNew = true;
      const sModelsType = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? this.props.app.currentPane.sModelsType : '';
      if (sModelsType === 'production/productionPlanInfo' || location.pathname.toLowerCase('commonList') || sModelsType === 'productionMainPlan/productionMainPlan' || location.pathname.toLowerCase().indexOf('oee') > -1) {
        sPartNameStatus[0].render = (itemStr) => {
          if (commonUtils.isJSON(itemStr)) {
            const sPartItem = JSON.parse(itemStr);
            return (
              // <div>
              <Tooltip color="#fff" title={() => {
                return <div >
                  {
                    // eslint-disable-next-line array-callback-return
                    sPartItem.map((t, i) => {
                      const sPartItemLength = sPartItem.length;
                      // const record = dataSource[i]; /* 获取每行数据 */
                      let colorValue = '#000000';
                      if (t?.background) {
                        colorValue = t.background;
                      } else {
                        const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState;
                        switch (Number(sState)) { // 根据状态显示颜色
                          case 0:
                            colorValue = '#808080'; /* 0：灰色 */
                            break;
                          case 1:
                            colorValue = '#808080'; /* 1：灰色 */
                            break;
                          case 2:
                            colorValue = '#ff4d4f'; /* 2：红色 */
                            break;
                          case 3:
                            colorValue = '#d4b106'; /* 3：黄色 */
                            break;
                          case 4:
                            colorValue = '#000000'; /* 黑色 */
                            break;
                          case 5:
                            colorValue = '#49aa19'; /* 5：绿色 */
                            break;
                          default:
                            colorValue = '#000000';
                        }
                      }
                      return (
                        <div style={{ display: 'inline-block', color: colorValue }} key={i} onClick={this.handlesPartNameStatus.bind(this, 'sPartNameStatus', t.sWorkOrderId)} >
                          {commonUtils.isNotEmptyObject(t.sProcessName) ? t.sProcessName : ''}
                          {i + 1 === sPartItemLength ? '' : <RightOutlined />}
                        </div>
                      );
                    })
                  }
                </div>
              }}>
                <div style={{ whiteSpace: 'nowrap', width: '100%', height: '29px', overflow: 'hidden', lineHeight: '29px', textOverflow: 'ellipsis' }}>
                  {
                    // eslint-disable-next-line array-callback-return
                    sPartItem.map((t, i) => {
                      const sPartItemLength = sPartItem.length;
                      // const record = dataSource[i]; /* 获取每行数据 */
                      let colorValue = '#000000';
                      if (t?.background) {
                        colorValue = t.background;
                      } else {
                        const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState;
                        switch (Number(sState)) { // 根据状态显示颜色
                          case 0:
                            colorValue = '#808080'; /* 0：灰色 */
                            break;
                          case 1:
                            colorValue = '#808080'; /* 1：灰色 */
                            break;
                          case 2:
                            colorValue = '#ff4d4f'; /* 2：红色 */
                            break;
                          case 3:
                            colorValue = '#d4b106'; /* 3：黄色 */
                            break;
                          case 4:
                            colorValue = '#000000'; /* 黑色 */
                            break;
                          case 5:
                            colorValue = '#49aa19'; /* 5：绿色 */
                            break;
                          default:
                            colorValue = '#000000';
                        }
                      }
                      return (
                        <div style={{ display: 'inline-block', color: colorValue }} key={i} onClick={this.handlesPartNameStatus.bind(this, 'sPartNameStatus', t.sWorkOrderId)} >
                          {commonUtils.isNotEmptyObject(t.sProcessName) ? t.sProcessName : ''}
                          {i + 1 === sPartItemLength ? '' : <RightOutlined />}
                        </div>
                      );
                    })
                  }
                </div>
              </Tooltip>

            );
          }
        };
      } else {
        sPartNameStatus[0].render = (itemStr) => {
          if (itemStr) {
            const sPartItem = itemStr.split('->');
            return (
              <div style={{ whiteSpace: 'normal' }}>
                {
                  // eslint-disable-next-line array-callback-return
                  sPartItem.map((t, i) => {
                    const sPartItemLength = sPartItem.length;
                    const ArrItemStr = t.split('#')[0]; /* 工序名称 */
                    const ArrItemNum = t.split('#')[1]; /* 状态 */
                    const ArrItemName = t.split('#')[2]; /* 机台名称 */
                    const ArrItemBanZhu = t.split('#')[3]; /* 班组 */
                    const ArrItemTime = t.split('#')[4]; /* 排单时间 */
                    const ArrItemPCNum = t.split('#')[5]; /* 排程数 */
                    const ArrItemSBNum = t.split('#')[6]; /* 上报数 */
                    const ArrItem7Num = commonUtils.isNotEmptyArr(t.split('#')) && t.split('#').length > 8 ? t.split('#')[8] : ''; /* 包数 */
                    const ArrItem8Num = commonUtils.isNotEmptyArr(t.split('#')) && t.split('#').length > 9 ? t.split('#')[9] : '';  /* 每包数量 */
                    const ArrItem9Num = commonUtils.isNotEmptyArr(t.split('#')) && t.split('#').length > 10 ? t.split('#')[10] : '';  /* 零头数量 */
                    let ArrItemNumChange = '';
                    let icon;
                    // eslint-disable-next-line default-case
                    switch (Number(ArrItemNum)) {
                      case 0:
                        ArrItemNumChange = '未排程';
                        icon = <ExclamationCircleFilled style={{ margin: '0 6px 0 0', color: '#ffd591' }} title="未排程" />;
                        break;
                      case 1:
                        ArrItemNumChange = '未完成';
                        icon = <CloseCircleFilled style={{ margin: '0 6px 0 0', color: '#ffa39e' }} title="未完成" />;
                        break;
                      case 2:
                        ArrItemNumChange = '生产中';
                        icon = <ClockCircleFilled style={{ margin: '0 6px 0 0', color: '#69c0ff' }} title="生产中" />;
                        break;
                      case 3:
                        ArrItemNumChange = '暂停';
                        icon = <LegacyIcon type="ause-circle" theme="filled" style={{ margin: '0 6px 0 0', color: '#fff566' }} title="暂停" />;
                        break;
                      case 4:
                        ArrItemNumChange = '取消';
                        icon = <StopFilled style={{ margin: '0 6px 0 0', color: '#ff85c0' }} title="取消" />;
                        break;
                      case 5:
                        ArrItemNumChange = '完成';
                        icon = <CheckCircleFilled style={{ margin: '0 6px 0 0', color: '#95de64' }} title="完成" />;
                        break;
                    }
                    // eslint-disable-next-line no-unused-vars
                    const content = (
                      <div>
                        <div><span style={{ color: '#fbca7b' }}>工序名称：</span>{ArrItemStr}</div>
                        <div><span style={{ color: '#fbca7b' }}>状态：</span>{ArrItemNumChange}</div>
                        <div><span style={{ color: '#fbca7b' }}>机台名称：</span>{ArrItemName}</div>
                        <div><span style={{ color: '#fbca7b' }}>班组：</span>{ArrItemBanZhu}</div>
                        <div><span style={{ color: '#fbca7b' }}>排单时间：</span>{ArrItemTime}</div>
                        <div><span style={{ color: '#fbca7b' }}>排程数：</span>{ArrItemPCNum}</div>
                        <div><span style={{ color: '#fbca7b' }}>上报数：</span>{ArrItemSBNum}</div>
                        {
                          ArrItem7Num ? <div><span style={{ color: '#fbca7b' }}>包数：</span>{ArrItem7Num}</div> : ''
                        }
                        {
                          ArrItem8Num ? <div><span style={{ color: '#fbca7b' }}>每包数量：</span>{ArrItem8Num}</div> : ''
                        }
                        {
                          ArrItem9Num ? <div><span style={{ color: '#fbca7b' }}>零头数量：</span>{ArrItem9Num}</div> : ''
                        }
                      </div>
                    );
                    // 数字转换图标
                    return (
                      <div style={{ display: 'inline-block', margin: '5px 5px 5px 0px' }} key={i} >
                        {icon}
                        <Popover placement="top" content={content} trigger="click">{ArrItemStr}</Popover>
                        {/*{ i + 1 === sPartItemLength ? '' : <RightOutlined style={{ margin: '0 6px' }} />}*/}
                      </div>
                    );
                  })
                }


              </div>
            );
          }
        };
      }
    }
    // 判断材料准备状态
    if (commonUtils.isNotEmptyArr(sMaterialsStatus) && commonUtils.isNotEmptyArr(dataSource)) {
      this.useVListNew = true;
      const sModelsType = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? this.props.app.currentPane.sModelsType : '';
      if (true || sModelsType === 'production/productionPlanInfo' || sModelsType === 'productionMainPlan/productionMainPlan' || (commonUtils.isNotEmptyObject(sModelsType) && sModelsType.includes('view/')) || location.pathname.toLowerCase().indexOf('oee') > -1) {
        /* 动态列Jsonn解析 */
        if (commonUtils.isNotEmptyArr(sMaterialsStatus) && commonUtils.isNotEmptyArr(dataSource)) {
          sMaterialsStatus.forEach((jsonStatus, index) => {
            const dWidth = jsonStatus.width * 2;
            const sBackGroundColor = jsonStatus.bReadonly ? '#f1f2f8' : '';
            if (commonUtils.isNotEmptyArr(jsonStatus.children)) { /* 嵌套列头JSON解析 */
              for (const obj of jsonStatus.children) {
                obj.render = (itemStr) => {
                  if (commonUtils.isJSON(itemStr)) {
                    const sPartItem = JSON.parse(itemStr);
                    /* 取箭头弹出的窗体配置 */
                    let showConfig = {};
                    let linkStyle = '';/* 弹窗 */
                    if (commonUtils.isNotEmptyArr(this.props.config) && commonUtils.isNotEmptyArr(this.props.config.gdsconfigformslave) && commonUtils.isNotEmptyStr('sMaterialsStatus')) {
                      const showConfigArr = this.props.config.gdsconfigformslave.filter(item => item.sName === 'sMaterialsStatus' && item.bVisible);
                      if (commonUtils.isNotEmptyArr(showConfigArr)) {
                        showConfig = showConfigArr[0];
                        if (commonUtils.isNotEmptyObject(showConfig) && showConfig.sDropDownType === 'picArr' && !commonUtils.isEmpty(showConfig.sActiveId) && commonUtils.isEmptyArr(this.props.sGroupByList)) {
                          linkStyle = 'sMaterialsStatusStyle';
                        }
                      }
                    }
                    return (
                      <Tooltip placement="right" color="#fff" title={() => {
                        return <div style={{ whiteSpace: 'normal' }}>
                          {
                            // eslint-disable-next-line array-callback-return;
                            sPartItem.map((t, i) => {
                              const sPartItemLength = sPartItem.length;
                              let colorValue = '#000000';
                              if (t?.background) {
                                colorValue = t.background;
                              } else {
                                const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState;
                                switch (Number(sState)) { // 根据状态显示颜色
                                  case 0:
                                    colorValue = '#000000'; /* 0：黑色 */
                                    break;
                                  case 1:
                                    colorValue = '#ff4d4f'; /* 1：红色 */
                                    break;
                                  case 2:
                                    colorValue = '#49aa19'; /* 2：绿色 */
                                    break;
                                  case 3:
                                    colorValue = '#49aa19'; /* 3：绿色 */
                                    break;
                                  case 4:
                                    colorValue = '#ff4d4f'; /* 4：红色 */
                                    break;
                                  default:
                                    colorValue = '#000000';
                                }
                              }
                              return (
                                <div style={{ display: 'inline-block', width: '100%', color: colorValue }} key={i} >
                                  {commonUtils.isNotEmptyObject(t.sMaterialsName) ?
                                    <span className={linkStyle} onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, this.props.name, showConfig.sName, t, i, showConfig) : null}>
                                      {t.sMaterialsName}
                                    </span> : ''}
                                  {i + 1 === sPartItemLength ? '' : <span style={{ color: '#000000', margin: '0 2px' }}>-</span>}
                                </div>
                              );
                            })
                          }
                        </div>
                      }}>
                        <div style={{ whiteSpace: 'nowrap', width: '100%', height: '29px', overflow: 'hidden', lineHeight: '29px', textOverflow: 'ellipsis' }}>
                          {
                            // eslint-disable-next-line array-callback-return;
                            sPartItem.map((t, i) => {
                              const sPartItemLength = sPartItem.length;
                              let colorValue = '#000000';
                              if (t?.background) {
                                colorValue = t.background;
                              } else {
                                const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState;
                                switch (Number(sState)) { // 根据状态显示颜色
                                  case 0:
                                    colorValue = '#000000'; /* 0：黑色 */
                                    break;
                                  case 1:
                                    colorValue = '#ff4d4f'; /* 1：红色 */
                                    break;
                                  case 2:
                                    colorValue = '#49aa19'; /* 2：绿色 */
                                    break;
                                  case 3:
                                    colorValue = '#49aa19'; /* 3：绿色 */
                                    break;
                                  case 4:
                                    colorValue = '#ff4d4f'; /* 4：红色 */
                                    break;
                                  default:
                                    colorValue = '#000000';
                                }
                              }
                              return (
                                <div style={{ display: 'inline-block', width: '100%', color: colorValue }} key={i} >
                                  {commonUtils.isNotEmptyObject(t.sMaterialsName) ?
                                    <span className={linkStyle} onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, this.props.name, showConfig.sName, t, i, showConfig) : null}>
                                      {t.sMaterialsName}
                                    </span> : ''}
                                  {i + 1 === sPartItemLength ? '' : <span style={{ color: '#000000', margin: '0 2px' }}>-</span>}
                                </div>
                              );
                            })
                          }
                        </div>
                      </Tooltip>
                    );
                  } else {
                    return itemStr;
                  }
                };
              };
            } else { /* 无嵌套列头JSON列解析 */
              sMaterialsStatus[index].render = (itemStr) => {
                if (commonUtils.isJSON(itemStr)) {
                  const sPartItem = JSON.parse(itemStr);
                  /* 取箭头弹出的窗体配置 */
                  let showConfig = {};
                  let linkStyle = '';/* 弹窗 */
                  if (commonUtils.isNotEmptyArr(this.props.config) && commonUtils.isNotEmptyArr(this.props.config.gdsconfigformslave) && commonUtils.isNotEmptyStr('sMaterialsStatus')) {
                    const showConfigArr = this.props.config.gdsconfigformslave.filter(item => item.sName === 'sMaterialsStatus' && item.bVisible);
                    if (commonUtils.isNotEmptyArr(showConfigArr)) {
                      showConfig = showConfigArr[0];
                      if (commonUtils.isNotEmptyObject(showConfig) && showConfig.sDropDownType === 'picArr' && !commonUtils.isEmpty(showConfig.sActiveId) && commonUtils.isEmptyArr(this.props.sGroupByList)) {
                        linkStyle = 'sMaterialsStatusStyle';
                      }
                    }
                  }
                  return (
                    <Tooltip color='#f1f2f8' placement='right' overlayInnerStyle={{ width: dWidth, paddingLeft: '6px' }} defaultOpen={false} title={() => {
                      return <div style={{ whiteSpace: 'normal', backgroundColor: '#f1f2f8', borderRight: '1px solid #f0f0f0', width: dWidth - 8 }}>
                        {
                          // eslint-disable-next-line array-callback-return;
                          sPartItem.map((t, i) => {
                            const sPartItemLength = sPartItem.length;
                            let colorValue = '#000000';
                            if (t?.background) {
                              colorValue = t.background;
                            } else {
                              const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState;
                              switch (Number(sState)) { // 根据状态显示颜色
                                case 0:
                                  colorValue = '#000000'; /* 0：黑色 */
                                  break;
                                case 1:
                                  colorValue = '#ff4d4f'; /* 1：红色 */
                                  break;
                                case 2:
                                  colorValue = '#49aa19'; /* 2：绿色 */
                                  break;
                                case 3:
                                  colorValue = '#49aa19'; /* 3：绿色 */
                                  break;
                                case 4:
                                  colorValue = '#ff4d4f'; /* 4：红色 */
                                  break;
                                default:
                                  colorValue = '#000000';
                              }
                            }
                            return (
                              <div style={{ display: 'inline-block', width: '100%', color: colorValue }} key={i} >
                                {commonUtils.isNotEmptyObject(t.sMaterialsName) ?
                                  <span className={linkStyle} onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, this.props.name, showConfig.sName, t, i, showConfig) : null}>
                                    {t.sMaterialsName}
                                  </span> : ''}
                                {i + 1 === sPartItemLength ? '' : <span style={{ color: '#000000', margin: '0 2px' }}>-</span>}
                              </div>
                            );
                          })
                        }
                      </div>
                    }}>
                      <div style={{ whiteSpace: 'nowrap', backgroundColor: sBackGroundColor, width: '100%', height: '29px', overflow: 'hidden', lineHeight: '29px', textOverflow: 'ellipsis' }}>
                        {
                          // eslint-disable-next-line array-callback-return;
                          sPartItem.map((t, i) => {
                            const sPartItemLength = sPartItem.length;
                            let colorValue = '#000000';
                            if (t?.background) {
                              colorValue = t.background;
                            } else {
                              const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState;
                              switch (Number(sState)) { // 根据状态显示颜色
                                case 0:
                                  colorValue = '#000000'; /* 0：黑色 */
                                  break;
                                case 1:
                                  colorValue = '#ff4d4f'; /* 1：红色 */
                                  break;
                                case 2:
                                  colorValue = '#49aa19'; /* 2：绿色 */
                                  break;
                                case 3:
                                  colorValue = '#49aa19'; /* 3：绿色 */
                                  break;
                                case 4:
                                  colorValue = '#ff4d4f'; /* 4：红色 */
                                  break;
                                default:
                                  colorValue = '#000000';
                              }
                            }
                            return (
                              <div style={{ display: 'inline-block', width: '100%', color: colorValue }} key={i} >
                                {commonUtils.isNotEmptyObject(t.sMaterialsName) ?
                                  <span className={linkStyle} onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, this.props.name, showConfig.sName, t, i, showConfig) : null}>
                                    {t.sMaterialsName}
                                  </span> : ''}
                                {i + 1 === sPartItemLength ? '' : <span style={{ color: '#000000', margin: '0 2px' }}>-</span>}
                              </div>
                            );
                          })
                        }
                      </div>
                    </Tooltip>
                  );
                } else {
                  return <div className='noInput readonlySpanStyle' style={{ backgroundColor: sBackGroundColor, height: '29px' }}> {itemStr} </div>;
                }
              };
            }
          });
        }
      }
    }
    /* 动态列Jsonn解析 */
    if (commonUtils.isNotEmptyArr(dynamicColumn) && commonUtils.isNotEmptyArr(dataSource)) {
      dynamicColumn.forEach((jsonStatus, index) => {
        if (commonUtils.isNotEmptyArr(jsonStatus.children)) { /* 嵌套列头JSON解析 */
          const childrenJson = jsonStatus.children.filter(itemChild => itemChild.dataIndex && itemChild.dataIndex.includes('json'));
          for (const obj of childrenJson) {
            obj.render = (itemStr) => {
              if (commonUtils.isNotEmptyObject(itemStr) && commonUtils.isJSON(itemStr)) {
                const sPartItem = JSON.parse(itemStr);
                return (
                  <div style={{ whiteSpace: 'normal', position: 'absolute', width: '100%', left: 0, top: 0, bottom: 0 }}>
                    {
                      // eslint-disable-next-line array-callback-return;
                      sPartItem.map((t, i) => {
                        // const sPartItemLength = sPartItem.length;
                        let colorValue = '#000000';
                        const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState;
                        switch (Number(sState)) { // 根据状态显示颜色
                          case 1:
                            colorValue = '#ff0000'; /* 1：红色 */
                            break;
                          case 2:
                            colorValue = '#49aa19'; /* 2：绿色 */
                            break;
                          case 3:
                            colorValue = '#ffff00'; /* 3：黄色 */
                            break;
                          case 0:
                            colorValue = ''; /* 3：不要颜色 */
                            break;
                          default:
                            colorValue = '';
                        }
                        return (
                          <div
                            className="dynamicColumnStyle"
                            style={{ display: 'flex', alignItems: 'center', padding: '4px', backgroundColor: colorValue, color: '#000', width: '100%', height: '100%' }}
                            key={i}
                          >
                            <div>{t.dSchedulHours}</div>
                          </div>
                        );
                      })
                    }
                  </div>
                );
              }
            };
          };
        } else { /* 无嵌套列头JSON列解析 */
          dynamicColumn[index].render = (itemStr) => {
            if (commonUtils.isNotEmptyObject(itemStr) && commonUtils.isJSON(itemStr)) {
              const sPartItem = JSON.parse(itemStr);
              return (
                <div style={{ whiteSpace: 'normal' }}>
                  {
                    // eslint-disable-next-line array-callback-return;
                    sPartItem.map((t, i) => {
                      // const sPartItemLength = sPartItem.length;
                      let colorValue = '#000000';
                      const sState = commonUtils.isEmpty(t.sState) ? 4 : t.sState;
                      switch (Number(sState)) { // 根据状态显示颜色
                        case 1:
                          colorValue = '#ff0000'; /* 1：红色 */
                          break;
                        case 2:
                          colorValue = '#49aa19'; /* 2：绿色 */
                          break;
                        case 3:
                          colorValue = '#ffff00'; /* 3：黄色 */
                          break;
                        default:
                          colorValue = '#666';
                      }
                      return (
                        <div
                          className="dynamicColumnStyle"
                          style={{ backgroundColor: colorValue, color: '#000' }}
                          key={i}
                        >
                          <div>{t.dSchedulHours}</div>
                        </div>
                      );
                    })
                  }
                </div>
              );
            } else {
              return itemStr;
            }
          };
        }
      });
    }

    // 判断时间状态
    if (commonUtils.isNotEmptyArr(sTimeStatus) && commonUtils.isNotEmptyArr(dataSource)) {
      sTimeStatus[0].render = (itemStr) => {
        if (commonUtils.isJSON(itemStr)) {
          const sPartItem = JSON.parse(itemStr);
          const linkStyle = 'sTimeStatusStyle';/* 弹窗 */
          return (
            <div style={{ display: 'flex' }}>
              {
                // eslint-disable-next-line array-callback-return;
                sPartItem.map((t, i) => {
                  const sPartItemLength = sPartItem.length;
                  const sColor = t.sColor;
                  const dWidth = t.dRate !== undefined && t.dRate !== 0 ? `${t.dRate * 500}px` : '100px';
                  const content = (
                    <div>
                      <p>{`${t.sName} ：${t.sValue}`}</p>
                    </div>
                  );

                  return (
                    <Popover content={content} title="时间状态">
                      <div
                        className={linkStyle}
                        style={{
                          width: dWidth, color: '#000', textAlign: 'center', backgroundColor: sColor, fontSize: '10px', height: '20px', borderRadius: i === 0 ? '10px 0 0 10px' : (i === sPartItemLength - 1 ? '0 10px 10px 0' : '0px'),
                        }}
                        key={i}
                      >
                        {t.sValue}
                      </div>
                    </Popover>
                  );
                })
              }
            </div>
          );
        } else {
          return itemStr;
        }
      };
    }
    // 判断拼板状态
    if (commonUtils.isNotEmptyArr(sScheduleStatusJson) && commonUtils.isNotEmptyArr(dataSource)) {
      this.useVListNew = true;
      sScheduleStatusJson[0].render = (itemStr) => {
        if (commonUtils.isJSON(itemStr)) {
          const itemJson = commonUtils.convertStrToObj(itemStr);
          const itemLength = itemJson.length;
          const content = itemJson.map((t, i) => {
            const { sState, sColor = '#000000', sName = '' } = t;
            return (
              <div style={{ display: 'inline-block', color: sColor }} key={i} >
                {sName}{i + 1 === itemLength ? '' : <RightOutlined />}
              </div>
            );
          })
          return (
            <div
              style={{
                whiteSpace: 'nowrap',
                width: 'auto',
                maxWidth: '100%',
                height: '29px',
                overflow: 'hidden',
                lineHeight: '29px',
                textOverflow: 'ellipsis'
              }}>
              <Tooltip color="#fff" title={() => {
                return <div>{content}</div>
              }}>
                {content}
              </Tooltip>
            </div>
          );
        }
      };
    }
    let components = {};
    if (this.isDragAndDrop) {
      components.header = { cell: ResizeableTitle };
      components.body = { row: DragableBodyRow };
    } else {
      components.header = { cell: ResizeableTitle };
    }
    let bPagination = true; /* 默认表格分页s  */
    if (commonUtils.isNotEmptyObject(this.props)) {
      bPagination = (commonUtils.isNotEmptyObject(this.props.tableProps) && commonUtils.isNotEmptyObject(this.props.tableProps.pagination));
    }
    let noVlistController = false;
    if (this.props.config && this.props.config.gdsconfigformslave.filter(item => item.sControlName === 'bNoVlist')[0]) {
      noVlistController = true;
    }

    /* 特殊情况的表格 在虚拟列表情况 会无法滑动 */
    let noVlistTable = false;
    if (this.props.noVlistTable) {
      noVlistTable = true;
    }
    // 判断是否有合并单元格, 有的话默认关闭虚拟滚动
    // if (this.mergeCellStateMap) {
    //   for (let key in this.mergeCellStateMap) {
    //     if (this.mergeCellStateMap[key]) {
    //       noVlistController= true;
    //     }
    //   }
    // }

    if (!noVlistTable && !this.props.xlyTableMax) {
      if (this.props.slaveInfo || this.useVListNew) {
        if (!this.uniqueId || window.vlistNewSearh) {
          this.uniqueId = this.props.formId ? `${this.props.formId}_${lodash.uniqueId()}` : lodash.uniqueId();
        }
        if (!this.Vcomponents || window.vlistNewSearh) {
          const { tableClassName } = this.state;
          const oTable = document.querySelectorAll(`.${tableClassName}`)[0];
          if (oTable) {
            const oBody = oTable.querySelector('.ant-table-body');
            oBody && (oBody.scrollTop = 0);
          }
          window.vlistNewSearh = null;
          this.Vcomponents = VListNew({
            height: this.scrollY, vid: this.uniqueId, onScroll: () => {
              setTimeout(() => {
                let divs = document.getElementsByClassName('noInputInsert');
                if (divs.length) {
                  Array.prototype.forEach.call(divs, item => {
                    item.parentNode.parentNode.parentNode.parentNode.classList.add('insertTd');
                  });
                }
              }, 20);
            }
          });
        }
        components = { ...this.Vcomponents, ...components };
      } else {
        // vid是多个列表在同个页面中，同时渲染会促发问题
        // vid不可以为随机数，随机数会导致双击时，点击的两个VList id不同
        if (!this.uniqueId || window.vlistNewSearh) {
          this.uniqueId = this.props.formId ? `${this.props.formId}_${lodash.uniqueId()}` : lodash.uniqueId();
        }
        if (!this.Vcomponents1 || window.vlistNewSearh) {
          const { tableClassName } = this.state;
          const oTable = document.querySelectorAll(`.${tableClassName}`)[0];
          if (oTable) {
            const oBody = oTable.querySelector('.ant-table-body');
            oBody && (oBody.scrollTop = 0);
          }
          window.vlistNewSearh = null;
          this.Vcomponents1 = VList({
            height: this.scrollY, vid: this.uniqueId, rowKey: this.rowKey, onScroll: () => {
              setTimeout(() => {
                let divs = document.getElementsByClassName('noInputInsert');
                if (divs.length) {
                  Array.prototype.forEach.call(divs, item => {
                    item.parentNode.parentNode.parentNode.parentNode.classList.add('insertTd');
                  });
                }
              }, 20);
            }
          });
        }
        components = { ...this.Vcomponents1, ...components };
      }
    }
    if (this.props.config && this.props.config.iFreezeColumn) {
      tableColumn.forEach((val, index) => {
        if (tableColumn[index].fixedHelp) {
          tableColumn[index].fixed = false;
          tableColumn[index].fixedHelp = false;
        }
        if (index < this.props.config.iFreezeColumn) {
          tableColumn[index].fixed = 'left';
          tableColumn[index].fixedHelp = true;
        }
      });
    }
    // 处理拖拽排序
    if (this.props.dragHandle) {
      const handleSortTitle = commonFunc.showMessage(this.props.app.commonConst, 'sort') || '排序';
      const handleSort = tableColumn.filter(item => item.dataIndex === 'handleSort').length;
      if (tableColumn[0]) {
        function arrayMoveMutable(array, fromIndex, toIndex) {
          const startIndex = fromIndex < 0 ? array.length + fromIndex : fromIndex;
          if (startIndex >= 0 && startIndex < array.length) {
            const endIndex = toIndex < 0 ? array.length + toIndex : toIndex;
            if (commonUtils.isNotEmptyObject(array[fromIndex].sWorkOrderUsed)) {
              message.error(array[fromIndex].sWorkOrderUsed);
              return;
            }
            const [item] = array.splice(fromIndex, 1);
            array.splice(endIndex, 0, item);
          }
        }
        function arrayMoveImmutable(array, fromIndex, toIndex) {
          array = [...array];
          arrayMoveMutable(array, fromIndex, toIndex);
          return array;
        }
        const DragHandle = sortableHandle(() => <MenuOutlined style={{ cursor: 'grab', color: '#999' }} />);
        const SortableItem = sortableElement(props => <tr {...props} />);
        const SortableContainer = sortableContainer(props => <tbody {...props} />);
        const onSortEnd = ({ oldIndex, newIndex }) => {
          const { dataSource } = this.state;
          if (oldIndex !== newIndex) {
            const newData = arrayMoveImmutable([].concat(dataSource), oldIndex, newIndex).filter(el => !!el);
            this.props.onDrag(newData, this.props.name);
          }
        };
        const DraggableContainer = props => (
          <SortableContainer
            useDragHandle
            disableAutoscroll
            helperClass="row-dragging"
            onSortEnd={onSortEnd}
            {...props}
          />
        );
        const DraggableBodyRow = ({ className, style, ...restProps }) => {
          const { dataSource } = this.state;
          // function findIndex base on Table rowKey props and should always be a right array index
          const index = dataSource.findIndex(x => x.index === restProps['data-row-key']);
          return <SortableItem index={index} className={className} style={{ ...style }} {...restProps} />;
        };
        // 处理渲染后丢失input focus的bug.
        let bDrag = this.props.enabled && !this.props.bForbiddenDrag;/* 是否可以拖动 */
        if (bDrag) {
          if (!this.DraggableContainer) {
            this.DraggableContainer = DraggableContainer;
          }
          if (!this.DraggableBodyRow) {
            this.DraggableBodyRow = DraggableBodyRow;
          }
        }
        if (!handleSort) {
          components = { ...components, body: { wrapper: this.DraggableContainer, row: this.DraggableBodyRow } };
        } else {
          components = { ...components, body: { wrapper: this.DraggableContainer, row: this.DraggableBodyRow } };
          tableColumn.shift();
        }
        tableColumn.unshift(
          {
            title: handleSortTitle,
            dataIndex: 'handleSort',
            fixed: 'left',
            width: 40,
            className: 'drag-visible',
            render: () => <DragHandle />,
          },
        )
      }
    }

    /**
     * 更新缓存数据
     */
    if (Array.isArray(tableColumn) && this.props.config) {
      const storageColumn = JSON.parse(sessionStorage.getItem(`${this.props.formId}_${this.props.config.sId}`));
      if (storageColumn) {
        sessionStorage.setItem(`${this.props.formId}_${this.props.config.sId}`, JSON.stringify(tableColumn));
      }
    }

    let rowSelection = this.props.rowSelection !== undefined ? this.props.rowSelection : this.getRowSelection(this.props.name, 'slave'); // 是否选择多选框的问题
    if (this.props.config && !this.props.config.bisMutiSelect) {
      rowSelection = null
    }
    const { expKeys } = this.state;

    /*   返回值  */
    return {
      components,
      rowKey: this.rowKey,
      size: 'middle',
      bordered: true, /*   显示边框   */
      className: !this.props.enabled ? styles.disabledProup : styles.proup, /*   样式控制   */
      scroll: { x: 'max-content' }, /*   宽度   */
      dataSource, /*   数据   */
      columns: tableColumn, /*   表头   */
      // rowSelection: this.props.rowSelection !== undefined ? this.props.rowSelection : this.getRowSelection(this.props.name, 'slave'), /*   添加的复选框(checkbox)功能   */
      rowSelection,
      // pagination: false, /*   不分页   */
      rowClassName: this.setRowClassName.bind(this, 'slave'),
      onRow: (record, index) => {
        if (this.isDragAndDrop) {
          return {
            index,
            onClick: () => { this.onRowClick(record, index, undefined, this.props.name, 'slave'); },
            onMouseEnter: () => { this.onRowMouseEnter(record); },
            onMouseLeave: () => { this.onRowMouseLeave(record); },
            onDoubleClick: () => { this.onDoubleClick(this.props.name, record); },
            moveRow: (dragIndex, hoverIndex, dragKey, hoverKey) => {
              this.moveRow(dragIndex, hoverIndex, dragKey, hoverKey);
            },
            onDragClick: (type) => { this.onRowClick(record, index, type, this.props.name, 'slave'); },
          };
        } else {
          return {
            index,
            onClick: () => { this.onRowClick(record, index, undefined, this.props.name, 'slave'); },
            onDoubleClick: () => { this.onDoubleClick(this.props.name, record); },
            onMouseEnter: () => { this.onRowMouseEnter(record); },
            onMouseLeave: () => { this.onRowMouseLeave(); },
          };
        }
      },
      onExpand: (expanded, record) => {
        if (this.showExpAll) {
          if (expanded) {
            const expKeysNew = [...expKeys, record[this.rowKey]];
            this.currentExpKeys = expKeysNew;
            this.setState({
              expKeys: expKeysNew
            });
          } else {
            const expKeysNew = expKeys.filter(item => item !== record[this.rowKey]);
            this.currentExpKeys = expKeysNew;
            this.setState({
              expKeys: expKeysNew
            });
          }
        }
        this.onExpand(expanded, record, 'slave'); /* 点击展开图标时触发s */
      },
      expandedRowKeys: expKeys.length || this.showExpAll || this.isAllowConExpendKeys ? expKeys : null,
      id: commonUtils.isEmptyArr(dataSource) ?
        'unDataBox' :
        'dataBox', /*   用户修改antd table中自带的样式(我听别人说的要这么弄,你们别骂我)   */
      ...this.props.tableProps,
      pagination: bPagination ? {
        ...this.props.tableProps.pagination,
        onChange: (current, size) => {
          this.curPagination = {
            current, pageSize: size
          }
        }
      } : false, /* 表格是否分页 */
      onChange: this.onChange,
    };
  };

  /**   获取子从表复选框对象的props   */
  getSlaveRowSelection = (name, type) => {
    const { bMutiSelect } = this.props.slaveInfo; /* 显示单选框还是复选框 */
    let { bisMutiSelect } = this.props.slaveInfo;  /* 是否显示选择框 */
    if (this.props.slaveInfo.config) {
      bisMutiSelect = this.props.slaveInfo.config.bisMutiSelect
    }
    if (name === 'control' || (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.indexOf('commonAuto') > -1)) { // 控制表中可以通过bisMutiSelect显示或者隐藏勾选框
      if (bisMutiSelect) {
        return {
          preserveSelectedRowKeys: true,
          selectedRowKeys: type === 'slaveInfo' ? this.state.slaveInfoSelectedRowKeys : this.state.selectedRowKeys, /*   已选择的数据集   */
          onChange: this.handleSelectRowChange.bind(this, name), /*   选择行发生改变时调用的函数   */
          getCheckboxProps: record => ({
            style: record.bSum && commonConfig.hasSum ? { display: 'none' } : { display: 'checkbox' },
          }), /*   过滤合计的选择框   */
          type: bMutiSelect ? this.props.rowSelectionType : 'radio', /* checkbox or radio */
          columnWidth: 37,
        };
      } else {
        return null;
      }
    } else {
      return {
        preserveSelectedRowKeys: true,
        selectedRowKeys: type === 'slaveInfo' ? this.state.slaveInfoSelectedRowKeys : this.state.selectedRowKeys, /*   已选择的数据集   */
        onChange: this.handleSelectRowChange.bind(this, name), /*   选择行发生改变时调用的函数   */
        getCheckboxProps: record => ({
          style: record.bSum && commonConfig.hasSum ? { display: 'none' } : { display: 'checkbox' },
        }), /*   过滤合计的选择框   */
        type: bMutiSelect ? this.props.rowSelectionType : 'radio', /* checkbox or radio */
        columnWidth: 37,
      };
    }
  };

  /**   获取table对象的props   */
  getSlaveTableProps = () => {
    /*   给数据都添加上key   */
    if (this.props.setExpandedRowRender !== undefined && this.props.setExpandedRowRender.toString() === 'Y') {
      const {
        dataSource, tableColumn, tableProps, name: slaveInfoName, config: slaveInfoConfig,
      } = this.props.slaveInfo;
      // const scrollHeight = parseInt(document.body.clientHeight - 400, 10);
      const components = {};
      if (this.isDragAndDrop) {
        components.header = { cell: ResizeableTitle };
        components.body = { row: DragableBodyRow };
      } else {
        components.header = { cell: ResizeableTitle };
      }

      let rowSelection = this.props.rowSelection !== undefined ? this.props.rowSelection : this.getSlaveRowSelection(slaveInfoName, 'slaveInfo');
      if (slaveInfoConfig && !slaveInfoConfig.bisMutiSelect) { /* 如果子表配置不显示选择框 则不显示选择框 */
        rowSelection = null;
      }
      /*   返回值   */
      return {
        components,
        rowKey: tableProps.rowKey,
        size: 'small',
        bordered: true, /*   显示边框   */
        className: !this.props.enabled ? styles.disabledProup : styles.proup, /*   样式控制   */
        scroll: { x: 'max-content' }, /*   宽度   */
        dataSource, /*   数据   */
        columns: tableColumn, /*   表头   */
        rowSelection: rowSelection, /* s  添加的复选框(checkbox)功能   */
        pagination: false, /*   不分页   */
        rowClassName: this.setRowClassName.bind(this, 'slaveInfo'),
        onRow: (record, index) => {
          if (this.isDragAndDrop) {
            return {
              index,
              onClick: () => {
                this.onRowClick(record, index, undefined, slaveInfoName, 'slaveInfo');
              },
              onDoubleClick: () => {
                this.onDoubleClick(record, index, undefined, slaveInfoName, 'slaveInfo');
              },
              moveRow: (dragIndex, hoverIndex, dragKey, hoverKey) => {
                this.moveRow(dragIndex, hoverIndex, dragKey, hoverKey);
              },
              onDragClick: (type) => {
                this.onRowClick(record, index, type, slaveInfoName, 'slaveInfo');
              },
            };
          } else {
            return {
              index,
              onClick: () => {
                this.onRowClick(record, index, undefined, slaveInfoName, 'slaveInfo');
              },
              onDoubleClick: () => {
                this.onDoubleClick(slaveInfoName, record);
              },
            };
          }
        },
        // footer: this.props.footer === undefined ? this.tableFooter : undefined,
        id: commonUtils.isEmptyArr(dataSource) ?
          'unDataBox' :
          'dataBox', /*   用户修改antd table中自带的样式(我听别人说的要这么弄,你们别骂我)  */
        ...this.props.slaveInfo.tableProps,
        onChange: this.onChange,
      };
    } else { return null; }
  };

  getTableFilterData = () => {
    const { dataSource } = this.state;
    const { masterData } = this.props;
    let filterData = 0;
    const GetFilterData = this.props.OnGetFilterData;
    if (GetFilterData !== undefined) {
      filterData = this.props.OnGetFilterData(this.props.name, this.props.bFinished);
    } else {
      filterData = dataSource.length;
    }
    if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sZczlxShowName)) {
      if (masterData.sZczlxShowName === '删除' || masterData.sZczlxShowName === '恢复') {
        filterData += 1;
      }
    }
    return filterData;
  }
  /**   获取showConfig   */
  getShowConfig = (props, sName, isSlaveInfo) => {
    /*   返回值声明   */
    let showConfig = [];
    /*   通过sName过滤出对应的showConfig   */
    if (props.customConfig) {
      const showConfigArr = props.customConfig.filter(item => item.sName === sName && item.bVisible);
      if (commonUtils.isNotEmptyArr(showConfigArr)) {
        showConfig = showConfigArr[0];
      }
    } else {
      if (props.config) {
        const showConfigArr = props.config.gdsconfigformslave.filter(item => item.sName === sName && item.bVisible);
        if (commonUtils.isNotEmptyArr(showConfigArr)) {
          showConfig = showConfigArr[0];
        }
      }

      if (isSlaveInfo && commonUtils.isNotEmptyObject(this.props.slaveInfo) && commonUtils.isNotEmptyObject(this.props.slaveInfo.config)) {
        const showConfigArr = this.props.slaveInfo.config.gdsconfigformslave.filter(item => item.sName === sName && item.bVisible);
        if (commonUtils.isNotEmptyArr(showConfigArr)) {
          showConfig = showConfigArr[0];
        }
      }

    }
    /*   返回值   */
    return showConfig;
  };

  /**   获取颜色Config   */
  getColorConfig = () => {
    let showConfig = [];
    /*   通过sName过滤出对应的showConfig   */
    /*   通过sName过滤出对应的showConfig   */
    if (this.props.customConfig) {
      const showConfigArr = this.props.customConfig.filter(item => commonUtils.isNotEmptyObject(item.sName) && commonUtils.isNotEmptyObject(item.sColorTerms) && item.bVisible);
      if (commonUtils.isNotEmptyArr(showConfigArr)) {
        showConfig = showConfigArr;
      }
    } else {
      if (this.props.config) {
        const showConfigArr = this.props.config.gdsconfigformslave.filter(item => commonUtils.isNotEmptyObject(item.sName) && commonUtils.isNotEmptyObject(item.sColorTerms) && item.bVisible);
        if (commonUtils.isNotEmptyArr(showConfigArr)) {
          showConfig = showConfigArr;
        }
      }

      if (commonUtils.isNotEmptyObject(this.props.slaveInfo) && commonUtils.isNotEmptyObject(this.props.slaveInfo.config)) {
        const showConfigArr = this.props.slaveInfo.config.gdsconfigformslave.filter(item => commonUtils.isNotEmptyObject(item.sName) && commonUtils.isNotEmptyObject(item.sColorTerms) && item.bVisible);
        if (commonUtils.isNotEmptyArr(showConfigArr)) {
          showConfig = showConfigArr;
        }
      }

    }
    /*   返回值   */
    return showConfig;
  };

  rowColorData = React.createRef();

  getColorStyle = (record, isRowShow) => {
    let styleColorArrTotal = '';
    const showConfigArr = this.getColorConfig(); /* 拿到颜色配置json */
    if (commonUtils.isNotEmptyArr(showConfigArr) && showConfigArr.length > 0) {
      for (const showConfig of showConfigArr) {
        let styleColorArr = '';
        const colorConditon = commonUtils.isNotEmptyObject(showConfig) ? showConfig.sColorTerms : null;
        if (commonUtils.isNotEmptyObject((colorConditon))) {
          let colorConditionArr = '';
          try {
            colorConditionArr = JSON.parse(colorConditon); /* 转化为json */
          } catch (e) {
            colorConditionArr = '';
          }
          colorConditionArr = Array.isArray(colorConditionArr) ? colorConditionArr : ''; /* 判断是否是数组 */
          for (const item of colorConditionArr) {
            let styleColor = '';
            const {
              column, condition, conditionValue, color, isRow,
            } = item;
            if (record[column] !== undefined) {
              if (color && !document.getElementById(`color${color.replace('#', '-')}`)) {
                var style = document.createElement('style');
                style.type = 'text/css';
                style.id = `color${color.replace('#', '-')}`;
                style.innerHTML = `
                  .color${color.replace('#', '-')} td {
                    background-color:${color}!important;
                    .ant-table-selection-column {
                      background-color:${color}!important;
                    }
                  }
                `;
                document.getElementsByTagName('head')[0].appendChild(style);
              }
              if (isRow && isRowShow && !commonUtils.isEmpty(record[column]) && commonUtils.isNotEmptyObject(record[column].toString())) { /* 配置行 */
                let { conditionValue: conditionValueOld } = item;
                const conditionValue = record[conditionValueOld] ? record[conditionValueOld] : conditionValueOld;
                if (condition === '=') {
                  if (commonUtils.isNotEmptyObject(conditionValue) && conditionValue.includes('#')) {
                    const sXName = conditionValue.replace('#', '').replace('#', '').trim();
                    if (sXName && commonUtils.isNotEmptyObject(this.props[sXName])) {
                      const sXValue = this.props[sXName];
                      styleColor = record[column] === sXValue ? `SetRow_${color} color${color.replace('#', '-')}` : '';
                    }
                  } else {
                    styleColor = record[column] === conditionValue ? `SetRow_${color} color${color.replace('#', '-')}` : '';
                  }
                } else if (condition === '!=') {
                  styleColor = record[column] != conditionValue ? `SetRow_${color} color${color.replace('#', '-')}` : '';
                } else if (condition === 'like') {
                  if (column.substring(0, 1) === 's') { styleColor = record[column]?.indexOf(conditionValue) > -1 ? `SetRow_${color} color${color.replace('#', '-')}` : ''; }
                } else if (condition === '>') {
                  styleColor = record[column] > conditionValue ? `SetRow_${color} color${color.replace('#', '-')}` : '';
                } else if (condition === '>=') {
                  styleColor = record[column] >= conditionValue ? `SetRow_${color} color${color.replace('#', '-')}` : '';
                } else if (condition === '<') {
                  styleColor = record[column] < conditionValue ? `SetRow_${color} color${color.replace('#', '-')}` : '';
                } else if (condition === '<=') {
                  styleColor = record[column] <= conditionValue ? `SetRow_${color} color${color.replace('#', '-')}` : '';
                }
              }
            }
            styleColorArr += styleColor;
            const index = this.rowColorData.current?.findIndex(i => i && i.key === record?.[this.rowKey]);
            if (styleColor) {
              if (Array.isArray(this.rowColorData.current) && index >= 0) {
                this.rowColorData.current[index] = { key: record?.[this.rowKey], color };
              } else {
                this.rowColorData.current = [...this.rowColorData.current || [], { key: record?.[this.rowKey], color }];
              }
            } else {
              if (Array.isArray(this.rowColorData.current) && index >= 0) this.rowColorData.current?.splice(index, 1);
            }
          }
        }
        styleColorArrTotal += `${styleColorArr} `;
      }
    }
    return styleColorArrTotal;
  }
  /**   获取单元格颜色配置  */
  getCellColorConfig = (text, record, sName) => {
    let styleColorArrTotal = ''; /* 单元格文字颜色 */
    let styleColorArrTotalB = ''; /* 单元格背景颜色 */
    let styleColorArr = '';
    let styleColorArrB = '';
    const styleColorArrTotalM = {};
    const showConfigArr = this.getColorConfig(); /* 拿到颜色配置json */
    if (commonUtils.isNotEmptyArr(showConfigArr) && showConfigArr.length > 0) {
      for (const showConfig of showConfigArr) {
        const colorConditon = commonUtils.isNotEmptyObject(showConfig) ? showConfig.sColorTerms : null;
        if (commonUtils.isNotEmptyObject((colorConditon))) {
          let colorConditionArr = '';
          try {
            colorConditionArr = JSON.parse(colorConditon); /* 转化为json */
          } catch (e) {
            colorConditionArr = '';
          }
          colorConditionArr = Array.isArray(colorConditionArr) ? colorConditionArr : '';
          for (const item of colorConditionArr) {
            let styleColor = '';
            // eslint-disable-next-line no-unused-vars
            let styleBackground = '';
            const {
              column, condition, color, background, isRow,
            } = item;
            if (!isRow) { /* 根据配置设置单元格颜色 */
              let { conditionValue: conditionValueOld } = item;
              const conditionValue = record[conditionValueOld] ? record[conditionValueOld] : conditionValueOld;
              if (column === sName && (column === showConfig.sName || showConfig.sControlName?.startsWith('canOtherConfig'))) { /* 只控制该配置的单元格 */
                if (condition === '=') {
                  styleColor = record[column] === conditionValue ? color : '';
                  styleBackground = record[column] === conditionValue ? background : '';
                } else if (condition === '!=') {
                  styleColor = record[column] != conditionValue ? color : '';
                  styleBackground = record[column] !== conditionValue ? background : '';
                } else if (condition === 'like') {
                  if (sName.substring(0, 1) === 's') {
                    styleColor = record[column]?.indexOf(conditionValue) > -1 ? color : '';
                    styleBackground = record[column]?.indexOf(conditionValue) > -1 ? background : '';
                  }
                } else if (condition === '!=') {
                  styleColor = record[column] !== conditionValue ? color : '';
                  styleBackground = record[column] !== conditionValue ? background : '';
                } else if (condition === '>') {
                  styleColor = record[column] > conditionValue ? color : '';
                  styleBackground = record[column] > conditionValue ? background : '';
                } else if (condition === '>=') {
                  styleColor = record[column] >= conditionValue ? color : '';
                  styleBackground = record[column] >= conditionValue ? background : '';
                } else if (condition === '<') {
                  styleColor = record[column] < conditionValue ? color : '';
                  styleBackground = record[column] < conditionValue ? background : '';
                } else if (condition === '<=') {
                  styleColor = record[column] <= conditionValue ? color : '';
                  styleBackground = record[column] <= conditionValue ? background : '';
                } else if (Array.isArray(condition)) { /* 通过其他列条件控制该字段的颜色显示 */
                  if (commonUtils.isNotEmptyArr(condition)) {
                    for (const itemConditon of condition) {
                      const {
                        bFilterName, bFilterCondition, color, background,
                      } = itemConditon;
                      let { bFilterValue: bFilterValueOld } = itemConditon;
                      const bFilterValue = record[bFilterValueOld] ? record[bFilterValueOld] : bFilterValueOld;
                      if (bFilterCondition === '=') {
                        styleColor = record[bFilterName] === bFilterValue ? color : '';
                        styleBackground = record[bFilterName] === bFilterValue ? background : '';
                      } else if (bFilterCondition === 'like') {
                        if (sName.substring(0, 1) === 's') {
                          styleColor = record[bFilterName].indexOf(bFilterValue) > -1 ? color : '';
                          styleBackground = record[bFilterName].indexOf(bFilterValue) > -1 ? background : '';
                        }
                      } else if (bFilterCondition === '!=') {
                        styleColor = record[bFilterName] !== bFilterValue ? color : '';
                        styleBackground = record[bFilterName] !== bFilterValue ? background : '';
                      } else if (bFilterCondition === '>') {
                        styleColor = record[bFilterName] > bFilterValue ? color : '';
                        styleBackground = record[bFilterName] > bFilterValue ? background : '';
                      } else if (bFilterCondition === '>=') {
                        styleColor = record[bFilterName] >= bFilterValue ? color : '';
                        styleBackground = record[bFilterName] >= bFilterValue ? background : '';
                      } else if (bFilterCondition === '<') {
                        styleColor = record[bFilterName] < bFilterValue ? color : '';
                        styleBackground = record[bFilterName] < bFilterValue ? background : '';
                      } else if (bFilterCondition === '<=') {
                        styleColor = record[bFilterName] <= bFilterValue ? color : '';
                        styleBackground = record[bFilterName] <= bFilterValue ? background : '';
                      }
                    }
                  }
                }
              }
            }
            styleColorArr += styleColor;
            styleColorArrB += styleBackground;
            if (styleColor) {
              styleColorArr = styleColor;
            }
            if (styleBackground) {
              styleColorArrB = styleBackground;
            }
          }
        }
        styleColorArrTotal = styleColorArr;
        styleColorArrTotalB = styleColorArrB;
      }
    }
    const iIndex = showConfigArr.findIndex(item => item.sName === sName);
    if (iIndex !== -1) {
      const { sColorTerms } = showConfigArr[iIndex];
      if (sColorTerms && sColorTerms.startsWith('#')) {
        styleColorArrTotal = sColorTerms;
      }
    }
    styleColorArrTotalM.styleColorArrTotal = styleColorArrTotal;
    styleColorArrTotalM.styleColorArrTotalB = styleColorArrTotalB;
    return styleColorArrTotalM;
  };

  /**
  * 部分字段不可编辑
  */
  getSelectRowEditState = (sName, record, enabled) => {
    const { config, name, masterData } = this.props;
    let result = enabled;
    const { sInstruct: sInstructStr } = config;
    const sInstruct = commonUtils.convertStrToObj(sInstructStr, {});
    const { data = [] } = sInstruct;

    const btnConfig = data.find(item => item && item.name === sName && item.enabled !== undefined);
    if (btnConfig && enabled) {
      const { enabled: enabledContent } = btnConfig;
      if (typeof enabledContent === 'boolean') {
        result = enabledContent;
      } else if (enabledContent) {
        const tempData = {
          props: {
            enabled
          },
          master: masterData,
          [name]: record
        };

        let strNew = enabledContent;
        Object.keys(tempData).forEach(key => {
          const reg = new RegExp(`${key}\\.`, "g");
          strNew = strNew.replace(reg, `tempData["${key}"].`);
        });
        try {
          const evalStr = eval("`" + strNew + "`");
          result = !!eval(evalStr);
          // console.log('=====表格行按钮状态结果', result, { sName, enabledContent, tempData, strNew, evalStr });
        } catch (error) {
          // console.log('=====表格行按钮状态错误', { error, enabledContent, strNew, tempData });
        }
      }
    }

    return result;
  }

  // 获取表格行按钮状态
  getTableBtnState = (btnName, record) => {
    let result = false;
    const { enabled, config, masterData, name, sUseInfo, bLimitOperate } = this.props;
    result = enabled;
    /* 订单占用，则该行锁定 不能操作  */
    const { sWorkOrderUsed } = record;
    if (commonUtils.isNotEmptyObject(sWorkOrderUsed)) {
      result = false;
    }
    /* 若红冲单据 则按钮锁定 不能操作  */
    if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sMinusSrcId) && masterData.sMinusType === '1') {
      result = false;
    }
    if (btnName === 'BtnAdd' && bLimitOperate) {
      result = false;
    }

    const { sInstruct: sInstructStr } = config;
    const sInstruct = commonUtils.convertStrToObj(sInstructStr, {});
    const { data = [] } = sInstruct;

    const btnConfig = data.find(item => item && item.name === btnName && item.enabled !== undefined);
    if (btnConfig) {
      const { enabled: enabledContent } = btnConfig;
      if (typeof enabledContent === 'boolean') {
        result = enabledContent;
      } else if (enabledContent) {
        const tempData = {
          props: {
            enabled
          },
          master: masterData,
          [name]: record
        };

        let strNew = enabledContent;
        Object.keys(tempData).forEach(key => {
          const reg = new RegExp(`${key}\\.`, "g");
          strNew = strNew.replace(reg, `tempData["${key}"].`);
        });
        try {
          const evalStr = eval("`" + strNew + "`");
          result = !!eval(evalStr);
          // console.log('=====表格行按钮状态结果', result, { btnName, enabledContent, tempData, strNew, evalStr });
        } catch (error) {
          console.log('=====表格行按钮状态错误', { error, enabledContent, strNew, tempData });
        }
      }
    }

    return result;
  }

  bCheckBoxColumm = (column) => {
    const { gdsconfigformslave } = this.props.config || {};
    const item = gdsconfigformslave?.find(i => i && i.sName === column?.dataIndex && i.bVisible);
    if (item?.sControlName?.startsWith('bCheckBox')) {
      const checked = !!this.state.dataSource.length && !this.state.dataSource?.find(i => !i || !i[column?.dataIndex]);
      return <>
        <Checkbox
          style={{ marginRight: 5 }}
          disabled={!this.props.enabled}
          checked={checked}
          onChange={(e) => {
            const { handleCheckBoxStatus } = this.props;
            typeof handleCheckBoxStatus === 'function' && handleCheckBoxStatus(e.target.checked, column?.dataIndex, this.props.name)
          }}
        />
        {column?.title}
      </>
    }
  }

  /**   获取table的表头信息(主要是table中的表头信息合并,[{title:1-1},{title:1-2}]变成[{title:1,children:[{title:1},{title:2}]}]) type：是否过滤   */
  getTableColumn = (headerColumn, type, props) => {
    // this.hasMergeHeader = false;
    // 判断是否是表单详情
    const isSlaveInfo = props.name === 'slaveInfo' ||
      (
        location.pathname === '/indexPage/commonCostomTabBill' &&
        props.name &&
        props.name.includes('Info') &&
        commonUtils.isNotEmptyObject(this.props.slaveInfo)
      );
    const config = isSlaveInfo ? this.props.slaveInfo.config : this.props.config;
    const isSlaveInfoM = isSlaveInfo && commonUtils.isNotEmptyObject(config) ? config.showName === '工单物资评审' : false;
    /*   返回值声明   */
    const tableColumn = [];
    let iIndex = 0;
    const specialRoute = commonUtils.isNotEmptyObject(this.props.app.currentPane) ? this.props.app.currentPane.route : ''; /* 获取路由名称 */
    /*   遍历每一个表头标题   */
    for (const column of headerColumn) {
      /*   表头标题   */
      const title = column.title;
      const width = column.width;
      const bNotEmpty = column.bNotEmpty;
      /*   带'-'的表头是需要合并滴   */
      const index = commonUtils.isNotEmptyObject(title) ? title.indexOf('-') : -1;
      /*   合并走合并的,不合并就直接push   */
      let columnNew = {};
      let sorter;
      let search = true;
      if (props.tableProps !== undefined && props.tableProps.rowKey !== undefined && props.tableProps.rowKey !== 'sId' && !props.tableProps.sortSelf) {
        sorter = true;
      } else {
        const firstDataIndex = column.dataIndex.substring(0, 1);
        if (firstDataIndex === 'd' || firstDataIndex === 'i') {
          sorter = (a, b) => ((commonUtils.isEmpty(a[column.dataIndex]) ? 0 : a[column.dataIndex]) - (commonUtils.isEmpty(b[column.dataIndex]) ? 0 : b[column.dataIndex]));
        } else if (firstDataIndex === 't') {
          sorter = (a, b) => (moment(commonUtils.isEmpty(a[column.dataIndex]) ? '2000-01-01' : a[column.dataIndex]).diff(moment(commonUtils.isEmpty(b[column.dataIndex]) ? '2000-01-01' : b[column.dataIndex])));
        } else {
          sorter = (a, b) => ((commonUtils.isEmpty(a[column.dataIndex]) ? '0' : a[column.dataIndex]).localeCompare((commonUtils.isEmpty(b[column.dataIndex]) ? '1' : b[column.dataIndex])));
        }
      }

      /* 工单、工艺卡、报价单 去掉排序 */
      if (this.props.name === 'sParam' || specialRoute.includes('workOrder') || specialRoute.includes('processCard') || specialRoute.includes('quotation')) {
        sorter = false;
      }
      /* 默认字段是排序的 通过配置bNotSort来设置字段不排序 */
      if (config && commonUtils.isNotEmptyStr(config.gdsconfigformslave.filter(item => item.sName === column.dataIndex))) {
        if (config.gdsconfigformslave.filter(item => item.sName === column.dataIndex).length > 0 && config.gdsconfigformslave.filter(item => item.sName === column.dataIndex)[0].bNotSort) {
          sorter = false;
        }
      }
      if (config && commonUtils.isNotEmptyStr(config.gdsconfigformslave.filter(item => item.sName === column.dataIndex))) {
        if (config.gdsconfigformslave.filter(item => item.sName === column.dataIndex)[0].bNotSearch) {
          search = false;
        }
      }
      if (column.dataIndex === "spicture" || column.dataIndex === "tableLastEmpty") {
        sorter = false;
      }
      let sTitleBgColor = commonUtils.isNotEmptyObject(column.sTitleBgColor) ? column.sTitleBgColor : ''; /* 标题背景颜色 */
      let sTitleColor = commonUtils.isNotEmptyObject(column.sTitleColor) ? column.sTitleColor : ''; /* 标题字体颜色 */
      const styleObj = {};
      if (commonUtils.isNotEmptyObject(sTitleBgColor)) {
        styleObj.background = sTitleBgColor;
      }
      if (commonUtils.isNotEmptyObject(sTitleColor)) {
        styleObj.color = sTitleColor;
      }
      const renderTitle = () => {
        // 树形表格在第一个column上加上全部展开/收起功能
        let expandedAllIcon = '';
        const columnIndex = headerColumn.findIndex(item => column.title === item.title);
        let { data } = this.props;
        let { expKeys } = this.state;
        expKeys = commonUtils.isNotEmptyArr(expKeys) ? expKeys : [];
        expKeys = this.currentExpKeys || expKeys;
        data = commonUtils.isNotEmptyArr(data) ? data : [];

        const childrenList = [];
        const getChildrenList = (data) => {
          data.forEach(item => {
            if (item && typeof item.children === 'object') {
              childrenList.push(item);
              getChildrenList(item.children);
            }
          });
        }
        getChildrenList(data);
        if (columnIndex === 0 && childrenList.length) { // 第一个column并且数据中有children
          this.showExpAll = true;
          this.tableCollapsed = !expKeys.length;
          const marginLeft = this.props.bMutiSelect ? '6px' : '2px';
          expandedAllIcon = (
            <button
              class={`table-expAllIcon ant-table-row-expand-icon ${this.tableCollapsed ? 'ant-table-row-expand-icon-collapsed' : ''}`}
              style={{ margin: `1px 4px 0 ${marginLeft}` }}
              ref={(ref) => { this.expRef = ref }}
              onClick={(e) => {
                e.stopPropagation();
                if (this.tableCollapsed) {
                  this.tableCollapsed = false;
                  this.expRef.classList.remove('ant-table-row-expand-icon-collapsed');
                  this.setState({
                    expKeys: childrenList.map(item => item[this.rowKey])
                  });
                } else {
                  this.tableCollapsed = true;
                  this.expRef.classList.add('ant-table-row-expand-icon-collapsed');
                  this.setState({
                    expKeys: []
                  });
                }
              }}
            />);
        }

        const titleCheckBox = this.bCheckBoxColumm({ ...column });
        if (titleCheckBox) {
          sorter = false;
          return titleCheckBox;
        }

        let res = column.title;
        if (bNotEmpty) {
          res = <div className='th-div' style={styleObj}>{expandedAllIcon}<span className="table-title-required">*</span> {column.title}</div>;
        } else {
          res = <div className='th-div' style={styleObj}>{expandedAllIcon}{column.title}</div>;
        }
        if (column.dataIndex === 'bSelfCbx') {
          res = <div style={{ marginLeft: '5px' }}><Checkbox disabled={!props.enabled} checked={column.bCheckAll} onChange={(e) => this.onParamChange(e)}></Checkbox></div>;
        }

        return res;
      }
      columnNew = {
        ...column,
        title: renderTitle(),
        sorter,
        sortOrder: props && props.sortedInfo ? props.sortedInfo.columnKey === column.dataIndex && props.sortedInfo.order : false,
        width,
        onHeaderCell: !column.bNotResize ? this.onHeaderCell.bind(this, isSlaveInfo, iIndex) : null,
        ...this.getColumnSearchProps(iIndex, column, type, props, search),
      };
      if (index > -1) { /*   合并   */
        this.mergeTableColumn(title, columnNew, tableColumn, index, bNotEmpty, styleObj);
      } else { /*   不合并   */
        // columnNew.onHeaderCell = this.onHeaderCell.bind(this, iIndex);
        tableColumn.push(columnNew);
      }
      iIndex += 1;
    }
    let tableWidth = 0;
    if (this.mydiv && !isSlaveInfo) {
      const ths = this.mydiv.getElementsByClassName('ant-table-header')[0].getElementsByClassName('react-resizable');
      for (let i = 0; i < ths.length - 1; i += 1) {
        tableWidth += ths[i].offsetWidth;
      }
    }
    if (this.myInfoDiv && isSlaveInfo) {
      const ths = this.myInfoDiv.getElementsByClassName('ant-table-header')[0].getElementsByClassName('react-resizable');
      for (let i = 0; i < ths.length - 1; i += 1) {
        tableWidth += ths[i].offsetWidth;
      }
    }
    const lastRowOld = tableColumn.length ? tableColumn[tableColumn.length - 1].width : 0;
    /*  判断是否有选择列，如有计算checkbox宽度 */
    let CheckBoxWidth = 0;
    /* tableProps默认不传入rowSelection属性，代表设置选择框，若传入rowSelection=null，则代表不设置复选框 */
    if (props.tableProps.rowSelection !== null && props.tableProps.rowSelection !== undefined) {
      CheckBoxWidth = 37;
    }
    if (this.props.setOpterationColumn === 'Y') {
      /*   获取choose的props   */
      const chooseProcessProps = { ...this.getChooseProcessPropsTableRow(), disabled: false };
      /*   获取modal的props   */
      const modalProps = { ...this.getModalPropsTableRow(), disabled: false };
      /*   获取modal的props   */
      const modalRemarkProps = { ...this.getModalRemarkPropsTableRow(), disabled: false, style: { display: 'block', margin: '0 10px' } };
      /*   获取add的props   */
      const addProps = { ...this.getAddPropsTableRow(), disabled: false };
      const headProps = { ...this.getHeadPropsTableRow(), disabled: false };
      /*   获取del的props   */
      const delProps = { ...this.getDelPropsTableRow(), disabled: false };
      /*   获取del多行的props   */
      const copyMoreProps = { ...this.getCopyMorePropsTableRow(), disabled: false };
      /*   获取复制的props   */
      const copyProps = { ...this.getCopyProps(), disabled: false };
      /* 通用弹窗按钮 */
      const choosePopupProps = { ...this.getPopupPropsTableRow(), disabled: false };
      const chooseParamProps = { ...this.getParamPropsTableRow(), disabled: false };
      /* 通用弹窗按钮 */
      const chooseProductProcessProps = { ...this.getChooseProductProcessPropsTableRow(), disabled: false };
      /* 通用弹窗按钮 */
      const chooseProductMaterialsProps = { ...this.getChooseProductMaterialsPropsTableRow(), disabled: false };
      /*   获取复制全部的props   */
      // const copyAllProps = { ...this.getCopyAllProps(), disabled: false, style: { display: 'block', margin: '0 10px' } };
      const copyAllProps = { ...this.getCopyAllProps(), disabled: false };
      const uploadProps = { ...this.getUploadProps(), disabled: false, style: { margin: '0 10px', 'caret-color': 'transparent' } };
      const downloadProps = { ...this.getDownProps(), disabled: false, style: { display: 'block', margin: '0 5px' } };
      if (isSlaveInfoM) {
        addProps.style.display = 'block';
        delProps.style.display = 'block';
      }
      const { formId } = props;
      const { token } = props.app;
      const divProps = {
        action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`,
        onChange: this.handleUploadChange,
        accept: '*/*',
        showUploadList: false,
        multiple: true,
        beforeUpload: this.handleBeforeUpload,
      };
      const addIcon = props.tableProps.setAdd; /* 增加操作 */
      const copyIcon = props.tableProps.setCopy; /* 复制操作 */
      const copyAllIcon = props.tableProps.setCopyAll; /* 复制部件操作 */
      const delIcon = props.tableProps.setDelete; /* 删除操作 */
      const materialIcon = props.tableProps.setMaterial; /* 材料操作 */
      const processIcon = props.tableProps.setProcess; /* 工序操作 */
      const materailremarkIcon = props.tableProps.setMaterialRemark;/* 材料备注 */
      let uploadIcon = props.tableProps.setUpload;/* 上传 */
      let downloadIcon = props.tableProps.setDownload;/* 下载 */
      let headPopup = false; /* 表头放大镜 */
      let sAlumitePopup = false; /* 选择电化铝 */
      let bCopyMore = false; /* 复制多行 */
      let bReplace = false; /* 替换数据 */
      const setOperation = commonFunc.showMessage(props.app.commonConst, 'operation') || '操作';
      const bShowTreeAdd = props.tableProps.bShowTreeAdd && this.findIsExistByControlName(props, 'BtnAdd'); /* 添加树节点 */
      const bShowTreeAddChild = props.tableProps.bShowTreeAddChild && this.findIsExistByControlName(props, 'BtnAddChildNode'); /* 添加树节点 */
      const bShowTreeDel = props.tableProps.bShowTreeDel && this.findIsExistByControlName(props, 'BtnDel'); /* 添加树节点 */
      const bShowTreeCopyAll = props.tableProps.bShowTreeCopyAll && this.findIsExistByControlName(props, 'BtnCopyAll'); /* 添加树节点 */
      const exitIcon = props.tableProps.setExit; /* 退出操作 */
      let bShowProductProcess = false;/* 选择成品工序 */
      if (commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.tableProps) && props.tableProps.bShowProductProcess !== undefined) {
        bShowProductProcess = props.tableProps.bShowProductProcess;/* 选择成品工序 */
      }
      let bShowProductMaterials = false;/* 选择成品材料 */
      if (commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.tableProps) && props.tableProps.bShowProductMaterials !== undefined) {
        bShowProductMaterials = props.tableProps.bShowProductMaterials;/* 选择成品工序 */
      }
      /* 操作栏设置上传 */
      uploadIcon = this.findVisibleControlName(this.props, 'BtnSetUpload');
      downloadIcon = this.findVisibleControlName(this.props, 'BtnSetDownload');
      headPopup = this.findVisibleControlName(this.props, 'BtnHeadPopup'); /* 表头放大镜 */
      sAlumitePopup = this.findVisibleControlName(this.props, 'BtnPopupsAlumiteBomBillNo'); /* 表头放大镜 */
      bCopyMore = this.findVisibleControlName(this.props, 'BtnCopyMore'); /* 复制多行 */
      bReplace = this.findVisibleControlName(this.props, 'BtnReplace'); /* 替换材料 */

      const setNoCommonOperate = props.tableProps.setNoCommonOperate; /* 没有默认的增加删除按钮 */
      let operateWidth = isSlaveInfoM ? 80 : 0;

      if (addProps.style.display === 'inline-block') {
        operateWidth += 40;
      }
      if (delProps.style.display === 'inline-block') {
        operateWidth += 40;
      }
      if (bCopyMore) {
        operateWidth += 40;
      }
      if (bReplace) {
        operateWidth += 40;
      }
      if (copyProps.style.display === 'inline-block') {
        operateWidth += 40;
      }
      if (copyAllProps.style.display === 'inline-block') {
        operateWidth += 40;
      }
      if (setNoCommonOperate) {
        operateWidth = 0;
      }
      if (!setNoCommonOperate && this.props.name === 'sWorkOrderParamList') {
        operateWidth -= 80;
      }
      if (this.props.bHideCopyAll) {
        operateWidth -= 40;
      }
      if (modalProps.style.display === 'inline-block') {
        operateWidth += 40;
      }
      if (!commonUtils.isEmpty(materailremarkIcon)) {
        operateWidth += 40;
      }
      if (chooseProcessProps.style.display === 'inline-block') {
        operateWidth += 40;
      }
      if (choosePopupProps.style.display === 'inline-block') {
        operateWidth += 40;
      }

      if (chooseParamProps.style.display === 'inline-block') {
        operateWidth += 40;
      }

      if (bShowProductProcess) {
        operateWidth += 40;
      }
      if (bShowTreeAdd) {
        operateWidth += 40;
      }
      if (bShowTreeAddChild) {
        operateWidth += 40;
      }
      if (bShowTreeDel) {
        operateWidth += 40;
      }
      if (bShowTreeCopyAll) {
        operateWidth += 40;
      }
      if (bShowProductMaterials) {
        operateWidth += 40;
      }
      if (exitIcon) {
        operateWidth += 60;
      }
      if (headPopup) {
        operateWidth += 20;
      }
      if (sAlumitePopup) {
        operateWidth += 40;
      }
      let scrollWidth = 18;
      if (commonUtils.isNotEmptyStr(this.props.tableProps.f) && this.props.tableProps.AutoTableHeight.indexOf('calc') === -1) { /* 固定列计算 */
        scrollWidth = 0;
      }

      if (uploadIcon) {
        operateWidth += 80;
      }

      const tableAllWidth = tableWidth + CheckBoxWidth + operateWidth + lastRowOld;
      if (commonUtils.isNotEmptyObject(props.tableProps.CalLastWidth)) {
        this.tableContentWidth = props.tableProps.CalLastWidth; /* 解决材料与工艺Modal最后一行问题 */
        scrollWidth = 18;
      }
      let lastRow = 0;
      if (props.bNaturalWidth) { /* 取后台配置原始宽度 不进行最后一列计算 */
        tableColumn[tableColumn.length - 1].width = lastRowOld;
      } else if (tableAllWidth < this.tableContentWidth) {
        lastRow = this.tableContentWidth - tableWidth - operateWidth - CheckBoxWidth - scrollWidth - 1; // 1像素为border宽度;
        if (lastRow > 0 && tableColumn.length > 0) {
          delete tableColumn[tableColumn.length - 1].width;
          // tableColumn[tableColumn.length - 1].width = lastRow;;
        }
      } else if (tableColumn.length > 0) {
        tableColumn[tableColumn.length - 1].width = lastRowOld;
      }
      /* 动态加载操作行 */
      tableColumn.push({
        dataIndex: 'operation',
        render: (text, record, index) => {
          let operateAdd = null;
          let operateCopy = null;
          let operateDel = null;
          let operateCopyMore = null;
          let operateReplace = null;
          let operateMaterial = null;
          let operateProcess = null;
          let operateCopyAll = null;
          let operateMaterailRemark = null;
          let operateDownload = null;
          let operatePopupModal = null;
          let operateParamModal = null;
          let operateProductProcess = null;
          let operateProductMaterials = null;
          let operateTreeAdd = null;
          let operateTreeDel = null;
          let operateTreeCopyAll = null;
          let operateTreeAddChild = null;
          let operateExit = null;
          let operatesAlumitePopup = null;
          const setAdd = commonFunc.showMessage(props.app.commonConst, 'setAdd');/* 新增s */
          const setCopy = commonFunc.showMessage(props.app.commonConst, 'setCopy');/* 复制 */
          const setDelete = commonFunc.showMessage(props.app.commonConst, 'setDelete');/* 删除 */
          const setCopyMore = commonFunc.showMessage(props.app.commonConst, 'setCopyMore') ? commonFunc.showMessage(props.app.commonConst, 'setCopyMore') : '复制多行'; /* 删除 */
          const setReplace = commonFunc.showMessage(props.app.commonConst, 'setCopyMore') ? commonFunc.showMessage(props.app.commonConst, 'setReplace') : '提取'; /* 提取 */
          const setCopyAll = commonFunc.showMessage(props.app.commonConst, 'setCopyAll');/* 复制部件 */
          let { rowTag } = record; /* 锁定行标识 */
          const { sWorkOrderUsed } = record;/* 订单被工单占用，则该行不能修改、删除 */
          if (commonUtils.isNotEmptyObject(sWorkOrderUsed)) {
            record.rowTag = 1;
            rowTag = 1;
          }
          if (commonUtils.isNotEmptyObject(this.props.sUseInfo)) {
            rowTag = 1;
          }
          /** 树节点添加 */
          if (bShowTreeAdd) {
            const enabled = this.getTableBtnState('BtnAdd', record);
            operateTreeAdd = <a title="添加同级" alt="添加同级" style={{ margin: '0 10px' }} onClick={enabled ? this.handleTreeAdd.bind(this, index) : null}>{enabled ? <SvgIcon iconClass="plus" fill="#1296db" size="14" alt="添加"></SvgIcon> : <SvgIcon iconClass="plus" fill="rgb(189, 189, 189)" size="14" alt="添加"></SvgIcon>}</a>
          }
          /** 树节点删除 */
          if (bShowTreeDel) {
            const enabled = this.getTableBtnState('BtnDel', record);
            operateTreeDel = <a title="删除" alt="删除" style={{ margin: '0 10px' }} onClick={enabled ? this.handleTreeDel.bind(this, index) : null}>{enabled ? <SvgIcon iconClass="close" fill="#1296db" size="14" alt="删除"></SvgIcon> : <SvgIcon iconClass="close" fill="rgb(189, 189, 189)" size="14" alt="删除"></SvgIcon>}</a>
          }
          /** 树节点添加子类 */
          if (bShowTreeAddChild) {
            const enabled = this.getTableBtnState('BtnAddChildNode', record);
            operateTreeAddChild = <a title="添加子级" alt="添加子级" style={{ margin: '0 10px' }} onClick={enabled ? this.handleTreeAddChild.bind(this, index) : null}>{enabled ? <SvgIcon iconClass="tree" fill="#1296db" size="14" alt="增加"></SvgIcon> : <SvgIcon iconClass="tree" fill="rgb(189, 189, 189)" size="14" alt="增加"></SvgIcon>}</a>
          }
          /** 树节点复制 */
          if (bShowTreeCopyAll) {
            const enabled = this.getTableBtnState('BtnCopyAll', record);
            operateTreeCopyAll = <a title="复制全部" alt="复制全部" style={{ margin: '0 10px' }} onClick={enabled ? this.handleTreeCopyAll.bind(this, index) : null}>{enabled ? <SvgIcon iconClass="copyall" fill="#1296db" size="14" alt="复制"></SvgIcon> : <SvgIcon iconClass="copyall" fill="rgb(189, 189, 189)" size="14" alt="复制"></SvgIcon>}</a>
          }
          /** 放置添加图标 添加为默认显示 */
          if (!commonUtils.isEmpty(addIcon)) {
            const enabled = this.getTableBtnState('BtnAdd', record);
            operateAdd = <a title={setAdd} {...addProps} onClick={enabled || this.findIsUpdByControlName(this.props, 'BtnAdd') ? this.addTbRow.bind(this, index) : null}>{enabled || this.findIsUpdByControlName(this.props, 'BtnAdd') ? <SvgIcon iconClass="plus" fill="#1296db" size="14" alt="添加"></SvgIcon> : <SvgIcon iconClass="plus" fill="rgb(189, 189, 189)" size="14" alt="添加"></SvgIcon>}</a>;
          } else if (setNoCommonOperate) {
            operateAdd = '';
          } else {
            const enabled = this.getTableBtnState('BtnAdd', record);
            operateAdd = <a title={setAdd} {...addProps} onClick={enabled || this.findIsUpdByControlName(this.props, 'BtnAdd') ? this.addTbRow.bind(this, index) : null} > {enabled || this.findIsUpdByControlName(this.props, 'BtnAdd') ? <SvgIcon iconClass="plus" fill="#1296db" size="14" alt="添加"></SvgIcon> : <SvgIcon iconClass="plus" fill="rgb(189, 189, 189)" size="14" alt="添加"></SvgIcon>}</a>;
          }
          /** 放置复制图标 */
          if (!commonUtils.isEmpty(copyIcon)) {
            const enabled = this.getTableBtnState('BtnCopy', record);
            operateCopy = <a title={setCopy} {...copyProps} onClick={enabled ? this.copyTbRow.bind(this, index) : null} >{enabled ? <SvgIcon iconClass="copy" fill="#1296db" size="14" alt="复制"></SvgIcon> : <SvgIcon iconClass="copy" fill="rgb(189, 189, 189)" size="14" alt="复制"></SvgIcon>}</a>;
          } else if (setNoCommonOperate || this.props.name === 'sWorkOrderParamList') {
            operateCopy = '';
          } else {
            const enabled = this.getTableBtnState('BtnCopy', record);
            operateCopy = <a title={setCopy}{...copyProps} onClick={enabled ? this.copyTbRow.bind(this, index) : null} > {enabled ? <SvgIcon iconClass="copy" fill="#1296db" size="14" alt="复制"></SvgIcon> : <SvgIcon iconClass="copy" fill="rgb(189, 189, 189)" size="14" alt="复制"></SvgIcon>}</a>;
          }
          /** 放置复制部件图标 */
          if (!commonUtils.isEmpty(copyAllIcon)) {
            const enabled = this.getTableBtnState('BtnCopyAll', record);
            operateCopyAll = <a title={setCopyAll} {...copyAllProps} onClick={enabled ? this.copyAllTbRow.bind(this, index) : this.handleTbRowUsed.bind(this, index, record, 'copyAll')}>{enabled ? <SvgIcon iconClass="copyall" fill="#1296db" size="14" alt="复制全部"></SvgIcon> : <SvgIcon iconClass="copyall" fill="rgb(189, 189, 189)" size="14" alt="复制全部"></SvgIcon>}</a>;
          } else if (setNoCommonOperate || this.props.bHideCopyAll || this.props.name === 'sWorkOrderParamList') {
            operateCopyAll = '';
          } else {
            const enabled = this.getTableBtnState('BtnCopyAll', record);
            operateCopyAll = <a title={setCopyAll} {...copyAllProps} onClick={enabled ? this.copyAllTbRow.bind(this, index) : null}>{enabled || this.findIsUpdByControlName(this.props, 'BtnCopyAll') ? <SvgIcon iconClass="copyall" fill="#1296db" size="14" alt="复制全部"></SvgIcon> : <SvgIcon iconClass="copyall" fill="rgb(189, 189, 189)" size="14" alt="复制全部"></SvgIcon>}</a>;
          }
          /** 放置删除图标 删除为默认显示 */
          if (!commonUtils.isEmpty(delIcon)) {
            const enabled = this.getTableBtnState('BtnDel', record);
            operateDel = <a title={setDelete} {...delProps} onClick={props.bDirectDel || (enabled && rowTag !== 1) ? this.delTbRow.bind(this, index, record) : this.handleTbRowUsed.bind(this, index, record, 'del')} >{props.bDirectDel || (enabled && rowTag !== 1) ? <SvgIcon iconClass="close" fill="#1296db" size="14" alt="删除"></SvgIcon> : <SvgIcon iconClass="close" fill="rgb(189, 189, 189)" size="14" alt="删除"></SvgIcon>}</a>;
          } else if (setNoCommonOperate) {
            operateDel = '';
          } else {
            const enabled = this.getTableBtnState('BtnDel', record);
            operateDel = <a title={setDelete} {...delProps} onClick={props.bDirectDel || (enabled || this.findIsUpdByControlName(this.props, 'BtnDel')) ? this.delTbRow.bind(this, index, record) : null} >{props.bDirectDel || (enabled || this.findIsUpdByControlName(this.props, 'BtnDel')) ? <SvgIcon iconClass="close" fill="#1296db" size="14" alt="删除"></SvgIcon> : <SvgIcon iconClass="close" fill="rgb(189, 189, 189)" size="14" alt="删除"></SvgIcon>}</a>;
          }

          /* 复制多行 */
          if (bCopyMore) {
            const enabled = this.getTableBtnState('BtnDelMore', record);
            operateCopyMore = <a title={setCopyMore} {...copyMoreProps} onClick={enabled ? this.copyTbMoreRow.bind(this, index) : null} >{enabled ? <SvgIcon iconClass="copy" fill="#1296db" size="14" alt="复制"></SvgIcon> : <SvgIcon iconClass="copy" fill="rgb(189, 189, 189)" size="14" alt="复制多行"></SvgIcon>}</a>;

          }
          /* 提取数据 */
          if (bReplace) {
            const enabled = this.getTableBtnState('BtnReplace', record);
            operateReplace = <a title={setReplace} onClick={enabled ? this.replaceTbRow.bind(this, index, record) : null} >{enabled ? <img src={ReplaceIcon} alt="提取数据" width="18px" height="18px" /> : <img src={DisReplaceIcon} alt="查看工艺参数" width="16px" height="16px" />}</a>;

          }

          /** 放置选择材料图标 */
          if (!commonUtils.isEmpty(materialIcon)) {
            const enabled = this.getTableBtnState('BtnChooseMaterials', record);
            const setMaterial = commonFunc.showMessage(props.app.commonConst, 'setMaterial');/* 选择材料 */
            operateMaterial = (
              <a
                title={setMaterial}
                {...modalProps}
                onClick={
                  enabled && rowTag !== 1 ?
                    this.modalTbRow.bind(this, index, props.name) :
                    this.handleTbRowUsed.bind(this, index, record, 'setMaterial')
                }
              >
                {
                  enabled && rowTag !== 1 ?
                    <SvgIcon iconClass="material" fill="#1296db" size="14" alt="选择材料" /> :
                    <SvgIcon iconClass="material" fill="rgb(189, 189, 189)" size="14" alt="选择材料" />
                }
              </a>
            );
          }
          /** 放置材料备注图标 */
          if (!commonUtils.isEmpty(materailremarkIcon)) {
            const enabled = this.getTableBtnState('BtnChooseMaterials', record);
            const setMaterailRemark = commonFunc.showMessage(props.app.commonConst, 'setMaterailRemark');/* 选择材料工艺 */
            operateMaterailRemark = (
              <a
                title={setMaterailRemark}
                {...modalRemarkProps}
                onClick={enabled ? this.modalRemarkTbRow.bind(this, index) : () => { }}
              >
                <SvgIcon iconClass="material" fill={enabled ? "#1296db" : "rgb(189, 189, 189)"} size="14" alt="选择材料">
                </SvgIcon></a>
            )
          }
          /** 放置选择工序材料图标 */
          if (!commonUtils.isEmpty(processIcon)) {
            const enabled = this.getTableBtnState('BtnChooseProcess', record);
            const setProcess = commonFunc.showMessage(props.app.commonConst, 'setProcess');/* 选择工序 */
            operateProcess = <a title={setProcess} {...chooseProcessProps} onClick={enabled ? this.chooseProcessTbRow.bind(this, index) : null} >{enabled ? <SvgIcon iconClass="process" fill="#1296db" size="14" alt="选择工序"></SvgIcon> : <SvgIcon iconClass="process" fill="rgb(189, 189, 189)" size="14" alt="选择工序"></SvgIcon>}</a>;
          }
          /** 选择成品工序图标 */
          if (bShowProductProcess) {
            const enabled = this.getTableBtnState('BtnChooseProductProcess', record);
            const setProductProcess = commonFunc.showMessage(props.app.commonConst, 'setProductProcess');/* 选择成品工序 */
            operateProductProcess = <a title={setProductProcess} {...chooseProductProcessProps} onClick={enabled ? this.chooseProductProcessModalTbRow.bind(this, index, record) : null}>{enabled ? <SvgIcon iconClass="process" fill="#1296db" size="14" alt="选择成品工序"></SvgIcon> : <SvgIcon iconClass="process" fill="rgb(189, 189, 189)" size="14" alt="选择成品工序"></SvgIcon>}</a>;
          }
          /** 选择成品材料图标 */
          if (bShowProductMaterials) {
            const enabled = this.getTableBtnState('BtnChooseProductMaterials', record);
            const setProductMaterials = commonFunc.showMessage(props.app.commonConst, 'setProductMaterials');/* 选择成品材料 */
            operateProductMaterials = <a title={setProductMaterials} {...chooseProductMaterialsProps} onClick={enabled ? this.chooseProductMaterialsModalTbRow.bind(this, index, record) : null}>{enabled ? <SvgIcon iconClass="material" fill="#1296db" size="14" alt="选择成品材料"></SvgIcon> : <SvgIcon iconClass="material" fill="rgb(189, 189, 189)" size="14" alt="选择成品材料"></SvgIcon>}</a>;
          }

          if (downloadIcon) {
            const setDownload = commonFunc.showMessage(props.app.commonConst, 'setDownload');/* 下载 */
            operateDownload = <a title={setDownload} {...downloadProps} onClick={this.downloadTbRow.bind(this, index, record)}>{<DownloadOutlined />}</a>;
          }

          if (this.isPopupShow) {
            const enabled = this.getTableBtnState('BtnPopup', record);
            const setDownload = commonFunc.showMessage(props.app.commonConst, 'setPopup');/* 弹窗 */
            operatePopupModal = <a title={setDownload} {...choosePopupProps} onClick={enabled ? this.popupModalTbRow.bind(this, index, record) : null}>{enabled ? <SvgIcon iconClass="search" fill="#1296db" size="14" alt="弹窗"></SvgIcon> : <SvgIcon iconClass="search" fill="rgb(189, 189, 189)" size="14" alt="弹窗"></SvgIcon>}</a>;
          }

          if (this.isParamShow) {
            const setParam = commonUtils.isNotEmptyObject(commonFunc.showMessage(props.app.commonConst, 'setParam')) ? commonFunc.showMessage(props.app.commonConst, 'setParam') : '查看参数';/* 参数 */
            operateParamModal = <a title={setParam} {...chooseParamProps} onClick={this.paramModalTbRow.bind(this, index, record)}>{<img src={ParamIcon} alt="查看工艺参数" width="16px" height="16px" />}</a>;
          }

          if (exitIcon) {
            const setExit = '退出';
            operateExit = <a title={setExit} onClick={this.exitTbRow.bind(this, index, record)}>{<ExportOutlined style={{ color: '#8e1f13' }} />}</a>;
          }
          if (sAlumitePopup) {
            const setAlumitePopup = '电化铝';
            const enabled = this.getTableBtnState('BtnPopupsAlumiteBomBillNo', record);
            operatesAlumitePopup = <a title={setAlumitePopup} onClick={enabled ? this.popupModalTbRow.bind(this, index, record, 'BtnPopupsAlumiteBomBillNo') : null}>{enabled ? <img src={sAlumiteIcon} alt="电化铝" width="18px" height="18px" /> : <img src={DisAlumiteIcon} alt="电化铝" width="18px" height="18px" />}</a>;
          }

          return (<div
            style={{
              width: '100%', height: '100%', display: 'flex', justifyContent: !exitIcon ? 'right' : 'center',
            }}
            className="operate-bar"
          >{operateTreeAdd}{operateTreeAddChild}{operateTreeCopyAll}{operateTreeDel}{operateAdd}{operatesAlumitePopup}{operatePopupModal}{operateCopy}{operateCopyAll}{operateReplace}{operateCopyMore}{operateMaterial}{operateProductMaterials}{operateMaterailRemark}{operateDel}{operateProcess}{operateParamModal}{operateDownload}{operateProductProcess}{operateExit}
          </div>);
        },
        title: () => (this.props.setOpterationColumn === 'Y' && this.getTableFilterData() === 0 ? <span
          style={{
            width: '100%', height: '100%', display: 'flex', justifyContent: 'left', textDecoration: 'none',
          }}
        >{setOperation} {uploadIcon ? <Upload {...divProps} disabled={!this.props.enabled}>
          <a {...uploadProps}
            contenteditable="true"
            ref={(ref) => { this.uploadRef1 = ref; }}
            onPaste={this.handleUploadByClipboard}
            onMouseOver={() => {
              this.uploadRef1.setAttribute('contenteditable', "true");
            }}
            onKeyDown={() => {
              this.uploadRef1.setAttribute('contenteditable', "false");
            }}
            onKeyUp={() => {
              this.uploadRef1.setAttribute('contenteditable', "true");
            }}
          >
            {
              this.props.enabled ? <UploadOutlined /> : <UploadOutlined style={{ color: 'rgb(189, 189, 189)' }} />
            }
          </a>
        </Upload> : <span><a {...addProps} onClick={!this.props.bLimitOperate && (props.enabled || this.findIsUpdByControlName(this.props, 'BtnAdd')) ? this.addTbRowInHeader : null}>{!this.props.bLimitOperate && (props.enabled || this.findIsUpdByControlName(this.props, 'BtnAdd')) ? <SvgIcon iconClass="plus" fill="#1296db" size="14" alt="添加" offsetY="2"></SvgIcon> : <SvgIcon iconClass="plus" fill="rgb(189, 189, 189)" size="14" alt="添加" offsetY="2"></SvgIcon>}</a>
          {headPopup ? <a {...headProps} onClick={!this.props.bLimitOperate && (props.enabled || this.findIsUpdByControlName(this.props, 'BtnHeadPopup')) ? this.popupModalTbRow : null}>{!props.bLimitOperate && (props.enabled || this.findIsUpdByControlName(this.props, 'BtnHeadPopup')) ? <SvgIcon iconClass="plus" fill="#1296db" size="14" alt="添加" offsetY="2"></SvgIcon> : <SvgIcon iconClass="plus" fill="rgb(189, 189, 189)" size="14" alt="添加" offsetY="2"></SvgIcon>}</a> : ''}</span>}
        </span> :
          uploadIcon ? <span> <Upload {...divProps} disabled={!this.props.enabled}>
            <a {...uploadProps}
              contenteditable="true"
              ref={(ref) => { this.uploadRef1 = ref; }}
              onPaste={this.handleUploadByClipboard}
              onMouseOver={() => {
                this.uploadRef1.setAttribute('contenteditable', "true");
              }}
              onKeyDown={() => {
                this.uploadRef1.setAttribute('contenteditable', "false");
              }}
              onKeyUp={() => {
                this.uploadRef1.setAttribute('contenteditable', "true");
              }}
            >
              {
                this.props.enabled ? <UploadOutlined /> : <UploadOutlined style={{ color: 'rgb(189, 189, 189)' }} />
              }
            </a>
          </Upload></span> : <span> {setOperation}  {headPopup ? <a {...headProps} onClick={!this.props.bLimitOperate && (props.enabled || this.findIsUpdByControlName(this.props, 'BtnHeadPopup')) ? this.popupModalTbRow : null}>{!props.bLimitOperate && (props.enabled || this.findIsUpdByControlName(this.props, 'BtnHeadPopup')) ? <SvgIcon iconClass="plus" fill="#1296db" size="14" alt="添加" offsetY="2"></SvgIcon> : <SvgIcon iconClass="plus" fill="rgb(189, 189, 189)" size="14" alt="添加" offsetY="2"></SvgIcon>}</a> : ''} </span>),
        width: operateWidth + 'px',
        // fixed: commonUtils.isNotEmptyObject(this.props.tableProps.AutoTableHeight) ? 'right' : false,
        fixed: 'right',
      });
    } else {
      const tableAllWidth = tableWidth + lastRowOld + CheckBoxWidth;
      if (tableAllWidth < this.tableContentWidth) {
        const lastRow = this.tableContentWidth - tableWidth - CheckBoxWidth - 18;/* ant-table-body的div宽度-操作列宽度-选择列宽度36  */
        if (lastRow > 0 && tableColumn.length > 0 && lastRow > lastRowOld) {
          delete tableColumn[tableColumn.length - 1].width;
          // tableColumn[tableColumn.length - 1].width = lastRow;
        }
      }
    }
    /*   返回值 s  */
    return tableColumn;
  };

  getColumnSearchProps = (iIndex, column, type, props, search) => {
    const returnProps = {};
    if (props.onFilterData !== undefined && iIndex === 0 && type === 'filter' && !this.resize) {
      returnProps.onFilter = props.onFilterData.bind(this, props.name, column.dataIndex);
    } else if (column.dataIndex !== undefined && column.bFind && type === 'filter' && !this.resize) {
      if (!search) {
        return false;
      }
      returnProps.filterDropdown = ({
        setSelectedKeys, selectedKeys, confirm, clearFilters,
      }) => {
        return (
          <div style={{ padding: 8 }}>
            <Input
              // id="searchInput"
              ref={(node) => { this.searchInput = node; }}
              // onClick={this.handleInputOnClick.bind(this, 'searchInput')}
              placeholder={`Search ${column.title}`}
              value={selectedKeys[0]}
              onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
              onPressEnter={() => this.handleSearch(selectedKeys, confirm, column.dataIndex, clearFilters)}
              style={{ marginBottom: 8 }}
            />
            <Space>
              <Button
                type="primary"
                onClick={() => this.handleSearch(selectedKeys, confirm, column.dataIndex, clearFilters)}
                icon={<SearchOutlined />}
                size="small"
                style={{
                  width: 90,
                }}
              >
                搜索
              </Button>
              <Button
                onClick={() => this.handleReset(clearFilters, confirm)}
                size="small"
                style={{ width: 90 }}
              >
                重置
              </Button>
            </Space>
          </div>
        );
      };
      returnProps.filterIcon = filtered => <SearchOutlined style={{ color: filtered ? '#1890ff' : undefined }} />;
      returnProps.onFilterDropdownVisibleChange = (visible) => {
        if (visible) {
          setTimeout(() => this.searchInput.select());
        }
      };
      returnProps.onFilter = (value, record) => {
        let sValue = record[column.dataIndex];
        const dropdownData = commonUtils.getStoreDropDownData(props.formId, props.name, column.dataIndex);
        if (commonUtils.isNotEmptyArr(dropdownData)) {
          const sId = commonUtils.isEmpty(dropdownData[0].sSlaveId) ? 'sId' : 'sSlaveId';
          const iDropdownIndex = dropdownData.findIndex(item => item[sId] === record[column.dataIndex]);
          if (iDropdownIndex > -1) {
            const sFieldName = Object.keys(dropdownData[iDropdownIndex])[0];
            sValue = dropdownData[iDropdownIndex][sFieldName];
          }
        } else {
          const staticDropdownData = commonUtils.getStoreStaticDropDownData(props.formId, column.dataIndex);
          if (commonUtils.isNotEmptyObject(staticDropdownData)) {
            sValue = staticDropdownData[sValue];
          }
        }

        if (record[column.dataIndex] !== undefined && sValue !== undefined) {
          return sValue.toString().toLowerCase().includes(value.toLowerCase());
        } else {
          return ''.toString().toLowerCase().includes(value.toLowerCase());
        }
      };
      if (!props.enabled) {
        returnProps.render = (text, record, index) => {
          // 此处添加了row的index,原先一次渲染中包含searchProps的行的iIndex会相同，无法对行判断进行单元格合并
          let sValue = record[column.dataIndex];
          const dropdownData = commonUtils.getStoreDropDownData(props.formId, props.name, column.dataIndex);
          if (commonUtils.isNotEmptyArr(dropdownData)) {
            const sId = commonUtils.isEmpty(dropdownData[0].sSlaveId) ? 'sId' : 'sSlaveId';
            const iDropdownIndex = dropdownData.findIndex(item => item[sId] === record[column.dataIndex]);

            if (text !== undefined && iDropdownIndex > -1) {
              const sFieldName = Object.keys(dropdownData[iDropdownIndex])[0];
              sValue = dropdownData[iDropdownIndex][sFieldName];
            }
          }
          if (!commonUtils.isEmpty(this.state.searchText) && column.bFind && column.dataIndex === this.state.searchColumnName && column.dataIndex.substring(0, 1) !== 'b' && column.dataIndex.substring(0, 1) !== 't') {
            return (<Highlighter
              highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }}
              searchWords={[this.state.searchText]}
              autoEscape
              textToHighlight={commonUtils.isEmpty(sValue) ? '' : sValue.toString()}
            />);
          } else {
            return this.bindShowType(props, text, record, column.dataIndex, index);
          }
        };
      }
    }
    return returnProps;
  };

  /**   获取ShowType的props   */
  getShowTypeProps = (props, text, record, sName) => {
    const { enabled, sUseInfo, app, masterData } = props;
    /*   待用数据   */
    const showConfig = this.getShowConfig(props, sName); /*   配置信息    */
    if (commonUtils.isEmptyObject(showConfig)) {
      console.log('渲染失败：', showConfig, sName);
    }
    /*   返回值   */
    let enabledNew = (enabled && !showConfig.bReadonly && !record.bInvalid && commonUtils.isEmpty(sUseInfo));
    if (showConfig.iTag === 1) {
      enabledNew = false;
    } else if (showConfig.iTag === 3) {
      if (commonUtils.isNotEmptyObject(masterData) && !masterData.bCheck) {
        enabledNew = true;
      }
    } else if (record.rowTag === 1) { /* 当rowTag为1时，锁定该行不可编辑 */
      enabledNew = false;
    } else if (record.bInvLock) { /* 当bInvLock时，锁定该行不可编辑 */
      enabledNew = false;
    }
    /* 红冲中的单据 不可修改 */
    if (commonUtils.isNotEmptyObject(masterData) && ((commonUtils.isNotEmptyObject(masterData.sMinusSrcId)) || commonUtils.isNotEmptyObject(masterData.sMinusUsed))) {
      enabledNew = false;
      if (app?.currentPane?.copyTo?.name && app.currentPane.copyTo.name.toLowerCase().includes('portion')) {
        // 部分红冲中可修改的字段
        const iIndex = props.config.gdsconfigformslave.findIndex(item => item.sName === sName && item.sControlName.includes('portionField'));
        enabledNew = iIndex !== -1;
      }
    }

    enabledNew = this.getSelectRowEditState(sName, record, enabledNew);

    typeof props.otherlimitDisabled === 'function' && (enabledNew = props.otherlimitDisabled({ enabledNew, record, sName }));

    const showConfigAll = this.getColorConfig(); /* 拿到颜色配置json */
    const showConfigArr = commonUtils.isNotEmptyArr(showConfigAll) ? showConfigAll.filter(item => item.sName === sName) : []; /* 找到该字段颜色配置 */
    const colorConditon = commonUtils.isNotEmptyArr(showConfigArr) ? showConfigArr[0].sColorTerms : null;
    let styleColorArr = '';
    if (commonUtils.isNotEmptyObject((colorConditon))) {
      let colorConditionArr = '';
      try {
        colorConditionArr = JSON.parse(colorConditon); /* 转化为json */
      } catch (e) {
        colorConditionArr = '';
      }
      colorConditionArr = Array.isArray(colorConditionArr) ? colorConditionArr : '';
      for (const item of colorConditionArr) {
        let styleColor = '';
        const {
          column, condition, background, isRow,
        } = item;
        if (!isRow) { /* 根据配置设置单元格颜色 */
          let { conditionValue: conditionValueOld } = item;
          const conditionValue = record[conditionValueOld] ? record[conditionValueOld] : conditionValueOld;
          if (column === sName && !commonUtils.isEmpty(record[column])) {
            if (condition === '=') {
              styleColor = record[column] === conditionValue ? `SetCell_${background}` : '';
            } else if (condition === '!=') {
              styleColor = record[column] != conditionValue ? `SetCell_${background}` : '';
            } else if (condition === 'like') {
              if (sName.substring(0, 1) === 's') { styleColor = record[column]?.indexOf(conditionValue) > -1 ? `SetCell_${color}` : ''; }
            } else if (condition === '>') {
              styleColor = record[column] > conditionValue ? `SetCell_${background}` : '';
            } else if (condition === '>=') {
              styleColor = record[column] >= conditionValue ? `SetCell_${background}` : '';
            } else if (condition === '<') {
              styleColor = record[column] < conditionValue ? `SetCell_${background}` : '';
            } else if (condition === '<=') {
              styleColor = record[column] <= conditionValue ? `SetCell_${background}` : '';
            }
          }
        }
        styleColorArr += styleColor;
      }
    }
    return {
      app,
      record,
      name: props.name,
      configName: props.configName,
      sTabId: props.sTabId,
      sId: record.sId, /*   修改当前编号(数据格式:字符串)   */
      dataValue: text, /*   本showType数据(数据格式:对象)   */
      enabled: enabledNew, /*   是否是查看状态(数据格式:布尔)   */
      showConfig, /*   关于本showType相关配置(数据格式:对象)   */
      tableConfig: props.config, /*  表格的所有配置   */
      formId: this.formId, /*   窗体Id(数据格式:字符串)   */
      onChange: props.onDataChange, /*   表单数据改变事件方法(数据格式:函数)   */
      onKeyDown: (...args) => {
        props.onKeyDown && props.onKeyDown(...args, props.data);
      },
      onInputClick: props.onInputClick, /* 鼠标单击事件 */
      onContextMenu: props.onContextMenu, /* 字段右侧单击事件 */
      bTable: true, /*   是否为表格数据   */
      getSqlDropDownData: props.getSqlDropDownData,
      getSqlCondition: props.getSqlCondition,
      handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
      getFloatNum: props.getFloatNum,
      getDateFormat: props.getDateFormat,
      onViewClick: this.handleViewClick,
      onTabModalClick: this.handleTabModalClick,
      onRightArrow: this.handleRightArrow,
      onViewChoose: this.handleViewChoose,
      onPreviewImage: this.handlePreviewImage,
      onPreviewOffice: this.handlePreviewOffice,
      onDropdownVisibleChange: this.handleDropdownVisibleChange,
      onFilterDropDownData: props.onFilterDropDownData,
      onFieldPopupModal: this.handleFieldPopupModal, /* 字段选择弹窗 */
      onFieldDoubleClick: this.props.onFieldDoubleClick,
      onDropDownBlur: props.onDropDownBlur, /* 下拉框多选离开事件 */
      className: styleColorArr,
      readOnly: props.readOnly,
      onSaveState: props.onSaveState,
      formRoute: props.formRoute,
      customDropData: props.customDropData,
      onGetParamsValue: props.onGetParamsValue,
      onExecInstructSet: props.onExecInstructSet, // 调用指令集
      // handleSum: this.handleSum,
    };
  };
  /**   获取上传控件的props   */
  getUploadProps = () => {
    return {
      disabled: this.props.name === 'picFile' ? !this.findIsUpdByControlName(this.props, 'BtnUpload') : !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isUploadShow) }, /*   是否显示   */
    };
  };
  /**   获取下载控件的props   */
  getDownProps = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isDownloadShow) }, /*   是否显示   */
    };
  };
  /**   获取查看控件的props   */
  getLookProps = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isLookShow) }, /*   是否显示   */
      onClick: this.handleLookRow, /*   点击事件   */
    };
  };
  /**   获取添加控件的props   */
  getAddProps = () => {
    return {
      disabled: !this.props.enabled || this.findIsUpdByControlName(this.props, 'BtnAdd'), /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isAddShow) }, /*   是否显示   */
      onClick: this.handleAddRow, /*   点击事件   */
    };
  };
  getModalPropsTableRow = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isModalShow), margin: '0 10px' }, /*   是否显示   */
    };
  };
  getModalRemarkPropsTableRow = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isModalRemarkShow) }, /*   是否显示   */
    };
  };
  getChooseProcessPropsTableRow = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isChooseProcessShow), margin: '0 10px' }, /*   是否显示   */
    };
  };
  getChooseProductProcessPropsTableRow = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isChooseProductProcess), margin: '0 10px' }, /*   是否显示   */
    };
  };
  getChooseProductMaterialsPropsTableRow = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isChooseProductMaterials), margin: '0 10px' }, /*   是否显示   */
    };
  };
  getAddPropsTableRow = () => {
    return {
      disabled: !this.props.enabled || !this.findIsUpdByControlName(this.props, 'BtnAdd'), /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isAddShow), margin: '0 10px' }, /*   是否显示   */
    };
  };

  getHeadPropsTableRow = () => {
    return {
      disabled: false, /*   是否可用   */
      style: { margin: '0 0' }, /*   是否显示   */
    };
  };


  /**   获取复制控件的props   */
  getCopyProps = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isCopyShow), margin: '0 10px' }, /*   是否显示   */
      onClick: this.handleCopyRow, /*   点击事件   */
    };
  };

  /**   获取复制全部控件的props   */
  getCopyAllProps = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isCopyAllShow), margin: '0 10px' }, /*   是否显示   */
      onClick: this.handleCopyAllRow, /*   点击事件   */
    };
  };
  /**   获取删除控件的props   */
  getDelProps = () => {
    return {
      disabled: !this.props.enabled || this.findIsUpdByControlName(this.props, 'BtnDel'), /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isDelShow) }, /*   是否显示   */
      className: styles.del, /*   样式名   */
      onClick: this.handleDelRow, /*   点击事件   */
    };
  };

  getDelPropsTableRow = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isDelShow), margin: '0 10px' }, /*   是否显示   */
      className: styles.del, /*   样式名   */
    };
  };
  getCopyMorePropsTableRow = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isCopyMoreShow), margin: '0 10px' }, /*   是否显示   */
      className: styles.del, /*   样式名   */
    };
  };
  getPopupPropsTableRow = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      style: { display: commonUtils.convertBooleanToDisplayBlock(this.isPopupShow), margin: '0 10px' }, /*   是否显示   */
    };
  };

  getParamPropsTableRow = () => {
    return {
      disabled: !this.props.enabled, /*   是否可用   */
      // style: { display: commonUtils.convertBooleanToDisplayBlock(this.isParamShow), margin: '0 10px' }, /*   是否显示   */
      style: { display: 'block', margin: '0 10px' }, /*   是否显示   */
    };
  };
  /**   生成单元格stateMap  */
  genMergeCellStateMap() {
    let config = [];
    if (this.props.customConfig) {
      config = this.props.customConfig;
    } else {
      if (this.props.config) {
        config = this.props.config.gdsconfigformslave
      }
    }
    this.mergeCellStateMap = config.length && config.reduce((prev, cur) => {
      if (cur.sName) {
        prev[cur.sName] = cur.bMergeCell;
        if (cur.bMergeCell) {
          this.mergeCellList.push(cur.sName);
        }
      }
      return { ...prev };
    }, {});
  }
  genMergeInfoCellStateMap() {
    this.mergeInfoCellStateMap = this.props.slaveInfo.config && this.props.slaveInfo.config.gdsconfigformslave.reduce((prev, cur) => {
      if (cur.sName) {
        prev[cur.sName] = cur.bMergeCell;
      }
      return { ...prev };
    }, {});
  }
  /**   生成单元格list记录Map  */
  genMergeListStateMap() {

    let bPagination = true; /* 默认表格分页s  */
    let pagination = {};
    if (commonUtils.isNotEmptyObject(this.props)) {
      bPagination = (commonUtils.isNotEmptyObject(this.props.tableProps) && commonUtils.isNotEmptyObject(this.props.tableProps.pagination));
      pagination = this.props.tableProps.pagination;
    }

    let data;
    if (commonUtils.isNotEmptyArr(this.tableFilterData)) {
      const sSlaveIdArr = this.tableFilterData.map(item => item.sSlaveId);
      data = this.props.data.filter(item => sSlaveIdArr.includes(item.sSlaveId));
    } else if (bPagination) {
      const { pageSize, current } = commonUtils.isNotEmptyObject(this.curPagination) ? this.curPagination : pagination;
      this.curPagination = {};
      // 如果数据条数大于每页条数，说明是假分页，要截取当前页数据
      if (this.props.data && pageSize && this.props.data.length > pageSize) {
        const maxCurrent = Math.ceil(this.props.data.length / pageSize);
        const newCurrent = Math.min(maxCurrent, current);
        const startIndex = (newCurrent - 1) * pageSize;
        const endIndex = startIndex + pageSize;
        data = this.props.data.slice(startIndex, endIndex);
      } else {
        data = this.props.data;
      }
    } else {
      data = this.props.data;
    }

    if (!data) {
      return;
    }
    /* 如果是树形 则返回 */
    if (this.props.sTableType && this.props.sTableType != 'zero') {
      return;
    }
    const obj = {};
    let sColorIndex = 1;
    let config = [];
    if (this.props.customConfig) {
      config = this.props.customConfig;
    } else {
      if (this.props.config) {
        config = this.props.config.gdsconfigformslave;
      }
    }
    data.forEach((item, index) => {
      const mergeCellData = config.filter(item => item.sName === 'sMergeCellFiled'); /* 查找合并单元格的基准字段 */
      const sMergeCellFiled = commonUtils.isNotEmptyArr(mergeCellData) ? mergeCellData[0].sActiveKey : ''; /* 基准字段 */
      if (index === 0 && commonUtils.isNotEmptyArr(this.mergeCellList)) {
        item.sColor = '';
      }
      // 第一条数据不需要检测
      if (index !== 0) {
        const prevData = data[index - 1];
        let flag = false;
        for (const key in item) {
          // 判断是否与上一个值相同
          if (item[key] !== '' && item[key] === prevData[key] && (commonUtils.isNotEmptyObject(sMergeCellFiled) ? item[sMergeCellFiled] === prevData[sMergeCellFiled] : true)) {
            if (!obj[key]) {
              obj[key] = [];
            }
            obj[key].push(index - 1);
            if (this.mergeCellList.includes(key)) {
              flag = true;
            }
          }
        }
        if (commonUtils.isNotEmptyArr(this.mergeCellList)) {
          if (flag) {
            item.sColor = sColorIndex % 2 === 0 ? 'dark-record-row' : '';
          } else {
            sColorIndex++;
            item.sColor = sColorIndex % 2 === 0 ? 'dark-record-row' : '';
          }
        }
      }
    });
    for (const key in obj) {
      obj[key] = obj[key].reduce((prev, cur) => {
        if (prev.length && (cur - prev[0][0]) === 1) {
          prev[0].unshift(cur);
        } else {
          prev.unshift([cur]);
        }
        return prev;
      }, []).reverse().map(a => a.reverse());
    }
    this.mergeCellListMap = obj;
  }

  genMergeInfoListStateMap() {
    if (!this.curSlaveInfoData) {
      return;
    }
    const obj = {};
    this.curSlaveInfoData.forEach((item, index) => {
      const mergeCellData = this.props.slaveInfo.config && this.props.slaveInfo.config.gdsconfigformslave.filter(item => item.sName === 'sMergeCellFiled'); /* 查找合并单元格的基准字段 */
      const sMergeCellFiled = commonUtils.isNotEmptyArr(mergeCellData) ? mergeCellData[0].sActiveKey : ''; /* 基准字段 */
      // 第一条数据不需要检测
      if (index !== 0) {
        const prevData = this.curSlaveInfoData[index - 1];
        for (const key in item) {
          // 判断是否与上一个值相同
          if (item[key] !== '' && item[key] === prevData[key] && (commonUtils.isNotEmptyObject(sMergeCellFiled) ? item[sMergeCellFiled] === prevData[sMergeCellFiled] : true)) {
            if (!obj[key]) {
              obj[key] = [];
            }
            obj[key].push(index - 1);
          }
        }
      }
    });
    for (const key in obj) {
      obj[key] = obj[key].reduce((prev, cur) => {
        if (prev.length && (cur - prev[0][0]) === 1) {
          prev[0].unshift(cur);
        } else {
          prev.unshift([cur]);
        }
        return prev;
      }, []).reverse().map(a => a.reverse());
    }
    this.mergeInfoCellListMap = obj;
  }

  modalTbRow = (record, tableName) => {
    this.handleModalRow(record, tableName);
  };
  modalRemarkTbRow = async (record) => {
    await this.onRowClick(record);
    this.handleModalRemarkRow(record);
  };
  chooseProcessTbRow = (record) => {
    this.handleChooseProcessRow(record);
  };

  /* 选择成品工序 */
  chooseProductProcessModalTbRow = (index, record) => {
    this.handleChooseProductProcessRow(index, record);
  };

  /* 选择成品材料 */
  chooseProductMaterialsModalTbRow = (index, record) => {
    this.handleChooseProductMaterialsRow(index, record);
  };

  addTbRow = (index) => {
    this.handleAddRow(index);
  };

  addTbRowInHeader = (index) => {
    this.handleAddRow(index, this.props.bModalAdd);
  };

  delTbRow = (index, record) => {
    this.handleDelRow(index, record);
  };
  copyTbMoreRow = (index, record) => {
    this.handleCopyMoreRow(index, record);
  };
  replaceTbRow = (index, record) => {
    this.handleReplaceRow(index, record);
  };
  /* 被占用的表格行不能删除 */
  handleTbRowUsed = (index, record) => {
    const { rowTag, sWorkorderNo } = record;
    const { enabled } = this.props;
    if (enabled && rowTag === 1) {
      const warning = commonFunc.showMessage(this.props.app.commonConst, 'beUsed');/* 复制部件 */
      const { sModelsType } = this.props.app.currentPane;
      if (sModelsType.includes('sales/')) {
        message.error(warning + sWorkorderNo);
      }
    } else {
      return null;
    }
  };
  handleSelectCancel = (modelVisible) => {
    this.setState({
      [modelVisible]: false,
    });
  };
  handleSelectCommonPopup = (name, selectConfig, selectData) => {
    const { commonPopupTbName, commonPopupShowConfig, commonFieldPopupVisible, commonPopupVisible, commonFieldPopupTbName, commonFieldPopupShowConfig,
      commonModalVisible, commonModalShowConfig, commonModalTbName } = this.state;
    /* 若是产品名称弹窗 并且配置了调用产品工艺卡标识copyFromTechnology 则走自己的逻辑 */
    if (selectConfig.sCompareColor === 'copyFromTechnology') {
      this.props.onSelectCommonPopupProduct(name, selectConfig, selectData, commonPopupTbName, commonPopupShowConfig);
    } else {
      let tb = commonPopupVisible ? { name: commonPopupTbName, config: commonPopupShowConfig } : commonFieldPopupVisible ? { name: commonFieldPopupTbName, config: commonFieldPopupShowConfig } : undefined;
      tb = commonModalVisible ? { name: commonModalTbName, config: commonModalShowConfig } : tb;
      if (selectConfig.sControlName?.startsWith('BtnPopupEdit')) {
        this.props.onSelectCommonPopup(name, selectConfig, selectData, tb?.name, tb?.config, { index: this.rowClickRef.current });
        return;
      }
      this.props.onSelectCommonPopup(name, selectConfig, selectData, tb?.name, commonPopupShowConfig);
    }
  };

  handleSelectCommonFieldPopup = (name, selectConfig, selectData) => {
    const { commonFieldPopupTbName, commonFieldPopupShowConfig } = this.state;
    this.props.onSelectCommonPopup(name, selectConfig, selectData, commonFieldPopupTbName, commonFieldPopupShowConfig);
  };

  copyTbRow = (index) => {
    this.handleCopyRow(index);
  };
  copyAllTbRow = (index) => {
    this.handleCopyAllRow(index);
  };
  downloadTbRow = (index, record) => {
    this.handleDownloadRow(index, record);
  };
  popupModalTbRow = (index, record, btnName) => {
    setTimeout(() => {
      this.handlePopupRow(index, record, btnName);
    }, 0);
  };

  paramModalTbRow = (index, record) => {
    this.handleParamRow(index, record);
  };

  exitTbRow = (index, record) => {
    this.props.onExitTbRow(index, record);
  }
  handleViewClick = (name, sName, record, index, showConfig, configName) => {
    // console.log('vvvs', showConfig);
    if (commonUtils.isNotEmptyObject(showConfig) && commonUtils.isNotEmptyObject(record)) {
      const printPdf = showConfig.sControlName; /* 工单号配置调到打印界面，跳转打印页面 */
      const sActiveKey = showConfig.sActiveKey;/* 弹出界面对应数据主字段 */
      if (commonUtils.isNotEmptyObject(printPdf) && printPdf === 'printPdf' && commonUtils.isNotEmptyObject(sActiveKey)) {
        const token = this.props.app.token;
        const sActiveId = showConfig.sActiveId === '1' ? commonUtils.isEmpty(record.sFormId) ? record.sSrcFormId : record.sFormId : showConfig.sActiveId;
        const printsId = record[sActiveKey];
        const urlPrint = `${commonConfig.file_host}printReport/printPdfByFromDataId/${printsId}.pdf?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent(token)}`;
        window.open(urlPrint);
      } else if (showConfig.sActiveId === "172129113112117442504826460") { // 生成拼板
        if (record.bMakeUpEnd) {
          this.props.onSaveState({
            makeUpPDFRecord: record,
          });
        } else {
          message.info("请先完成拼版！");
        }
      } else if (showConfig.sDropDownType && showConfig.sDropDownType.toLowerCase().includes('picarrmodal')) { /* 蓝色链接跳转用Modal呈现 */
        // this.props.onTabModalClick(name, sName, record, index, showConfig, configName);
        this.handleTabModalClick(name, sName, record, index, showConfig, configName);
        return;
      } else {
        if (this.handleHideModal()) {
          this.props.onViewClick(name, sName, { ...record, bLinkFieledClick: true }, index, showConfig, configName);
        }
      }
    } else {
      if (this.handleHideModal()) {
        this.props.onViewClick(name, sName, record, index, showConfig, configName);
      }
    }
  };

  handleHideModal = () => {
    let antModalRootEl = null;
    const bInModal = (el) => {
      if (commonUtils.isEmpty(el) || commonUtils.isEmpty(el.classList)) {
        return false;
      } else if (el.classList.contains('ant-modal-root')) {
        antModalRootEl = el;
        return true;
      } else {
        return bInModal(el.parentNode);
      }
    }
    if (bInModal(event.target)) { // 如果是在modal里的表格，不允许跳转
      const activeTab = document.querySelector('#navTabWrap .ant-tabs-nav-list>div[class*="ant-tabs-tab-active"]');
      if (activeTab) {
        const modalId = activeTab.getAttribute('data-node-key')
        antModalRootEl.style.display = 'none';
        antModalRootEl.setAttribute('data-attr-modalId', 'modalId_' + modalId);
      } else {
        return false;
      }
    }
    return true;
  }

  /* 快捷键跳转 */
  handleQuickViewClick = async (name, sName, record, index, myConfigArr) => {
    const {
      slaveConfig,
      slaveData,
      dispatch,
      slaveFilterCondition,
      slavePagination,
      slaveOrderBy,
      sModelsType,
      formRoute,
      treeFilterCondition,
      app,
      iPageSize,
      sModelsId,
      // slaveSelectedData,
      // masterData,
      // employeeConfig,
    } = this.props;
    let picArr = ''
    if (commonUtils.isNotEmptyArr(slaveConfig)) {
      picArr = slaveConfig.gdsconfigformslave.filter(item => (item.sName === sName));
    }
    if (commonUtils.isNotEmptyArr(myConfigArr)) {
      picArr = myConfigArr;
    }
    if (picArr.length > 0) {
      const getConfig = this.handleGetTableConfig;
      const tableDataRow = record;
      const iIndex = index;
      const [{ sActiveId }] = picArr;
      let [{ sActiveKey }] = picArr;
      const sFormId = sActiveId === '1' ? commonUtils.isEmpty(tableDataRow.sFormId) ? tableDataRow.sSrcFormId : tableDataRow.sFormId : sActiveId;
      if (commonUtils.isNotEmptyObject(sActiveKey) && sActiveKey.includes('.')) { /* 接口按钮跳转 如果有slave.对应字段 则需要取出对应字段 */
        const index = sActiveKey.lastIndexOf('.');
        sActiveKey = sActiveKey.substring(index + 1, sActiveKey.length);
      }
      const sNameUrl = `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sFormId}?sModelsId=${sFormId}&sName=${formRoute}`;
      const filterCondition = [];
      const conditionValues = this.props.getSqlCondition(picArr[0], name, tableDataRow);
      if (!commonUtils.isEmpty(conditionValues)) {
        Object.keys(conditionValues).forEach((item) => {
          if ((item === 'tStartDate_pro' || item.substring(0, 1) === 'p')) {
            if (!commonUtils.isEmpty(conditionValues[item]) && conditionValues[item].length >= 2) {
              const tStartDate = moment(conditionValues[item][0]).format(this.sDateFormat);
              const tEndDate = moment(conditionValues[item][1]).add(1, 'days').format(this.sDateFormat);
              filterCondition.push({
                bFilterName: item,
                bFilterCondition: '=',
                bFilterValue: `${tStartDate},${tEndDate}`,
              });
            }
          } else if ((item === 'mStartDate_pro' || item.substring(0, 1) === 'm')) {
            if (!commonUtils.isEmpty(conditionValues[item])) {
              const tStartDate = moment(conditionValues[item]).startOf('month').format(this.sDateFormat);
              const tEndDate = moment(conditionValues[item]).endOf('month').add(1, 'days').format(this.sDateFormat);
              filterCondition.push({
                bFilterName: `t${item.substring(1, item.length)}`,
                bFilterCondition: '=',
                bFilterValue: `${tStartDate},${tEndDate}`,
              });
            }
          } else if (item.substring(0, 1) === 't') {
            filterCondition.push({
              bFilterName: item,
              bFilterCondition: '=',
              bFilterValue: moment(conditionValues[item]).format(this.sDateFormat),
            });
          } else {
            filterCondition.push({
              bFilterName: item,
              bFilterCondition: '=',
              bFilterValue: conditionValues[item],
            });
          }
        });
      }
      this.props.dispatch({
        type: 'content/onRouter',
        payload: {
          url: sNameUrl,
          refresh: getConfig.bind(this, name, sModelsId), /*   刷新方法   */
          sTabId: commonUtils.createSid(),
          // sParentId: this.state.sTabId,
          urlDataType: 'newPane',
          checkedId: myConfigArr[0].sId,
          sName: myConfigArr[0].sName,
          bFilter: slaveFilterCondition,
          pageSize: commonConfig.pageSize,
          pages: slavePagination,
          currentData: slaveData,
          conditonValues: conditionValues,
          newKey: tableDataRow[sActiveKey],
          currentIndex: iIndex,
          filterCondition,
        },
      });
    }
  };

  /* 文件下载 */
  handleFileDownload = (fileUrl) => {
    const fileList = fileUrl.split(',');
    fileList.forEach(item => {
      let fileName = item.substring(item.lastIndexOf('/') + 1);
      fileName = fileName.substring(fileName.indexOf('_') + 1);
      const filepath = `${commonConfig.file_host}file/download?savePathStr=${encodeURIComponent(item)}&sModelsId=100&token=${encodeURIComponent(this.props.app.token)}`;
      const xhr = new XMLHttpRequest();
      xhr.open('get', filepath);
      xhr.responseType = 'blob';
      xhr.send();
      xhr.onload = function () {
        if (this.status === 200 || this.status === 304) {
          // 如果是IE10及以上，不支持download属性，采用msSaveOrOpenBlob方法，但是IE10以下也不支持msSaveOrOpenBlob
          if ('msSaveOrOpenBlob' in navigator) {
            navigator.msSaveOrOpenBlob(this.response, fileName);
            return;
          }
          const url = URL.createObjectURL(this.response);
          const a = document.createElement('a');
          a.style.display = 'none';
          a.href = url;
          a.download = fileName;
          document.body.appendChild(a);
          a.click();
          document.body.removeChild(a);
          URL.revokeObjectURL(url);
        }
      };
    })
  };

  /* 所有备注非编辑状态下点击链接可以弹出备注窗体 */
  handleMemoShow = (name, sName, record, index, showConfig) => {
    if (commonUtils.isNotEmptyObject(record)) {
      const sMemo = showConfig.sName;
      const title = showConfig.showName;
      if (sName.includes(['sTemplateFullMemo', 'sContentMemo'])) {
        return this.setState({ simpleModalVisible: true, simpleModalWord: record[sName] });
      }
      const sCurrMemoProps = {
        title,
        name,
        sValue: record[sName],
        sMemoField: sMemo,
        bVisibleMemo: true,
        sRecord: record,
        sMemoConfig: showConfig,
        bOnlyShow: true,
      };
      this.props.onSaveState({ sCurrMemoProps });
    }
  }
  handleViewChoose = (name, sName, record, index) => {
    this.props.onViewChoose(name, sName, record, index);
  }
  /* 弹出通用窗体 */
  handlePopupModal = (showConfig, name) => {
    this.setState({
      commonPopupVisible: true,
      commonPopupTbName: name,
      commonPopupShowConfig: showConfig,
    });
  }

  /* 字段弹窗 */
  handleFieldPopupModal = (showConfig, name, record) => {
    this.setState({
      commonFieldPopupVisible: true,
      commonFieldPopupTbName: name,
      commonFieldPopupShowConfig: showConfig,
      commonFieldPopupShowRecord: record,
    });
  }

  /* 蓝色链接弹出通用窗体 */
  handleTabModalClick = (name, sName, record, index, showConfig, configName) => {
    // const { sourceAllData:data } = this.props;
    // let commonModalData = [];
    // if(sName === 'dSumCompleteAvailableStockQty' &&  commonUtils.isNotEmptyArr(data)) {
    //   commonModalData = data.filter(item => item.sInkBOMsSlaveId === record.sInkBOMsSlaveId &&
    //     commonUtils.isNotEmptyObject(item.sInkBOMsMaterialsChildId) &&
    //     item.bSecondMainMaterials);
    // }
    this.setState({
      commonModalVisible: true,
      commonModalTbName: name,
      commonModalShowConfig: showConfig,
      commonModalRecord: record,
      commonModalConfigName: configName,
      // commonModalData,
    });
  }

  handleCellClick = (record) => {
    try {
      const { target } = event;

      const { tagName } = target;
      const oDiv = {
        'span': target.getAttribute('data-name') ? target : target.parentNode,
        'td': target?.childNodes[0]?.childNodes[0],
        'div': target.getAttribute('data-name') ? target : target.childNodes[0],
        'input': target,
      }[tagName.toLowerCase()];

      if (!oDiv || window.getSelection().toString()) return false;

      const [sName, sControlName] = [oDiv.getAttribute('data-name'), oDiv.getAttribute('data-control-name')];
      if (sControlName?.includes('_Sum')) {
        const { sumGroup = {}, totalData = [{}], totalDataNew: totalDataNew0 = [{}] } = this.state;
        const { dNetMoney, dNetPrice } = this.props.app.decimals;
        sumGroup[sName] = sumGroup[sName] || [];
        if (sumGroup[sName].includes(record[this.rowKey])) {
          sumGroup[sName] = sumGroup[sName].filter(item => item !== record[this.rowKey]);
        } else {
          sumGroup[sName].push(record[this.rowKey]);
        }

        let totalDataNew = [...totalDataNew0];
        if (sumGroup[sName].length) {
          const sum = sumGroup[sName].reduce((pre, cur) => {
            const curData = this.props.data.find(item => item[this.rowKey] === cur);
            if (curData) {
              let tempValue = 0;
              if (sName.toLowerCase().endsWith('price')) { /*   价格   */
                tempValue = commonUtils.convertFixNum(commonUtils.convertFixNum(commonUtils.isNull(curData[sName], 0), dNetPrice) + commonUtils.convertFixNum(commonUtils.isNull(pre, 0), dNetPrice), dNetPrice);
              } else { /*   金额   */
                tempValue = commonUtils.convertFixNum(commonUtils.convertFixNum(commonUtils.isNull(curData[sName], 0), dNetMoney) + commonUtils.convertFixNum(commonUtils.isNull(pre, 0), dNetMoney), dNetMoney);
              }
              return tempValue;
            }
            return pre;
          }, 0);

          totalDataNew = [{ ...totalData[0], ...totalDataNew[0], [sName]: sum }];
        } else {
          totalDataNew[0][sName] = totalData[0][sName];
        }

        this.setState({ sumGroup, totalDataNew });
        return !this.props.enabled;
      }
      return false;
    } catch (error) {
      return false;
    }
  }

  handleGetSumStyle = (sName, record) => {
    const { sumGroup = {} } = this.state;
    const sumList = sumGroup[sName] || [];
    return sumList.includes(record?.[this.rowKey]) ? " tableSumColor" : "";
  }

  /* 点击图片预览 */
  handlePreviewImage = (e, dataUrlArr) => {
    e.stopPropagation();  /* 阻止父级穿透 */
    if (commonUtils.isNotEmptyObject(dataUrlArr)) {
      const { token } = this.props.app;
      const previewImageArr = [];
      dataUrlArr.forEach((item = '') => {
        const dataPreviewUrl = item.includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${item}&sModelsId=100&token=${token}` : item; /* 预览 */
        previewImageArr.push(dataPreviewUrl);
      });
      this.setState({
        previewImage: previewImageArr,
        previewVisible: true,
        showimgs: true,
        firstIndex: 0,
      });
    }
  };

  // office文件预览
  handlePreviewOffice = (dataUrlArr) => {
    this.setState({
      officePreviewVisible: true,
      officeFileUrl: dataUrlArr
    });
  };

  handleDropdownVisibleChange = (open) => {
    // this.beSelectDropdownOpen = open;
  };
  /* 生产排程工艺流程字段弹窗 - 生产进度详情 */
  handlesPartNameStatus = (sName, sWorkOrderId) => {
    if (commonUtils.isNotEmptyObject(sName) && commonUtils.isNotEmptyObject(sWorkOrderId)) {
      const filterData = this.props.config.gdsconfigformslave.filter(item => item.sName === sName);
      const showConfig = commonUtils.isNotEmptyArr(filterData) ? filterData[0] : [];
      const record = {};
      record.sWorkOrderId = sWorkOrderId;
      this.props.onPartNameClick(sName, showConfig, record);
    }
  };

  /* 打开新窗口查看SQL编辑器 */
  handleOpenWin = (name, sName, record, index, showConfig) => {
    const sBtnName = sName;
    const sBtnContent = record[sName];
    const sFormId = commonUtils.isNotEmptyObject(record.sId) ? record.sId : '';
    const sBtnControlName = commonUtils.isNotEmptyObject(showConfig.sControlName) ? showConfig.sControlName : '';
    console.log('sFormId:', sFormId);
    if (commonUtils.isNotEmptyObject(sBtnContent)) {
      const urlPrint = `${commonConfig.server_host}template/getSql/${sBtnName}/?sBtnContent=${sBtnContent}&sBtnControlName=${sBtnControlName}&sFormId=${sFormId}`;
      const w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
      const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
      //const newWin = window.open('','_blank');
      const features = "width=" + (w + 350) + ",height=" + (h + 300) + ", top=0, left=0, toolbar=no, menubar=no,scrollbars=no,resizable=no, location =no, status=no";
      const newWin = window.open("", "SQL查看器", features);
      newWin.document.write('<body scroll="no" style="margin: 0px;padding: 0px;border:0px;overflow:hidden;"><iframe style="margin: 0px;padding: 0px;border: 0px;width:100%;height:100%" src="' + urlPrint + '"></iframe></body>');
      // window.open(urlPrint);
    } else {
      message.error('未找到对应过程名');
    }
  };

  /* 右箭头点击 */
  handleRightArrow = (name, sName, record, index, showConfig) => {
    if (this.props.onRightArrow) {
      this.props.onRightArrow(name, sName, record, index, showConfig);
    }

  }

  /* 确定按钮：复制多行 */
  handleOperateMoreOk = () => {
    const sNumber = document.getElementById('iNumber').value;
    console.log('sNumber', sNumber);
    if (commonUtils.isNotEmptyObject(iNumber) && Number(sNumber) > 0) {
      const iNumber = Number(sNumber);
      for (let i = 0; i < iNumber; i++) {
        this.handleCopyRow(0);
      }
    }
    this.setState({ bOperateMoreVisible: false })
  }


  showimg = (i) => {
    this.setState({ showimgs: true, firstIndex: i });
  };
  toggleshow = () => {
    this.setState({ showimgs: false, previewVisible: false });
  };
  handleOk = () => {
    this.props.onSaveState({
      previewVisible: false,
    });
  };
  handleCancelModal = (modelVisible) => {
    this.props.onSaveState({
      [modelVisible]: false,
    });
  };

  /**   调整列宽   */
  handleResize = (index, column, isSlaveInfo) => {
    return (e, { size }) => {
      if (e) {
        this.resize = true;
      }
      if (size.width === column.width) {
        return;
      }
      this.setState(({ tableColumn, tableInfoColumn }) => {
        let nextColumns;
        if (isSlaveInfo) {
          nextColumns = [...tableInfoColumn];
        } else {
          nextColumns = [...tableColumn];
        }

        let iIndexList = [];
        let iWidth = 0;
        let offset = 0;
        const iIndex = nextColumns.findIndex(item => item.dataIndex === column.dataIndex);
        if (iIndex !== -1) { // 单层表头
          iIndexList = [iIndex, -1];
          iWidth = nextColumns[iIndex].width === undefined ? this.countOperate() : nextColumns[iIndex].width;
          offset = size.width - iWidth;
          nextColumns[iIndex].width = size.width;
        } else { // 双层表头
          for (let i = 0; i < nextColumns.length; i++) {
            const item = nextColumns[i];
            const { children } = item;
            if (commonUtils.isNotEmptyArr(children)) {
              const childIndex = children.findIndex(child => child.dataIndex === column.dataIndex);
              if (childIndex !== -1) {
                iIndexList = [i, childIndex];
                iWidth = nextColumns[i].children[childIndex].width === undefined ? this.countOperate() : nextColumns[i].children[childIndex].width;
                offset = size.width - iWidth;
                // const iWidthTemp = nextColumns[i].width === undefined ? this.countOperate() : nextColumns[i].width;
                // nextColumns[i].width = iWidthTemp + offset;
                nextColumns[i].children[childIndex].width = size.width;
                break;
              }
            }
          }
        }

        if (commonUtils.isNotEmptyArr(iIndexList)) {
          let lastIndexList = [];
          let lastIndex = nextColumns.findIndex(item => item.dataIndex === 'tableLastEmpty') - 1;
          if (lastIndex < -1) {
            lastIndexList = [nextColumns.length - 1, -1];
          } else if (commonUtils.isNotEmptyArr(nextColumns[lastIndex].children)) {
            lastIndexList = [lastIndex, nextColumns[lastIndex].children.length - 1];
          } else {
            lastIndexList = [lastIndex, -1];
          }
          const oBody = this.mydiv.querySelector('.ant-table-body');
          const { scrollWidth, clientWidth, scrollLeft } = oBody;
          const scrollRight = scrollWidth - clientWidth - scrollLeft;

          // 判断当前拖动列是否在最后一列前面
          if (iIndexList[0] < lastIndexList[0] || (iIndexList[0] === lastIndexList[0] && iIndexList[1] < lastIndexList[1])) {
            const lastColumn = lastIndexList[1] === -1 ? nextColumns[lastIndexList[0]] : nextColumns[lastIndexList[0]].children[lastIndexList[1]];
            const iWidthExtra = lastColumn.widthExtra || 0; // 最后一列额外的宽度
            if (offset > 0) { // 向右拉伸
              if (iWidthExtra) { //有额外宽度
                if (iWidthExtra >= offset) {
                  lastColumn.width -= offset;
                  lastColumn.widthExtra -= offset;
                  offset = 0;
                } else {
                  const diffWidth = offset - iWidthExtra;
                  lastColumn.width -= iWidthExtra;
                  lastColumn.widthExtra = 0;
                  offset = diffWidth;
                }
              } else if (!iWidthExtra && lastColumn.width - offset > 150) { // 没有额外宽度，但是减去位移后宽度大于150
                lastColumn.width -= offset;
                offset = 0;
              }
            } else if (offset < 0) { // 向左拉伸
              if (scrollRight < -offset) { // 滚动条距离表格右边距离小于拉伸距离
                const diffWidth = -offset - scrollRight;
                lastColumn.width += diffWidth;
                lastColumn.widthExtra ? (lastColumn.widthExtra += diffWidth) : (lastColumn.widthExtra = diffWidth);
                offset = -diffWidth;
              }
            }

            // 处理拖动幅度太大时，空白列会显示问题
            const oCol = this.mydiv.querySelector('colgroup');
            const oCols = oCol ? oCol.childNodes : [];
            const oColsWithList = Array.from(oCols).filter(item => !item.className).map(item => parseInt(item.style.width));
            if (!oColsWithList.includes(0)) {
              lastColumn.width += oColsWithList[lastIndex + 1];
            }
          }
        }

        if (isSlaveInfo) {
          if (this.scrollInfoX) {
            this.scrollInfoX += offset;
          } else {
            this.scrollInfoX = 0;
            this.scrollInfoX = this.countScrollX(nextColumns, true);
          }
          return { tableInfoColumn: nextColumns };
        } else {
          if (this.scrollX) {
            this.scrollX += offset;
          } else {
            this.scrollX = 0;
            this.scrollX = this.countScrollX(nextColumns);
          }
          return { tableColumn: nextColumns };
        }
      }, () => {
        this.resize = false;
        this.initColumn = null;
        if (isSlaveInfo) {
          sessionStorage.setItem(`${this.props.formId}_${this.props.config.sId}_info`, JSON.stringify(this.state.tableInfoColumn));
        } else {
          sessionStorage.setItem(`${this.props.formId}_${this.props.config.sId}`, JSON.stringify(this.state.tableColumn));
        }
      });
    };
  }

  genFooter = () => {
    const { tableColumn, totalData: totalData0, totalDataNew, sumGroup = {}, totalData1 } = this.state;
    const totalData = Object.keys(sumGroup).some(key => sumGroup[key]?.length) ? totalDataNew : totalData0;
    const { dNetMoney, dNetPrice } = this.props.app.decimals;
    const sModelsType = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? this.props.app.currentPane.sModelsType : '';
    const sumset = commonFunc.showMessage(this.props.app.commonConst, 'sumSet') || '合计';

    let colSpan = 0;
    if ((!totalData.length && !totalData1.length) || this.props.footer !== undefined) {
      return (<></>);
    }
    if (this.props.tableProps.rowSelection !== null && !(this.props.config && !this.props.config.bisMutiSelect)) {
      colSpan = colSpan + 1;
    }
    if (this.props.slaveInfo) {
      colSpan = colSpan + 1;
    }
    if (this.props.dragHandle) {
      // colSpan = colSpan + 1; // 临时处理标准精准报价单据工序信息表合计错位问题
    }
    const cells = [];
    const cells1 = [];
    if (totalData.length) {
      let summaryCellTotal = '';
      summaryCellTotal = (
        <Table.Summary.Cell key={0} colSpan={colSpan ? colSpan : 1} index={0}>
          <span className={styles.summaryCellTotal}>{sumset}</span>
        </Table.Summary.Cell>
      );
      // if(this.props.slaveInfo) {
      //   summaryCellTotal = (
      //     <Table.Summary.Cell key={0} colSpan={2} index={0} >
      //       <span className={styles.summaryCellTotal}>合计</span>
      //     </Table.Summary.Cell>
      //   );
      // } else {
      //   summaryCellTotal = (
      //     <Table.Summary.Cell key={0} index={0} >
      //       <span className={styles.summaryCellTotal}>合计</span>
      //     </Table.Summary.Cell>
      //   );
      // }

      cells.push(summaryCellTotal);
      tableColumn.forEach((item, index) => {
        if (colSpan === 0 && index === 0) {
          return;
        }
        let iTag = index + colSpan;
        if (tableColumn[index].children !== undefined && tableColumn[index].children.length > 0) { /* 循环嵌套标题行 */
          tableColumn[index].children.forEach((itemChild, i) => {
            /* 合计 格式化单价、金额 */
            let sValue = totalData[0][itemChild.dataIndex];
            const columnConfig = this.props.config.gdsconfigformslave.find(item => item.sName === itemChild.dataIndex);
            if (commonUtils.isNotEmptyObject(itemChild.dataIndex) && itemChild.dataIndex.substring(0, 1) === 'd' && columnConfig?.sDateFormat === 'decimalPoint' && columnConfig?.sFieldValidation) {
              /* 取小数点位数 */
              const point = columnConfig.sFieldValidation.split(',')[1] || 2;
              if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
                const dConfigResult = commonUtils.convertFixNum(Number(sValue), point).toFixed(point);
                if (!isNaN(dConfigResult)) {
                  sValue = dConfigResult;
                }
              }
            } else if (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('commonList') || (sModelsType && sModelsType.indexOf('commonMultiList') > -1)) {
              /* 有配置以配置为主 否则以系统设定为主 */
              if (commonUtils.isNotEmptyObject(itemChild.dataIndex) && itemChild.dataIndex.substring(0, 1) === 'd' && commonUtils.isNotEmptyObject(itemChild.sDateFormat)) {
                /* 取小数点位数 */
                let point = 0;
                let strIndex = itemChild.sDateFormat.indexOf('.');
                if (strIndex > -1 && itemChild.sDateFormat.length > 1) {
                  point = itemChild.sDateFormat.substring(strIndex + 1, itemChild.sDateFormat.length).length;
                  if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
                    const dConfigResult = commonUtils.convertFixNum(Number(sValue), point).toFixed(point);
                    if (!isNaN(dConfigResult)) {
                      sValue = dConfigResult;
                    }
                  }
                }
              } else {
                if (commonUtils.isNotEmptyObject(itemChild.dataIndex) && itemChild.dataIndex.toLowerCase().endsWith('price')) {  /* 列表单价格式化显示1 */
                  if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
                    const dResult = commonUtils.convertFixNum(Number(sValue), dNetPrice).toFixed(dNetPrice);
                    if (!isNaN(dResult)) {
                      sValue = dResult;
                    }
                  }
                } else if (commonUtils.isNotEmptyObject(itemChild.dataIndex) && itemChild.dataIndex.toLowerCase().endsWith('money')) {  /* 列表金额格式化显示 */
                  if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
                    const dResult = commonUtils.convertFixNum(Number(sValue), dNetMoney).toFixed(dNetMoney);
                    if (!isNaN(dResult)) {
                      sValue = dResult;
                    }
                  }
                }
              }
            }
            const cellChild = (
              <Table.Summary.Cell key={itemChild.dataIndex} index={iTag + i}>
                <Tooltip title={sValue}><span
                  className={styles.summaryCell}
                >{sValue}</span></Tooltip>
              </Table.Summary.Cell>
            );
            cells.push(cellChild);
          });
        } else { /* 正常单层标题行 */
          let cell = '';
          /* commonList 格式化单价、金额 */
          let sValue = totalData[0][item.dataIndex];
          if (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('commonList') || (sModelsType && sModelsType.indexOf('commonMultiList') > -1)) {
            /* 有配置以配置为主 否则以系统设定为主 */
            const columnConfig = this.props.config.gdsconfigformslave.find(item1 => item1.sName === item.dataIndex);
            if (commonUtils.isNotEmptyObject(item.dataIndex) && item.dataIndex.substring(0, 1) === 'd' && columnConfig?.sDateFormat === 'decimalPoint' && columnConfig?.sFieldValidation) {
              /* 取小数点位数 */
              const point = columnConfig.sFieldValidation.split(',')[1] || 2;
              if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
                const dConfigResult = commonUtils.convertFixNum(Number(sValue), point).toFixed(point);
                if (!isNaN(dConfigResult)) {
                  sValue = dConfigResult;
                }
              }
            } else if (commonUtils.isNotEmptyObject(item.sDateFormat)) {
              /* 取小数点位数 */
              let point = 0;
              let strIndex = item.sDateFormat.indexOf('.');
              if (strIndex > -1 && item.sDateFormat.length > 1) {
                point = item.sDateFormat.substring(strIndex + 1, item.sDateFormat.length).length;
                if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
                  const dConfigResult = commonUtils.convertFixNum(Number(sValue), point).toFixed(point);
                  if (!isNaN(dConfigResult)) {
                    sValue = dConfigResult;
                  }
                }
              }
            } else {
              if (commonUtils.isNotEmptyObject(item.dataIndex) && item.dataIndex.toLowerCase().endsWith('price')) {  /* 列表单价格式化显示1 */
                if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
                  const dResult = commonUtils.convertFixNum(Number(sValue), dNetPrice);
                  if (!isNaN(dResult)) {
                    sValue = dResult;
                  }
                }
              } else if (commonUtils.isNotEmptyObject(item.dataIndex) && item.dataIndex.toLowerCase().endsWith('money')) {  /* 列表金额格式化显示 */
                if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
                  const dResult = commonUtils.convertFixNum(Number(sValue), dNetMoney);
                  if (!isNaN(dResult)) {
                    sValue = dResult;
                  }
                }
              }
            }
          }
          cell = (
            <Table.Summary.Cell key={item.dataIndex} index={iTag}>
              <Tooltip title={sValue}><span
                className={styles.summaryCell}
              >{sValue}</span></Tooltip>
            </Table.Summary.Cell>
          );
          cells.push(cell);
        }
      });
    }

    if (totalData1.length) {
      let summaryCellTotal1 = '';
      summaryCellTotal1 = (
        <Table.Summary.Cell key={0} colSpan={colSpan ? colSpan : 1} index={0}>
          <span className={styles.summaryCellTotal}>总计</span>
        </Table.Summary.Cell>
      );
      cells1.push(summaryCellTotal1);
      tableColumn.forEach((item, index) => {
        if (colSpan === 0 && index === 0) {
          return;
        }
        let iTag = index + colSpan;
        if (tableColumn[index].children !== undefined && tableColumn[index].children.length > 0) { /* 循环嵌套标题行 */
          tableColumn[index].children.forEach((itemChild, i) => {
            /* 合计 格式化单价、金额 */
            let sValue = totalData1[0][itemChild.dataIndex];
            const cellChild = (
              <Table.Summary.Cell key={itemChild.dataIndex} index={iTag + i}>
                <Tooltip title={sValue}><span
                  className={styles.summaryCell}
                >{sValue}</span></Tooltip>
              </Table.Summary.Cell>
            );
            cells1.push(cellChild);
          });
        } else { /* 正常单层标题行 */
          let cell = '';
          /* commonList 格式化单价、金额 */
          let sValue = totalData1[0][item.dataIndex];
          cell = (
            <Table.Summary.Cell key={item.dataIndex} index={iTag}>
              <Tooltip title={sValue}><span
                className={styles.summaryCell}
              >{sValue}</span></Tooltip>
            </Table.Summary.Cell>
          );
          cells1.push(cell);
        }
      });
    }
    return (
      <Table.Summary fixed>
        {
          totalData.length ? (
            <Table.Summary.Row>
              {cells}
            </Table.Summary.Row>
          ) : ''
        }
        {
          totalData1.length ? (
            <Table.Summary.Row>
              {cells1}
            </Table.Summary.Row>
          ) : ''
        }
      </Table.Summary>
    );
  }

  handleSearch = (selectedKeys, confirm, searchColumnName, clearFilters) => {
    confirm();
    if (this.mounted) {
      this.setState({ searchText: selectedKeys[0], searchColumnName });
    }
    let { clearArray } = this.props;
    if (commonUtils.isEmptyArr(clearArray)) {
      clearArray = [];
    }
    clearArray.push({ confirm, clearFilters });
    this.props.onSaveState({ clearArray });
  };

  handleReset = (clearFilters, confirm) => {
    clearFilters();
    if (this.mounted) {
      this.setState({ searchText: '' }, () => {
        // 重置搜索条件
        confirm();
      });
    }
  };


  /** 求和所有列 */
  handleSumAllColumn = (config, dataSource) => {
    const tableDataTotal = {};
    const sumConfig = config.gdsconfigformslave.filter(item => item.sName !== '' && item.bVisible && item.bSum);
    if (commonUtils.isNotEmptyArr(sumConfig)) {
      if (commonUtils.isNotEmptyObject(config) && commonUtils.isNotEmptyArr(dataSource)) {
        dataSource.forEach((tableDataRow) => {
          sumConfig.forEach((sumItem) => {
            if (tableDataRow.handleType !== 'del') {
              if (sumItem.sName.substring(sumItem.sName.length - 5, sumItem.sName.length).toLowerCase() === 'Price'.toLowerCase()) {
                tableDataTotal[sumItem.sName] = commonUtils.convertFixNum(commonUtils.convertToNum(tableDataTotal[sumItem.sName]) +
                  commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName));
              } else {
                /* 如果设置格式 按照设置格式来，否则按照系统设定 */
                const sFieldConfigArr = config.gdsconfigformslave.filter(item => item.sName === sumItem.sName && item.bVisible);
                if (commonUtils.isNotEmptyArr(sFieldConfigArr)) {
                  const { sFieldValidation: sFieldValidationOld, sName } = sFieldConfigArr[0];
                  if (commonUtils.isNotEmptyObject(sFieldValidationOld)) {
                    const [length1, length2] = sFieldValidationOld.split(',');
                    if (commonUtils.isNotEmptyNumber(length2)) {
                      tableDataTotal[sumItem.sName] = commonUtils.convertFixNum(commonUtils.convertToNum(tableDataTotal[sumItem.sName]) +
                        commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(length2));
                    }
                  } else {
                    tableDataTotal[sumItem.sName] = commonUtils.convertFixNum(commonUtils.convertToNum(tableDataTotal[sumItem.sName]) +
                      commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName));
                  }
                }

              }
            }
          });
        });
      } else {
        sumConfig.forEach((sumItem) => {
          tableDataTotal[sumItem.sName] = 0;
        });
      }
      tableDataTotal.bSum = true;
      tableDataTotal.key = '0000';

      if (this.mounted) {
        this.setState({ totalData: [tableDataTotal] });
      }
    }
  }

  handleSumOtherColumn = (config, dataSource) => {
    const tableDataTotal = {};
    const sumConfig = config.gdsconfigformslave.filter(item => item.sName !== '' && item.bVisible && item.bSum);
    if (commonUtils.isNotEmptyArr(sumConfig)) {
      if (commonUtils.isNotEmptyObject(config) && commonUtils.isNotEmptyArr(dataSource)) {
        const { selectedRowKeys } = this.state;
        /* 生产排程对选中行进行汇总 */
        if (commonUtils.isNotEmptyArr(selectedRowKeys)) {
          const selectedData = dataSource.filter(item => selectedRowKeys.includes(item.sSlaveId));
          if (commonUtils.isNotEmptyArr(selectedData)) {
            selectedData.forEach((tableDataRow) => {
              sumConfig.forEach((sumItem) => {
                if (tableDataRow.handleType !== 'del') {
                  if (sumItem.sName.substring(sumItem.sName.length - 5, sumItem.sName.length).toLowerCase() === 'Price'.toLowerCase()) {
                    tableDataTotal[sumItem.sName] = commonUtils.convertFixNum(commonUtils.convertToNum(tableDataTotal[sumItem.sName]) +
                      commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName));
                  } else {
                    tableDataTotal[sumItem.sName] = commonUtils.convertFixNum(commonUtils.convertToNum(tableDataTotal[sumItem.sName]) +
                      commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName));
                  }
                }
              });
            });
          }
        } else {
          dataSource.forEach((tableDataRow) => {
            sumConfig.forEach((sumItem) => {
              if (tableDataRow.handleType !== 'del') {
                if (sumItem.sName.substring(sumItem.sName.length - 5, sumItem.sName.length).toLowerCase() === 'Price'.toLowerCase()) {
                  tableDataTotal[sumItem.sName] = commonUtils.convertFixNum(commonUtils.convertToNum(tableDataTotal[sumItem.sName]) +
                    commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName));
                } else {
                  tableDataTotal[sumItem.sName] = commonUtils.convertFixNum(commonUtils.convertToNum(tableDataTotal[sumItem.sName]) +
                    commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName));
                }
              }
            });
          });
        }
      } else {
        sumConfig.forEach((sumItem) => {
          tableDataTotal[sumItem.sName] = 0;
        });
      }
      tableDataTotal.bSum = true;
      tableDataTotal.key = '0000';
      if (this.mounted) {
        this.setState({ totalData: [tableDataTotal] });
      }
    }
  }

  handleSumChildColumn = (config, dataSource) => {
    const tableDataTotal = {};
    const { filteredValue } = this.state;
    const sumConfig = config.gdsconfigformslave.filter(item => item.sName !== '' && item.bVisible && item.bSum);
    if (commonUtils.isNotEmptyArr(sumConfig)) {
      if (commonUtils.isNotEmptyObject(config) && commonUtils.isNotEmptyArr(dataSource) && commonUtils.isNotEmptyArr(filteredValue)) {
        /* 序号根据sSqlConditonId分组 序号重排 */
        const groupedData = commonUtils.groupBy(dataSource, item => item.sSqlConditionId);
        let selectedData = [];
        if (commonUtils.isNotEmptyObject(groupedData)) {
          for (const key of Object.keys(groupedData)) {
            const eachData = groupedData[key];
            if (commonUtils.isNotEmptyArr(eachData)) {
              /* 看当前选中在哪个组里 */
              const iIndex = eachData.findIndex(item => filteredValue.includes(item.sSqlConditionId));
              if (iIndex > -1) {
                selectedData = eachData;
              }
            }
          }
        }

        if (commonUtils.isNotEmptyArr(selectedData)) {
          selectedData.forEach((tableDataRow) => {
            sumConfig.forEach((sumItem) => {
              if (tableDataRow.handleType !== 'del') {
                if (sumItem.sName.substring(sumItem.sName.length - 5, sumItem.sName.length).toLowerCase() === 'Price'.toLowerCase()) {
                  tableDataTotal[sumItem.sName] = commonUtils.convertFixNum(commonUtils.convertToNum(tableDataTotal[sumItem.sName]) +
                    commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName));
                } else {
                  tableDataTotal[sumItem.sName] = commonUtils.convertFixNum(commonUtils.convertToNum(tableDataTotal[sumItem.sName]) +
                    commonUtils.convertToNum(tableDataRow[sumItem.sName]), this.props.getFloatNum(sumItem.sName));
                }
              }
            });
          });
        }
      } else {
        sumConfig.forEach((sumItem) => {
          tableDataTotal[sumItem.sName] = 0;
        });
      }
      tableDataTotal.bSum = true;
      tableDataTotal.key = '0000';
      if (this.mounted) {
        this.setState({ totalData: [tableDataTotal] });
      }
    }
  }
  // 表格按钮点击后调用指令集
  handleInstruct = (btnName, callback) => {
    const { sInstruct: sInstructStr } = this.props.config;
    const sInstruct = commonUtils.convertStrToObj(sInstructStr, {});
    const { data = [] } = sInstruct;

    const btnConfig = data.find(item => item && item.name === btnName && item.click);
    if (btnConfig) {
      const { click, afterClick, clickOnly } = btnConfig;
      if (clickOnly) {
        // 只执行指令集
        this.props.onExecInstructSet({ sInstruct: click, showName: "表格按钮only" });
      } else if (afterClick) {
        // 先按钮再指令集
        callback && callback();
        setTimeout(() => {
          this.props.onExecInstructSet({ sInstruct: click, showName: "表格按钮->指令集" });
        }, 1000);
      } else {
        // 先指令集再按钮
        this.props.onExecInstructSet({ sInstruct: click, showName: "指令集->表格按钮", callback });
      }
    } else {
      callback && callback();
    }
  }

  /**   查看行   */
  handleLookRow = () => {
    this.props.onLookRow(this.props.name);
  };
  /**   材料备注行   */
  handleModalRemarkRow = (index) => {
    this.props.onModalRow(index);
  };
  /**   modal行   */
  handleModalRow = (recordIndex, tableName) => {
    if (commonUtils.isNotEmptyObject(this.props.tableProps.chooseMaterialsConfigRow)) {
      this.handleInstruct('BtnChooseMaterials', () => {
        const iIndex = this.props.tableProps.chooseMaterialsConfigRow;
        this.props.onBtnChoose('materials', 'BtnChooseMaterials', iIndex, recordIndex, tableName); // recordIndex选中行的索引
      });
    }
  };
  handleChooseProcessRow = (record) => {
    if (commonUtils.isNotEmptyObject(this.props.tableProps.chooseProcessConfigRow)) {
      this.handleInstruct('BtnChooseProcess', () => {
        const iIndex = this.props.tableProps.chooseProcessConfigRow;
        if (this.props.name === 'slave0Child1') {
          const { name } = this.props;
          let btnPupopConfig = this.props.tableProps.chooseProcessConfigRow;
          this.setState({
            commonPopupVisible: true,
            commonPopupTbName: name,
            commonPopupShowConfig: btnPupopConfig,
            commonPopupRecord: record,
          });

        } else {
          this.props.onBtnChoose('process', 'BtnChooseProcess', iIndex);
        }
      });
    }
  };

  /* 成品工序弹窗 */
  handleChooseProductProcessRow = (recordIndex) => {
    /* recordIndex 为选中行下标 */
    if (commonUtils.isNotEmptyObject(this.props.tableProps.chooseProductProcessConfigRow)) {
      const btnConfig = this.props.tableProps.chooseProductProcessConfigRow;
      this.props.onBtnChoose('productProcess', 'BtnChooseProductProcess', btnConfig, recordIndex);
    }
  };

  /* 成品材料弹窗 */
  handleChooseProductMaterialsRow = (recordIndex) => {
    /* recordIndex 为选中行下标 */
    if (commonUtils.isNotEmptyObject(this.props.tableProps.chooseProductMaterialsConfigRow)) {
      const btnConfig = this.props.tableProps.chooseProductMaterialsConfigRow;
      this.props.onBtnChoose('productMaterials', 'BtnChooseProductMaterials', btnConfig, recordIndex);
    }
  };

  /**   添加行   */
  handleAddRow = (index, bModalAdd) => {
    this.stopRowClick = true;
    /* 多表树形删除 */
    if (this.props && this.props.slaveInfo && this.props.slaveInfo.tableProps && this.props.slaveInfo.tableProps.bSlaveInfo) {
      this.handleAddInfoRow(index);
      return;
    }
    setTimeout(() => {
      if (this.props.onAddRow) {
        this.handleInstruct('BtnAdd', () => {
          this.props.onAddRow(this.props.name, null, index, this.props.bFinished, bModalAdd);
        });
      }
    }, 0)
  };
  handleAddInfoRow = (index) => {
    const tableInfoName = this.props.slaveInfo.name;
    setTimeout(() => {
      if (this.props.onAddRow) {
        this.handleInstruct('BtnAdd', () => {
          this.props.onAddRow(tableInfoName, null, index, false, false);
        });
      }
    }, 0)
  };

  handleTreeAdd = () => {
    setTimeout(() => {
      this.handleInstruct('BtnAdd', () => {
        if (this.props.onTreeAdd) {
          this.props.onTreeAdd(this.props.name, true, 'sameNode');
        }
      });
    }, 0)
  };
  handleTreeAddChild = () => {
    setTimeout(() => {
      this.handleInstruct('BtnAddChildNode', () => {
        if (this.props.onTreeAddChild) {
          this.props.onTreeAddChild(this.props.name, true, 'childNode');
        }
      });
    }, 0)
  };
  handleTreeCopyAll = () => {
    setTimeout(() => {
      this.handleInstruct('BtnCopyAll', () => {
        if (this.props.onTreeCopyAll) {
          this.props.onTreeCopyAll(this.props.name, false, 'isChild');
        }
      });
    }, 0)
  };
  handleTreeDel = (index, record) => {
    if (this.props.name === 'control') {
      const sureDel = commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'SureDel') : '确认要删除吗？';
      const BtnSure = commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'BtnSure') : '确定？';
      const BtnCancel = commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'BtnCancel') : '确定？';
      const _this = this;
      confirm({
        title: sureDel,
        onOk() {
          _this.handleTreeDelOk(index, record);
        },
        onCancel() {
          return false;
        },
        okText: BtnSure,
        cancelText: BtnCancel
      });
    } else {
      this.handleTreeDelOk(index, record);
    }
  };
  handleTreeDelOk = () => {
    setTimeout(() => {
      this.handleInstruct('BtnDel', () => {
        if (this.props.onTreeDel) {
          this.props.onTreeDel(this.props.name, true, '');
        }
      });
    }, 0);
  };
  /**   复制   */
  handleCopyRow = (index) => {
    setTimeout(() => {
      this.handleInstruct('BtnCopy', () => {
        if (this.props.onCopyRow) {
          this.props.onCopyRow(this.props.name, undefined, undefined, index);
        }
      });
    }, 0)
  };
  /**   复制全部   */
  handleCopyAllRow = () => {
    setTimeout(() => {
      this.handleInstruct('BtnCopyAll', () => {
        if (this.props.onCopyAllRow) {
          this.props.onCopyAllRow(this.props.name);
        }
      });
    }, 0)
  };
  /**   删除行   */
  handleDelRow = (index, record) => {
    if (this.props.name !== 'slaveFilter') {
      const sureDel = commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'SureDel') : '确认要删除吗？';
      const BtnSure = commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'BtnSure') : '确定？';
      const BtnCancel = commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'BtnCancel') : '确定？';
      const _this = this;
      confirm({
        title: sureDel,
        onOk() {
          _this.handleDelOkRow(index, record);
        },
        onCancel() {
          return false;
        },
        okText: BtnSure,
        cancelText: BtnCancel
      });
    } else {
      this.handleDelOkRow(index, record);
    }
  };

  /**   删除行   */
  handleDelOkRow = (index, record) => {
    const tableSelectedRowKeys = [];
    if (this.props?.formId === '12710101117043535363530') {
      tableSelectedRowKeys.push(record[this.rowKey]);
    } else {
      tableSelectedRowKeys.push(record.sId);
    }
    /* 多表树形删除 */
    if (this.props && this.props.slaveInfo && this.props.slaveInfo.tableProps && this.props.slaveInfo.tableProps.bSlaveInfo) {
      this.handleDelInfoRow(index, record);
      return;
    }
    setTimeout(() => {
      this.handleInstruct('BtnDel', () => {
        if (this.props.onDelRow(this.props.name, false, tableSelectedRowKeys, undefined, index)) {
          this.handleSumAllColumn(this.props.config, this.state.dataSource);
        }
      });
    }, 0);
    // if (this.props.formRoute === '/indexOee/processReport') {
    //   localStorage.setItem(`${commonConfig.prefix}oeeEmployeeData`, JSON.stringify(this.props.data));
    //   this.props.onSaveState({
    //     employeeData: JSON.parse(localStorage.getItem(`${commonConfig.prefix}oeeEmployeeData`)),
    //   });
    // }
  };

  handleDelInfoRow = (index, record) => {
    const tableSelectedRowKeys = [];
    tableSelectedRowKeys.push(record.sId);
    const tableInfoName = this.props.slaveInfo.name;
    setTimeout(() => {
      this.handleInstruct('BtnDel', () => {
        this.props.onDelRow(tableInfoName, false, tableSelectedRowKeys)
      });
    }, 0);
  };

  /**   复制   */
  handleCopyMoreRow = (index) => {
    this.setState({ bOperateMoreVisible: true });
  };

  /**   提取数据   */
  handleReplaceRow = (index, record) => {
    if (this.props.onReplaceRow) {
      this.props.onReplaceRow(this.props.name, record);
    }
  };

  /**   下载行   */
  handleDownloadRow = (index, record) => {
    const tableSelectedRowKeys = [];
    tableSelectedRowKeys.push(record.sId);
    if (this.props.onDownloadRow) {
      this.props.onDownloadRow(this.props.name, false, tableSelectedRowKeys);
    }
  };
  /**   通用弹窗新增行   */
  handlePopupRow = (index, record, btnName) => {
    const { name, config } = this.props;
    let btnPupopConfig = {};
    if (commonUtils.isNotEmptyArr(config) && commonUtils.isNotEmptyArr(config.gdsconfigformslave)) {
      let controlConfig = config.gdsconfigformslave.filter(item => commonUtils.isNotEmptyObject(item.sControlName) && (item.sControlName.includes('BtnPopup') || item.sControlName.includes('BtnHeadPopup')));
      if (btnName && typeof btnName === 'string') {
        controlConfig = config.gdsconfigformslave.filter(item => commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName === btnName);
      }
      if (commonUtils.isNotEmptyArr(controlConfig)) {
        if (controlConfig[0].bVisible && controlConfig[0].sDropDownType === 'popup') {
          btnPupopConfig = controlConfig[0];
          const conditionValue = this.props.getSqlCondition(btnPupopConfig);
          if (commonUtils.isNotEmptyObject(conditionValue)) {
            if (commonUtils.isNotEmptyObject(conditionValue.warning)) {
              message.warn(conditionValue.warning);
              return;
            }
          }
          this.setState({
            commonPopupVisible: true,
            commonPopupTbName: name,
            commonPopupShowConfig: btnPupopConfig,
            commonPopupRecord: record,
          });
        }
      }
    }
  };
  /**   查看工艺参数   */
  handleParamRow = (index, record) => {
    const tableSelectedRowKeys = [];
    tableSelectedRowKeys.push(record.sId);
    this.props.onShowParamRow(this.props.name, record, tableSelectedRowKeys);
  };

  /**  拖动排序   */
  handleSaveOrder = (sortItems, isSlaveInfo) => {
    const { formSrcRoute } = isSlaveInfo ? this.props.slaveInfo : this.props;
    const { token } = isSlaveInfo ? this.props.slaveInfo.app : this.props.app;
    const sActiveId = isSlaveInfo ? this.props.slaveInfo.app.currentPane.formId : this.props.app.currentPane.formId;
    const url = `${commonConfig.server_host}configform/sHandleConfigform?sModelsId=${sActiveId}&sName=${formSrcRoute}`;
    const headerArr = isSlaveInfo ? this.props.slaveInfo.headerColumn.map(item => item.dataIndex) : this.props.headerColumn.map(item => item.dataIndex);
    const handleData = isSlaveInfo ? this.props.slaveInfo.config.gdsconfigformslave.filter(item => headerArr.indexOf(item.sName) !== -1) : this.props.config.gdsconfigformslave.filter(item => headerArr.indexOf(item.sName) !== -1);
    let sortIndexFirst = 0;
    let sortIndexLast = 0;

    handleData.forEach((item, index) => {
      if (item.sName === sortItems[0]) {
        sortIndexFirst = index;
      }
      if (item.sName === sortItems[1]) {
        sortIndexLast = index;
      }
    });

    const tempOrder = handleData[sortIndexFirst].iOrder;
    handleData[sortIndexFirst].iOrder = handleData[sortIndexLast].iOrder;
    handleData[sortIndexLast].iOrder = tempOrder;

    const postData = isSlaveInfo ? {
      [this.props.slaveInfo.config.sId]: handleData,
    } : {
      [this.props.config.sId]: handleData,
    };
    // console.log(postData, 'postData');
    // console.log(sortItems, 'sortItems');

    const value = {
      handleType: 'group',
      sJurisdictionClassifyId: '',
      bDefault: true,
      handleData: postData,
    };

    const options = {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        authorization: token,
      },
      body: JSON.stringify(value),
    };
    const { dispatch } = this.props;
    fetch(url, options).then(response => response.json()).then((json) => {
      if (json.code === 1) {
        this.forceUpdate();
      } else if (json.code === -2) {
        dispatch({ type: 'app/throwError', payload: json });
      }
    });
  };

  /**   查找控件名是否存在   */
  findIsExistByControlName = (props, controlName) => {
    // 解决操作栏按钮没显示但是加上了宽度问题
    let propsIcon = true;
    switch (controlName) {
      // case 'BtnUpload':
      //   propsIcon = '';
      //   break;
      // case 'BtnLook':
      //   propsIcon = '';
      //   break;
      // case 'BtnAdd':
      //   propsIcon = props.tableProps.setAdd;
      //   break;
      case 'BtnChooseMaterials':
        propsIcon = props.tableProps.setMaterial;
        break;
      case 'BtnChooseProcess':
        propsIcon = props.tableProps.setProcess;
        break;
      // case 'BtnCopy':
      //   propsIcon = props.tableProps.setCopy;
      //   break;
      // case 'BtnCopyAll':
      //   propsIcon = props.tableProps.setCopyAll;
      //   break;
      // case 'BtnDel':
      //   propsIcon = props.tableProps.setDelete;
      //   break;
      default:
        break;
    }

    /*   返回值声明   */
    let ret = false;
    /*   查询控件名是否存在   */
    if (commonUtils.isNotEmptyArr(props.config) && commonUtils.isNotEmptyArr(props.config.gdsconfigformslave) && commonUtils.isNotEmptyStr(controlName)) {
      const controlConfig = props.config.gdsconfigformslave.filter(item => item.sControlName === controlName);
      ret = commonUtils.isEmptyArr(controlConfig) ? (propsIcon ? true : false) : commonUtils.converStrToBoolean(controlConfig[0].bVisible);
    }
    /*   返回值   */
    return ret;
  };

  BtnUploadDivPropsAttr = React.createRef();

  /**   查找控件名是否存在   */
  findIsUpdByControlName = (props, controlName) => {
    /*   返回值声明   */
    let ret = false;
    /*   查询控件名是否存在   */
    if (commonUtils.isNotEmptyArr(props.config) && commonUtils.isNotEmptyArr(props.config.gdsconfigformslave) && commonUtils.isNotEmptyStr(controlName)) {
      const controlConfig = props.config.gdsconfigformslave.filter(item => item.sControlName === controlName);
      ret = commonUtils.isNotEmptyArr(controlConfig) && commonUtils.converStrToBoolean(controlConfig[0].iTag === 3);
      if (ret && controlName === 'BtnUpload' && Array.isArray(controlConfig)) {
        this.BtnUploadDivPropsAttr.current = controlConfig[0];
      }
    }
    /*   返回值   */
    return ret;
  };

  /**   查找控件名是否显示   */
  findVisibleControlName = (props, controlName) => {
    /*   返回值声明   */
    let ret = false;
    /*   查询控件名是否存在   */
    if (commonUtils.isNotEmptyArr(props.config) && commonUtils.isNotEmptyArr(props.config.gdsconfigformslave) && commonUtils.isNotEmptyStr(controlName)) {
      const controlConfig = props.config.gdsconfigformslave.filter(item => item.sControlName === controlName);
      ret = commonUtils.isNotEmptyArr(controlConfig) && commonUtils.converStrToBoolean(controlConfig[0].bVisible);
    }
    /*   返回值   */
    return ret;
  };
  /**   查找控件名是否存在   */
  findIsExistByControlPopup = (props, controlName) => {
    /*   返回值声明   */
    let ret = false;
    /*   查询控件名是否存在   */
    if (commonUtils.isNotEmptyArr(props.config) && commonUtils.isNotEmptyArr(props.config.gdsconfigformslave) && commonUtils.isNotEmptyStr(controlName)) {
      const controlConfig = props.config.gdsconfigformslave.filter(item => commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName.includes(controlName) && !item.sControlName.includes('.'));
      if (commonUtils.isNotEmptyArr(controlConfig)) {
        if (controlConfig[0].bVisible && controlConfig[0].sDropDownType === 'popup') {
          ret = true;
        }
      }
    }
    /*   返回值   */
    return ret;
  };

  handleGetRjRes = (res, index, sName) => {
    const { masterData = {}, formId, enabled } = this.props;
    if (enabled && formId === "12710101117225611571970" && masterData.sTeamName?.includes('质检') && sName === "sInspectionCode") {
      return (
        <>
          {res}
          <Button
            type="link"
            icon={<CaretUpOutlined style={{ fontSize: 16 }} />}
            size="large"
            style={{
              position: "absolute",
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              top: 0,
              right: 0,
              height: 15
            }}
            onClick={this.props.onMoveLine.bind(this, {
              index,
              direction: "up"
            })}
          />
          <Button
            type="link"
            icon={<CaretDownOutlined style={{ fontSize: 16 }} />}
            size="large"
            style={{
              position: "absolute",
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              bottom: 0,
              right: 0,
              height: 15
            }}
            onClick={this.props.onMoveLine.bind(this, {
              index,
              direction: "down"
            })}
          />
        </>);
    } else {
      return res;
    }
  }

  /**   绑定showType控件   */
  bindShowType = (props, text, record, sName, index, isSlaveInfo) => {
    record.iRowNum = index + 1;
    /*   如果从表没有数据就返回一个默认的input text,不返回showType了   */
    let res = '';
    const idx = index;
    const inputProps = {
      disabled: true,
      value: record[sName],
    };
    if (sName === 'tableLastEmpty') {
      return '';
    }
    const showConfigObj = this.getShowConfig(props, sName, isSlaveInfo);
    const { dNetMoney, dNetPrice } = props.app.decimals;
    let bShow = '';
    /* 如果是布尔类型 ，加checkbox */
    if (commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === 'b') {
      if (props.enabled) {
        bShow = <span style={{ border: 'none', outline: 'none' }} onKeyDown={e => this.onKeyDownDiv(e, sName)} suppressContentEditableWarning contentEditable="true"> <Checkbox checked={record[sName]} /></span>;
      } else {
        bShow = <span style={{ border: 'none', outline: 'none' }} onKeyDown={e => this.onKeyDownDiv(e, sName)} suppressContentEditableWarning contentEditable="true"> <Checkbox checked={record[sName]} disabled /></span>;
      }
    }
    /* 如果是图片类型 ，加载图片 */
    let imgBox = '';
    if (commonUtils.isNotEmptyObject(sName) && sName.indexOf('picture') > -1) {
      const picAddr = commonUtils.isNotEmptyObject(record[sName]) ? record[sName].split(',') : '';
      if (commonUtils.isNotEmptyObject(picAddr)) {
        const { token } = props.app;
        const dataUrl = picAddr[0].includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` : picAddr[0]; /* 缩略图 */
        const officeFileTypeList = ['PDF', 'DOCX', 'XLSX', 'MP4', 'WEBM', 'OGG'];
        const imgTypeList = ['PNG', 'SVG', 'JPG', 'JPEG', 'GIF', 'BMP', 'TIFF', 'ICO'];
        const officeFileType = picAddr[0].split('.').pop().toUpperCase();
        let fileIcon = <FilePdfOutlined />;
        if (officeFileType === 'DOCX') {
          fileIcon = <FileWordOutlined />;
        } else if (officeFileType === 'XLSX') {
          fileIcon = <FileExcelOutlined />;
        } else if (['MP4', 'WEBM', 'OGG'].includes(officeFileType)) {
          fileIcon = <PlaySquareOutlined />;
        }
        if (officeFileTypeList.includes(officeFileType)) {
          imgBox = <span
            style={{ cursor: 'pointer' }}
            onClick={() => {
              this.setState({
                officePreviewVisible: true,
                officeFileUrl: picAddr[0]
              })
            }}>{fileIcon}</span>
        } else if (imgTypeList.includes(officeFileType)) {
          imgBox = <span style={{ cursor: 'pointer' }}> <img src={dataUrl} alt="img" onFocus={() => 0} onClick={e => this.handlePreviewImage(e, picAddr)} style={{ width: '30px', height: '20px' }} /></span>;
        } else {
          imgBox = <span><FileOutlined /></span>
        }
      }
    }
    /* 变量设置 显示字段名 */
    let specialTitle = '';
    let bSpecialTitle = false;
    if (sName !== '' && sName.includes('sValue')) {
      specialTitle = `R${idx}_${sName}`;
    } else if (location.pathname?.includes('production') && (sName === 'sStateName' || sName === 'sProcessState')) {
      if (commonUtils.isNotEmptyObject(record?.sState) || commonUtils.isNotEmptyObject(record?.sStateName)) {
        specialTitle = commonUtils.isNotEmptyObject(record.sWorkOrderChangeMemo) ? record.sWorkOrderChangeMemo : '';
        bSpecialTitle = true;
      }
    }
    if (record.bSum && commonConfig.hasSum) { /*   从表无数据   */
      res = (<Input {...inputProps} />);
      const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
      return cell;
    } else if (props.tableBelone === 'list' || ((commonUtils.isNotEmptyObject(props.slaveInfo) && props.slaveInfo.tableBelone === 'list'))) {
      /* CommonList列表加下划线 */
      const showConfig = this.getShowConfig(props, sName) || {};
      /* 获取单元格颜色配置 */
      let cellColor = '';
      let backgroundColor = '';
      if (commonUtils.isNotEmptyArr(showConfig)) {
        const cellStyle = this.getCellColorConfig(text, record, sName);
        if (commonUtils.isNotEmptyObject(cellStyle)) {
          cellColor = cellStyle.styleColorArrTotal;
          backgroundColor = cellStyle.styleColorArrTotalB;
        }
      }
      let sValue = record[sName];
      let linkStyle = '';
      let displayAlign = 'left';
      if (commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === 'd') {
        const { dNumAlign } = props.app.decimals;
        displayAlign = dNumAlign === '1' ? 'right' : 'left'; /* 判断如果是数字格式，对齐方式根据系统设定s */
      }
      const firstDataIndex = commonUtils.isNotEmptyObject(sName) ? sName.substring(0, 1) : ''; /*   控件首字母(数据格式:字符串)   */
      if ((showConfig.sDropDownType === 'picArr' || showConfig.sDropDownType === 'picArrModal') && !commonUtils.isEmpty(showConfig.sActiveId) && commonUtils.isEmptyArr(props.sGroupByList)) {
        linkStyle = 'linksActiveIdStyle'; /* 列表加弹窗,如果有分组，则不加弹窗 */
        if (sName === 'sDetailMemoview') {
          // record.sDetailMemotemp = sValue; /* 存放值字段 */
          sValue = sValue !== undefined ? '查看操作日志' : sValue;
        }
      } else if (showConfig.sDropDownType === 'const') {
        let showDropDown = [];
        if (typeof showConfig.showDropDown === 'object') {
          showDropDown = showConfig.showDropDown;
        } else {
          showDropDown = commonUtils.objectToArr(commonUtils.convertStrToObj(showConfig.showDropDown));
        }
        const iIndex = commonUtils.isEmpty(record[sName]) ? -1 : showDropDown.findIndex(item => item.sId === record[sName].toString());
        sValue = iIndex > -1 ? showDropDown[iIndex].value : '';
      } else if (firstDataIndex === 't' || firstDataIndex === 'p' || firstDataIndex === 'm') {
        const { sDateFormat } = showConfig;
        if (!commonUtils.isEmpty(sValue)) {
          if (commonUtils.isNotEmptyStr(sDateFormat)) {
            sValue = moment(sValue).format(sDateFormat);
          } else if (!commonUtils.isEmpty(sValue)) {
            sValue = moment(sValue).format(props.getDateFormat());
          }
        }
      } else if (firstDataIndex === 'd') {
        const { sDateFormat } = showConfig;
        /* 如果配置时间格式中设置了0.0000则以配置为准，没有设置时间格式 则以系统设定为主 */
        if (commonUtils.isNotEmptyObject(sDateFormat)) {
          /* 取小数点位数 */
          let point = 0;
          let strIndex = sDateFormat.indexOf('.');
          if (strIndex > -1 && sDateFormat.length > 1) {
            point = sDateFormat.substring(strIndex + 1, sDateFormat.length).length;
            if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
              const dConfigResult = commonUtils.convertFixNum(Number(sValue), point).toFixed(point);
              if (!isNaN(dConfigResult)) {
                sValue = dConfigResult;
              }
            }
          }
        } else {
          if (firstDataIndex === 'd' && sName.toLowerCase().endsWith('price')) {  /* 列表单价格式化显示 */
            if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
              const dResult = commonUtils.convertFixNum(Number(sValue), dNetPrice).toFixed(dNetPrice);
              if (!isNaN(dResult)) {
                sValue = dResult;
              }
            }
          } else if (firstDataIndex === 'd' && sName.toLowerCase().endsWith('money')) {  /* 列表金额格式化显示 */
            if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
              const dResult = commonUtils.convertFixNum(Number(sValue), dNetMoney).toFixed(dNetMoney);
              if (!isNaN(dResult)) {
                sValue = dResult;
              }
            }
          }
        }
      }

      /* 如果列表行包含sDivRow并且sDivRow有值 则代表该行行不渲染数据 只做分割作用 */
      if (commonUtils.isNotEmptyObject(record.sDivRow) && record.bInsert) {
        bShow = '';
        if (sName !== 'sDivRow') {
          sValue = '';
        }
      }
      if (commonUtils.isNotEmptyObject(sName) && sName === 'sColorSerialMemo') {
        if (sName === 'sColorSerialMemo') {
          let JsonData = [];
          if (commonUtils.isNotEmptyObject(sValue)) {
            try {
              JsonData = JSON.parse(sValue);
            } catch (e) {
              JsonData = [];
            }
          }
          /* 将色序json解析成需要的字符串形式 */
          let sMemo = '';
          if (commonUtils.isNotEmptyArr(JsonData)) {
            JsonData.forEach((item) => {
              sMemo += `${item.sName}+`;
            });
            sMemo = commonUtils.isNotEmptyObject(sMemo) ? sMemo.substr(0, sMemo.length - 1) : '';
            sValue = sMemo;
          }
        }
      }

      if (cellColor && sName !== 'sState') {
        res = (<div
          className='listDiv'
          style={{
            position: 'absolute', width: '100%', left: 0, top: 0, bottom: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', textAlign: `${displayAlign}`, backgroundColor: `${backgroundColor}`, color: `${cellColor}`
          }}
        >
          {(commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === 'b') || (imgBox !== '') ? '' :
            <div
              className={linkStyle}
              title={sValue}
              style={{ padding: '4px', paddingTop: '6px', backgroundColor: `${backgroundColor}`, color: `${cellColor}`, width: '100%', height: '100%' }}
              onKeyDown={e => this.onKeyDownDiv(e, sName)}
              onCut={e => e.preventDefault()}
              onPaste={e => e.preventDefault()}
              // suppressContentEditableWarning
              // contentEditable="true"
              onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null}
            > {sValue}</div>}
          {bShow}{imgBox}
        </div>);
      } else {
        res = (<div
          className={`${styles.tdCell} listDiv`}
          style={{
            position: 'relative', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: `${cellColor}`, backgroundColor: `${backgroundColor}`, textAlign: `${displayAlign}`,
          }}
          data-name={showConfig.sName}
          data-control-name={showConfig.sControlName}
        >
          {(commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === 'b') || (imgBox !== '') ? '' :
            <Tooltip
              arrow={false}
              placement='bottomLeft'
              overlayClassName="commonTitle"
              mouseEnterDelay={0.8}
              title={<span style={{ fontSize: 16 }}>{sValue}</span>}
            >
              <span
                className={linkStyle}
                style={{ border: 'none', outline: 'none' }}
                onKeyDown={e => this.onKeyDownDiv(e, sName)}
                onCut={e => e.preventDefault()}
                onPaste={e => e.preventDefault()}
                // suppressContentEditableWarning
                // contentEditable="true"
                onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null}
              > {sValue}</span>
            </Tooltip>
          }
          {bShow}{imgBox}{this.handleGetFastSearchBtn({ record, sName, isSlaveInfo })}
        </div>);
      }
      const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
      return cell;
    } else if (commonUtils.isNotEmptyObject(showConfigObj) && !showConfigObj.bReadonly && (props.enabled || showConfigObj.iTag === 3)
      && commonUtils.isEmptyObject(record.sDivRowNew) && (commonUtils.isNotEmptyArr(props.selectedRowKeys)
        && props.selectedRowKeys.toString().includes(record.sId) || props.name === 'sParam'
        || (props.name === 'slaveInfo' && commonUtils.isNotEmptyArr(props.selectedRowKeys) && props.selectedRowKeys.toString().includes(record.sSlaveId) && showConfigObj.iTag === 3))
      || (this.getShowTypeProps(props, text, record, sName)?.enabled && record.sId === this.state.currentHoverSid)
      || (false && location.pathname.includes('productionScheduleTree') && this.getShowTypeProps(props, text, record, sName)?.enabled && record.sId === props.rowHoverSid)
      || (props.rootType === 'list' && props.selectedRowKeys.toString().includes(record.sSlaveId))) {
      res = (<ShowTypeNew {...this.getShowTypeProps(props, text, record, sName)} />);
      // 人检-质检代码特殊处理
      res = this.handleGetRjRes(res, index, sName);
      const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
      return cell;
    } else if (props.bSParamTable && sName === 'sParamValue' && commonUtils.isNotEmptyObject(record.sDropDownData)) {
      const showTypeProps = this.getShowTypeProps(props, text, record, sName);
      const sDropDownDataStr = commonUtils.convertObjToStr(record.sDropDownData);
      if (sDropDownDataStr) {
        showTypeProps.showConfig.sDropDownType = 'const';
        showTypeProps.showConfig.showDropDown = sDropDownDataStr;
        showTypeProps.onChange = (...args) => {
          props.onDataChange(...args, record);
        }
      }
      res = (<ShowTypeNew {...showTypeProps} />);
      const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
      return cell;
    } else {
      const showConfig = this.getShowConfig(props, sName);

      /* 获取单元格颜色配置 */
      let cellColor = '';
      let backgroundColor = '';
      if (commonUtils.isNotEmptyArr(showConfig)) {
        const cellStyle = this.getCellColorConfig(text, record, sName);
        if (commonUtils.isNotEmptyObject(cellStyle.styleColorArrTotal) || commonUtils.isNotEmptyObject(cellStyle.styleColorArrTotalB)) {
          cellColor = cellStyle.styleColorArrTotal;
          backgroundColor = cellStyle.styleColorArrTotalB;
        }
      }

      let sValue = record[sName];
      /* 判断如果是日期格式，则根据配置进行时间格式format转化 */
      const firstDataIndex = commonUtils.isNotEmptyObject(sName) ? sName.substring(0, 1) : ''; /*   控件首字母(数据格式:字符串)   */
      if (firstDataIndex === 't' || firstDataIndex === 'p' || firstDataIndex === 'm') {
        const { sDateFormat } = showConfig;
        if (!commonUtils.isEmpty(sValue)) {
          if (commonUtils.isNotEmptyStr(sDateFormat)) {
            sValue = moment(sValue).format(sDateFormat);
          } else {
            sValue = moment(sValue).format(props.getDateFormat());
          }
        }
      } else if (firstDataIndex === 'd' && !props.enabled) {
        const { sDateFormat } = showConfig;
        /* 如果配置时间格式中设置了0.0000则以配置为准，没有设置时间格式 则以系统设定为主 */
        if (commonUtils.isNotEmptyObject(sDateFormat)) {
          /* 取小数点位数 */
          let point = 0;
          let strIndex = sDateFormat.indexOf('.');
          if (strIndex > -1 && sDateFormat.length > 1) {
            point = sDateFormat.substring(strIndex + 1, sDateFormat.length).length;
            if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
              const dConfigResult = commonUtils.convertFixNum(Number(sValue), point).toFixed(point);
              if (!isNaN(dConfigResult)) {
                sValue = dConfigResult;
              }
            }
          }
        } else {
          if (firstDataIndex === 'd' && sName.toLowerCase().endsWith('price')) {  /* 列表单价格式化显示 */
            if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
              const dResult = commonUtils.convertFixNum(Number(sValue), dNetPrice).toFixed(dNetPrice);
              if (!isNaN(dResult)) {
                sValue = dResult;
              }
            }
          } else if (firstDataIndex === 'd' && sName.toLowerCase().endsWith('money')) {  /* 列表金额格式化显示 */
            if (commonUtils.isNotEmptyNumber(sValue) && sValue !== null) {
              const dResult = commonUtils.convertFixNum(Number(sValue), dNetMoney).toFixed(dNetMoney);
              if (!isNaN(dResult)) {
                sValue = dResult;
              }
            }
          }
        }
      }

      let linkStyle = ''; /* 设置当从表表格没被选中时的弹窗样式 */
      if (showConfig.sDropDownType !== 'popup' && !commonUtils.isEmpty(showConfig.sActiveId) && !commonUtils.isEmpty(showConfig.sActiveKey) && (commonUtils.isNotEmptyObject(sValue) || commonUtils.isNotEmptyNumber(sValue))) {
        linkStyle = 'linksActiveIdStyle';
      }
      if (showConfig.sDropDownType === 'const') {
        let showDropDown = [];
        if (typeof showConfig.showDropDown === 'object') {
          showDropDown = showConfig.showDropDown;
        } else {
          if (commonUtils.isJSON(showConfig.showDropDown)) {
            showDropDown = commonUtils.objectToArr(commonUtils.convertStrToObj(showConfig.showDropDown));
          }
        }
        let iIndex = commonUtils.isEmpty(record[sName]) ? -1 : showDropDown.findIndex(item => item.sId === record[sName].toString());
        if (iIndex === -1 && record[sName] === '') {
          iIndex = showDropDown.findIndex(item => item.sId === '');
        }
        sValue = iIndex > -1 ? showDropDown[iIndex].value : record[sName];
      }
      let clickEvent = '';
      /* 选择合版产品弹窗 */
      const sModelsType = commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) ? props.app.currentPane.sModelsType : '';
      const combinedInfo = commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) ? commonFunc.showMessage(props.app.commonConst, 'CombinedInfo') : '合版信息';

      const pleaseSelect = commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'pleaseSelect') : '请选择';

      if (commonUtils.isNotEmptyObject(sName) && (sName === 'sCombinedMemo' || sName === 'sCombineProductNameNew' || sName === 'sColorSerialMemo' || sName === 'sPositiveColor' || sName === 'sOppositeColor' || sName === 'sParams' || sName === 'sParamsNew' || sName === 'sQuoParams' || (commonUtils.isNotEmptyObject(sModelsType) && !sModelsType.includes('Set') && sName === 'sCombinePartsNameNew'))) {
        linkStyle = 'linksActiveIdStyle';
        clickEvent = 'onViewChoose';
        if (sName === 'sCombinedMemo') {
          let JsonData = [];
          if (commonUtils.isNotEmptyObject(sValue)) {
            try {
              JsonData = JSON.parse(sValue);
            } catch (e) {
              JsonData = [];
            }
          }
          /* 将合版信息json解析成需要的字符串形式 */
          let sCombinedMemo = '';
          if (commonUtils.isNotEmptyArr(JsonData)) {
            JsonData.forEach((item) => {
              sCombinedMemo += `${item.sProductNo}:排${item.dCombineQty}个,`;
            });
            sCombinedMemo = commonUtils.isNotEmptyObject(sCombinedMemo) ? sCombinedMemo.substr(0, sCombinedMemo.length - 1) : '';
            sValue = sCombinedMemo;
          }
        } else if (sName === 'sColorSerialMemo' || sName === 'sPositiveColor' || sName === 'sOppositeColor') {
          let JsonData = [];
          if (commonUtils.isNotEmptyObject(sValue)) {
            try {
              JsonData = JSON.parse(sValue);
            } catch (e) {
              try {
                JsonData = JSON.parse(sValue.replace(/'/g, '"'));
              } catch (error) {
                JsonData = [];
              }
            }
          }
          /* 将颜色json解析成需要的字符串形式 */
          let sMemo = '';
          if (commonUtils.isNotEmptyArr(JsonData)) {
            JsonData.forEach((item) => {
              sMemo += `${item.sName}+`;
            });
            sMemo = commonUtils.isNotEmptyObject(sMemo) ? sMemo.substr(0, sMemo.length - 1) : '';
            sValue = sMemo;
          }
        } else if (sName === 'sParams' || sName === 'sQuoParams' || sName === 'sParamsNew') {
          if (props.onGetParamsValue) {
            // 页面自行处理sparams的sValue
            sValue = props.onGetParamsValue({ sName, sValue, record });
          } else {
            let JsonData = [];
            if (commonUtils.isNotEmptyObject(sValue)) {
              try {
                JsonData = JSON.parse(sValue);
              } catch (e) {
                try {
                  JsonData = JSON.parse(sValue.replace(/'/g, '"'));
                } catch (error) {
                  JsonData = [];
                }
              }
            }
            /* 将sParams的json解析成需要的字符串形式 */
            let sParamStr = '';
            if (commonUtils.isNotEmptyArr(JsonData)) {
              JsonData.forEach((item) => {
                if (item.bSelfCbx) {
                  const strValue = commonUtils.isNotEmptyObject(item.sParamValue) ? item.sParamValue : '';
                  sParamStr += `${item.sParamName}:${strValue},`;
                }
              });
              sParamStr = commonUtils.isNotEmptyObject(sParamStr) ? sParamStr.substr(0, sParamStr.length - 1) : '';
              sValue = sParamStr;
            } else {
              sValue = '';
            }
          }
        }
        sValue = commonUtils.isEmpty(sValue) ? sName === 'sCombinedMemo' ? combinedInfo : pleaseSelect : sValue;
      } else if ((!props.enabled) && sName.indexOf('Memo') > -1 && showConfigObj.iTag !== 3) {
        linkStyle = 'linksActiveIdStyle';
        clickEvent = 'onMemoShow';
        sValue = commonUtils.isEmpty(sValue) ? '' : sValue;
        const regex = /<[^>]*>/g;
        sValue = sValue.replace(regex, '');
      } else if ((!props.enabled) && showConfigObj.sControlName && showConfigObj.sControlName.toLowerCase().indexOf('memo') > -1 && showConfigObj.iTag !== 3) {
        linkStyle = 'linksActiveIdStyle';
        clickEvent = 'onMemoShow';
        sValue = commonUtils.isEmpty(sValue) ? '' : sValue;
        const regex = /<[^>]*>/g;
        sValue = sValue.replace(regex, '');
      } else if (["sWorkOrderNo", "sMachineName", 'sChangeMeachine'].includes(sName) && showConfig.sActiveId && showConfig.sDropDownType === "popup") {
        linkStyle = 'linksActiveIdStyle';
        clickEvent = 'onOpenPopupModal';
      }
      /* 如果列表行包含sDivRow并且sDivRow有值 则代表该行行不渲染数据 只做分割作用 */
      if (commonUtils.isNotEmptyObject(record.sDivRowNew) && record.bInsert) {
        bShow = '';
        // linkStyle = 'linksActiveIdStyle';
        if (sValue) {
          const splitArr = sValue ? sValue.toString().split('F') : [];
          if (commonUtils.isNotEmptyArr(splitArr) && splitArr.length > 1) {
            sValue = <span className="noInputInsert">{splitArr[0]} <span style={{ color: '#ff0000' }}> {splitArr[1]}</span> </span>;
          }
        }
      }
      let showQty = '';
      if (!this.props.enabled && location.pathname.includes('quotationPackTableTree') && this.props.name === 'control' && sName === 'dSinglePQty') {
        showQty = <span onClick={this.handleViewClick.bind(this, this.props.name, showConfig.sName, record, index, showConfig)} style={{ position: 'absolute', right: '2px' }}><EyeOutlined /></span>
      } else if (sName === 'sSaveProName' || sName === 'sDeleteProName' || sName === 'sSaveProNameBefore' || sName === 'sProcName') {
        /* 增删改存业务处理 加查看眼睛 */
        sValue = <span> {sValue}<span onClick={this.handleOpenWin.bind(this, this.props.name, showConfig.sName, record, index, showConfig)} style={{ position: 'absolute', right: '2px' }}><EyeOutlined /></span> </span>
      } else if (sName === 'dNeedAuxiliaryQty' && showConfig.sControlName && showConfig.sControlName !== 'slaveInfo') { /* 净需求 */
        /* 增删改存业务处理 加查看眼睛 */
        sValue = <span> {sValue}<span onClick={this.handleRightArrow.bind(this, this.props.name, showConfig.sName, record, index, showConfig)} style={{ position: 'absolute', right: '2px' }}><RightOutlined /></span> </span>
      }
      /* 只读字段置灰 */
      const isColorInclude = this.rowColorData.current?.find(i => i && i?.key === record?.[this.rowKey]);
      let bReadonlyField = false;
      if ((showConfig.bReadonly || showConfig.iTag === 1) && commonUtils.isEmptyStr(backgroundColor) && !isColorInclude) {
        backgroundColor = '#f1f2f8';
        bReadonlyField = true;
      }
      if (backgroundColor && !this.props.slaveInfo) {
        this.hasSpanBgColor = true;
      }

      res = (<span
              className={`noInput readonlySpanStyle ${bReadonlyField ? "readonlyField" : ""}`}
              style={{ color: `${cellColor}`, backgroundColor: `${backgroundColor}` }}
              data-name={showConfig.sName}
              data-control-name={showConfig.sControlName}
            > {(commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === 'b') || (imgBox !== '') ? '' :
        <Tooltip
          placement={bSpecialTitle ? 'right' : 'bottomLeft'}
          overlayClassName={bSpecialTitle ? 'commonSpecialTitle' : 'commonTitle'}
          mouseEnterDelay={0.8}
          title={<span style={{ fontSize: 16 }}>{commonUtils.isNotEmptyObject(specialTitle) ? specialTitle : sValue}</span>}
        >
          <span
            className={linkStyle}
            onKeyDown={e => this.onKeyDownDiv(e, sName)}
            suppressContentEditableWarning
            contentEditable="true"
            onClick={
              commonUtils.isNotEmptyObject(linkStyle)
                ? clickEvent === "onViewChoose"
                  ? this.handleViewChoose.bind(
                    this,
                    this.props.name,
                    showConfig.sName,
                    record,
                    index
                  )
                  : clickEvent === "onMemoShow"
                    ? this.handleMemoShow.bind(
                      this,
                      this.props.name,
                      showConfig.sName,
                      record,
                      index,
                      showConfig
                    )
                    : clickEvent === "onOpenPopupModal"
                      ? this.handleFieldPopupModal.bind(this, showConfig, sName, record)
                      : this.handleViewClick.bind(
                        this,
                        this.props.name,
                        showConfig.sName,
                        record,
                        index,
                        showConfig
                      )
                : null
            }
          > {sValue}</span>
        </Tooltip>
      }{bShow}{imgBox}{showQty}</span>
      );

      // 人检-质检代码特殊处理
      res = this.handleGetRjRes(res, index, sName);

      const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
      return cell;
    }
  };

  /**   willProps赋值   * */
  assignmentWillProps = (props) => {
    // 重构修改 去除filteredData;
    const {
      dataSource, totalData, totalData1, selectedRowKeys, enabled, headerColumn, previewImage, previewVisible, tableColumn, slaveInfoHeaderColumn, searchText, slaveInfoSelectedRowKeys, expKeys,
    } = this.state;
    const stateValue = {};
    this.computedTableHeight();
    this.sticky = this.props.tableProps.sticky ? this.props.tableProps.sticky : false;
    if (props.expKeys !== undefined && JSON.stringify(expKeys) !== JSON.stringify(props.expKeys) && !this.showExpAll) {
      stateValue.expKeys = [...props.expKeys];
      this.currentExpKeys = stateValue.expKeys;
    }
    /*   表头信息(数据类型:数组对象)   */
    if (props.headerColumn !== undefined && props.config) {
      const storageColumn = JSON.parse(sessionStorage.getItem(`${props.formId}_${props.config.sId}`));
      if (storageColumn) {
        const columnArry = storageColumn;
        for (const i in columnArry) {
          for (const j in props.headerColumn) {
            if (!commonUtils.isEmpty(columnArry[i])) {
              if (!commonUtils.isEmpty(columnArry[i].children)) {
                for (const m in columnArry[i].children) {
                  if (columnArry[i].children[m].dataIndex === props.headerColumn[j].dataIndex) {
                    props.headerColumn[j].width = columnArry[i].children[m].width;
                  }
                }
              } else if (columnArry[i].dataIndex === props.headerColumn[j].dataIndex) {
                props.headerColumn[j].width = columnArry[i].width;
              }
            }
          }
        }
      }
      stateValue.headerColumn = [...props.headerColumn].map(item => {
        const result = item;
        if (!item.width) {
          item.width = 120;
        } else if (typeof item.width === 'string') {
          item.width = parseInt(item.width);
        }
        return result;
      });

      // 给headerColumn加一个空的列来自适应表格宽度
      const hasTableLastEmpty = stateValue.headerColumn.find(item => item.dataIndex === 'tableLastEmpty');
      if (!hasTableLastEmpty) {
        stateValue.headerColumn.push({
          with: undefined,
          title: '',
          dataIndex: 'tableLastEmpty',
          bReadonly: true,
          bNotResize: true,
        })
      }

      /*   showType附加于表格中  */
      for (const child of stateValue.headerColumn) {
        child.render = (text, record, index) => this.bindShowType(props, text, record, child.dataIndex, index);
      }
    }
    if (!this.props.skipSlaveInfo && props.slaveInfo !== undefined && props.slaveInfo.headerColumn !== undefined && props.config) { // commonUtils.isNotEmptyArr(props.data) 不能用函数不然新增时置空后不能更新数据
      // && JSON.stringify(headerColumn) !== JSON.stringify(props.headerColumn)
      if (JSON.parse(sessionStorage.getItem(`${props.formId}_${props.config.sId}_info`))) {
        const columnArry = JSON.parse(sessionStorage.getItem(`${props.formId}_${props.config.sId}_info`));
        for (const i in columnArry) {
          for (const j in props.slaveInfo.headerColumn) {
            if (!commonUtils.isEmpty(columnArry[i])) {
              if (!commonUtils.isEmpty(columnArry[i].children)) {
                for (const m in columnArry[i].children) {
                  if (columnArry[i].children[m].dataIndex === props.slaveInfo.headerColumn[j].dataIndex) {
                    props.slaveInfo.headerColumn[j].width = columnArry[i].children[m].width;
                  }
                }
              } else if (columnArry[i].dataIndex === props.slaveInfo.headerColumn[j].dataIndex) {
                props.slaveInfo.headerColumn[j].width = columnArry[i].width;
              }
            }
          }
        }
      }
      stateValue.slaveInfoHeaderColumn = [...props.slaveInfo.headerColumn];
      /*   showType附加于表格中  */
      for (const child of stateValue.slaveInfoHeaderColumn) {
        child.render = (text, record, index) => this.bindShowType(props, text, record, child.dataIndex, index);
      }
    }
    /*   是否显示上传控件(数据格式:布尔)   */
    this.isUploadShow = this.findIsExistByControlName(props, 'BtnUpload');
    /*   是否显示查看控件(数据格式:布尔)   */
    this.isLookShow = this.findIsExistByControlName(props, 'BtnLook');
    /*   是否显示新增控件(数据格式:布尔)   */
    this.isAddShow = this.findIsExistByControlName(props, 'BtnAdd');
    /*   是否显示modal控件(数据格式:布尔)   */
    this.isModalShow = this.findIsExistByControlName(props, 'BtnChooseMaterials');
    /*   是否显示ChooseProcess控件(数据格式:布尔)   */
    this.isChooseProcessShow = this.findIsExistByControlName(props, 'BtnChooseProcess');
    /*   是否显示复制控件(数据格式:布尔)   */
    this.isCopyShow = this.findIsExistByControlName(props, 'BtnCopy');
    /*   是否显示复制全部控件(数据格式:布尔)   */
    this.isCopyAllShow = this.findIsExistByControlName(props, 'BtnCopyAll');
    /*   是否显示复制全部控件(数据格式:布尔)   */
    this.isCopyMoreShow = this.findIsExistByControlName(props, 'BtnCopyMore');
    /*   是否显示删除控件(数据格式:布尔)   */
    this.isDelShow = this.findIsExistByControlName(props, 'BtnDel');
    // /*   上传后执行函数(数据格式:函数)   */
    // this.onUploadChange = props.onUploadChange;
    /*   是否可以进行行移动  */
    // this.isDragAndDrop = false; // props.isDragAndDrop;
    this.isDragAndDrop = props.isDragAndDrop; // props.isDragAndDrop;
    /*   是否可以弹窗 */
    this.isPopupShow = this.findIsExistByControlPopup(props, 'BtnPopup');
    this.isParamShow = this.findVisibleControlName(props, 'BtnShowParam');

    /*   是否可以成品工序 */
    if (commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.tableProps) && props.tableProps.bShowProductProcess !== undefined) {
      this.isChooseProductProcess = props.tableProps.bShowProductProcess;
    }
    /*   是否可以成品材料 */
    if (commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyObject(props.tableProps) && props.tableProps.bShowProductMaterials !== undefined) {
      this.isChooseProductMaterials = props.tableProps.bShowProductMaterials;
    }
    /*   table表头信息(数据类型:数组对象)   */
    if (props.headerColumn !== undefined && (commonUtils.isNotEmptyArr(stateValue.headerColumn) || (enabled !== props.enabled))) {
      if (commonUtils.isNotEmptyArr(stateValue.headerColumn)) {
        stateValue.tableColumn = this.getTableColumn(stateValue.headerColumn, 'filter', props);
      } else {
        stateValue.tableColumn = this.getTableColumn(headerColumn, 'filter', props);
      }
    }

    /*   table表头信息(数据类型:数组对象)   */
    if (!this.props.skipSlaveInfo && props.slaveInfo !== undefined && props.slaveInfo.headerColumn !== undefined && (commonUtils.isNotEmptyArr(props.slaveInfo.headerColumn) || (enabled !== props.enabled))) {
      stateValue.slaveInfoHeaderColumn = props.slaveInfo.headerColumn;
      /*   showType附加于表格中   */
      for (const child of stateValue.slaveInfoHeaderColumn) {
        child.render = (text, record, index) => this.bindShowType(props.slaveInfo, text, record, child.dataIndex, index, true);
      }
      if (commonUtils.isNotEmptyArr(props.slaveInfo.headerColumn)) {
        if (commonUtils.isNotEmptyArr(stateValue.slaveInfoHeaderColumn)) {
          stateValue.tableInfoColumn = this.getTableColumn(stateValue.slaveInfoHeaderColumn, 'filter', props.slaveInfo);
        } else {
          stateValue.tableInfoColumn = this.getTableColumn(slaveInfoHeaderColumn, 'filter', props.slaveInfo);
        }
      }
      stateValue.slaveInfo = props.slaveInfo;
    }

    /*   表格宽度统计值(数据格式:整形)   */
    if (commonUtils.isNotEmptyArr(stateValue.headerColumn)) {
      this.scrollX = 0;
      this.scrollX = this.countScrollX(stateValue.headerColumn);
    }
    if (commonUtils.isNotEmptyArr(stateValue.slaveInfoHeaderColumn)) {
      this.scrollInfoX = this.countScrollX(stateValue.slaveInfoHeaderColumn, true);
    }
    /*   窗体Id(数据格式:字符串)   */
    if (commonUtils.isEmptyStr(this.formId)) {
      this.formId = props.formId;
    }
    /*   主表Id(数据格式:字符串)   */
    if (commonUtils.isEmptyStr(this.sId)) {
      this.sId = props.sId;
    }

    if (props.data !== undefined && JSON.stringify(dataSource) !== JSON.stringify(props.data)) { // commonUtils.isNotEmptyArr(props.data) 不能用函数不然新增时置空后不能更新数据
      stateValue.dataSource = [...props.data];
    }

    /* 合计行数据 *//*   数据(数据格式:数组对象)   */
    if (props.totalData !== undefined && JSON.stringify(totalData) !== JSON.stringify(props.totalData) && !this.props.enabled) { // 要用this. this.props.enabled
      if (props.totalData.length > 0) {
        stateValue.totalData = [...props.totalData];
        if (commonUtils.isEmptyArr(stateValue.totalData)) {
          stateValue.totalData.push({});
        }
        stateValue.totalData[0].bSum = true;
        stateValue.totalData[0].key = '0000';
      } else {
        stateValue.totalData = [];
      }
    }

    // 总计
    if (props.formId === '101111519916710024055720' && props.totalData1 !== undefined && JSON.stringify(totalData1) !== JSON.stringify(props.totalData1) && !this.props.enabled) {
      stateValue.totalData1 = props.totalData1;
    }

    if (props.selectedRowKeys !== undefined && JSON.stringify(selectedRowKeys) !== JSON.stringify(props.selectedRowKeys)) {
      stateValue.selectedRowKeys = [...props.selectedRowKeys];
    }

    if (props.slaveInfo !== undefined && props.slaveInfo.selectedRowKeys !== undefined && JSON.stringify(slaveInfoSelectedRowKeys) !== JSON.stringify(props.slaveInfo.selectedRowKeys)) {
      stateValue.slaveInfoSelectedRowKeys = [...props.slaveInfo.selectedRowKeys];// [...props.slaveInfo.selectedRowKeys];
    }

    // 重构修改
    // if (props.filteredValue !== undefined && JSON.stringify(filteredValue) !== JSON.stringify(props.filteredValue)) {
    if (props.filteredValue !== undefined) {
      stateValue.filteredValue = props.filteredValue !== undefined ? [...props.filteredValue] : [];
      if (commonUtils.isNotEmptyArr(stateValue.tableColumn)) {
        stateValue.tableColumn[0].filteredValue = stateValue.filteredValue;
      } else if (commonUtils.isNotEmptyArr(tableColumn)) {
        stateValue.tableColumn = tableColumn;
        stateValue.tableColumn[0].filteredValue = stateValue.filteredValue;
      }
    }

    if (enabled !== props.enabled) {
      stateValue.enabled = props.enabled;
    }
    if (searchText !== props.searchText) {
      stateValue.searchText = props.searchText;
    }
    if (props.enabled) {
      const { config, name, rootType } = this.props;
      if (commonUtils.isNotEmptyObject(config)) {
        const productionRoute = (commonUtils.isNotEmptyObject(props.app.currentPane) && commonUtils.isNotEmptyObject(props.app.currentPane.route) && props.app.currentPane.route.includes('productionSchedule'));
        if (productionRoute) {  /* 生产排程对选中行进行汇总 */
          this.handleSumOtherColumn(props.config, props.data);
        } else if (rootType === 'list') {
          if (commonUtils.isNotEmptyObject(props) && commonUtils.isNotEmptyArr(props.totalData)) {
            const addState = {};
            addState.totalData = props.totalData;
            this.setState({ ...addState })
          }
        } else if (name === 'slaveChild') {
          this.handleSumChildColumn(props.config, props.data);
        } else {
          this.handleSumAllColumn(props.config, props.data);
        }
      }
    }
    if (previewImage !== props.previewImage) {
      stateValue.previewImage = props.previewImage;
    }
    if (props.previewVisible !== undefined && previewVisible !== props.previewVisible) {
      stateValue.previewVisible = props.previewVisible;
    }
    function compare(property) {
      return function (a, b) {
        const value1 = a[property];
        const value2 = b[property];
        return value1 - value2;
      };
    }
    if (this.props.config) {
      if (commonUtils.isJSON(sessionStorage.getItem(`${this.props.formId}_${this.props.config.sId}_headerColumns`)) && stateValue.tableColumn) {
        const sortArr = JSON.parse(sessionStorage.getItem(`${this.props.formId}_${this.props.config.sId}_headerColumns`));
        let addTableColumn = [];
        stateValue.tableColumn.forEach((item, index) => {
          if (stateValue.tableColumn[index].children && stateValue.tableColumn[index].children.length) {
            const childrenSortArr = [];
            const childrenDataIndexArr = [];
            item.children = item.children.map(child => { return { ...child, ...{ sortIndex: sortArr.indexOf(child.dataIndex) } } }).sort(compare('sortIndex'));
            item.children.forEach((child, childIndex) => {
              const currentSort = sortArr.indexOf(child.dataIndex);
              if (childIndex === 0) {
                childrenSortArr.push([currentSort]);
                childrenDataIndexArr.push([child.dataIndex]);
              } else {
                const iIndex = childrenSortArr.findIndex(arrItem => arrItem.includes(currentSort - 1) || arrItem.includes(currentSort + 1));
                if (iIndex !== -1) {
                  childrenSortArr[iIndex].push(currentSort);
                  childrenDataIndexArr[iIndex].push(child.dataIndex);
                } else {
                  childrenSortArr.push([currentSort]);
                  childrenDataIndexArr.push([child.dataIndex]);
                }
              }
            });
            if (childrenSortArr.length > 1) {
              const newColumnList = [];
              childrenSortArr.forEach((sortArrItem, sortArrIndex) => {
                newColumnList[sortArrIndex] = {
                  ...stateValue.tableColumn[index],
                  children: stateValue.tableColumn[index].children.filter(child => childrenDataIndexArr[sortArrIndex].includes(child.dataIndex)),
                  sortIndex: Math.min(...sortArrItem)
                }
              });
              addTableColumn = [...addTableColumn, ...newColumnList];
              stateValue.tableColumn[index].delete = true;
            } else {
              stateValue.tableColumn[index].sortIndex = Math.min(...childrenSortArr[0]);
            }
          } else {
            stateValue.tableColumn[index].sortIndex = sortArr.indexOf(item.dataIndex);
          }
        });
        stateValue.tableColumn = stateValue.tableColumn.filter(item => !item.delete); // 删除需要分割的双层表头
        stateValue.tableColumn = [...stateValue.tableColumn, ...addTableColumn]; // 将分割后的双层表头加回去
        stateValue.tableColumn = stateValue.tableColumn.sort(compare('sortIndex'));
        // 合并一级表头相同的相邻的column
        stateValue.tableColumn = stateValue.tableColumn.reduce((prev, cur) => {
          if (prev.length) {
            const prevColumn = prev[prev.length - 1];
            if (commonUtils.isNotEmptyArr(prevColumn.children) && commonUtils.isNotEmptyArr(cur.children) && prevColumn.title === cur.title) {
              prevColumn.children = [...prevColumn.children, ...cur.children];
              prev[prev.length - 1] = prevColumn;
              return prev;
            } else {
              prev.push(cur);
              return prev;
            }
          } else {
            prev.push(cur);
            return prev;
          }
        }, []);
      }
      if (commonUtils.isJSON(sessionStorage.getItem(`${this.props.formId}_${this.props.config.sId}_info_headerColumns`)) && stateValue.tableInfoColumn) {
        const sortArr = JSON.parse(sessionStorage.getItem(`${this.props.formId}_${this.props.config.sId}_info_headerColumns`));
        stateValue.tableInfoColumn.forEach((item, index) => {
          stateValue.tableInfoColumn[index].sortIndex = sortArr.indexOf(item.dataIndex);
        });
        stateValue.tableInfoColumn = stateValue.tableInfoColumn.sort(compare('sortIndex'));
      }
    }

    if (enabled) {
      const { sumGroup = {}, totalDataNew: totalDataNew0 = [{}] } = this.state;
      const { dNetMoney, dNetPrice } = this.props.app.decimals;
      let totalDataNew = [...totalDataNew0];
      const sumData = {};
      Object.keys(sumGroup).forEach(sName => {
        if (sumGroup[sName].length) {
          const sum = sumGroup[sName].reduce((pre, cur) => {
            const curData = this.props.data.find(item => item[this.rowKey] === cur);
            if (curData) {
              let tempValue = 0;
              if (sName.toLowerCase().endsWith('price')) { /*   价格   */
                tempValue = commonUtils.convertFixNum(commonUtils.convertFixNum(commonUtils.isNull(curData[sName], 0), dNetPrice) + commonUtils.convertFixNum(commonUtils.isNull(pre, 0), dNetPrice), dNetPrice);
              } else { /*   金额   */
                tempValue = commonUtils.convertFixNum(commonUtils.convertFixNum(commonUtils.isNull(curData[sName], 0), dNetMoney) + commonUtils.convertFixNum(commonUtils.isNull(pre, 0), dNetMoney), dNetMoney);
              }
              return tempValue;
            }
            return pre;
          }, 0);

          sumData[sName] = sum;
        }
      });

      totalDataNew = [{ ...totalData[0], ...sumData }];
      stateValue.totalDataNew = totalDataNew;
    }

    if (this.mounted) {
      this.setState(stateValue);
      // 生成merge maps;
      this.genMergeCellStateMap();
      if (this.props.slaveInfo) {
        this.genMergeInfoCellStateMap();
      }
      // 生成cell list
      this.genMergeListStateMap();
      if (this.props.slaveInfo) {
        this.genMergeInfoListStateMap();
      }
    }
  };

  /** 计算表格高度  * */
  computedTableHeight = () => {
    let tableHeaderHeight = this.hasMergeHeader ? 58 : 29;
    if (commonUtils.isNotEmptyArr(this.props.headerColumn) && this.props.headerColumn && this.props.headerColumn.find(item => commonUtils.isNotEmptyObject(item.title) && item.title.indexOf('-') != -1)) {
      tableHeaderHeight = 58;
    }
    // const footerHeight = (this.state.totalData.length && this.props.footer === undefined) ? 29 : 0;
    const footerHeight = commonUtils.isNotEmptyArr(this.state.totalData1) ? 58 : 29;
    if (this.props.tableProps.AutoTableHeight) {
      this.scrollY = this.props.tableProps.AutoTableHeight;
      this.tableHeight = this.props.tableProps.AutoTableHeight == '100%' ? '100%' : this.props.tableProps.AutoTableHeight + tableHeaderHeight + footerHeight;
      return;
    }

    const paneKey = this.props.app.currentPane.key;
    let searchMainFormDom = document.getElementsByClassName(`searchMainForm_${paneKey || 0}`)[0];
    if (searchMainFormDom && location.pathname?.includes('commonCostomTabBill')) {
      searchMainFormDom = searchMainFormDom.parentNode;
    }
    const searchComponentDom = document.getElementsByClassName(`searchComponentContainer_${paneKey || 0}`)[0];
    const searchMainFormHeight = searchMainFormDom ? searchMainFormDom.offsetHeight + 50 : 0; // 搜索栏的高度;
    const searchComponentHeight = searchComponentDom ? 44 : 0;
    const offsetHeight = this.props.offsetHeight ? this.props.offsetHeight : 0;
    // 页面切换时searchMainFormDom的高度会为0，此时计算的tableHeight会不对
    if (searchMainFormDom && searchMainFormDom.offsetHeight === 0) {
      return;
    }
    // 区分bill页面是否包含tab;
    if (this.scrollY && (!searchMainFormHeight && !searchComponentHeight && !offsetHeight)) {
      return;
    }
    const tabHeight = 89;
    const paginationHeight = this.props.tableProps.pagination ? 60 : 0;
    let extraHeight = 0; /* 额外的区域 */
    if (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.includes('commonListTab')) {     /* 带Tab页签的列表 */
      /* 有从表高度100，没有高度20 */
      const hasSlave = document.getElementsByClassName('hasSlave');
      if (commonUtils.isNotEmptyArr(hasSlave)) {
        extraHeight = 220;
      } else {
        extraHeight = 20;
      }
    }

    if (this.props?.masterConfig?.sTableColorTs) {
      extraHeight += this.colorInfo?.getBoundingClientRect()?.height || 80;
      if (location.pathname?.includes('productionScheduleTree')) {
        extraHeight -= 34;
      }
    } else {
      extraHeight += paginationHeight;
    }

    const tableHeight = window.innerHeight - tabHeight - searchMainFormHeight - searchComponentHeight - tableHeaderHeight - footerHeight - offsetHeight - extraHeight;
    this.scrollY = tableHeight;
    this.tableHeight = tableHeight + tableHeaderHeight + footerHeight;
  }

  /**  计算th宽度（实现隐藏空td）   */
  computedTdWidth = (refresh) => {
    if (!this.props.formId || !this.props.config) {
      return;
    }
    if (!this.mydivFlag || refresh) { // 表格初始化或屏幕size改变时触发
      this.mydivTime = 0;
      clearInterval(this.mydivTimer);
      this.mydivTimer = null;
      // 最多执行10次（处理有时候dom加载慢问题）
      this.mydivTimer = setInterval(() => {
        this.mydivTime++;
        if (!this.mydiv || this.mydivTime > 10) {
          clearInterval(this.mydivTimer);
          this.mydivTimer = null;
          return;
        }
        const { tableColumn, headerColumn } = this.state;
        const sessionColumn = sessionStorage.getItem(`${this.props.formId}_${this.props.config.sId}`);
        const column = sessionColumn ? JSON.parse(sessionColumn) : tableColumn;
        const oCol = this.mydiv.querySelector('colgroup');
        const oCols = oCol ? oCol.childNodes : [];
        const oColsWithList = Array.from(oCols).filter(item => !item.className).map(item => item.style.width);
        const tableLastEmptyIndex = column.findIndex(item => item.dataIndex === 'tableLastEmpty');
        if (tableLastEmptyIndex > 0 && oColsWithList[tableLastEmptyIndex]) {
          const iIndex = tableLastEmptyIndex - 1; // tableColumn最后一位
          this.mydivFlag = true;
          clearInterval(this.mydivTimer);
          this.mydivTimer = null;
          const headerColumnNew = [...headerColumn];
          const columnNew = [...column];
          const columnExtraSize = column.reduce((result, cur) => {
            if (commonUtils.isNotEmptyArr(cur.children)) {
              result += (cur.children.length - 1);
            }
            return result;
          }, 0)
          const widthExtra = parseInt(oColsWithList[tableLastEmptyIndex + columnExtraSize]);
          if (commonUtils.isNotEmptyArr(columnNew[iIndex].children)) { // 最后一个是双层表头
            const lastChildIndex = columnNew[iIndex].children.length - 1;
            columnNew[iIndex].children[lastChildIndex].width += widthExtra;
            if (!columnNew[iIndex].children[lastChildIndex].widthExtra) {
              columnNew[iIndex].children[lastChildIndex].widthExtra = 0;
            }
            columnNew[iIndex].children[lastChildIndex].widthExtra += widthExtra;
            const lastChildDataIndex = columnNew[iIndex].children[lastChildIndex].dataIndex;
            const headerIndex = headerColumnNew.findIndex(item => item.dataIndex === lastChildDataIndex);
            if (headerIndex !== -1) {
              headerColumnNew[headerIndex].width = columnNew[iIndex].children[lastChildIndex].width;
              headerColumnNew[headerIndex].widthExtra = columnNew[iIndex].children[lastChildIndex].widthExtra;
            }
          } else { // 单表头
            columnNew[iIndex].width += widthExtra;
            if (!columnNew[iIndex].widthExtra) {
              columnNew[iIndex].widthExtra = 0;
            }
            columnNew[iIndex].widthExtra += widthExtra;
            const headerIndex = headerColumnNew.findIndex(item => item.dataIndex === columnNew[iIndex].dataIndex);
            if (headerIndex !== -1) {
              headerColumnNew[headerIndex].width = columnNew[iIndex].width;
              headerColumnNew[headerIndex].widthExtra = columnNew[iIndex].widthExtra;
            }
          }

          if (sessionColumn && refresh) {
            sessionStorage.setItem(`${this.props.formId}_${this.props.config.sId}`, JSON.stringify(columnNew));
          }
          this.props.onSaveState({
            headerColumn: headerColumnNew,
            tableColumn: columnNew,
          });
          this.props.setHeaderColumn(headerColumnNew);
        }
      }, 100);
    }
  }

  /**  合并表头   */
  mergeTableColumn = (title, column, tableColumn, index, bNotEmpty, styleObj) => {
    this.hasMergeHeader = true;
    /*   '-'之前的内容是父表头s  */
    const parentTitle = title.substring(0, index);
    /*   '-'之后的内容是子表头   */
    const childTitleContent = title.substring(index + 1, title.length);

    const renderTitle = () => {

      const titleCheckBox = this.bCheckBoxColumm({ ...column || {}, title: childTitleContent });
      if (titleCheckBox) {
        return titleCheckBox;
      }

      let childTitle = ''
      if (bNotEmpty) {
        childTitle = <div style={styleObj}><span className="table-title-required">*</span> {childTitleContent}</div>;
      } else {
        childTitle = <div style={styleObj}>{childTitleContent}</div>;
      }
      return childTitle;
    }

    /*   把原有表头都替换成子表头   */
    column.title = renderTitle();
    /*   查看父表头是否已经添加   */
    const parentObj = tableColumn.filter(item => item.title === parentTitle);
    const lastParentObj = commonUtils.isNotEmptyArr(parentObj) ? parentObj[parentObj.length - 1] : {};
    const lastTableColumn = commonUtils.isNotEmptyArr(tableColumn) ? tableColumn[tableColumn.length - 1] : {};

    // 父表头已添加但是不是连续的
    const bPrevObj = commonUtils.isNotEmptyObject(lastParentObj) && lastTableColumn.title != lastParentObj.title;
    /*   [{title:1-1},{title:1-2}]变成[{title:1,children:[{title:1},{title:2}]}]   */
    if (commonUtils.isEmptyObject(lastParentObj) || bPrevObj) { /*   父表头未添加   */
      tableColumn.push({
        title: parentTitle,
        children: [column],
      });
    } else { /*   父表头已添加   */
      lastParentObj.children.push(column);
    }
  }

  /**   合并单元格   */
  mergeTableCell = (text, index, sName, isSlaveInfo, record) => {
    const obj = {
      children: text,
      props: {},
    };
    if (isSlaveInfo) {
      if (this.mergeInfoCellStateMap && this.mergeInfoCellListMap && this.mergeInfoCellStateMap[sName] && this.mergeInfoCellListMap[sName]) {
        this.mergeInfoCellListMap[sName].forEach((item) => {
          item.forEach((item2, idx) => {
            if (idx === 0) {
              if (index === item2) {
                obj.props.rowSpan = item.length + 1;
              }
            } else if (index === item2) {
              obj.props.rowSpan = 0;
            }
            if (index === item[item.length - 1] + 1) {
              obj.props.rowSpan = 0;
            }
          });
        });
      }
    } else if (this.mergeCellStateMap && this.mergeCellListMap && this.mergeCellStateMap[sName] && this.mergeCellListMap[sName]) {
      this.mergeCellListMap[sName].forEach((item) => {
        item.forEach((item2, idx) => {
          if (idx === 0) {
            if (index === item2) {
              obj.props.rowSpan = item.length + 1;
            }
          } else if (index === item2) {
            obj.props.rowSpan = item.length + 1 - idx;
            obj.props.className = 'vlist-td-display vlist-td-display1 ' + obj.props.rowSpan;
          }
          if (index === item[item.length - 1] + 1) {
            obj.props.rowSpan = 1;
            obj.props.className = 'vlist-td-display vlist-td-display2 ' + obj.props.rowSpan;
          }
        });
      });
    }
    obj.props.className = `${obj.props.className || ''}${this.handleGetSumStyle(sName, record)}`;
    return obj;
  }

  /**   处理选择行发生改变   */
  handleSelectRowChange = (name, selectedRowKeys, bCheckBoxClick) => {
    selectedRowKeys = this.handleMutiSelectRowKeys(selectedRowKeys);
    const { chooseProcessParams } = this.props.tableProps; // chooseProcessParams是选择工序中图标按钮点击工序名称表格行出现弹窗
    if (chooseProcessParams) {
      this.props.onSelectRowChange(name, selectedRowKeys, {}, chooseProcessParams);
    } else if (this.props.onSelectRowChange1) {
      this.props.onSelectRowChange1(name, selectedRowKeys, bCheckBoxClick);
    } else {
      this.props.onSelectRowChange(name, selectedRowKeys);
    }
  };

  /**   计算表格总宽度   */
  countScrollX = (headerColumn, isInfo) => {
    if (isInfo && !this.props.slaveInfo) {
      return this.scrollInfoX;
    }
    /*   初始值为37(那个checkbox的宽度)   */
    const rowSelection = isInfo ? this.props.slaveInfo.tableProps.rowSelection : this.props.tableProps.rowSelection;
    let scrollX = (rowSelection === null || rowSelection == undefined) ? 0 : 37;
    /*   遍历每一个表头配置   */
    for (const each of headerColumn) {
      /*   没给宽度的默认120宽度   */
      /*   没给宽度的默认120宽度   */
      let iWidth = 120;
      if (each.width) {
        iWidth = parseFloat(each.width);
      } else if (each.dataIndex === 'tableLastEmpty') {
        iWidth = 0;
      }
      /*   累加宽度   */
      scrollX += iWidth;
    }
    /*   返回值   */
    // return scrollX + this.countOperate();
    if (isInfo) {
      return this.scrollInfoX ? this.scrollInfoX : scrollX;
    }
    return this.scrollX ? this.scrollX : scrollX + this.countOperate();
  };
  /* 计算操作行宽度 */
  countOperate = () => {
    let operateWidth = 0;
    if (this.props.setOpterationColumn === 'Y') {
      const setNoCommonOperate = this.props.tableProps.setNoCommonOperate; /* 没有默认的增加删除按钮 */
      if (this.isAddShow) {
        operateWidth += 40;
      }
      if (this.isCopyShow) {
        operateWidth += 40;
      }
      if (this.isDelShow) {
        operateWidth += 40;
      }
      if (setNoCommonOperate) {
        operateWidth = 0;
      }
      if (this.isCopyAllShow) {
        operateWidth += 40;
      }
      if (this.isModalShow) {
        operateWidth += 40;
      }
      if (this.isModalRemarkShow) {
        operateWidth += 40;
      }
      if (this.isChooseProcessShow) {
        operateWidth += 40;
      }
    }
    return operateWidth;
  }
  /**   关闭弹窗   */
  handleModalCancel = (modelVisible) => {
    this.setState({
      [modelVisible]: false,
    });
    // this.props.onModalCancel();
  };
  // 获取进度条颜色
  handleGetStrokeColor = (percent) => {
    if (percent < 30) {
      return '#F50';
    } else if (percent >= 30 && percent < 90) {
      return '#FF9900';
    } else {
      return '#87D068';
    }
  };
  /** 上传文件改变时的状态 */
  handleUploadChange = (info, onUploadChange = this.props.onUploadChange) => {
    const { status, percent } = info.file;
    if (status === undefined) return;
    const percentNew = Number(percent.toFixed(2));
    if (['done', 'error'].includes(status)) {
      message.open({
        type: status === 'done' ? 'success' : 'error',
        content: status === 'done' ? '文件上传成功' : '文件上传失败',
        duration: 3
      });
    } else {
      message.open({
        key: 'xlyupload',
        type: percent === 100 ? 'success' : 'loading',
        content: (
          <>
            <span>上传进度:</span>
            <span
              style={{ display: 'inline-block', width: 200, padding: '0 25px 3px 14px' }}
            >
              <Progress percent={percentNew} strokeColor={this.handleGetStrokeColor(percentNew)} />
            </span>
          </>
        ),
        duration: percent === 100 ? 3 : 0
      });
    }
    onUploadChange(info, this.props.name);
  };
  /** 上传前的校验 */
  handleBeforeUpload = (file) => {
    if (this.props.uploadFileTypeVerification) {
      return this.props.onBeforeUpload(file);
    } else {
      this.props.onBeforeUpload(file);
    }
  };
  // 通过右键粘贴板导入文件
  handleUploadByClipboard = (event) => {
    const files = event.clipboardData.files;
    this.uploadRef.setAttribute('contenteditable', "false");
    this.uploadRef1.setAttribute('contenteditable', "false");
    if (commonUtils.isNotEmptyArr(files)) {
      const file = files[0];
      const formData = new FormData();
      formData.append('file', file);

      const { formId } = this.props;
      const { token } = this.props.app;
      const url = `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`;
      fetch(url, {
        method: 'POST',
        body: formData,
      }).then(res => res.json()).then(response => {
        const info = { file: { name: file.name, size: file.size, type: file.type, response } };
        this.handleUploadChange(info);
      })
    } else {
      message.warning('请确认复制的内容是文件类型！');
    }
  };
  handleGetFastSearchBtn = ({ record, sName, isSlaveInfo }) => {
    if (isSlaveInfo || !sName.startsWith('s') || this.props.name !== 'slave') {
      return '';
    }
    const iIndex = this.props.config.gdsconfigformslave.findIndex(item => item.sName === sName);
    if (iIndex === -1) {
      return '';
    }

    const config = this.props.config.gdsconfigformslave[iIndex];
    if (!config.bFind) {
      return '';
    }

    const { masterData, searchRowKeys } = this.props;
    if (commonUtils.isEmptyObject(masterData) || commonUtils.isEmptyArr(searchRowKeys)) {
      return '';
    }
    const masterDataKeys = Object.keys(masterData);
    let bInSearch = false;
    let oldKey = '';
    if (commonUtils.isNotEmptyArr(searchRowKeys)) {
      for (let i = 0; i < masterDataKeys.length; i++) {
        const keyName = masterDataKeys[i];
        if (!keyName.startsWith('sFirst-')) {
          continue;
        }
        const sFirstValue = masterData[keyName];
        if (sFirstValue !== sName) {
          continue;
        }
        const key = keyName.substring('sFirst-'.length, keyName.length);
        if (!searchRowKeys.includes(key)) {
          continue;
        }
        oldKey = key;
        const firstDataIndex = commonUtils.isEmpty(sFirstValue) ? 's' : sFirstValue.substring(0, 1);
        const sThirdName = `${firstDataIndex}Third-${key}`;
        const sThirdValue = masterData[sThirdName];
        if (sThirdValue === record[sName]) {
          bInSearch = true;
        }
        break;
      }
    }

    return (
      <div
        className={styles.fastSearchBtn}
        onClick={() => {
          this.stopRowClick = true;
          if (bInSearch) {
            this.handleClearFastSearch(oldKey);
          } else {
            this.handleFastSearch({ sName, record, oldKey });
          }
        }}
      >
        {bInSearch ? <ClearOutlined /> : <FileSearchOutlined />}
      </div>
    );
  }
  handleFastSearch = (params) => {
    const { sName, record, oldKey } = params;
    const { config, searchRowKeys = [], onBtnSearch } = this.props;

    const newKey = oldKey || commonUtils.createSid();
    const sFirstFieldName = `sFirst-${newKey}`;

    const { masterData } = this.props.onChange('master', sFirstFieldName, { [sFirstFieldName]: sName }, null, null, true);
    const sFirstValue = masterData[sFirstFieldName];

    const firstDataIndex = commonUtils.isEmpty(sFirstValue) ? 's' : sFirstValue.substring(0, 1);
    const sSecondConditionPro = firstDataIndex === 's' && sFirstValue.endsWith('_pro');
    const iIndex = config.gdsconfigformslave.findIndex(item => item.sName === sFirstValue);
    masterData[`sSecond-${newKey}`] = sSecondConditionPro && iIndex > -1 && config.gdsconfigformslave[iIndex].sDropDownType === 'sql' ?
      commonConfig.seaJudge.s_proDropDown[0].sId : sSecondConditionPro ?
        commonConfig.seaJudge.s_pro[0].sId : commonConfig.seaJudge[firstDataIndex][0].sId;
    masterData[`${firstDataIndex}Third-${newKey}`] = firstDataIndex === 'b' ? false : firstDataIndex === 't' ? moment().format('YYYY-MM-DD') : masterData[`${firstDataIndex}Third-${newKey}`];

    const sThirdName = `${firstDataIndex}Third-${newKey}`;
    masterData[`${sThirdName}`] = record[sName];

    const searchRowKeysNew = [...searchRowKeys];
    if (!searchRowKeysNew.includes(newKey)) {
      searchRowKeysNew.push(newKey);
    }
    this.props.onSaveState({ masterData, searchRowKeys: searchRowKeysNew }, () => {
      onBtnSearch();
    });
  };
  handleClearFastSearch = (oldKey) => {
    const { searchRowKeys = [], onBtnSearch, masterData = {} } = this.props;
    if (searchRowKeys.length > 1) {
      const searchRowKeysNew = searchRowKeys.filter(item => item !== oldKey);
      this.props.onSaveState({ searchRowKeys: searchRowKeysNew }, () => {
        onBtnSearch();
      });
    } else if (searchRowKeys.length === 1) {
      const sThirdName = Object.keys(masterData).find(key => key.indexOf(`Third-${oldKey}`) !== -1);
      if (sThirdName) {
        masterData[sThirdName] = '';
        this.props.onSaveState({ masterData }, () => {
          onBtnSearch();
        });
      }
    }
  }
  // 进行拖动排序，数据展现必须按照iOrder 进行排序展现，必须进行选择才能拖动（废弃)
  moveRowOld = (dragIndex, hoverIndex) => {
    const { name } = this.props;
    const { selectedRowKeys } = this.state;
    if (commonUtils.isEmptyArr(selectedRowKeys)) {
      message.warning('请选择后进行拖动');
    } else {
      // let mHoverIndex = hoverIndex;
      selectedRowKeys.forEach((item) => {
        const { dataSource } = this.state;
        const iIndex = dataSource.findIndex(newItem => item === newItem[this.rowKey]);
        const dragRow = dataSource[iIndex];
        // let newState = [];

        const newState = update(this.state, {
          dataSource: {
            $splice: [[iIndex, 1], [hoverIndex, 0, dragRow]],
          },
        });
        this.setState(newState);
      });

      const { dataSource } = this.state;
      dataSource.forEach((item, index) => {
        if (commonUtils.isEmpty(item.handleType)) {
          item.handleType = 'update';
        }
        item.iOrder = index + 1;
      });
      this.setState(dataSource);
      this.props.onRowMove({ [`${name}Data`]: dataSource });
    }
  }
  /* 拖拽改变对应层级 */
  moveRow = (dragIndex, hoverIndex, dragKey, hoverKey) => {
    if (this.props.onMoveRow) {
      this.props.onMoveRow(dragIndex, hoverIndex, dragKey, hoverKey);
    }
  };

  BtnUploadDivProps = () => {
    return {
      accept: this.BtnUploadDivPropsAttr.current?.sActiveKey || '*/*',
      beforeUpload: (file) => {
        const config = this.BtnUploadDivPropsAttr.current;
        if (config?.sActiveKey && typeof config?.sActiveKey === 'string') {
          const isAllow = config?.sActiveKey?.split(',').includes(file.type);
          if (!isAllow) {
            message.error(`请选择正确的文件类型,包含${config?.sActiveKey || ''}`);
          }
          return isAllow;
        }
        return true;
      }
    }
  }

  /**   渲染   */
  render() {
    /*   获取upload的props  */
    const uploadProps = this.getUploadProps();
    const {
      previewVisible,
      previewImage,
      firstIndex,
      showimgs,
      commonPopupVisible,
      commonPopupShowConfig,
      commonFieldPopupShowConfig,
      commonFieldPopupShowRecord,
      commonPopupRecord,
      randomId,
      commonFieldPopupVisible,
      tableClassName,
      commonFileDownloadVisible,
      commonFileDownloadList,
      pdfFileVisible,
      pdfFileUrl,
      bOperateMoreVisible,
      commonModalVisible,
      commonModalShowConfig,
      commonModalRecord,
      // commonModalData
    } = this.state;
    const { formId, isSmall } = this.props;
    const { token } = this.props.app;

    let data = [];
    if (commonUtils.isNotEmptyObject(previewImage)) {
      if (commonUtils.isNotEmptyArr(this.props.data)) {
        if (this.props.data[0].sPicturePath) {
          for (const item of this.props.data) {
            const dataUrl = `${commonConfig.file_host}file/download?savePathStr=${item.sPicturePath}&sModelsId=100&token=${token}`; /* 缩略图 */
            data.push(dataUrl);
          }
        } else {
          data = previewImage;
        }
      } else {
        data = previewImage;
      }
    }

    const divProps = {
      action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`,
      onChange: this.handleUploadChange,
      accept: '*/*',
      showUploadList: false,
      multiple: true,
      beforeUpload: this.handleBeforeUpload,
    };
    /*   获取look的props   */
    // const lookProps = this.getLookProps();

    /*   获取add的props   */
    const addProps = this.getAddProps();
    /*   获取copy的props   */
    // const copyProps = this.getCopyProps();
    /*   获取copyAll的props   */
    // const copyAllProps = this.getCopyAllProps();

    /*   获取del的props   */
    const delProps = this.getDelProps();

    /*  获取table中的props  */
    const tableProps = this.getTableProps();
    let autoHeight = this.props.tableProps.AutoTableHeight;

    const realizeHeight = this.props.realizeHeight !== undefined ? this.props.realizeHeight : 0;
    if (realizeHeight !== 0) {
      autoHeight += realizeHeight;
    }

    /* 浮动表格 */
    // const styleTableProps = {};
    // const styleTableData = [];
    // styleTableProps.dataSource = styleTableData;
    // const columns = tableProps.columns;
    // styleTableProps.columns = columns;

    /* 通用弹窗功能 */
    let commonPopupProps = {};
    let commonPopupTitle = '选择弹窗';
    let bCommonPopup = false; /* 多列弹出窗11 */
    let bCommonPopup1 = false; /* 单列弹出窗 */
    let bCommonPopupTree = false; /* 树形列弹出窗 */
    let bCommonPopupProcess = false;
    if (commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(commonPopupShowConfig)) {
      let commonPopupConfig = {};
      const { config, sModelsId, app, selectedRowKeys } = this.props;
      if (commonUtils.isNotEmptyObject(config)) {
        const iIndex = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sControlName) && (item.sControlName.includes('BtnPopup') || item.sControlName.includes('BtnHeadPopup')) && item.bVisible && item.sDropDownType === 'popup');
        if (iIndex > -1) {
          commonPopupConfig = config.gdsconfigformslave[iIndex];
          if (commonPopupShowConfig?.sControlName === 'BtnPopupsAlumiteBomBillNo' || commonPopupShowConfig?.sControlName === 'BtnChooseProcess') {
            commonPopupConfig = commonPopupShowConfig;
            if (commonPopupShowConfig?.sControlName === 'BtnChooseProcess') {
              bCommonPopupProcess = true;
            }
          }
          commonPopupTitle = commonUtils.isNotEmptyObject(commonPopupConfig) && commonUtils.isNotEmptyObject(commonPopupConfig.sActiveName) ? commonPopupConfig.sActiveName : commonPopupTitle;
          commonPopupTitle = commonUtils.isNotEmptyObject(commonPopupRecord) ? (commonPopupConfig.sActiveId === '1' ? commonUtils.isEmpty(commonPopupRecord.sSrcFormName) ? commonPopupTitle : commonPopupRecord.sSrcFormName : commonPopupTitle) : commonPopupTitle;
          const sFormId = commonUtils.isNotEmptyObject(commonPopupRecord) ? (commonPopupConfig.sActiveId === '1' ? commonUtils.isEmpty(commonPopupRecord.sFormId) ? commonPopupRecord.sSrcFormId : commonPopupRecord.sFormId : commonPopupConfig.sActiveId) : commonPopupConfig.sActiveId;

          commonPopupProps = {
            app: {
              ...this.props.app,
              currentPane: {
                name: 'commonPopup',
                bEdit: (commonUtils.isNotEmptyObject(app.currentPane) && commonUtils.isNotEmptyObject(app.currentPane.route) && app.currentPane.route.includes('commonBillDeliver')),
                config: commonPopupConfig,
                conditonValues: this.props.getSqlCondition(commonPopupConfig),
                title: commonPopupTitle,
                route: '/indexPage/commonList',
                formRoute: '/indexPage/commonList',
                formId: sFormId,
                key: sModelsId + commonPopupConfig.sId,
                sModelsType: bCommonPopupProcess ? 'search/commonProcess' : 'search/commonPopup',
                select: this.handleSelectCommonPopup,
                selectCancel: this.handleSelectCancel.bind(this, 'commonPopupVisible'),
              },
            },
            dispatch: this.props.dispatch,
            content: this.props.content,
            id: randomId,
            onOpenNewTab: this.onOpenNewTab,
            outerMasterData: this.props.masterData,
            realizeHeight: this.props.realizeHeight, /* 拖动偏移高度 */
          };
        }

        /* 多列弹出窗 */
        const commonPopupIndex = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sControlName) && (item.sControlName.includes('BtnPopup') || item.sControlName.includes('BtnHeadPopup')) && !['BtnPopup1'].includes(item.sControlName) && !item.sControlName.startsWith('BtnPopupEdit') && item.bVisible && item.sDropDownType === 'popup');
        if (commonPopupIndex > -1) {
          bCommonPopup = true;
        }

        /* 单列弹出窗 */
        const commonPopupIndex1 = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName.includes('BtnPopup1') && item.bVisible && item.sDropDownType === 'popup');
        if (commonPopupIndex1 > -1) {
          bCommonPopup1 = true;
          bCommonPopup = false;
        }

        /* commonListTree弹出窗 */
        const commonPopupIndexTree = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sControlName) && item.sControlName === 'BtnPopupListTree' && item.bVisible && item.sDropDownType === 'popup');
        if (commonPopupIndexTree > -1) {
          bCommonPopupTree = true;
        }

      }
    }

    /* 字段弹窗功能 */
    let commonFieldPopupProps = {};
    let bFieldPopup = true; /* 多列弹出窗 */
    let commonFieldPopupTitle = '选择弹窗';
    const commonFileDownloadTitle = '附件列表弹窗';
    const isBtnPopupEdit = this.state.commonFieldPopupShowConfig?.sControlName?.startsWith('BtnPopupEdit');
    if (commonUtils.isNotEmptyObject(this.props)) {
      let commonFieldPopupConfig = {};
      const { config, sModelsId } = this.props;
      if (commonUtils.isNotEmptyObject(config)) {
        let iIndex = -1;
        if (commonUtils.isNotEmptyObject(commonFieldPopupShowConfig)) {
          iIndex = 0;
          commonFieldPopupConfig = commonFieldPopupShowConfig;
        } else {
          iIndex = config.gdsconfigformslave.findIndex(item => commonUtils.isNotEmptyObject(item.sName) && (item.sDropDownType === 'popup' || item.sDropDownType === 'popupSingle'));
          if (iIndex > -1) {
            commonFieldPopupConfig = config.gdsconfigformslave[iIndex];
          }
        }

        if (iIndex > -1) {
          if (commonFieldPopupConfig.sDropDownType === 'popupSingle') { /* 如果下拉类型是单列弹出窗 则为单列 */
            bFieldPopup = false;
          }
          commonFieldPopupTitle = commonUtils.isNotEmptyObject(commonFieldPopupConfig) && commonUtils.isNotEmptyObject(commonFieldPopupConfig.sActiveName) ? commonFieldPopupConfig.sActiveName : commonFieldPopupTitle;
          commonFieldPopupProps = {
            app: {
              ...this.props.app,
              currentPane: {
                name: 'commonPopup',
                config: commonFieldPopupConfig,
                title: commonFieldPopupTitle,
                route: '/indexPage/commonList',
                formRoute: '/indexPage/commonList',
                formId: commonFieldPopupConfig.sActiveId,
                key: sModelsId + commonFieldPopupConfig.sId,
                sModelsType: 'search/commonPopup',
                select: this.handleSelectCommonFieldPopup,
                selectCancel: this.handleSelectCancel.bind(this, 'commonFieldPopupVisible'),
              },
            },
            dispatch: this.props.dispatch,
            content: this.props.content,
            id: randomId,
            onOpenNewTab: this.onOpenNewTab,
            outerMasterData: this.props.masterData,
            realizeHeight: this.props.realizeHeight, /* 拖动偏移高度 */
          };
          if (this.props.enabled && commonFieldPopupConfig?.sControlName?.includes('popupSingle_edit')) {
            commonFieldPopupProps.app.currentPane.conditonValues = this.props.getSqlCondition(commonFieldPopupConfig, this.props.name, commonFieldPopupShowRecord);
          } else {
            commonFieldPopupProps.app.currentPane.conditonValues = this.props.getSqlCondition(commonFieldPopupConfig);
          }
          if (isBtnPopupEdit) {
            const selectData = tableProps.dataSource[this.rowClickRef.current] || {};
            const sMemoData = selectData?.[this.state.commonFieldPopupShowConfig?.sActiveKey] || '[]';
            commonFieldPopupProps.app.sMemoData = JSON.parse(sMemoData);
            commonFieldPopupProps.app.originSlaveData = selectData;
            commonFieldPopupProps.app.currentPane.bEdit = isBtnPopupEdit;
            commonFieldPopupProps.app.currentPane.select = this.handleSelectCommonPopup;
          }
        }
      }
    }


    /* 蓝色链接弹Modal窗功能 */
    let commonModalProps = {};
    let commonModalTitle = '查看';
    if (commonUtils.isNotEmptyObject(this.props)) {
      const { config, sModelsId, app, selectedRowKeys, enabled } = this.props;
      if (commonUtils.isNotEmptyObject(config)) {
        commonModalTitle = commonUtils.isNotEmptyObject(commonModalShowConfig) && commonUtils.isNotEmptyObject(commonModalShowConfig.sActiveName) ? commonModalShowConfig.sActiveName : commonModalTitle;
        const sFormId = commonUtils.isNotEmptyObject(commonModalRecord) && commonUtils.isNotEmptyObject(commonModalShowConfig) ? (commonModalShowConfig.sActiveId === '1' ? commonUtils.isEmpty(commonModalRecord.sFormId) ? commonModalRecord.sSrcFormId : commonModalRecord.sFormId : commonModalShowConfig.sActiveId) : commonModalShowConfig?.sActiveId;

        commonModalProps = {
          app: {
            ...this.props.app,
            currentPane: {
              name: 'commonModal',
              bEdit: commonModalShowConfig?.sName === 'dStockAuxiliaryQty' ? enabled : false,
              config: commonModalShowConfig,
              conditonValues: commonModalShowConfig ? this.props.getSqlCondition(commonModalShowConfig, this.props.name, commonModalRecord) : {},
              title: commonModalTitle,
              route: '/indexPage/commonList',
              formRoute: '/indexPage/commonList',
              formId: sFormId,
              key: sModelsId + commonModalShowConfig?.sId,
              sModelsType: 'search/commonPopup',
              select: this.handleSelectCommonPopup,
              selectCancel: this.handleSelectCancel.bind(this, 'commonModalVisible'),
              slaveDataSource: commonModalShowConfig?.sName === 'dStockAuxiliaryQty' ? [commonModalRecord] : [],
            },
          },
          dispatch: this.props.dispatch,
          content: this.props.content,
          id: randomId,
          onOpenNewTab: this.onOpenNewTab,
          outerMasterData: this.props.masterData,
          realizeHeight: this.props.realizeHeight, /* 拖动偏移高度 */
          bEdit: commonModalShowConfig?.sName === 'dAvailableAuxiliaryQty' ? enabled : false
        };
        // if(commonModalShowConfig?.sName === 'dSumCompleteAvailableStockQty' ){
        //   commonModalProps.data = commonModalData;
        // }

      }
    }


    /* 表格可展开明细 */
    let slaveTableProps = '';
    let expandedRow = '';
    if (this.props.setExpandedRowRender !== undefined && this.props.setExpandedRowRender.toString() === 'Y') {
      slaveTableProps = this.getSlaveTableProps();
      expandedRow = (record) => {
        let filterData = 0;
        let columns = '';
        let planLoading = false;
        if (this.props.name === 'slave' || location.pathname === '/indexPage/commonCostomTabBill') { /* 过滤嵌套表 */
          /* 获取loading 加载状态 */
          const planLoadingSate = this.props.slaveInfo.tableProps.planLoadingSate;
          const planCurrentId = commonUtils.isNotEmptyObject(planLoadingSate) ? planLoadingSate.sId : '';
          if (record[this.rowKey] === planCurrentId) {
            planLoading = planLoadingSate.planLoading;
          }
          const AllData = this.props.slaveInfo.data;
          // columns = this.props.slaveInfo.headerColumn;
          columns = this.state.tableInfoColumn;
          const GetChildFilterData = this.props.onTableFilterData;
          if (GetChildFilterData !== undefined) {
            const slaveInfoData = this.props.onTableFilterData('slave', AllData, record);
            if (commonUtils.isNotEmptyArr(slaveInfoData) && slaveInfoData.length > 0) {
              filterData = slaveInfoData;
            }
          }
        }
        return (
          <div id="staticEditTable" style={{ height: '100%' }}>
            <Spin spinning={planLoading} style={{ height: '100%' }}>
              <div className="topTable" style={{ height: isSmall ? 'calc(100% - 44px)' : '' }} ref={(ref) => { this.myInfoDiv = ref; }}>
                <Table
                  {...slaveTableProps}
                  id="expandTable"
                  columns={columns}
                  dataSource={filterData}
                  pagination={false}
                  style={{ height: '100%' }}
                  addRow={addProps}
                  delProps={delProps}
                  scroll={{ x: this.scrollInfoX, y: '100%' }}
                  size="small"
                />
              </div>
            </Spin>
          </div>
        );
      };
    }

    if (commonUtils.isNotEmptyArr(tableProps.columns)) {
      const lastColumn = tableProps.columns[tableProps.columns.length - 1];
      if (lastColumn.title && typeof lastColumn.title === 'string' && lastColumn.title.indexOf('-') === -1) {
        lastColumn.width && delete lastColumn.width;
      }
    }

    const { officePreviewVisible, officeFileUrl } = this.state;
    const officePreviewProps = {
      app: this.props.app,
      officePreviewVisible,
      officeFileUrl,
      bFullUrl: false,
      onCancel: () => {
        this.setState({ officePreviewVisible: false });
      }
    };

    let layoutScrollY;
    if (this.props.layoutH) {
      layoutScrollY = this.props.layoutH * 40 - 10 - 30 - 2;
      if (this.props.bInTab) {
        layoutScrollY -= 30;
      }
    } else if (this.props.fixedHeight) {
      layoutScrollY = this.props.fixedHeight;
    }
    let bShowBtnUpload = true;
    if (commonUtils.isNotEmptyObject(this.props.masterData) && commonUtils.isNotEmptyObject(this.props.masterData.sZczlxShowName)) {
      bShowBtnUpload = this.props.masterData.sZczlxShowName !== '删除' && this.props.masterData.sZczlxShowName !== '恢复';
    }

    const hasColorInfo = this.props?.masterConfig?.sTableColorTs;
    const BtnUpload = commonFunc.showLocalMessage(this.props, "BtnUpload", "上传");

    return (
      <FormItem className={styles.subForm} style={{ height: '100%' }}>
        <div className={styles.extraAction} onselectstart="return false">
          {
            this.props.name === 'picFile' || (commonUtils.isNotEmptyObject(this.props.name) && this.props.name.indexOf('file') > -1) ||
              (this.props.name.startsWith('slave') && this.findIsUpdByControlName(this.props, 'BtnUpload') && bShowBtnUpload) ?
              <Upload {...divProps} {...this.BtnUploadDivProps()}>
                <Button {...uploadProps}
                  style={{ 'caret-color': 'transparent' }}
                  contenteditable="true" ref={(ref) => { this.uploadRef = ref; }}
                  onPaste={this.handleUploadByClipboard}
                  onMouseOver={() => {
                    this.uploadRef.setAttribute('contenteditable', "true");
                  }}
                  onKeyDown={() => {
                    this.uploadRef.setAttribute('contenteditable', "false");
                  }}
                  onKeyUp={() => {
                    this.uploadRef.setAttribute('contenteditable', "true");
                  }}
                >
                  <UploadOutlined /> {BtnUpload}
                </Button>
              </Upload>
              : null}
        </div>
        <div
          className={`xlyCommonTable ${tableClassName} ${this.hasSpanBgColor ? 'tableNoPadding' : ''} ${this.props.enabled ? 'tableEnabled' : ''} ${this.props.xlyTableMax ? 'xlyTableMax' : ''}`}
          style={{ height: isSmall ? 'calc(100% - 44px)' : '' }} ref={(ref) => {
            this.mydiv = ref;
            if (this.mydiv) {
              this.computedTdWidth();
              if (false && commonUtils.isNotEmptyObject(location.pathname) && location.pathname.includes('commonListTab')) {
                this.mydiv.getElementsByClassName('ant-table-body')[0].style.height = this.tableHeight ? this.tableHeight + 'px' : 80 + 'px';
              }
              if (layoutScrollY) {
                this.mydiv.getElementsByClassName('ant-table-body')[0].style.height = typeof layoutScrollY === 'number' ? layoutScrollY + 'px' : layoutScrollY;
              }
            }
          }}
          id={`table_${this.props.formId}_${this.props.config?.sId}`}
        >
          {
            this.isDragAndDrop ?
              <DndProvider backend={HTML5Backend} >
                <Table
                  {...tableProps}
                  pagination={!hasColorInfo && tableProps.pagination}
                  addRow={addProps}
                  delProps={delProps}
                  tableLayout={this.props.xlyTableMax ? "auto" : "fixed"}
                  expandable={{
                    expandedRowRender: this.props.setExpandedRowRender === 'Y' ? expandedRow : null,
                    defaultExpandAllRows: this.props.defaultExpandAllRows || null,
                  }}
                  scroll={{ x: this.props.xlyTableMax ? 'max-content' : this.scrollX, y: commonUtils.isNotEmptyNumber(autoHeight) ? autoHeight : 544 }}
                  summary={this.genFooter}
                  size="small"
                  sticky={this.sticky}
                  showSorterTooltip={false}
                />
              </DndProvider> :
              <div>
                <Table
                  {...tableProps}
                  pagination={!hasColorInfo && tableProps.pagination}
                  addRow={addProps}
                  delProps={delProps}
                  tableLayout={this.props.xlyTableMax ? "auto" : "fixed"}
                  expandable={{
                    expandedRowRender: this.props.setExpandedRowRender === 'Y' ? expandedRow : null,
                    defaultExpandAllRows: this.props.defaultExpandAllRows || null,
                  }}
                  scroll={{ x: this.props.xlyTableMax ? 'max-content' : this.scrollX, y: !layoutScrollY ? this.scrollY : layoutScrollY }}
                  summary={this.genFooter}
                  size="small"
                  sticky={this.sticky}
                  showSorterTooltip={false}
                />
              </div>
          }

          {hasColorInfo &&
            <Row style={{ paddingTop: 10, paddingBottom: 10 }} wrap={false} ref={e => this.colorInfo = e}>
              <Col span={14}><ColorInfo {...this.props} /></Col>
              <Col span={10}>
                {tableProps.pagination && <Pagination
                  {...tableProps.pagination}
                  showLessItems
                  size='small'
                  onChange={(page, pageSize) => { this.onChange({ current: page, pageSize }) }}
                />}
              </Col>
            </Row>
          }

        </div>
        {
          previewVisible ?
            <AntdDraggableDiv draggableDivClassName={ShowImgStyle.draggableImage}>
              <div className={ShowImgStyle.custcontent}>
                {/* 图片正常的列表显示 */}
                <div className="showimg">
                  {commonUtils.isNotEmptyArr(data) ? data.map((item, i) => {
                    return (
                      // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
                      <img
                        alt="example"
                        style={{ width: '400px', height: '200px' }}
                        src={item}
                        onClick={() => this.showimg(i)}
                        key={item}
                      />
                    );
                  }) : ''}
                </div>
                {/* 引入的image组件s */}
                <ShowImg
                  data={data}
                  firstIndex={firstIndex}
                  showimgs={showimgs}
                  toggleshow={this.toggleshow}
                />
              </div>
            </AntdDraggableDiv>
            : ''
        }{
          commonPopupVisible ?
            <AntdDraggableModal
              width={1300}
              zIndex={1000}
              title={commonPopupTitle}
              visible={commonPopupVisible}
              onCancel={this.handleSelectCancel.bind(this, 'commonPopupVisible')}
              footer={null}
              onSaveState={this.props.onSaveState}
              className={`${randomId}-CommonListSelectTree`}
            >
              {bCommonPopup ?
                <CommonListSelectTree {...commonPopupProps} />
                : bCommonPopup1 ?
                  <CommonListSelect {...commonPopupProps} />
                  : bCommonPopupTree ?
                    <CommonListTreeSelect {...commonPopupProps} /> : ''
              }
            </AntdDraggableModal>
            : ''
        }
        {
          commonFieldPopupVisible ?
            <AntdDraggableModal
              width={1300}
              zIndex={1000}
              title={commonFieldPopupTitle}
              visible={commonFieldPopupVisible}
              onCancel={this.handleSelectCancel.bind(this, 'commonFieldPopupVisible')}
              footer={null}
              onSaveState={this.props.onSaveState}
              className={`${randomId}-CommonListSelectTree`}
            >
              {[''].map(() => {
                if (commonFieldPopupShowConfig.sControlName?.includes("popupSingle")) {
                  if (this.props.enabled && commonFieldPopupShowConfig.sControlName?.includes("edit")) {
                    commonFieldPopupProps.editable = true;
                  }
                  return <CommonListSelect {...commonFieldPopupProps} />;
                } else {
                  return isBtnPopupEdit ? <EditTableCommonListSelectFlex {...commonFieldPopupProps} /> : bFieldPopup ? <CommonListSelectTree {...commonFieldPopupProps} /> : <CommonListSelect {...commonPopupProps} />;
                }
              })}
            </AntdDraggableModal>
            : ''
        }

        {
          commonModalVisible ?
            <AntdDraggableModal
              width={1300}
              zIndex={1000}
              title={commonModalTitle}
              visible={commonModalVisible}
              onCancel={this.handleSelectCancel.bind(this, 'commonModalVisible')}
              footer={null}
              onSaveState={this.props.onSaveState}
              className={`${randomId}-CommonListSelectTree`}
            >
              <CommonListSelect {...commonModalProps} />
            </AntdDraggableModal>
            : ''
        }

        {
          commonFileDownloadVisible ?
            <AntdDraggableModal
              width={500}
              zIndex={1000}
              title={commonFileDownloadTitle}
              visible={commonFileDownloadVisible}
              onCancel={this.handleSelectCancel.bind(this, 'commonFileDownloadVisible')}
              footer={[
                <Button key="selectedAll" type="primary" ghost onClick={
                  () => {
                    const newList = [...commonFileDownloadList];
                    const checkState = newList.find(item => !item.checked);
                    newList.forEach(item => item.checked = checkState);
                    this.setState({
                      commonFileDownloadList: newList
                    })
                  }
                }>全选/取消全选</Button>,
                <Button key="downloadSelected" type="primary" onClick={
                  () => {
                    const checkedObj = commonFileDownloadList.filter(item => item.checked);
                    if (commonUtils.isNotEmptyArrNew(checkedObj)) {
                      const fileUrl = checkedObj.map(item => item.url).toString();
                      this.handleFileDownload(fileUrl);
                    }
                  }
                }>下载选中</Button>,
                <Button key="close" onClick={this.handleSelectCancel.bind(this, 'commonFileDownloadVisible')}>关闭</Button>,
              ]}
            >
              <div style={{ width: '100%', height: '300px', overflow: 'auto' }}>{
                commonFileDownloadList.map(item => {
                  const { url, checked } = item;
                  const fileName = url.split('/').pop().split('_').pop();
                  const fileType = fileName.split('.').pop().toLowerCase();
                  const previewFileList = ['jpg', 'png', 'jepg', 'webp', 'svg', 'bmp', 'apng', 'pdf'];
                  return (
                    <Row>
                      <div style={{ width: '100%', height: '35px', margin: '0 10px 0 10px', 'line-height': '35px', 'border-bottom': '1px solid #9e9e9e70' }}>
                        <Checkbox checked={checked}
                          onChange={(e) => {
                            if (sessionStorage.previewFlag) {
                              sessionStorage.removeItem('previewFlag');
                            } else {
                              const newList = [...commonFileDownloadList];
                              newList.find(item => item.url === url).checked = e.target.checked;
                              this.setState({
                                commonFileDownloadList: newList
                              })
                            }
                          }}
                        >
                          <a style={!previewFileList.includes(fileType) ? { visibility: 'hidden' } : {}} onClick={e => {
                            sessionStorage.previewFlag = 1;
                            if (fileType === 'pdf') {
                              this.setState({
                                pdfFileVisible: true,
                                pdfFileUrl: url,
                              });
                            } else {
                              this.handlePreviewImage(e, [url]);
                            }
                          }} title="预览"><SearchOutlined /></a>
                          <span style={{ 'font-size': '14px' }}>{fileName}</span>
                        </Checkbox>
                      </div>
                    </Row>
                  )
                })
              }</div>
            </AntdDraggableModal>
            : ''
        }
        {
          pdfFileVisible ?
            <AntdDraggableModal
              title={pdfFileUrl.split('/').pop().split('_').pop()}
              visible={pdfFileVisible}
              width="100%"
              height="calc(100% - 50px)"
              style={{ top: 0 }}
              footer={null}
              onCancel={() => {
                this.setState({
                  pdfFileVisible: false
                });
              }}
            >
              <div style={{ width: '100%', height: 'calc(100vh - 67px)', overflow: 'auto' }}>
                <PrintPdf
                  style={{ height: '100%' }}
                  bFitWidth={true}
                  previewUrl={pdfFileUrl.includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${encodeURIComponent(pdfFileUrl)}&sModelsId=100&token=${this.props.app.token}` : pdfFileUrl}
                />
              </div>
            </AntdDraggableModal> : ''
        }
        {
          bOperateMoreVisible ?
            <AntdDraggableModal
              title='复制多行'
              visible={bOperateMoreVisible}
              onOk={this.handleOperateMoreOk}
              onCancel={() => {
                this.setState({
                  bOperateMoreVisible: false
                });
              }}
            >
              <div style={{ width: '100%', height: '30px' }}>
                <Input id="iNumber" addonBefore='行数' defaultValue={1} />
              </div>
            </AntdDraggableModal> : ''
        }
        <SlaveMemo {...this.props} />
        {officePreviewVisible && <OfficePreview {...officePreviewProps} />}
        {/* 简单对话框 */}
        {this.state.simpleModalVisible && <Modal
          title='详细'
          footer={null}
          focusTriggerAfterClose={false}
          visible={this.state.simpleModalVisible}
          onCancel={() => this.setState({ simpleModalVisible: false, simpleModalWord: '' })}
        >
          <div ref={this.simpleModalRef} style={{ maxHeight: '50vh', overflowY: 'auto' }} />
        </Modal>}
      </FormItem>
    );
  }
}

const CommonTable = (props) => {
  const { name, data = [] } = props;
  const [headerColumn, setHeaderColumn] = useState([]);
  const addState = {};
  if (name !== 'master') {
    const config = props.onMergeSlaveConfig && props.onMergeSlaveConfig(props.config);
    if (commonUtils.isNotEmptyObject(config)) {
      addState.config = config;
      addState.headerColumn = commonFunc.getHeaderConfig(addState.config).map(i => {
        const value = Array.isArray(headerColumn) && headerColumn.find(j => j && j.dataIndex === i.dataIndex);
        value && (i.width = value.width);
        return i;
      });
    }
  }

  // 增加行号iRowNum
  const [updateRowNumTime, setUpdateRowNumTime] = useState(0);
  addState.updateRowNumTime = updateRowNumTime;
  useEffect(() => {
    handleSetIRowNum(data, props);
    setUpdateRowNumTime(pre => pre + 1);
  }, [JSON.stringify(data)]);

  if (props.defaultExpandAllRows !== undefined && props.data === undefined) {
    return '';
  }

  const handleMoveLine = ({ index, direction }) => {
    if (direction === "up" && index === 0) {
      message.error("当前已是首行，无法上移！");
      return;
    } else if (direction === "down" && index === data.length - 1) {
      message.error("当前已是末行，无法下移！");
      return;
    }

    const indexNew = direction === "up" ? index - 1 : index + 1;
    const iOrder1 = data[index].iOrder;
    const iOrder2 = data[indexNew].iOrder;
    data[index].iOrder = iOrder2;
    data[indexNew].iOrder = iOrder1;

    const tempItem = data[index];
    data[index] = { ...data[indexNew], handleType: data[indexNew].handleType || "update" };
    data[indexNew] = { ...tempItem, handleType: tempItem.handleType || "update" };

    props.onSaveState({
      [`${props.name}Data`]: data
    });
  };

  addState.onMoveLine = handleMoveLine;

  if (sessionStorage.getItem(`${props.formId}_${props.config?.sId}_tableHeight`)) {
    addState.fixedHeight = Number(sessionStorage.getItem(`${props.formId}_${props.config.sId}_tableHeight`));
    if (props.tableProps?.AutoTableHeight) {
      delete props.tableProps.AutoTableHeight;
    }
  }
  const setTempFixedHeight = (height) => {
    sessionStorage.setItem(`${props.formId}_${props.config.sId}_tableHeight`, height);
    window.vlistNewSearh = true;
    setUpdateRowNumTime(pre => pre + 1);
  }
  const uniqueTableId = `table_${props.formId}_${props.config?.sId}`;

  addState.xlyTableMax = props.app?.currentPane?.route === "/indexPage/commonList" && localStorage.getItem(`${commonConfig.prefix}TableMax`);

  return (
    <Tooltip title={props.name} placement='topLeft' visible={props.showTableName}>
      <CommonTableRc {...props} {...addState} setHeaderColumn={setHeaderColumn} />
      <MoveLineComponent setTempFixedHeight={setTempFixedHeight} uniqueTableId={uniqueTableId} />
    </Tooltip>
  );
};

const handleSetIRowNum = (data, props) => {
  data.forEach((item, index) => {
    item.iRowNum = index + 1;
    if (['12710101117007068710620'].includes(props?.app?.currentPane?.formId)) {
      item.sVersionNum = item.iRowNum.toString().padStart(2, 0);
    }

    // 排除成品盘点、材料盘点（数据太多，循环页面卡死）
    if (props.name === 'slaveChild' && !['192116810113315264733417750', '192116810113315228128521360'].includes(props?.app?.currentPane?.formId)) {
      /* 序号根据sSqlConditonId分组 序号重排 */
      const groupedData = commonUtils.groupBy(data, item => item.sSqlConditionId);
      if (commonUtils.isNotEmptyObject(groupedData)) {
        for (const key of Object.keys(groupedData)) {
          const eachData = groupedData[key];
          if (commonUtils.isNotEmptyArr(eachData)) {
            eachData.forEach((item, index) => {
              /* 采购 */
              item.iRowNum = index + 1;
              const iIndex = data.findIndex(row => row.sId === item.sId);
              if (iIndex > -1) {
                data[iIndex] = { ...data[iIndex], iRowNum: index + 1 }
              }

            });
          }
        }
      }
    }
    if (location.pathname !== '/indexPage/commonClassify') {
      if (commonUtils.isNotEmptyArr(item.children)) {
        handleSetIRowNum(item.children, props);
      }
    }
  });
}

const MoveLineComponent = (props) => {

  if (!location.pathname.includes('commonSubBill')) {
    return "";
  }

  const [position, setPosition] = useState({ bottom: 0 });
  const positionRef = useRef(position);
  positionRef.current = position;

  const divProps = {
    className: styles.moveLine,
    style: position,
    onMouseDown: e => {
      const initialBottom = position.bottom;
      const initialY = e.clientY;

      const moveHandler = (moveEvent) => {
        const newY = moveEvent.clientY;
        const newBottom = initialBottom - (newY - initialY);
        setPosition({ bottom: newBottom });
      };

      const upHandler = () => {
        const preHeight = document.querySelector(`#${props.uniqueTableId}`).querySelector('.ant-table-body').getBoundingClientRect().height;
        props.setTempFixedHeight(Math.max(preHeight - positionRef.current.bottom, 37));
        setPosition({ bottom: 0 });
        document.body.onselectstart = () => true;
        document.removeEventListener('mousemove', moveHandler);
        document.removeEventListener('mouseup', upHandler);
      };

      document.body.onselectstart = () => false;
      document.addEventListener('mousemove', moveHandler);
      document.addEventListener('mouseup', upHandler);
    }
  };

  return <div {...divProps} />;
}

export default CommonTable;
