king
2021-07-28 137fb8ea6af2789b3238b22bac31d80bced41dfe
src/tabviews/zshare/normalTable/index.jsx
@@ -17,6 +17,7 @@
const PopupButton = asyncComponent(() => import('@/tabviews/zshare/actionList/popupbutton'))
const TabButton = asyncComponent(() => import('@/tabviews/zshare/actionList/tabbutton'))
const NewPageButton = asyncComponent(() => import('@/tabviews/zshare/actionList/newpagebutton'))
const ImgScale = asyncComponent(() => import('@/tabviews/zshare/imgScale'))
class NormalTable extends Component {
  static propTpyes = {
@@ -45,7 +46,7 @@
    pageSize: 10,         // 每页数据条数
    columns: null,        // 显示列
    imgShow: false,       // 图片放大模态框
    imgSrc: '',           // 图片路径
    imgData: {},          // 图片集
    lineMarks: null,      // 行标记
    activeIndex: null,    // 标记当前选中行
    rowspans: null        // 行合并字段信息
@@ -139,7 +140,10 @@
        if (item.rowspan === 'true') {
          rowspans.push(item.field)
        }
        if (_format && !Math.floor(Math.random() * radio)) {
        if (item.type === 'index') {
          item.field = '$Index'
          item.type = 'text'
        } else if (_format && !Math.floor(Math.random() * radio)) {
          item.blur = true
        }
@@ -165,14 +169,6 @@
          render: (text, record) => {
            return this.getContent(item, record)
          }
        }
      }
      if (item.fixed === true || item.fixed === 'true') {
        if (index < columns.length / 2) {
          cell.fixed = 'left'
        } else {
          cell.fixed = 'right'
        }
      }
      
@@ -552,7 +548,7 @@
      let photos = ''
      if (item.field && record.hasOwnProperty(item.field)) {
        photos = record[item.field] + ''
        photos = photos.split(',')
        photos = photos.split(',').filter(Boolean)
      } else {
        photos = ''
      }
@@ -562,7 +558,7 @@
        <div className="picture-col">
          {photos && photos.map((url, i) => {
            if (item.scale === 'true') {
              return <img style={{maxHeight: maxHeight}} className="image-scale" onClick={this.imgScale} key={`${i}`} src={url} alt=""/>
              return <img style={{maxHeight: maxHeight}} className="image-scale" onClick={() => this.imgScale(photos, i)} key={`${i}`} src={url} alt=""/>
            } else {
              return <img style={{maxHeight: maxHeight}} key={`${i}`} src={url} alt=""/>
            }
@@ -738,7 +734,7 @@
          let photos = []
          try {
            photos = record[col.field] + ''
            photos = photos.split(',')
            photos = photos.split(',').filter(Boolean)
          } catch {
            photos = []
          }
@@ -874,9 +870,8 @@
        <div className="content-fence">
          <div className="content-fence-top" style={images[0] ? {textAlign: images[0].align} : null}>
            {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=""/>
                return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={() => this.imgScale(images, index)} key={`${index}`} src={_img.url} alt=""/>
              } else {
                return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>)
              }
@@ -894,9 +889,8 @@
        <div className="content-fence">
          <div className="content-fence-left" style={images[0] ? {textAlign: images[0].align} : null}>
            {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=""/>
                return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={() => this.imgScale(images, index)} key={`${index}`} src={_img.url} alt=""/>
              } else {
                return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>)
              }
@@ -915,18 +909,19 @@
  /**
   * @description 图片缩放
   */
  imgScaleClose = () => {
  imgScale = (images, index) => {
    this.setState({
     imgShow: false
      imgShow: true,
      imgData: {
        list: images.map(item => {
          if (typeof(item) === 'string') {
            return item
          }
          return item.url
        }),
        index
      }
    })
  }
  imgScale = (e) => {
    if (e.target.nodeName === 'IMG') {
      this.setState({
        imgShow: true,
        imgSrc: e.target.src
      })
    }
  }
  /**
@@ -1242,12 +1237,12 @@
          visible={this.state.imgShow}
          width="70vw"
          maskClosable={true}
          onCancel={this.imgScaleClose}
          onCancel={() => {this.setState({ imgShow: false })}}
          title={this.props.dict['main.form.picture.check']}
          footer={[<span key="close" onClick={this.imgScaleClose}>{this.props.dict['main.close']}</span>]}
          footer={[<span key="close" onClick={() => {this.setState({ imgShow: false })}}>{this.props.dict['main.close']}</span>]}
          destroyOnClose
        >
         <img style={{maxWidth:'100%'}} src={this.state.imgSrc} alt="" />
          <ImgScale data={this.state.imgData}/>
        </Modal>
      </div>
    )