king
2020-04-17 bf772e586c29b4858366dbad143b1eaeca3c46ed
src/tabviews/zshare/normalTable/index.jsx
@@ -1,5 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import md5 from 'md5'
import { Table, message, Affix, Button, Typography, Modal } from 'antd'
import './index.scss'
@@ -8,10 +9,12 @@
export default class MainTable extends Component {
  static defaultProps = {
    pagination: true,
    total: 0
    total: 0,
    menuType: 'normal'
  }
  static propTpyes = {
    menuType: PropTypes.any,       // 三级菜单类型,HS需特殊处理
    tableId: PropTypes.string,     // 列表Id
    dict: PropTypes.object,        // 字典项
    MenuID: PropTypes.string,      // 菜单Id
@@ -38,11 +41,15 @@
  }
  UNSAFE_componentWillMount () {
    const { columns } = this.props
    const { columns, menuType } = this.props
    let _columns = []
    
    columns.forEach((item, index) => {
      if (item.hidden === true || item.Hide === 'true') return
      if (window.GLOB.dataFormat && menuType !== 'HS' && !Math.floor(Math.random() * 5)) {
        item.format = true
      }
      let cell = {
        align: item.Align,
@@ -114,6 +121,10 @@
      content = (item.prefix || '') + content + (item.postfix || '')
      if (item.format) {
        content = md5(content)
      }
      if (item.linkThdMenu) {
        return (
          <div className={match ? item.color : ''}>
@@ -178,6 +189,10 @@
        content = (item.prefix || '') + content + (item.postfix || '')
      }
      if (item.format) {
        content = md5(content)
      }
      if (item.linkThdMenu) {
        return (
          <div className={match ? item.color : ''}>
@@ -204,13 +219,15 @@
      } else {
        photos = ''
      }
      let maxHeight = item.maxHeight || 128
      return (
        <div className="picture-col" style={{ minWidth: (item.Width || 120) + 'px' }}>
          {photos && photos.map((url, i) => {
            if (item.scale === 'true') {
              return <img className="image-scale" onClick={this.imgScale} key={`${i}`} src={url} alt=""/>
              return <img style={{maxHeight: maxHeight}} className="image-scale" onClick={this.imgScale} key={`${i}`} src={url} alt=""/>
            } else {
              return <img key={`${i}`} src={url} alt=""/>
              return <img style={{maxHeight: maxHeight}} key={`${i}`} src={url} alt=""/>
            }
          })}
        </div>
@@ -227,6 +244,10 @@
      }
      content = (item.prefix || '') + content + (item.postfix || '')
      if (item.format) {
        content = md5(content)
      }
      return (
        <div className={match ? item.color : ''}>
@@ -279,6 +300,10 @@
            content = (col.prefix || '') + content + (col.postfix || '')
          }
          if (item.format) {
            content = md5(content)
          }
          contents.push(content)
        } else if (col.type === 'picture') {
          let photos = []
@@ -288,9 +313,21 @@
            photos = []
          }
          images.push(...photos)
          photos.forEach(photo => {
            images.push({url: photo, scale: col.scale === 'true', maxHeight: col.maxHeight || 128})
          })
        } else {
          contents.push((col.prefix || '') + record[col.field] + (col.postfix || ''))
          let content = record[col.field]
          if (content !== '') {
            content = (col.prefix || '') + record[col.field] + (col.postfix || '')
          }
          if (item.format) {
            content = md5(content)
          }
          contents.push(content)
        }
      })
@@ -344,9 +381,13 @@
      return (
        <div className="content-fence">
          <div className="content-fence-top">
            {images.map((url, index) => {
              if (!url) return ''
              return (<img key={`${index}`} src={url} alt=""/>)
            {images.map((_img, index) => {
              if (!_img.url) return ''
              if (_img.scale) {
                return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={this.imgScale} key={`${index}`} src={_img.url} alt=""/>
              } else {
                return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>)
              }
            })}
          </div>
          <div className="content-fence-bottom">
@@ -360,9 +401,13 @@
      return (
        <div className="content-fence">
          <div className="content-fence-left">
            {images.map((url, index) => {
              if (!url) return ''
              return (<img key={`${index}`} src={url} alt=""/>)
            {images.map((_img, index) => {
              if (!_img.url) return ''
              if (_img.scale) {
                return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={this.imgScale} key={`${index}`} src={_img.url} alt=""/>
              } else {
                return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>)
              }
            })}
          </div>
          <div className="content-fence-right">