Commit d7456877dc97a9f808286896e468f5c53a935c8f

Authored by Min
1 parent 9cb0f1da

1.全系统:数量,金额,单价位置,需以“千位分隔法”标识;

比如:4567890,应标识为“4,567,890”;(包括统计列)
src/components/Common/CommonTable/index.js
... ... @@ -4548,9 +4548,9 @@ class CommonTableRc extends React.Component {
4548 4548 }
4549 4549 const cellChild = (
4550 4550 <Table.Summary.Cell key={itemChild.dataIndex} index={iTag + i}>
4551   - <Tooltip title={sValue}><span
  4551 + <Tooltip title={this.formatThousands(sValue)}><span
4552 4552 className={styles.summaryCell}
4553   - >{sValue}</span></Tooltip>
  4553 + >{this.formatThousands(sValue)}</span></Tooltip>
4554 4554 </Table.Summary.Cell>
4555 4555 );
4556 4556 cells.push(cellChild);
... ... @@ -4602,11 +4602,12 @@ class CommonTableRc extends React.Component {
4602 4602 }
4603 4603 }
4604 4604 }
  4605 + // 金额 数量 价格 千分位处理
4605 4606 cell = (
4606 4607 <Table.Summary.Cell key={item.dataIndex} index={iTag}>
4607   - <Tooltip title={sValue}><span
  4608 + <Tooltip title={this.formatThousands(sValue)}><span
4608 4609 className={styles.summaryCell}
4609   - >{sValue}</span></Tooltip>
  4610 + >{this.formatThousands(sValue)}</span></Tooltip>
4610 4611 </Table.Summary.Cell>
4611 4612 );
4612 4613 cells.push(cell);
... ... @@ -4633,9 +4634,9 @@ class CommonTableRc extends React.Component {
4633 4634 let sValue = totalData1[0][itemChild.dataIndex];
4634 4635 const cellChild = (
4635 4636 <Table.Summary.Cell key={itemChild.dataIndex} index={iTag + i}>
4636   - <Tooltip title={sValue}><span
  4637 + <Tooltip title={this.formatThousands(sValue)}><span
4637 4638 className={styles.summaryCell}
4638   - >{sValue}</span></Tooltip>
  4639 + >{this.formatThousands(sValue)}</span></Tooltip>
4639 4640 </Table.Summary.Cell>
4640 4641 );
4641 4642 cells1.push(cellChild);
... ... @@ -4646,9 +4647,9 @@ class CommonTableRc extends React.Component {
4646 4647 let sValue = totalData1[0][item.dataIndex];
4647 4648 cell = (
4648 4649 <Table.Summary.Cell key={item.dataIndex} index={iTag}>
4649   - <Tooltip title={sValue}><span
  4650 + <Tooltip title={this.formatThousands(sValue)}><span
4650 4651 className={styles.summaryCell}
4651   - >{sValue}</span></Tooltip>
  4652 + >{this.formatThousands(sValue)}</span></Tooltip>
4652 4653 </Table.Summary.Cell>
4653 4654 );
4654 4655 cells1.push(cell);
... ... @@ -5351,6 +5352,8 @@ class CommonTableRc extends React.Component {
5351 5352 /** 绑定showType控件 */
5352 5353 bindShowType = (props, text, record, sName, index, isSlaveInfo) => {
5353 5354 record.iRowNum = index + 1;
  5355 + // 金额 数量 价格 千分位处理
  5356 + const isAmount = sName.includes('Price') || sName.includes('Money') || sName.includes('Qty');
5354 5357 /* 如果从表没有数据就返回一个默认的input text,不返回showType了 */
5355 5358 let res = '';
5356 5359 const idx = index;
... ... @@ -5540,7 +5543,7 @@ class CommonTableRc extends React.Component {
5540 5543 {(commonUtils.isNotEmptyObject(sName) && sName.substring(0, 1) === 'b') || (imgBox !== '') ? '' :
5541 5544 <div
5542 5545 className={linkStyle}
5543   - title={sValue}
  5546 + title={isAmount ? this.formatThousands(sValue) : sValue}
5544 5547 style={{ padding: '4px', paddingTop: '6px', backgroundColor: `${backgroundColor}`, color: `${cellColor}`, width: '100%', height: '100%' }}
5545 5548 onKeyDown={e => this.onKeyDownDiv(e, sName)}
5546 5549 onCut={e => e.preventDefault()}
... ... @@ -5548,7 +5551,7 @@ class CommonTableRc extends React.Component {
5548 5551 // suppressContentEditableWarning
5549 5552 // contentEditable="true"
5550 5553 onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null}
5551   - > {sValue}</div>}
  5554 + > {isAmount ? this.formatThousands(sValue) : sValue}</div>}
5552 5555 {bShow}{imgBox}
5553 5556 </div>);
5554 5557 } else {
... ... @@ -5566,7 +5569,7 @@ class CommonTableRc extends React.Component {
5566 5569 placement='bottomLeft'
5567 5570 overlayClassName="commonTitle"
5568 5571 mouseEnterDelay={0.8}
5569   - title={<span style={{ fontSize: 16 }}>{sValue}</span>}
  5572 + title={<span style={{ fontSize: 16 }}>{isAmount ? this.formatThousands(sValue) : sValue}</span>}
5570 5573 >
5571 5574 <span
5572 5575 className={linkStyle}
... ... @@ -5577,7 +5580,7 @@ class CommonTableRc extends React.Component {
5577 5580 // suppressContentEditableWarning
5578 5581 // contentEditable="true"
5579 5582 onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null}
5580   - > {sValue}</span>
  5583 + > {isAmount ? this.formatThousands(sValue) : sValue}</span>
5581 5584 </Tooltip>
5582 5585 }
5583 5586 {bShow}{imgBox}{this.handleGetFastSearchBtn({ record, sName, isSlaveInfo })}
... ... @@ -5832,7 +5835,7 @@ class CommonTableRc extends React.Component {
5832 5835 placement={bSpecialTitle ? 'right' : 'bottomLeft'}
5833 5836 overlayClassName={bSpecialTitle ? 'commonSpecialTitle' : 'commonTitle'}
5834 5837 mouseEnterDelay={0.8}
5835   - title={<span style={{ fontSize: 16 }}>{commonUtils.isNotEmptyObject(specialTitle) ? specialTitle : sValue}</span>}
  5838 + title={<span style={{ fontSize: 16 }}>{commonUtils.isNotEmptyObject(specialTitle) ? specialTitle : isAmount ? this.formatThousands(sValue) : sValue}</span>}
5836 5839 >
5837 5840 <span
5838 5841 className={linkStyle}
... ... @@ -5870,9 +5873,9 @@ class CommonTableRc extends React.Component {
5870 5873 )
5871 5874 : null
5872 5875 }
5873   - > {sValue}</span>
5874   - </Tooltip>
5875   - }{bShow}{imgBox}{showQty}</span>
  5876 + > {isAmount ? this.formatThousands(sValue) : sValue}</span>
  5877 + </Tooltip>
  5878 + }{bShow}{imgBox}{showQty}</span>
5876 5879 );
5877 5880  
5878 5881 // 人检-质检代码特殊处理
... ... @@ -5883,6 +5886,40 @@ class CommonTableRc extends React.Component {
5883 5886 }
5884 5887 };
5885 5888  
  5889 + formatThousands = (value) => {
  5890 + if (value == null || value === '') return '';
  5891 +
  5892 + let str = String(value).trim();
  5893 +
  5894 + // 清理:只保留数字、小数点和开头的负号
  5895 + const cleaned = str.replace(/[^\d.-]/g, '');
  5896 + const parts = cleaned.split('.');
  5897 +
  5898 + // 多个小数点只保留第一个
  5899 + if (parts.length > 2) {
  5900 + str = parts[0] + '.' + parts.slice(1).join('');
  5901 + } else {
  5902 + str = cleaned;
  5903 + }
  5904 +
  5905 + // 最终验证(允许 -.(数字) 和 数字. 格式)
  5906 + if (!/^-?(\d+|\d*\.\d+)$/.test(str)) return '';
  5907 +
  5908 + // 分离并格式化
  5909 + const [integerPart, decimalPart] = str.split('.');
  5910 +
  5911 + const formatWithCommas = (num) =>
  5912 + num.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
  5913 +
  5914 + const formattedInteger = integerPart.startsWith('-')
  5915 + ? '-' + formatWithCommas(integerPart.slice(1))
  5916 + : formatWithCommas(integerPart);
  5917 +
  5918 + return decimalPart !== undefined
  5919 + ? `${formattedInteger}.${decimalPart}`
  5920 + : formattedInteger;
  5921 + };
  5922 +
5886 5923 /** willProps赋值 * */
5887 5924 assignmentWillProps = (props) => {
5888 5925 // 重构修改 去除filteredData;
... ...
src/components/login/Login.js
... ... @@ -191,9 +191,7 @@ class LoginForm extends Component {
191 191 // decimals.dNetPrice = dNetPrice !== undefined && dNetPrice.sValue !== undefined ? (dNetPrice.sValue) * 1 : 6;
192 192 // decimals.dNetMoney = dNetMoney !== undefined && dNetMoney.sValue !== undefined ? (dNetMoney.sValue) * 1 : 6;
193 193 decimals.dNumAlign = dNumAlign !== undefined && dNumAlign.sValue !== undefined ? dNumAlign.sValue : 0;
194   - // commonUtils.setNetPrice(decimals.dNetPrice);
195   - // commonUtils.setNetMoney(decimals.dNetMoney);
196   - // commonUtils.setDateFormat(commonFunc.getDateFormat(systemData));
  194 + decimals.bThousandth = !!(commonUtils.isNotEmptyObject(bThousandthObj) && bThousandthObj.sValue === '1');
197 195 }
198 196 // 判断是否是初始密码
199 197 if (values.username !== "zhangz") {
... ...