瀏覽代碼

清单对比,清单汇总,对同编号的不同清单,增加底色显示

MaiXinRong 5 年之前
父節點
當前提交
e8482237ca

+ 2 - 2
app/controller/revise_controller.js

@@ -207,11 +207,11 @@ module.exports = app => {
 
         async _getDefaultReviseInfoData(ctx, revise) {
             const reviseBills = revise.bills_file
-                ? JSON.parse(await fs.readFileSync(this.ctx.app.baseDir + revise.bills_file, 'utf8'))
+                ? JSON.parse(await fs.readFileSync(this.ctx.app.filePath + revise.bills_file, 'utf8'))
                 : await ctx.service.reviseBills.getData(ctx.tender.id);
 
             const revisePos = revise.pos_file
-                ? JSON.parse(await fs.readFileSync(this.ctx.app.baseDir + revise.pos_file, 'utf8'))
+                ? JSON.parse(await fs.readFileSync(this.ctx.app.filePath + revise.pos_file, 'utf8'))
                 : await ctx.service.revisePos.getData(ctx.tender.id);
             const [ledgerSpread, posSpread] = this._getSpreadSetting(revise);
             const [stdBills, stdChapters] = await this.ctx.service.valuation.getValuationStdList(ctx.tender.data.valuation);

+ 18 - 0
app/public/js/gcl_gather.js

@@ -378,13 +378,31 @@ const gclGatherModel = (function () {
                 }
             }
         });
+
         return gclList;
     }
 
+    function checkDiffer(gclList) {
+        for (const gcl of gclList) {
+            gcl.differ = false;
+        }
+        for (const [i, gcl] of gclList.entries()) {
+            if (i === gclList.length - 1) continue;
+            const next = gclList[i+1];
+            if (gcl.b_code === next.b_code) {
+                if (gcl.name !== next.name || gcl.unit !== next.unit || !checkZero(gcl.unit_price - next.unit_price)) {
+                    gcl.differ = true;
+                    next.differ = true;
+                }
+            }
+        }
+    }
+
     return {
         loadLedgerData,
         loadPosData,
         loadDealBillsData,
         gatherGclData,
+        checkDiffer,
     };
 })();

+ 10 - 0
app/public/js/ledger_gather.js

@@ -21,6 +21,8 @@ $(document).ready(() => {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'deal_bills_tp', hAlign: 2, width: 80, type: 'Number'},
             {title: '台账|数量', colSpan: '2|1', rowSpan: '1|1', field: 'quantity', hAlign: 2, width: 80, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 80, type: 'Number'},
+            {title: '签约-台账|数量', colSpan: '2|1', rowSpan: '1|1', field: 'compare_qty', hAlign: 2, width: 80, type: 'Number'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'compare_tp', hAlign: 2, width: 80, type: 'Number'},
         ],
         emptyRows: 0,
         headRows: 2,
@@ -29,6 +31,9 @@ $(document).ready(() => {
         headerFont: '12px 微软雅黑',
         font: '12px 微软雅黑',
         readOnly: true,
+        getColor: function (sheet, data, col, defaultColor) {
+            return data && data.differ ? '#FFE699' : defaultColor;
+        }
     });
     const gclSheet = gclSpread.getActiveSheet();
     const leafXmjSpread = SpreadJsObj.createNewSpread($('#leaf-xmj-spread')[0]);
@@ -76,6 +81,11 @@ $(document).ready(() => {
         gclGatherModel.loadPosData(data.pos);
         gclGatherModel.loadDealBillsData(data.dealBills);
         gclGatherData = gclGatherModel.gatherGclData();
+        gclGatherModel.checkDiffer(gclGatherData);
+        for (const gcl of gclGatherData) {
+            gcl.compare_qty = ZhCalc.sub(gcl.deal_bills_qty, gcl.quantity);
+            gcl.compare_tp = ZhCalc.sub(gcl.deal_bills_tp, gcl.total_price);
+        }
         SpreadJsObj.loadSheetData(gclSheet, SpreadJsObj.DataType.Data, gclGatherData);
         loadLeafXmjData(0);
     }, null, true);

+ 4 - 0
app/public/js/stage_gather.js

@@ -19,6 +19,9 @@ $(document).ready(function () {
     autoFlashHeight();
     // 初始化工程量清单
     const gclSpread = SpreadJsObj.createNewSpread($('#gcl-spread')[0]);
+    gclSpreadSetting.getColor = function (sheet, data, col, defaultColor) {
+        return data && data.differ ? '#FFE699' : defaultColor;
+    }
     SpreadJsObj.initSheet(gclSpread.getActiveSheet(), gclSpreadSetting);
     // 初始化所属项目节
     const leafXmjSpread = SpreadJsObj.createNewSpread($('#leaf-xmj-spread')[0]);
@@ -58,6 +61,7 @@ $(document).ready(function () {
     gclGatherModel.loadPosData(pos, curPosData, prePosData);
     gclGatherModel.loadDealBillsData(dealBills);
     const gclGatherData = gclGatherModel.gatherGclData();
+    gclGatherModel.checkDiffer(gclGatherData);
     // 获取项目节数据
     function loadLeafXmjData(iGclRow) {
         const gcl = gclGatherData[iGclRow];

+ 1 - 1
app/view/ledger/gather.ejs

@@ -5,7 +5,7 @@
             <% include ../tender/tender_sub_mini_menu.ejs %>
             <div>
                 <div class="d-inline-block">
-                    台帐对比
+                    清单对比
                 </div>
             </div>
             <div class="ml-auto">