Jelajahi Sumber

台账修订,台账对比,新增清单下的新增计量单元显示问题

MaiXinRong 4 tahun lalu
induk
melakukan
1ad7c78442
1 mengubah file dengan 29 tambahan dan 28 penghapusan
  1. 29 28
      app/public/js/revise_compare.js

+ 29 - 28
app/public/js/revise_compare.js

@@ -58,6 +58,7 @@ $(document).ready(() => {
     }
 
     posSpreadSetting.getColor = function (sheet, data, row, col, defaultColor) {
+        if (!data || !data.differ) return defaultColor;
         // 增
         if (data.differ.indexOf('add') >= 0) return '#ffddc5';
         // 删
@@ -149,6 +150,34 @@ $(document).ready(() => {
             for (const data of tree.datas) {
                 data.differ = [];
                 data.differ_str = [];
+                for (const p of data.pos) {
+                    p.differ = [];
+                    p.differ_str = [];
+                    if (p.isNew && !p.isOrg) {
+                        p.differ.push('add');
+                        if (data.differ.indexOf('pos-add') === -1) data.differ.push('pos-add');
+                        p.differ_str.push('增');
+                    } else if (!p.isNew && p.isOrg) {
+                        p.differ.push('del');
+                        if (data.differ.indexOf('pos-del') === -1) data.differ.push('pos-del');
+                        p.differ_str.push('删');
+                    } else {
+                        const orgPosCalc = getCompare(p, compareFields.posCalc, 'org_', 0);
+                        const newPosCalc = getCompare(p, compareFields.posCalc, 'new_', 0);
+                        if (!_.isMatch(orgPosCalc, newPosCalc)) {
+                            p.differ.push('calc');
+                            if (data.differ.indexOf('pos-calc') === -1) data.differ.push('pos-calc');
+                            p.differ_str.push('量改');
+                        }
+                        const orgPosInfo = getCompare(p, compareFields.posInfo, 'org_', 0);
+                        const newPosInfo = getCompare(p, compareFields.posInfo, 'new_', 0);
+                        if (!_.isMatch(orgPosInfo, newPosInfo)) {
+                            p.differ.push('info');
+                            if (data.differ.indexOf('pos-info') === -1) data.differ.push('pos-info');
+                            p.differ_str.push('文改');
+                        }
+                    }
+                }
                 if (data.isNew && !data.isOrg) {
                     data.differ.push('add');
                     data.differ_str.push('增');
@@ -170,34 +199,6 @@ $(document).ready(() => {
                     const newInfo = getCompare(data, compareFields.info, 'new_', '');
                     if (!_.isMatch(newInfo, orgInfo)) data.differ.push('info');
 
-                    for (const p of data.pos) {
-                        p.differ = [];
-                        p.differ_str = [];
-                        if (p.isNew && !p.isOrg) {
-                            p.differ.push('add');
-                            if (data.differ.indexOf('pos-add') === -1) data.differ.push('pos-add');
-                            p.differ_str.push('增');
-                        } else if (!p.isNew && p.isOrg) {
-                            p.differ.push('del');
-                            if (data.differ.indexOf('pos-del') === -1) data.differ.push('pos-del');
-                            p.differ_str.push('删');
-                        } else {
-                            const orgPosCalc = getCompare(p, compareFields.posCalc, 'org_', 0);
-                            const newPosCalc = getCompare(p, compareFields.posCalc, 'new_', 0);
-                            if (!_.isMatch(orgPosCalc, newPosCalc)) {
-                                p.differ.push('calc');
-                                if (data.differ.indexOf('pos-calc') === -1) data.differ.push('pos-calc');
-                                p.differ_str.push('量改');
-                            }
-                            const orgPosInfo = getCompare(p, compareFields.posInfo, 'org_', 0);
-                            const newPosInfo = getCompare(p, compareFields.posInfo, 'new_', 0);
-                            if (!_.isMatch(orgPosInfo, newPosInfo)) {
-                                p.differ.push('info');
-                                if (data.differ.indexOf('pos-info') === -1) data.differ.push('pos-info');
-                                p.differ_str.push('文改');
-                            }
-                        }
-                    }
                     if (data.differ.length > 0) data.differ_str.push('改');
                 }
             }