king
2020-12-04 3659f0773a14b54c18ed0af8b64de4afe8227489
src/tabviews/zshare/normalTable/index.jsx
@@ -26,12 +26,11 @@
    pageSize: PropTypes.any,         // 每页数据
    MenuName: PropTypes.any,         // 菜单名称
    dict: PropTypes.object,          // 字典项
    config: PropTypes.object,        // 页面配置
    MenuID: PropTypes.string,        // 菜单Id
    setting: PropTypes.object,       // 表格全局设置:tableType(表格是否可选、单选、多选)、columnfixed(列固定)、actionfixed(按钮固定)
    pickup: PropTypes.any,           // 数据收起
    columns: PropTypes.array,        // 表格列
    logcolumns: PropTypes.array,     // 字段列
    fields: PropTypes.array,         // 组件字段集
    BID: PropTypes.any,              // 主表Id
    ContainerId: PropTypes.any,      // 标签页外层Id
    BData: PropTypes.any,            // 主表数据
@@ -57,8 +56,8 @@
  }
  UNSAFE_componentWillMount () {
    const { menuType, config, memberLevel, pageSize } = this.props
    let columns = JSON.parse(JSON.stringify(this.props.columns))
    const { menuType, memberLevel, pageSize } = this.props
    let columns = fromJS(this.props.columns).toJS()
    let lineMarks = []
    let _columns = []
    let radio = 5          // 虚化比例
@@ -75,45 +74,28 @@
      }
    }
    // 获取行标记
    config.columns.forEach(col => {
      if (!col.field) return
      col.marks && col.marks.forEach(mark => {
        if (mark.signType === 'line') {
          lineMarks.push(mark)
        }
      })
    })
    columns.forEach((item, index) => {
      if (item.hidden === true || item.Hide === 'true') return
      if (_format && !Math.floor(Math.random() * radio)) {
        item.blur = true
      }
      if (item.marks) { // 过滤行和卡片标记
        item.marks = item.marks.filter(mark => mark.signType !== 'line' && mark.signType !== 'card')
        if (item.marks.length === 0) {
          item.marks = ''
        }
      }
      let cell = null
      if (item.type === 'colspan' && item.unfold === 'true') {
      if (item.type === 'colspan') {
        cell = {title: item.label, children: []}
        item.subcols.forEach(col => {
          if (col.rowspan === 'true') {
            rowspan = col
          }
          if (_format && !Math.floor(Math.random() * radio)) {
            col.blur = true
          }
          if (col.marks) { // 过滤行和卡片标记
            col.marks = col.marks.filter(mark => mark.signType !== 'line' && mark.signType !== 'card')
            col.marks = col.marks.filter(mark => {
              if (mark.signType === 'line') {
                lineMarks.push(mark)
              }
              return mark.signType !== 'line' && mark.signType !== 'card'
            })
    
            if (col.marks.length === 0) {
              col.marks = ''
@@ -131,9 +113,51 @@
            }
          })
        })
      } else if (item.type === 'old_colspan') {
        item.subcols.forEach(col => {
          if (col.marks) { // 过滤行和卡片标记
            col.marks = col.marks.filter(mark => {
              if (mark.signType === 'line') {
                lineMarks.push(mark)
              }
              return mark.signType !== 'line' && mark.signType !== 'card'
            })
            if (col.marks.length === 0) {
              col.marks = ''
            }
          }
        })
        cell = {
          align: item.Align,
          dataIndex: item.field || item.uuid,
          title: item.label,
          sorter: item.field && item.IsSort === 'true',
          width: item.Width || 120,
          render: (text, record) => {
            return this.getContent(item, record)
          }
        }
      } else {
        if (item.rowspan === 'true') {
          rowspan = item
        }
        if (_format && !Math.floor(Math.random() * radio)) {
          item.blur = true
        }
        if (item.marks) { // 过滤行和卡片标记
          item.marks = item.marks.filter(mark => {
            if (mark.signType === 'line') {
              lineMarks.push(mark)
            }
            return mark.signType !== 'line' && mark.signType !== 'card'
          })
          if (item.marks.length === 0) {
            item.marks = ''
          }
        }
        cell = {
@@ -426,11 +450,13 @@
      }
      if (content !== '') {
        let decimal = item.decimal || 0
        if (item.format === 'percent') {
          content = content * 100
          decimal = decimal > 2 ? decimal - 2 : 0
        }
  
        content = content.toFixed(item.decimal || 0)
        content = content.toFixed(decimal)
  
        if (item.format === 'thdSeparator') {
          content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
@@ -569,7 +595,7 @@
                  BData={this.props.BData}
                  setting={this.props.setting}
                  MenuName={this.props.MenuName}
                  columns={this.props.logcolumns}
                  columns={this.props.fields || this.props.columns}
                  ContainerId={this.props.ContainerId}
                  updateStatus={this.updateStatus}
                />
@@ -612,7 +638,7 @@
          })}
        </div>
      )
    } else if (item.type === 'colspan') {
    } else if (item.type === 'old_colspan') {
      if (item.subcols.length === 0) return ''
      let ordertype = item.order
      let contents = []
@@ -633,11 +659,13 @@
          }
    
          if (content !== '') {
            let decimal = col.decimal || 0
            if (col.format === 'percent') {
              content = content * 100
              decimal = decimal > 2 ? decimal - 2 : 0
            }
            
            content = content.toFixed(col.decimal || 0)
            content = content.toFixed(decimal)
      
            if (col.format === 'thdSeparator') {
              content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
@@ -686,7 +714,7 @@
              content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}`
            }
            content = (col.prefix || '') + record[col.field] + (col.postfix || '')
            content = (col.prefix || '') + content + (col.postfix || '')
          }
          if (col.marks) {
@@ -890,7 +918,7 @@
  changeRow = (record, index) => {
    if (!this.props.setting.tableType || this.props.pickup) return
    
    let newkeys = JSON.parse(JSON.stringify(this.state.selectedRowKeys))
    let newkeys = fromJS(this.state.selectedRowKeys).toJS()
    if (this.props.setting.tableType === 'radio') {
      newkeys = [index]