From e9e8b1c7b481415714fff9a0d83099fd5a7d6ff0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 18 五月 2023 17:25:11 +0800 Subject: [PATCH] 2023-05-18 --- src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 40 +++++++++++++++++++++------------------- 1 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index fe8a4d0..36e29df 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -429,7 +429,7 @@ val = '' } return (<td className="editing_table_cell"> - <InputNumber className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={val} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> + <InputNumber className={err ? 'has-error' : ''} precision={col.decimal || 0} title={err} id={col.uuid + record.$$uuid} defaultValue={val} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> </td>) } else { return (<td className={className + ' pointer'} style={style}> @@ -466,6 +466,10 @@ // eslint-disable-next-line content = eval(content) } catch (e) { + if (window.debugger) { + console.info(content) + console.warn(e) + } content = '' } } @@ -474,6 +478,11 @@ if (col.noValue === 'hide' && content === 0) { content = '' + } + + if (col.round && typeof(content) === 'number') { + content = Math.round(content * col.round) / col.round + content = content.toFixed(col.decimal) } if (content !== '') { @@ -505,14 +514,6 @@ style = {...style, ...col.style} } - children = ( - <CardCellComponent data={record} cards={config} elements={col.elements}/> - ) - } else if (col.type === 'action') { - style.padding = '0px' - if (col.style) { - style = {...style, ...col.style} - } children = ( <CardCellComponent data={record} cards={config} elements={col.elements}/> ) @@ -786,7 +787,7 @@ } children = (<> - <InputNumber className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={_value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> + <InputNumber className={err ? 'has-error' : ''} title={err} precision={col.decimal || 0} id={col.uuid + record.$$uuid} defaultValue={_value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> </>) } else { let content = '' @@ -866,6 +867,10 @@ // eslint-disable-next-line content = eval(content) } catch (e) { + if (window.debugger) { + console.info(content) + console.warn(e) + } content = '' } } @@ -874,6 +879,11 @@ if (col.noValue === 'hide' && content === 0) { content = '' + } + + if (col.round && typeof(content) === 'number') { + content = Math.round(content * col.round) / col.round + content = content.toFixed(col.decimal) } if (content !== '') { @@ -905,14 +915,6 @@ style = {...style, ...col.style} } - children = ( - <CardCellComponent data={record} cards={config} elements={col.elements}/> - ) - } else if (col.type === 'action') { - style.padding = '0px' - if (col.style) { - style = {...style, ...col.style} - } children = ( <CardCellComponent data={record} cards={config} elements={col.elements}/> ) @@ -1010,7 +1012,7 @@ onCell: record => ({ record, col: item, - config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null, + config: item.type === 'custom' ? {setting, columns: fields} : null, }) } } -- Gitblit v1.8.0