From decf1f6555b6e003860401a692faea259cc565af Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 23 三月 2021 21:00:08 +0800 Subject: [PATCH] 2021-03-23 --- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 34 +++++++++++++++++++++++++++------- 1 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index f2a67e7..ec8f827 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -433,12 +433,17 @@ let _header = [] let _topRow = {} let colwidth = [] + let abses = [] btn.verify.columns.forEach(col => { if (_topRow[col.Column]) return _header.push(col.Column) _topRow[col.Column] = col.Text + + if (col.abs === 'true') { + abses.push(col.Column) + } colwidth.push({width: col.Width || 20}) }) @@ -447,14 +452,29 @@ table.push(_topRow) - data && data.forEach(item => { - let _row = {} - _header.forEach(field => { - _row[field] = item[field] + if (data && abses.length > 0) { + data.forEach(item => { + let _row = {} + _header.forEach(field => { + if (item[field] && abses.includes(field)) { + _row[field] = Math.abs(item[field]) + } else { + _row[field] = item[field] + } + }) + + table.push(_row) }) - - table.push(_row) - }) + } else if (data) { + data.forEach(item => { + let _row = {} + _header.forEach(field => { + _row[field] = item[field] + }) + + table.push(_row) + }) + } const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true}) -- Gitblit v1.8.0