Преглед изворни кода

兼容检测取消flat flatMap

vian пре 5 година
родитељ
комит
b7b408c835
2 измењених фајлова са 6 додато и 5 уклоњено
  1. 2 2
      public/web/syntax-detection.js
  2. 4 3
      web/building_saas/main/js/views/std_ration_lib.js

+ 2 - 2
public/web/syntax-detection.js

@@ -112,8 +112,8 @@ function checkSyntax() {
             'keys',
             'values',
             'entries',
-            'flat',
-            'flatMap',
+            //'flat', // es2019
+            //'flatMap',
             'includes'
         ];
         var arrayStaticFuncs = [

+ 4 - 3
web/building_saas/main/js/views/std_ration_lib.js

@@ -201,13 +201,12 @@ var rationLibObj = {
          */
         //@param {String}sectionName(章节名称) {Array}datas(定额数据)
         function simplifyName(sectionName, datas){
-            debugger;
             if (!sectionName || !datas || datas.length === 0) {
                 return;
             }
             //提取需要匹配的章节名称
             // 去掉后缀
-            const suffixReg = /[((]编码[::]\w+[))]/;
+            const suffixReg = /[((]编码[::][\w、]+[))]/;
             const tempName = sectionName.split(suffixReg)[0];
             // 获取第一个空格后的内容
             const sReg = /\s(.+)/;
@@ -227,7 +226,9 @@ var rationLibObj = {
                     continue;
                 }
                 let matchName = nameArr[0];
-                if (matchName === target) {
+                const matchNameWithoutSpace = matchName.replace(/\s/g, '');
+                const targetWithoutSpace = target.replace(/\s/g, '');
+                if (matchNameWithoutSpace === targetWithoutSpace) {
                     nameArr.shift();
                     data.name = nameArr.join(' ');
                 }