浏览代码

导入信息,增加定位

MaiXinRong 3 年之前
父节点
当前提交
d387128f27
共有 5 个文件被更改,包括 34 次插入10 次删除
  1. 9 9
      app/lib/sum_load.js
  2. 3 0
      app/public/js/revise.js
  3. 19 0
      app/public/js/shares/cs_tools.js
  4. 3 0
      app/public/js/stage.js
  5. 0 1
      app/service/deal_bills.js

+ 9 - 9
app/lib/sum_load.js

@@ -100,7 +100,7 @@ class loadGclBaseTree {
             node.quantity = this.ctx.helper.round(node.quantity, p.value);
 
             if (!node.unit_price) {
-                const db = dealBills.find(x => { return x.b_code === node.b_code && x.name === node.name && x.unit === node.unit });
+                const db = dealBills.find(x => { return x.code === node.b_code && x.name === node.name && x.unit === node.unit });
                 if (!db) return;
                 node.unit_price = db.unit_price;
             }
@@ -133,10 +133,10 @@ class loadLedgerGclTree extends loadGclBaseTree {
             create.push({
                 id: i.id, tender_id: i.tender_id, ledger_id: i.ledger_id, ledger_pid: i.ledger_pid,
                 level: i.level, order: i.order, full_path: i.full_path, is_leaf: !i.children || i.children.length === 0,
-                b_code: i.b_code, name: i.name, unit: i.unit,
+                b_code: i.b_code, name: i.name, unit: i.unit, unit_price: i.unit_price || 0,
                 sgfh_qty: i.sgfh_qty, sjcl_qty: i.sjcl_qty, qtcl_qty: i.qtcl_qty, quantity: i.quantity,
-                sgfh_tp: i.sgfh_tp, sjcl_tp: i.sjcl_tp, qtcl_tp: i.qtcl_tp, total_price: i.total_price,
-            })
+                sgfh_tp: i.sgfh_tp || 0, sjcl_tp: i.sjcl_tp || 0, qtcl_tp: i.qtcl_tp || 0, total_price: i.total_price || 0,
+            });
         }
         return {update, create};
     }
@@ -210,7 +210,7 @@ class updateReviseGclTree extends loadGclBaseTree {
                     result.update.push({
                         id: bn.id, ledger_id: bn.ledger_id,
                         sgfh_qty: bn.sgfh_qty, sjcl_qty: bn.sjcl_qty, qtcl_qty: bn.qtcl_qty, quantity: bn.quantity,
-                        sgfh_tp: bn.sgfh_tp, sjcl_tp: bn.sjcl_tp, qtcl_tp: bn.qtcl_tp, total_price: bn.total_price,
+                        sgfh_tp: bn.sgfh_tp || 0, sjcl_tp: bn.sjcl_tp || 0, qtcl_tp: bn.qtcl_tp || 0, total_price: bn.total_price || 0,
                     })
                 }
             }
@@ -219,9 +219,9 @@ class updateReviseGclTree extends loadGclBaseTree {
             result.create.push({
                 id: i.id, tender_id: i.tender_id, ledger_id: i.ledger_id, ledger_pid: i.ledger_pid,
                 level: i.level, order: i.order, full_path: i.full_path, is_leaf: !i.children || i.children.length === 0,
-                b_code: i.b_code, name: i.name, unit: i.unit,
+                b_code: i.b_code, name: i.name, unit: i.unit, unit_price: i.unit_price || 0,
                 sgfh_qty: i.sgfh_qty, sjcl_qty: i.sjcl_qty, qtcl_qty: i.qtcl_qty, quantity: i.quantity,
-                sgfh_tp: i.sgfh_tp, sjcl_tp: i.sjcl_tp, qtcl_tp: i.qtcl_tp, total_price: i.total_price,
+                sgfh_tp: i.sgfh_tp || 0, sjcl_tp: i.sjcl_tp || 0, qtcl_tp: i.qtcl_tp || 0, total_price: i.total_price || 0,
             })
         }
         return result;
@@ -359,7 +359,7 @@ class sumLoad {
                 this.recusiveLoadGatherGcl(top, null);
             }
         }
-        const dealBills = await this.ctx.service.dealBills.getAllDataByCondition({ tid: this.ctx.tender.id });
+        const dealBills = await this.ctx.service.dealBills.getAllDataByCondition({ where: { tender_id: this.ctx.tender.id } });
         this.loadTree.calculateAll(dealBills);
         return this.loadTree;
     }
@@ -389,7 +389,7 @@ class sumLoad {
                 this.recusiveLoadGatherGcl(top, null);
             }
         }
-        const dealBills = await this.ctx.service.dealBills.getAllDataByCondition({ tid: this.ctx.tender.id });
+        const dealBills = await this.ctx.service.dealBills.getAllDataByCondition({ where: { tender_id: this.ctx.tender.id } });
         this.loadTree.calculateAll(dealBills);
         return this.loadTree;
     }

+ 3 - 0
app/public/js/revise.js

@@ -99,6 +99,9 @@ $(document).ready(() => {
         relaSpread: billsSpread,
         storeKey: 'revise-slm-' + window.location.pathname.split('/')[2] + '-' + window.location.pathname.split('/')[4],
         id: 'revise-slm',
+        afterLocated:  function () {
+            posSpreadObj.loadCurPosData();
+        },
         afterShow: function () {
             billsSpread.refresh();
             if (posSpread) posSpread.refresh();

+ 19 - 0
app/public/js/shares/cs_tools.js

@@ -986,6 +986,25 @@ const showSelectTab = function(select, spread, afterShow) {
             const spread = SpreadJsObj.createNewSpread($('#' + resultId)[0]);
             const sheet = spread.getActiveSheet();
             SpreadJsObj.initSheet(sheet, setting.spreadSetting);
+            spread.getActiveSheet().bind(spreadNS.Events.CellDoubleClick, function (e, info) {
+                if (!setting.relaSpread) return;
+
+                const sheet = info.sheet;
+                const data = sheet.zh_data;
+                if (!data) { return }
+
+                const curBills = data[info.row];
+                if (!curBills) { return }
+
+                if (curBills.ledger_id) {
+                    SpreadJsObj.locateTreeNode(setting.relaSpread.getActiveSheet(), curBills.ledger_id, true);
+                    if (setting.afterLocated) {
+                        setting.afterLocated();
+                    }
+                } else {
+                    toastr.warning('找不到该清单');
+                }
+            });
 
             const loadMissData = function (data, his = false) {
                 const sourceTree = setting.relaSpread.getActiveSheet().zh_tree;

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

@@ -837,6 +837,9 @@ $(document).ready(() => {
         relaSpread: slSpread,
         storeKey: 'stage-slm-' + stage.id,
         id: 'stage-slm',
+        afterLocated:  function () {
+            stagePosSpreadObj.loadCurPosData();
+        },
         afterShow: function () {
             slSpread.refresh();
             if (spSpread) spSpread.refresh();

+ 0 - 1
app/service/deal_bills.js

@@ -66,7 +66,6 @@ module.exports = app => {
                         }
                     } else {
                         const code = this.ctx.helper._.trim(row[iCode]);
-                        console.log(code);
                         if (this.ctx.helper.validBillsCode(code)) {
                             const data = {
                                 deal_id: bills.length + 1,