Jelajahi Sumber

处理定额单位

zhongzewei 7 tahun lalu
induk
melakukan
053626e415
1 mengubah file dengan 13 tambahan dan 0 penghapusan
  1. 13 0
      web/maintain/ration_repository/js/ration.js

+ 13 - 0
web/maintain/ration_repository/js/ration.js

@@ -374,6 +374,9 @@ var rationOprObj = {
         let failPasteArr = [];
         for (var i = 0, rowIdx =info.cellRange.row; i < items.length; i++, rowIdx++) {
             if (cacheSection) {
+                if(!me.isValidUnit(items[i], rationUnits)){//无效单位
+                    items[i].unit = typeof cacheSection[rowIdx].unit !== 'undefined' && !cacheSection[rowIdx] ? cacheSection[rowIdx].unit : '';
+                };
                 //var hasCacheItem = false;
                 if(!cacheSection[rowIdx] && info.cellRange.col === 0 ){
                     if(me.rationsCodes.indexOf(items[i].code) === -1){
@@ -407,6 +410,9 @@ var rationOprObj = {
                 }
 
             } else {
+                if(!me.isValidUnit(items[i], rationUnits)){//无效单位
+                    items[i].unit = '';
+                };
                 //add
                 if(info.cellRange.col === 0){
                     //是否含有已存在的编号
@@ -427,6 +433,13 @@ var rationOprObj = {
             me.mixUpdateRequest(updateArr, addArr, []);
         }
     },
+    isValidUnit: function (rationObj, validUnits) {
+        let rst = true;
+        if(typeof rationObj.unit !== 'undefined' && rationObj.unit && validUnits.indexOf(rationObj.unit) === -1){//无效
+            rst = false;
+        }
+        return rst;
+    },
     getRationsCodes: function (repId) {
         let me = rationOprObj;
         $.ajax({