king
2022-10-25 5891206952e2ff63e87aed2f47df5324b019d32e
src/tabviews/custom/components/share/normalTable/index.jsx
@@ -15,8 +15,9 @@
import './index.scss'
const { Paragraph } = Typography
const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList'))
const Video = asyncComponent(() => import('@/components/video'))
const MkPicture = asyncComponent(() => import('@/components/mkPicture'))
const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList'))
const PicRadio = {
  '4:3': '75%', '3:2': '66.67%', '16:9': '56.25%', '2:1': '50%', '3:1': '33.33%', '4:1': '25%',
  '5:1': '20%', '6:1': '16.67%', '7:1': '14.29%', '8:1': '12.5%', '9:1': '11.11%',
@@ -24,7 +25,7 @@
}
class BodyRow extends React.Component {
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props.data), fromJS(nextProps.data)) || !is(fromJS(this.props.className), fromJS(nextProps.className))
    return !is(fromJS(this.props.data), fromJS(nextProps.data)) || this.props.className !== nextProps.className
  }
  render() {
@@ -259,6 +260,14 @@
          ))}
        </div>
      )
    } else if (col.type === 'video') {
      let url = record[col.field] || ''
      resProps.children = (
        <div className="video-wrap">
          {url ? <Video card={col} value={url}/> : null}
        </div>
      )
    } else if (col.type === 'textarea') {
      let content = ''
      if (record[col.field] !== undefined) {
@@ -434,52 +443,69 @@
      }
    }
    let getColumns = (cols) => {
      return cols.map(item => {
        let cell = null
        if (item.type === 'colspan') {
          cell = { title: item.label, align: item.Align }
          cell.children = getColumns(item.subcols)
        } else {
          if (item.rowspan === 'true') {
            rowspans.push(item.field)
          }
          if (item.type === 'index') {
            item.field = '$Index'
            item.type = 'text'
          } else if (_format && !Math.floor(Math.random() * radio)) {
            item.blur = true
          }
          if (item.marks && item.marks.length === 0) {
            item.marks = ''
          }
    let _columns = []
          if (item.field) {
            orderfields[item.uuid] = item.field
          }
          cell = {
            align: item.Align,
            dataIndex: item.uuid,
            title: item.label,
            sorter: item.field && item.IsSort === 'true',
            width: item.Width || 120,
            onCell: record => ({
              record,
              col: item,
              config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null,
              triggerLink: this.triggerLink
            })
          }
        }
    if (setting.tableMode !== 'fast') {
      let getColumns = (cols) => {
        return cols.map(item => {
          let cell = null
          if (item.type === 'colspan') {
            cell = { title: item.label, align: item.Align }
            cell.children = getColumns(item.subcols)
          } else {
            if (item.rowspan === 'true') {
              rowspans.push(item.field)
            }
            if (item.type === 'index') {
              item.field = '$Index'
              item.type = 'text'
            } else if (_format && !Math.floor(Math.random() * radio)) {
              item.blur = true
            }
            if (item.marks && item.marks.length === 0) {
              item.marks = ''
            }
  
        return cell
            if (item.field) {
              orderfields[item.uuid] = item.field
            }
            cell = {
              align: item.Align,
              dataIndex: item.uuid,
              title: item.label,
              sorter: item.field && item.IsSort === 'true',
              width: item.Width || 120,
              onCell: record => ({
                record,
                col: item,
                config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null,
                triggerLink: this.triggerLink
              })
            }
          }
          return cell
        })
      }
      _columns = getColumns(columns)
    } else {
      let fields = []
      columns.forEach(item => {
        if (!item.field || fields.includes(item.field)) return
        fields.push(item.field)
        _columns.push({
          align: item.Align,
          dataIndex: item.field,
          title: item.label,
          sorter: item.IsSort === 'true',
          width: item.Width || 120
        })
      })
    }
    let _columns = getColumns(columns)
    if (rowspans.length === 0) {
      rowspans = null
@@ -493,13 +519,6 @@
      }
      return uuid.join('')
    }) ()
    // if (setting.borderColor) { // 边框颜色
    //   let style = `#${tableId} table, #${tableId} tr, #${tableId} th, #${tableId} td {border-color: ${setting.borderColor}}`
    //   let ele = document.createElement('style')
    //   ele.innerHTML = style
    //   document.getElementsByTagName('head')[0].appendChild(ele)
    // }
    let size = (setting.pageSize || 10) + ''
    let pageOptions = ['10', '25', '50', '100', '500', '1000']
@@ -856,11 +875,14 @@
      }
    }
    const components = {
    let components = {
      body: {
        row: BodyRow,
        cell: BodyCell
        row: BodyRow
      }
    }
    if (setting.tableMode !== 'fast') {
      components.body.cell = BodyCell
    }
    // 数据收起时,过滤已选数据
@@ -899,7 +921,6 @@
        }
        <Table
          components={components}
          // style={setting.style}
          size={setting.size || 'middle'}
          bordered={setting.bordered !== 'false'}
          rowSelection={rowSelection}
@@ -909,7 +930,7 @@
          scroll={{ x: '100%', y: height }}
          onRow={(record, index) => {
            return {
              lineMarks,
              lineMarks: setting.tableMode !== 'fast' ? lineMarks : null,
              data: record,
              className: index === activeIndex ? ' mk-row-active ' : '',
              onClick: () => {this.changeRow(record, index)},