浏览代码

原单价记录问题

MaiXinRong 2 年之前
父节点
当前提交
dd01cf4434

+ 5 - 5
app/const/spread.js

@@ -204,7 +204,7 @@ const stageTz = {
             {title: '本期数量变更|数量', colSpan: '3|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qc_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
             {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number'},
-            { title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number', getValue(data){ return data.contract_pc_tp || data.qc_pc_tp ? data.org_price : null; }, },
+            { title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number' },
             { title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'pc_tp', hAlign: 2, width: 60, type: 'Number' },
             {title: '本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
@@ -287,7 +287,7 @@ const stageCl = {
             {title: '本期数量变更|数量', colSpan: '3|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number',},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qc_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
             {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number'},
-            { title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number', getValue(data){ return data.contract_pc_tp || data.qc_pc_tp ? data.org_price : null; }, },
+            { title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number' },
             { title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'pc_tp', hAlign: 2, width: 60, type: 'Number' },
             {title: '本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
@@ -372,7 +372,7 @@ const stageNoCl = {
             {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
-            {title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number', getValue(data){ return data.contract_pc_tp || data.qc_pc_tp ? data.org_price : null; }, },
+            {title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number' },
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'pc_tp', hAlign: 2, width: 60, type: 'Number'},
             {title: '截止本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, readOnly: true, type: 'Number'},
@@ -453,7 +453,7 @@ const stageGather = {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qc_tp', hAlign: 2, width: 60, type: 'Number'},
             {title: '本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 60, type: 'Number'},
-            { title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number', getValue(data){ return data.contract_pc_tp || data.qc_pc_tp ? data.org_price : null; }, },
+            { title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number' },
             { title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'pc_tp', hAlign: 2, width: 60, type: 'Number' },
             {title: '截止本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, type: 'Number'},
@@ -512,7 +512,7 @@ const stageCompare = {
             {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 230, formatter: '@'},
             {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
-            { title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number', getValue(data){ return data.contract_pc_tp || data.qc_pc_tp ? data.org_price : null; }, },
+            { title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number', },
             { title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'pc_tp', hAlign: 2, width: 60, type: 'Number' },
         ],
         extraCols: [

+ 1 - 1
app/controller/stage_controller.js

@@ -241,7 +241,7 @@ module.exports = app => {
                 { data: importData, fields: ['is_import'], prefix: '', relaId: 'lid' },
                 { data: curStageData, fields: ['contract_qty', 'contract_expr', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'postil'], prefix: '', relaId: 'lid' },
                 { data: preStageData, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'used'], prefix: 'pre_', relaId: 'lid' },
-                { data: pcData, fields: ['contract_pc_tp', 'qc_pc_tp', 'pc_tp'], prefix: '', relaId: 'lid' },
+                { data: pcData, fields: ['contract_pc_tp', 'qc_pc_tp', 'pc_tp', 'org_price'], prefix: '', relaId: 'lid' },
             ]);
             return ledgerData;
         }

+ 13 - 1
app/public/js/shares/sjs_setting.js

@@ -92,5 +92,17 @@ const sjsSettingObj = (function () {
             col.showImage = r.showImage;
         }
     };
-    return {setFxTreeStyle, FxTreeStyle, setGridSelectStyle, setTpThousandthFormat, setThousandthFormat, setTpColsThousandthFormat, setPropValue, set3FCols, setQcCols};
+    setOrgPriceCol = function (cols, rela) {
+        for (const r of rela) {
+            const col = _.find(cols, {field: r.field});
+            if (col) {
+                col.getValue = function (data) { return data.contract_pc_tp || data.qc_pc_tp ? data.org_price : null; };
+            }
+        }
+    };
+    return {
+        setFxTreeStyle, FxTreeStyle, setGridSelectStyle,
+        setTpThousandthFormat, setThousandthFormat, setTpColsThousandthFormat,
+        setPropValue, set3FCols, setQcCols, setOrgPriceCol
+    };
 })();

+ 1 - 0
app/public/js/stage.js

@@ -659,6 +659,7 @@ $(document).ready(() => {
         {field: 'qc_qty', showImage: qcColShowImage},
         {field: 'qc_minus_qty', showImage: qcColShowImage},
     ]);
+    sjsSettingObj.setOrgPriceCol(ledgerSpreadSetting.cols, [ {field: 'org_price'} ]);
     // const ratioCol = ledgerSpreadSetting.cols.find(x => {return x.field === 'end_gather_percent' || x.field === 'end_correct_percent'});
     // if (ratioCol) ratioCol.field = tenderInfo.display.stage.correct ? 'end_correct_percent' : 'end_gather_percent';
     const ratioCol = ledgerSpreadSetting.cols.find(x => {return x.field === 'end_final_1_percent' || x.field === 'end_correct_1_percent'});

+ 1 - 0
app/public/js/stage_compare.js

@@ -87,6 +87,7 @@ $(document).ready(function () {
     const ledgerSheet = ledgerSpread.getActiveSheet();
     sjsSettingObj.setFxTreeStyle(ledgerSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
     if (thousandth) sjsSettingObj.setTpThousandthFormat(ledgerSpreadSetting);
+    sjsSettingObj.setOrgPriceCol(ledgerSpreadSetting.cols, [{ field: 'org_price' }]);
     SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), ledgerSpreadSetting);
     // 初始化部位
     const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);

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

@@ -60,6 +60,7 @@ $(document).ready(function () {
         if (!data) return defaultColor;
         return data.overRange && hintOver ? spreadColor.stage.over : data.differ ? spreadColor.gcl.differ : defaultColor;
     };
+    sjsSettingObj.setOrgPriceCol(gclSpreadSetting.cols, [{ field: 'org_price' }]);
     if (thousandth) sjsSettingObj.setTpThousandthFormat(gclSpreadSetting);
     SpreadJsObj.initSheet(gclSpread.getActiveSheet(), gclSpreadSetting);
     // 初始化所属项目节

+ 3 - 0
app/service/stage_bills_final.js

@@ -90,6 +90,7 @@ module.exports = app => {
                     return x.lid === c.lid;
                 });
                 if (p) {
+                    c.unit_price = p.org_price;
                     c.contract_qty = this.ctx.helper.add(c.contract_qty, p.contract_qty);
                     c.contract_tp = this.ctx.helper.add(c.contract_tp, p.contract_tp);
                     c.qc_qty = this.ctx.helper.add(c.qc_qty, p.qc_qty);
@@ -104,6 +105,7 @@ module.exports = app => {
                 }
                 const cp = curPc.find(x => { return x.lid === c.lid; });
                 if (cp) {
+                    c.unit_price = cp.org_price;
                     c.contract_tp = this.ctx.helper.add(c.contract_tp, cp.contract_pc_tp);
                     c.qc_tp = this.ctx.helper.add(c.qc_tp, cp.qc_pc_tp);
                     curPc.splice(curPc.indexOf(cp), 1);
@@ -116,6 +118,7 @@ module.exports = app => {
                 p.sorder = stage.order;
                 const cp = curPc.find(x => { return x.lid === p.lid; });
                 if (cp) {
+                    p.unit_price = cp.org_price;
                     p.contract_tp = this.ctx.helper.add(p.contract_tp, cp.contract_pc_tp);
                     p.qc_tp = this.ctx.helper.add(p.qc_tp, cp.qc_pc_tp);
                     curPc.splice(curPc.indexOf(cp), 1);