| | |
| | | </div> |
| | | ) |
| | | } else if (item.type === 'colspan') { |
| | | let contents = '' |
| | | if (item.subColumn.length > 0) { |
| | | contents = item.subColumn.map(col => { |
| | | let content = '' |
| | | if (col.type === 'text' || col.type === 'textarea') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = `${record[col.field]}` |
| | | } |
| | | if (item.subColumn.length === 0) return '' |
| | | |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } else if (col.type === 'number') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = +record[col.field] |
| | | } |
| | | if (content && col.format === 'thdSeparator') { |
| | | content = `${content}` |
| | | content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') |
| | | } |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | let contents = item.subColumn.map(col => { |
| | | let content = '' |
| | | if (col.type === 'text' || col.type === 'textarea') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = `${record[col.field]}` |
| | | } |
| | | return content |
| | | }) |
| | | } |
| | | |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } else if (col.type === 'number') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = +record[col.field] |
| | | } |
| | | if (content && col.format === 'thdSeparator') { |
| | | content = `${content}` |
| | | content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') |
| | | } |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } else if (col.type === 'picture') { |
| | | let photos = '' |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | photos = record[col.field].split(',') |
| | | } else { |
| | | photos = '' |
| | | } |
| | | content = <div className="picture-col"> |
| | | {photos && photos.map((url, i) => { |
| | | return <img key={`${i}`} src={url} alt=""/> |
| | | })} |
| | | </div> |
| | | } |
| | | |
| | | return content |
| | | }) |
| | | |
| | | if (contents && item.order === 'vertical2') { |
| | | let _contents = [] |