Browse Source

1. 台账修订,台账对比,表头调整
2. 台账修订,清单对比,排序调整

MaiXinRong 4 years ago
parent
commit
1072a93174

+ 36 - 0
app/public/js/shares/gcl_gather_compare.js

@@ -356,6 +356,39 @@ const gclCompareModel = (function () {
         ledgerSetting = null;
     }
 
+    function compareCode(str1, str2, symbol = '-') {
+        if (!str1) {
+            return 1;
+        } else if (!str2) {
+            return -1;
+        }
+
+        function compareSubCode(code1, code2) {
+            if (numReg.test(code1)) {
+                if (numReg.test(code2)) {
+                    return parseInt(code1) - parseInt(code2);
+                } else {
+                    return -1
+                }
+            } else {
+                if (numReg.test(code2)) {
+                    return 1;
+                } else {
+                    return code1 === code2 ? 0 : (code1 < code2 ? -1 : 1); //code1.localeCompare(code2);
+                }
+            }
+        }
+        const numReg = /^[0-9]+$/;
+        const aCodes = str1.split(symbol), bCodes = str2.split(symbol);
+        for (let i = 0, iLength = Math.min(aCodes.length, bCodes.length); i < iLength; ++i) {
+            const iCompare = compareSubCode(aCodes[i], bCodes[i]);
+            if (iCompare !== 0) {
+                return iCompare;
+            }
+        }
+        return aCodes.length - bCodes.length;
+    }
+
     /**
      *
      * @param data {Array} - 签约清单数据
@@ -385,6 +418,9 @@ const gclCompareModel = (function () {
      * 检查汇总完的工程量清单中,同编号 & 不同名称/单位/单价 的清单并标记
      */
     function checkDiffer() {
+        gclList.sort((a, b) => {
+            return compareCode(a.b_code, b.b_code);
+        });
         for (const gcl of gclList) {
             gcl.differ = false;
         }

+ 21 - 18
app/view/revise/compare.ejs

@@ -109,24 +109,27 @@
     };
     const billsSpreadSetting = {
         cols: [
-            {title: '', colSpan: '1', rowSpan: '3', field: 'differ_str', hAlign: 1, width: 20, formatter: '@', cellType: 'tip', getTip: function (x) {
-                if (x.differ_str.indexOf('改') >= 0) {
-                    const differ_hint = [];
-                    if (x.differ.indexOf('tree') >= 0)
-                        differ_hint.push('结构调整(原父项:' + (x.org_parent.code || '') + (x.org_parent.b_code || '') + ')');
-                    if (x.differ.indexOf('calc') >= 0) differ_hint.push('计算项修改');
-                    if (x.differ.indexOf('info') >= 0) differ_hint.push('文字修改');
-                    const pos_hint = [];
-                    if (x.differ.indexOf('pos-add') >= 0) pos_hint.push('增');
-                    if (x.differ.indexOf('pos-del') >= 0) pos_hint.push('删');
-                    if (x.differ.indexOf('pos-info') >= 0) pos_hint.push('文改');
-                    if (x.differ.indexOf('pos-calc') >= 0) pos_hint.push('量改');
-                    if (pos_hint.length > 0) differ_hint.push('计量单元: ' + pos_hint.join(','))
-                    return differ_hint.join('<br>');
-                } else {
-                    return '';
+            {
+                title: '修\n订\n类\n型', colSpan: '1', rowSpan: '3', field: 'differ_str', hAlign: 1, width: 20, formatter: '@', cellType: 'tip',
+                getTip: function (x) {
+                    if (x.differ_str.indexOf('改') >= 0) {
+                        const differ_hint = [];
+                        if (x.differ.indexOf('tree') >= 0)
+                            differ_hint.push('结构调整(原父项:' + (x.org_parent.code || '') + (x.org_parent.b_code || '') + ')');
+                        if (x.differ.indexOf('calc') >= 0) differ_hint.push('计算项修改');
+                        if (x.differ.indexOf('info') >= 0) differ_hint.push('文字修改');
+                        const pos_hint = [];
+                        if (x.differ.indexOf('pos-add') >= 0) pos_hint.push('增');
+                        if (x.differ.indexOf('pos-del') >= 0) pos_hint.push('删');
+                        if (x.differ.indexOf('pos-info') >= 0) pos_hint.push('文改');
+                        if (x.differ.indexOf('pos-calc') >= 0) pos_hint.push('量改');
+                        if (pos_hint.length > 0) differ_hint.push('计量单元: ' + pos_hint.join(','))
+                        return differ_hint.join('<br>');
+                    } else {
+                        return '';
+                    }
                 }
-                }},
+            },
             {title: '修订台账|项目节编号', colSpan: '16|1', rowSpan: '1|2', field: 'new_code', hAlign: 0, width: 145, formatter: '@', cellType: 'tree'},
             {title: '|清单编号', colSpan: '|1', rowSpan: '|2', field: 'new_b_code', hAlign: 0, width: 70, formatter: '@'},
             {title: '|名称', colSpan: '|1', rowSpan: '|2', field: 'new_name', hAlign: 0, width: 185, formatter: '@'},
@@ -189,7 +192,7 @@
     };
     const posSpreadSetting = {
         cols: [
-            {title: '', colSpan: '1', rowSpan: '3', field: 'differ_str', hAlign: 1, width: 60, formatter: '@'},
+            {title: '修订类型', colSpan: '1', rowSpan: '3', field: 'differ_str', hAlign: 1, width: 60, formatter: '@'},
             {title: '修改台账|计量单元', colSpan: '6|1', rowSpan: '1|2', field: 'new_name', hAlign: 0, width: 230, formatter: '@'},
             {title: '|位置', colSpan: '|1', rowSpan: '|2', field: 'new_position', hAlign: 0, width: 60, formatter: '@'},
             {title: '|台账数量|设计量', colSpan: '|4|1', rowSpan: '|1|1', field: 'new_sgfh_qty', hAlign: 2, width: 100, type: 'Number'},

+ 0 - 1
app/view/revise/gcl_compare.ejs

@@ -17,7 +17,6 @@
                         台账修订 ≠ 原台账
                     </label>
                 </div>
-                 <div class="ml-2 d-inline-block">|</div>
                 <span class="ml-2"><i class="fa fa-stop text-warning-50 border-warning-50 bg-primary-50" style="color: #FFE699"></i> 编号相同,名称/单位/单价不同</span>
             </div>
             <div class="ml-auto">