Browse Source

修复无法变更无法上报审批bug

laiguoran 5 years ago
parent
commit
33445eb5d1
4 changed files with 2874 additions and 2851 deletions
  1. 5 5
      app/extend/helper.js
  2. 1 1
      app/public/js/change_set.js
  3. 1 5
      app/service/change.js
  4. 2867 2840
      package-lock.json

+ 5 - 5
app/extend/helper.js

@@ -82,7 +82,7 @@ module.exports = {
      * @return {string} - 结果
      */
     accMul(arg1, arg2) {
-        if (!arg1 || !arg1) {
+        if (!arg1 || !arg2) {
             return '';
         }
         let m = 0;
@@ -102,9 +102,6 @@ module.exports = {
     },
 
     accAdd(arg1, arg2) {
-        if (!arg1 || !arg1) {
-            return '';
-        }
         let r1;
         let r2;
         try {
@@ -137,7 +134,7 @@ module.exports = {
 
     // 四舍五入或末尾加零,实现类似php的 sprintf("%.".decimal."f", val);
     roundNum(val, decimals) {
-        if (!val) {
+        if (val === '' || val === null) {
             return '';
         }
         if (val !== '') {
@@ -644,6 +641,9 @@ module.exports = {
      * @returns {*}
      */
     mul(num1, num2, digit = 6) {
+        if (num1 === '' || num1 === null || num2 === '' || num2 === null) {
+            return 0;
+        }
         return Decimal.mul(num1 ? num1 : 0, num2 ? num2 : 0).toDecimalPlaces(digit).toNumber();
     },
     /**

+ 1 - 1
app/public/js/change_set.js

@@ -631,7 +631,7 @@ function maketablelist(status){
     let radionWhiteList = $('#change-whitelist').val() !== '' ? $('#change-whitelist').val().split('^_^') : [];
     //判断是否添加空白清单
     if(status == 'addwhite'){
-        let trlist = ['','','','','','','','',0];
+        let trlist = ['','','','','',makedecimalzero(findDecimal(3)),makedecimalzero(findDecimal(3)),'',0];
         radionWhiteList.push(trlist.join(';'));
     }
 

+ 1 - 5
app/service/change.js

@@ -369,13 +369,9 @@ module.exports = app => {
                             detail: clInfo[7],
                             spamount: clInfo[6],
                         };
-                        if (clInfo[3] === '') {
+                        if (clInfo[4] === '') {
                             delete clArray.unit_price;
-                            delete clArray.oamount;
-                            delete clArray.camount;
-                            delete clArray.spamount;
                         }
-                        console.log(clArray);
                         insertCL.push(clArray);
                         total_price = this.ctx.helper.accAdd(total_price,
                             this.ctx.helper.mul(clArray.unit_price, clArray.spamount, tenderInfo.decimal.tp));

File diff suppressed because it is too large
+ 2867 - 2840
package-lock.json