king
2022-05-05 4677982c003e357cff8f2544be44706bf31ea6de
src/tabviews/custom/components/share/normalTable/index.jsx
@@ -30,6 +30,10 @@
    let { lineMarks, onDoubleClick, data, className, ...resProps } = this.props
    let style = {}
    if (data && data.$disabled) {
      className = className + ' mk-disabled '
    }
    if (lineMarks && lineMarks.length > 0) {
      lineMarks.some(mark => {
        let originVal = data[mark.field[0]] + ''
@@ -80,7 +84,7 @@
            if (mark.fontColor) {
              style.color = mark.fontColor
            }
            className += className + ' background'
            className = className + ' background'
          } else if (mark.signType[0] === 'underline') {
            style.textDecoration = 'underline'
            style.color = mark.color
@@ -145,7 +149,7 @@
        resProps.rowSpan = record['$$' + col.field]
      }
      
      if (col.linkThdMenu || col.linkurl) {
      if (!record.$disabled && (col.linkThdMenu || col.linkurl)) {
        content = (
          <div>
            <div className="link-menu" onDoubleClick={(e) => triggerLink(e, col, record)}></div>
@@ -171,6 +175,8 @@
        if (col.format === 'percent') {
          content = content * 100
          decimal = decimal > 2 ? decimal - 2 : 0
        } else if (col.format === 'abs') {
          content = Math.abs(content)
        }
  
        content = content.toFixed(decimal)
@@ -204,7 +210,7 @@
        resProps.rowSpan = record['$$' + col.field]
      }
      if (col.linkThdMenu || col.linkurl) {
      if (!record.$disabled && (col.linkThdMenu || col.linkurl)) {
        content = (
          <div>
            <div className="link-menu" onDoubleClick={(e) => triggerLink(e, col, record)}></div>
@@ -218,7 +224,12 @@
      let photos = ''
      if (record[col.field]) {
        photos = `${record[col.field]}`
        photos = photos.split(',')
      }
      if (/^data:image/.test(photos)) {
        photos = [photos]
      } else {
        photos = photos.split(',').filter(Boolean)
      }
      let cols = 24 / (col.picSort || 1)
@@ -376,7 +387,6 @@
    lineMarks: PropTypes.array,      // 行标记
    fields: PropTypes.array,         // 组件字段集
    ContainerId: PropTypes.any,      // 标签页外层Id
    BData: PropTypes.any,            // 主表数据
    data: PropTypes.any,             // 表格数据
    total: PropTypes.any,            // 总数
    loading: PropTypes.bool,         // 表格加载中
@@ -522,17 +532,27 @@
    MKEmitter.removeListener('resetTable', this.resetTable)
  }
  mkCheckTopLine = (menuId) => {
  mkCheckTopLine = (menuId, id) => {
    const { MenuID, data, setting } = this.props
    if (MenuID !== menuId || !data || data.length === 0) return
    this.changedata(0)
    this.setState({ selectedRowKeys: [0], activeIndex: 0 })
    this.props.chgSelectData([data[0]])
    let index = 0
    if (id) {
      index = data.findIndex(item => item.$$uuid === id)
      if (index === -1) {
        index = 0
      }
    }
    if (data[index].$disabled) return
    this.changedata(index)
    this.setState({ selectedRowKeys: [index], activeIndex: index })
    this.props.chgSelectData([data[index]])
    if (setting.$hasSyncModule) {
      MKEmitter.emit('syncBalconyData', MenuID, [data[0]], data.length === 1)
      MKEmitter.emit('syncBalconyData', MenuID, [data[index]], data.length === 1)
    }
  }
@@ -649,7 +669,7 @@
    this.setState({ selectedRowKeys, activeIndex: _activeIndex })
    let selects = this.props.data.filter((item, _index) => selectedRowKeys.includes(_index))
    let selects = this.props.data.filter((item, _index) => selectedRowKeys.includes(_index) && !item.$disabled)
    this.props.chgSelectData(selects)
    if (setting.$hasSyncModule) {
@@ -664,6 +684,7 @@
    const { setting, MenuID, data } = this.props
    if (!setting.tableType || this.state.pickup) return
    if (record.$disabled) return
    
    let newkeys = fromJS(this.state.selectedRowKeys).toJS()
@@ -688,7 +709,7 @@
      this.setState({ selectedRowKeys: newkeys, activeIndex: _index !== '' ? _index : null })
    }
    let selects = this.props.data.filter((item, _index) => newkeys.includes(_index))
    let selects = this.props.data.filter((item, _index) => newkeys.includes(_index) && !item.$disabled)
    
    this.props.chgSelectData(selects)
@@ -714,15 +735,17 @@
  }
  changedata = (index) => {
    const { MenuID, data, setting } = this.props
    const { MenuID, data } = this.props
    let _id = ''
    let _data = ''
    if (data && data.length > 0 && index !== '') {
      _id = data[index][setting.primaryKey] || ''
      _id = data[index].$$uuid || ''
      _data = data[index] || ''
    }
    if (_data && _data.$disabled) return
    MKEmitter.emit('resetSelectLine', MenuID, _id, _data)
  }
@@ -812,6 +835,7 @@
    const { setting } = this.props
    if (!setting.doubleClick) return
    if (record.$disabled) return
    MKEmitter.emit('triggerBtnId', setting.doubleClick, [record])
  }