فهرست منبع

合同结算金额功能

ellisran 6 ساعت پیش
والد
کامیت
db155c175e
2فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 2 0
      app/public/js/contract_detail.js
  2. 10 0
      app/service/contract_tree.js

+ 2 - 0
app/public/js/contract_detail.js

@@ -882,6 +882,8 @@ $(document).ready(function() {
                 postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
                     const refreshNode = contractTree.loadPostData(result);
                     contractTreeSpreadObj.refreshTree(info.sheet, refreshNode);
+                }, function () {
+                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
                 });
             }
         },

+ 10 - 0
app/service/contract_tree.js

@@ -190,6 +190,16 @@ module.exports = app => {
                     if (!updateNode) {
                         const contractNode = await this.ctx.service.contract.getDataById(row.id);
                         if (contractNode) {
+                          if (Object.prototype.hasOwnProperty.call(row, 'settle_price')) {
+                              const settlePrice = Number(row.settle_price || 0);
+                              if (!Number.isFinite(settlePrice) || settlePrice < 0) {
+                                  throw '结算金额只能输入大于等于0的数字';
+                              }
+                              if (settlePrice !== 0 && settlePrice < Number(contractNode.yf_price || 0)) {
+                                  throw '结算金额不能小于累计应' + (options.contract_type === contractConst.type.expenses ? '付' : '回') + '金额';
+                              }
+                              row.settle_price = settlePrice;
+                          }
                           const updateContractData = !updateAll ? this._filterUpdateInvalidField(contractNode.id, row) : row;
                           updateContractDatas.push(updateContractData);
                           continue;