Browse Source

1. 台账分解,删除是否可用

MaiXinRong 5 years ago
parent
commit
815d1fa3f9
2 changed files with 4 additions and 10 deletions
  1. 2 2
      app/public/js/ledger.js
  2. 2 8
      app/service/stage_bills.js

+ 2 - 2
app/public/js/ledger.js

@@ -136,7 +136,7 @@ $(document).ready(function() {
             const valid = !sheet.zh_setting.readOnly;
 
             setObjEnable($('#insert'), valid && first && first.level > 1);
-            setObjEnable($('#delete'), valid && first && sameParent && first.level > 1 && !first.node_type);
+            setObjEnable($('#delete'), valid && first && sameParent && !(first.level === 1 && first.node_type));
             setObjEnable($('#up-move'), valid && first && sameParent && first.level > 1 && preNode);
             setObjEnable($('#down-move'), valid && first && sameParent && first.level > 1 && !tree.isLastSibling(last));
             if (checkTzMeasureType()) {
@@ -718,7 +718,7 @@ $(document).ready(function() {
                             }
                         }
                         const valid = !sheet.zh_setting.readOnly;
-                        return !(valid && first && sameParent && first.level > 1 && !first.node_type);
+                        return !(valid && first && sameParent && !(first.level === 1 && first.node_type));
                     }
                 },
                 'copyBlock': {

+ 2 - 8
app/service/stage_bills.js

@@ -197,11 +197,11 @@ module.exports = app => {
             }
 
             const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, ledgerData.unit);
-            if (insertData.contract_qty) {
+            if (insertData.contract_qty !== undefined) {
                 d.contract_qty = this.round(insertData.contract_qty, precision.value);
                 d.contract_tp = this.ctx.helper.mul(d.contract_qty, ledgerData.unit_price, info.decimal.tp);
             }
-            if (insertData.qc_qty) {
+            if (insertData.qc_qty !== undefined) {
                 d.qc_qty = this.round(insertData.qc_qty, precision.value);
                 d.qc_tp = this.ctx.helper.mul(d.qc_qty, ledgerData.unit_price, info.decimal.tp);
             }
@@ -235,12 +235,6 @@ module.exports = app => {
                     }
                     if (!stageBills || stageBills.times !== this.ctx.stage.curTimes || stageBills.order !== this.ctx.stage.curOrder) {
                         await this._insertStageBillsData(transaction, d, stageBills, ledgerBills);
-                        // d.tid = this.ctx.tender.id;
-                        // d.sid = this.ctx.stage.id;
-                        // d.said = this.ctx.session.sessionUser.accountId;
-                        // d.times = this.ctx.stage.curTimes;
-                        // d.order = this.ctx.stage.curOrder;
-                        // await transaction.insert(this.tableName, d);
                     } else {
                         d.id = stageBills.id;
                         await transaction.update(this.tableName, d);