From d7456877dc97a9f808286896e468f5c53a935c8f Mon Sep 17 00:00:00 2001
From: pengm <674192343@qq.com>
Date: Wed, 28 Jan 2026 15:01:15 +0800
Subject: [PATCH] 1.全系统:数量,金额,单价位置,需以“千位分隔法”标识; 比如:4567890,应标识为“4,567,890”;(包括统计列)
---
src/components/Common/CommonTable/index.js | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
src/components/login/Login.js | 4 +---
2 files changed, 54 insertions(+), 19 deletions(-)
diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js
index d830513..864758d 100644
--- a/src/components/Common/CommonTable/index.js
+++ b/src/components/Common/CommonTable/index.js
@@ -4548,9 +4548,9 @@ class CommonTableRc extends React.Component {
}
const cellChild = (
- {sValue}
+ >{this.formatThousands(sValue)}
);
cells.push(cellChild);
@@ -4602,11 +4602,12 @@ class CommonTableRc extends React.Component {
}
}
}
+ // 金额 数量 价格 千分位处理
cell = (
- {sValue}
+ >{this.formatThousands(sValue)}
);
cells.push(cell);
@@ -4633,9 +4634,9 @@ class CommonTableRc extends React.Component {
let sValue = totalData1[0][itemChild.dataIndex];
const cellChild = (
- {sValue}
+ >{this.formatThousands(sValue)}
);
cells1.push(cellChild);
@@ -4646,9 +4647,9 @@ class CommonTableRc extends React.Component {
let sValue = totalData1[0][item.dataIndex];
cell = (
- {sValue}
+ >{this.formatThousands(sValue)}
);
cells1.push(cell);
@@ -5351,6 +5352,8 @@ class CommonTableRc extends React.Component {
/** 绑定showType控件 */
bindShowType = (props, text, record, sName, index, isSlaveInfo) => {
record.iRowNum = index + 1;
+ // 金额 数量 价格 千分位处理
+ const isAmount = sName.includes('Price') || sName.includes('Money') || sName.includes('Qty');
/* 如果从表没有数据就返回一个默认的input text,不返回showType了 */
let res = '';
const idx = index;
@@ -5540,7 +5543,7 @@ class CommonTableRc extends React.Component {
{(commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === 'b') || (imgBox !== '') ? '' :
this.onKeyDownDiv(e, sName)}
onCut={e => e.preventDefault()}
@@ -5548,7 +5551,7 @@ class CommonTableRc extends React.Component {
// suppressContentEditableWarning
// contentEditable="true"
onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null}
- > {sValue}
}
+ > {isAmount ? this.formatThousands(sValue) : sValue}}
{bShow}{imgBox}
);
} else {
@@ -5566,7 +5569,7 @@ class CommonTableRc extends React.Component {
placement='bottomLeft'
overlayClassName="commonTitle"
mouseEnterDelay={0.8}
- title={{sValue}}
+ title={{isAmount ? this.formatThousands(sValue) : sValue}}
>
{sValue}
+ > {isAmount ? this.formatThousands(sValue) : sValue}
}
{bShow}{imgBox}{this.handleGetFastSearchBtn({ record, sName, isSlaveInfo })}
@@ -5832,7 +5835,7 @@ class CommonTableRc extends React.Component {
placement={bSpecialTitle ? 'right' : 'bottomLeft'}
overlayClassName={bSpecialTitle ? 'commonSpecialTitle' : 'commonTitle'}
mouseEnterDelay={0.8}
- title={{commonUtils.isNotEmptyObject(specialTitle) ? specialTitle : sValue}}
+ title={{commonUtils.isNotEmptyObject(specialTitle) ? specialTitle : isAmount ? this.formatThousands(sValue) : sValue}}
>
{sValue}
-
- }{bShow}{imgBox}{showQty}
+ > {isAmount ? this.formatThousands(sValue) : sValue}
+
+ }{bShow}{imgBox}{showQty}
);
// 人检-质检代码特殊处理
@@ -5883,6 +5886,40 @@ class CommonTableRc extends React.Component {
}
};
+ formatThousands = (value) => {
+ if (value == null || value === '') return '';
+
+ let str = String(value).trim();
+
+ // 清理:只保留数字、小数点和开头的负号
+ const cleaned = str.replace(/[^\d.-]/g, '');
+ const parts = cleaned.split('.');
+
+ // 多个小数点只保留第一个
+ if (parts.length > 2) {
+ str = parts[0] + '.' + parts.slice(1).join('');
+ } else {
+ str = cleaned;
+ }
+
+ // 最终验证(允许 -.(数字) 和 数字. 格式)
+ if (!/^-?(\d+|\d*\.\d+)$/.test(str)) return '';
+
+ // 分离并格式化
+ const [integerPart, decimalPart] = str.split('.');
+
+ const formatWithCommas = (num) =>
+ num.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
+
+ const formattedInteger = integerPart.startsWith('-')
+ ? '-' + formatWithCommas(integerPart.slice(1))
+ : formatWithCommas(integerPart);
+
+ return decimalPart !== undefined
+ ? `${formattedInteger}.${decimalPart}`
+ : formattedInteger;
+ };
+
/** willProps赋值 * */
assignmentWillProps = (props) => {
// 重构修改 去除filteredData;
diff --git a/src/components/login/Login.js b/src/components/login/Login.js
index 4720654..6601885 100644
--- a/src/components/login/Login.js
+++ b/src/components/login/Login.js
@@ -191,9 +191,7 @@ class LoginForm extends Component {
// decimals.dNetPrice = dNetPrice !== undefined && dNetPrice.sValue !== undefined ? (dNetPrice.sValue) * 1 : 6;
// decimals.dNetMoney = dNetMoney !== undefined && dNetMoney.sValue !== undefined ? (dNetMoney.sValue) * 1 : 6;
decimals.dNumAlign = dNumAlign !== undefined && dNumAlign.sValue !== undefined ? dNumAlign.sValue : 0;
- // commonUtils.setNetPrice(decimals.dNetPrice);
- // commonUtils.setNetMoney(decimals.dNetMoney);
- // commonUtils.setDateFormat(commonFunc.getDateFormat(systemData));
+ decimals.bThousandth = !!(commonUtils.isNotEmptyObject(bThousandthObj) && bThousandthObj.sValue === '1');
}
// 判断是否是初始密码
if (values.username !== "zhangz") {
--
libgit2 0.22.2