From 8eb9303af35b6bee86daaa9ff478b623516fc183 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 16 三月 2020 11:49:29 +0800 Subject: [PATCH] 2020-03-16 --- src/tabviews/commontable/mainTable/index.jsx | 54 +++++++++++++++++++++++++++++++++--------------------- 1 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/tabviews/commontable/mainTable/index.jsx b/src/tabviews/commontable/mainTable/index.jsx index 8d9bfca..0d7425b 100644 --- a/src/tabviews/commontable/mainTable/index.jsx +++ b/src/tabviews/commontable/mainTable/index.jsx @@ -164,29 +164,41 @@ </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 = [] -- Gitblit v1.8.0