Commit 019948efd5d25ec82d8eb3469676ca57ade54dd2

Authored by Min
1 parent 3bea7e76

1.处理放大镜新增报错

2.处理数字去掉小数点格式化
src/components/Common/CommonComponent/index.js
@@ -1516,8 +1516,7 @@ export default class CommonComponent extends Component { @@ -1516,8 +1516,7 @@ export default class CommonComponent extends Component {
1516 this.handleSelectOptionEvent(value); 1516 this.handleSelectOptionEvent(value);
1517 }, /* 数据改变回带到父组件 */ 1517 }, /* 数据改变回带到父组件 */
1518 parser: (oldValue) => { 1518 parser: (oldValue) => {
1519 - const value = this.handleCheckNumberInnerInput(oldValue);  
1520 - return value?.replace(/\$\s?|(,*)/g, ''); 1519 + return oldValue;
1521 }, 1520 },
1522 formatter: (value) => { 1521 formatter: (value) => {
1523 if (value === '' || value === undefined || value === null || location.pathname.includes("indexPad")) { 1522 if (value === '' || value === undefined || value === null || location.pathname.includes("indexPad")) {
src/components/Common/CommonHooks/useCommonBase.js
@@ -2991,6 +2991,45 @@ const useCommonBase = props => { @@ -2991,6 +2991,45 @@ const useCommonBase = props => {
2991 ); 2991 );
2992 }; 2992 };
2993 2993
  2994 +
  2995 + const handleTableAdd = (name, isWait) => {
  2996 + /* 外置处理业务 */
  2997 + const {
  2998 + [`${name}Config`]: tableConfig, masterData, slaveData, slaveSelectedRowKeys,
  2999 + } = state;
  3000 + let { [`${name}Data`]: tableData } = state;
  3001 + tableData = commonUtils.isEmptyObject(tableData) ? [] : tableData;
  3002 + const allTableData = {};
  3003 + allTableData.master = masterData;
  3004 + if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
  3005 + const iSlaveIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys.toString());
  3006 + allTableData.slave = slaveData[iSlaveIndex];
  3007 + }
  3008 + const iOrderArr = [];
  3009 + tableData.forEach((item) => {
  3010 + const iOrder = commonUtils.isNotEmptyNumber(item.iOrder) ? item.iOrder : 0; /* 获取tableData中iOrder最大值 */
  3011 + iOrderArr.push(iOrder);
  3012 + });
  3013 + const iOrderMax = Math.max(...iOrderArr);
  3014 + const tableDataRow = commonFunc.getDefaultData(tableConfig, allTableData);
  3015 + tableDataRow.handleType = 'add';
  3016 + tableDataRow.sId = commonUtils.createSid();
  3017 + tableDataRow.sParentId = masterData && masterData.sId ? masterData.sId : null;
  3018 + tableDataRow.key = tableDataRow.sId;
  3019 + tableDataRow.bDefault = false;
  3020 + tableDataRow.iOrder = commonUtils.isNotEmptyArr(tableData) ? iOrderMax + 1 : 1;
  3021 + tableDataRow.defaultAdded = tableData.length === 0;
  3022 + if (isWait) {
  3023 + return tableDataRow;
  3024 + } else {
  3025 + // tableData.splice(index, 1, tableDataRow); /* 该处会导致新增时删除首行 */
  3026 + tableData.push(tableDataRow);
  3027 + if (this.mounted) {
  3028 + handleSaveState({ [`${name}Data`]: tableData, [`${name}SelectedRowKeys`]: [tableDataRow.sId] });
  3029 + }
  3030 + }
  3031 + };
  3032 +
2994 // 表格行删除 3033 // 表格行删除
2995 const handleMesTableLineDel = ({ 3034 const handleMesTableLineDel = ({
2996 tableName, 3035 tableName,