| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Table, message, Affix, Button, Typography, Icon, Modal } from 'antd' |
| | | import { Table, message, Affix, Button, Typography, Modal } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const { Paragraph } = Typography |
| | |
| | | let cell = { |
| | | align: item.Align, |
| | | dataIndex: item.field || item.uuid, |
| | | title: <span>{item.label}{item.linkThdMenu ? <Icon type="link"/> : null}</span>, |
| | | title: item.label, |
| | | sorter: item.field && item.IsSort === 'true', |
| | | width: item.Width || 120, |
| | | render: (text, record) => { |
| | |
| | | } else if (item.type === 'number') { |
| | | let content = '' |
| | | let match = false |
| | | if (item.field && record.hasOwnProperty(item.field)) { |
| | | content = +record[item.field] |
| | | } |
| | | |
| | | if (content && item.match && item.matchVal) { |
| | | if (item.match === '>') { |
| | | if (content > item.matchVal) { |
| | | match = true |
| | | if (item.field && record.hasOwnProperty(item.field)) { |
| | | try { |
| | | content = parseFloat(record[item.field]) |
| | | if (isNaN(content)) { |
| | | content = '' |
| | | } |
| | | } else if (item.match === '<') { |
| | | if (content < item.matchVal) { |
| | | match = true |
| | | } |
| | | } else if (item.match === '>=') { |
| | | if (content >= item.matchVal) { |
| | | match = true |
| | | } |
| | | } else if (item.match === '<=') { |
| | | if (content <= item.matchVal) { |
| | | match = true |
| | | } |
| | | } catch { |
| | | content = '' |
| | | } |
| | | } |
| | | |
| | | if (content && item.format === 'thdSeparator') { |
| | | content = `${content}` |
| | | content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') |
| | | if (content !== '') { |
| | | if (item.match && item.matchVal) { |
| | | if (item.match === '>') { |
| | | if (content > item.matchVal) { |
| | | match = true |
| | | } |
| | | } else if (item.match === '<') { |
| | | if (content < item.matchVal) { |
| | | match = true |
| | | } |
| | | } else if (item.match === '>=') { |
| | | if (content >= item.matchVal) { |
| | | match = true |
| | | } |
| | | } else if (item.match === '<=') { |
| | | if (content <= item.matchVal) { |
| | | match = true |
| | | } |
| | | } |
| | | } |
| | | |
| | | content = content.toFixed(item.decimal || 0) |
| | | |
| | | if (item.format === 'thdSeparator') { |
| | | content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') |
| | | } |
| | | |
| | | content = (item.prefix || '') + content + (item.postfix || '') |
| | | } |
| | | |
| | | content = (item.prefix || '') + content + (item.postfix || '') |
| | | |
| | | if (item.linkThdMenu) { |
| | | return ( |
| | |
| | | item.subColumn.forEach(col => { |
| | | if (!col.field || !record.hasOwnProperty(col.field)) return |
| | | |
| | | if (col.type === 'number' && typeof(record[col.field]) === 'number') { |
| | | let content = record[col.field] |
| | | |
| | | if (col.format === 'thdSeparator') { |
| | | content = `${content}` |
| | | content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') |
| | | if (col.type === 'number') { |
| | | let content = '' |
| | | try { |
| | | content = parseFloat(record[col.field]) |
| | | if (isNaN(content)) { |
| | | content = '' |
| | | } |
| | | } catch { |
| | | content = '' |
| | | } |
| | | |
| | | if (content !== '') { |
| | | content = content.toFixed(col.decimal || 0) |
| | | |
| | | if (col.format === 'thdSeparator') { |
| | | content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') |
| | | } |
| | | |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } |
| | | |
| | | contents.push(content) |
| | | } else if (col.type === 'picture') { |