Browse Source

中间计量bug

MaiXinRong 4 years ago
parent
commit
319ecf2d5b
2 changed files with 13 additions and 17 deletions
  1. 2 2
      app/public/js/stage.js
  2. 11 15
      app/public/js/stage_im.js

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

@@ -2721,7 +2721,7 @@ $(document).ready(() => {
                     $('#calc-img').attr('src', '');
                     $('#view-calc-img').attr('src', '');
                     $('#view-calc-remark').val('');
-                    $('#text-edit').val('')
+                    $('#text-edit').val('');
                     $('#edit-img').modal('hide');
                     // postData(window.location.pathname + '/detail/merge-img', {updateType: 'clear', lid: data.lid, pid: data.pid, uuid: data.uuid}, function (result) {
                     //     stageIm.loadUpdateDetailData(result);
@@ -2739,7 +2739,7 @@ $(document).ready(() => {
                     $('#calc-img').attr('src', '');
                     $('#view-calc-img').attr('src', '');
                     $('#view-calc-remark').val('');
-                    $('#text-edit').val('')
+                    $('#text-edit').val('');
                     $('#edit-img').modal('hide');
                 }
             });

+ 11 - 15
app/public/js/stage_im.js

@@ -253,6 +253,15 @@ const stageIm = (function () {
         }
     }
 
+    function loadCustomDetail(im, detail) {
+        im.custom_define = detail.custom_define ? detail.custom_define.split(',') : imFields;
+        _.assignInWith(im, detail, function (oV, sV, key) {
+            return (im.custom_define.indexOf(key) > -1 && sV !== undefined && sV !== null) ? sV : oV;
+        });
+        im.calc_img_org = detail.calc_img_org;
+        im.calc_img_remark = detail.calc_img_remark;
+    }
+
     function checkCustomDetail(im) {
         const cd = _.find(details, function (d) {
             return im.lid === d.lid &&
@@ -263,12 +272,7 @@ const stageIm = (function () {
                 (!im.pid || im.pid === d.pid) &&
                 (!im.pos_name || im.pos_name === d.pos_name);
         });
-        if (cd) {
-            im.custom_define = cd.custom_define ? cd.custom_define.split(',') : imFields;
-            _.assignInWith(im, cd, function (oV, sV, key) {
-                return (im.custom_define.indexOf(key) > -1 && sV !== undefined && sV !== null) ? sV : oV;
-            });
-        }
+        if (cd) loadCustomDetail(im, cd);
     }
 
     function getCalcMemo(im) {
@@ -881,15 +885,7 @@ const stageIm = (function () {
                         (!im.pid || im.pid === d.pid);
                 });
             }
-            if (imData) {
-                _.assignInWith(imData, d, function (oV, sV, key) {
-                    return imFields.indexOf(key) > -1 && !_.isUndefined(sV) && !_.isNull(sV) ? sV : oV;
-
-                });
-                imData.calc_img = d.calc_img;
-                imData.calc_img_org = d.calc_img_org;
-                imData.calc_img_remark = d.calc_img_remark;
-            }
+            if (imData) loadCustomDetail(imData, d);
         }
     }