| | |
| | | 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' |
| | | |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | 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, |
| | |
| | | |
| | | content = (item.prefix || '') + content + (item.postfix || '') |
| | | |
| | | if (item.format) { |
| | | content = md5(content) |
| | | } |
| | | |
| | | if (item.linkThdMenu) { |
| | | return ( |
| | | <div className={match ? item.color : ''}> |
| | |
| | | content = (item.prefix || '') + content + (item.postfix || '') |
| | | } |
| | | |
| | | if (item.format) { |
| | | content = md5(content) |
| | | } |
| | | |
| | | if (item.linkThdMenu) { |
| | | return ( |
| | | <div className={match ? item.color : ''}> |
| | |
| | | } 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> |
| | |
| | | } |
| | | |
| | | content = (item.prefix || '') + content + (item.postfix || '') |
| | | |
| | | if (item.format) { |
| | | content = md5(content) |
| | | } |
| | | |
| | | return ( |
| | | <div className={match ? item.color : ''}> |
| | |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } |
| | | |
| | | if (item.format) { |
| | | content = md5(content) |
| | | } |
| | | |
| | | contents.push(content) |
| | | } else if (col.type === 'picture') { |
| | | let photos = [] |
| | |
| | | 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) |
| | | } |
| | | }) |
| | | |
| | |
| | | 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"> |
| | |
| | | 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"> |