From bf772e586c29b4858366dbad143b1eaeca3c46ed Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 17 四月 2020 10:18:09 +0800 Subject: [PATCH] 2020-04-17 --- src/tabviews/zshare/normalTable/index.jsx | 71 +++++++++++++++++++++++++++++------ 1 files changed, 58 insertions(+), 13 deletions(-) diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 0e5dc7d..4fc83b9 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/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, // 涓夌骇鑿滃崟绫诲瀷锛孒S闇�鐗规畩澶勭悊 tableId: PropTypes.string, // 鍒楄〃Id dict: PropTypes.object, // 瀛楀吀椤� MenuID: PropTypes.string, // 鑿滃崟Id @@ -19,7 +22,7 @@ pickup: PropTypes.any, // 鏁版嵁鏀惰捣 columns: PropTypes.array, // 琛ㄦ牸鍒� data: PropTypes.any, // 琛ㄦ牸鏁版嵁 - total: PropTypes.any, // 鎬绘暟 + total: PropTypes.any, // 鎬绘暟 loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� buttonTrigger: PropTypes.func, // 琛ㄦ牸涓寜閽Е鍙戞搷浣� @@ -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"> -- Gitblit v1.8.0