Browse Source

feat(wise-cost-util): 辅助定额param为空的情况

zhangweicheng 5 years atrás
parent
commit
494ee304f3
2 changed files with 4 additions and 4 deletions
  1. 1 1
      wise-cost-util/package.json
  2. 3 3
      wise-cost-util/src/rationAss.ts

+ 1 - 1
wise-cost-util/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "@sc/wise-cost-util",
   "name": "@sc/wise-cost-util",
-  "version": "1.0.0",
+  "version": "1.0.1",
   "description": "wise-cost项目前后端业务通用工具包",
   "description": "wise-cost项目前后端业务通用工具包",
   "main": "./dist/index.cjs.js",
   "main": "./dist/index.cjs.js",
   "module": "./dist/index.esm.js",
   "module": "./dist/index.esm.js",

+ 3 - 3
wise-cost-util/src/rationAss.ts

@@ -30,18 +30,18 @@ export const handleMulAss = (rationAssList: IRationAss[]) => {
     // 处理多个辅助定额的情况
     // 处理多个辅助定额的情况
     if (ass.groupList && ass.groupList.length > 0) {
     if (ass.groupList && ass.groupList.length > 0) {
       const newAss = { ...ass };
       const newAss = { ...ass };
-      const newList = sortBy(ass.groupList, item => parseFloat(item.param)); // 按参数排序
+      const newList = sortBy(ass.groupList, item => parseFloat(item.param || '0')); // 按参数排序
       let pre = 0;
       let pre = 0;
       for (const tem of newList) {
       for (const tem of newList) {
         if (ass.actualValue) {
         if (ass.actualValue) {
-          if (ass.actualValue > pre && ass.actualValue <= parseFloat(tem.param)) {
+          if (ass.actualValue > pre && ass.actualValue <= parseFloat(tem.param || '0')) {
             // 落在中间,则用组里的这条定额
             // 落在中间,则用组里的这条定额
             newAss.param = tem.param;
             newAss.param = tem.param;
             newAss.paramName = tem.paramName;
             newAss.paramName = tem.paramName;
             newAss.assistCode = tem.assistCode;
             newAss.assistCode = tem.assistCode;
             break;
             break;
           }
           }
-          pre = parseFloat(tem.param);
+          pre = parseFloat(tem.param || '0');
         }
         }
       }
       }
       assList.push(newAss);
       assList.push(newAss);