Browse Source

中间计量问题

MaiXinRong 5 years ago
parent
commit
6568ed2601
2 changed files with 12 additions and 4 deletions
  1. 9 3
      app/public/js/stage.js
  2. 3 1
      app/public/js/stage_im.js

+ 9 - 3
app/public/js/stage.js

@@ -2212,7 +2212,7 @@ $(document).ready(() => {
                 updateData.drawing_code = $('#drawing-code').val();
                 updateData.calc_memo = $('#calc-memo').val();
                 postData(window.location.pathname + '/detail/save', updateData, function (result) {
-                    _.assign(data, result);
+                    stageIm.loadUpdateDetailData(result);
                     self.reLoadDetailData();
                 });
             });
@@ -2361,14 +2361,20 @@ $(document).ready(() => {
                     postData(window.location.pathname + '/detail/merge-img', updateData, function (result) {
                         data.calc_img = result.calc_img;
                         data.calc_img_org = result.calc_img_org;
-                        self.reLoadDetailData();
+                        const calcImgSrc = data && data.calc_img ? '/' + data.calc_img : '';
+                        $('#show-calc-img').attr('src', calcImgSrc);
+                        $('#calc-img').attr('src', calcImgSrc);
+                        $('#view-calc-img').attr('src', calcImgSrc);
                         $('#edit-img').modal('hide');
                     });
                 } else if (data.calc_img) {
                     postData(window.location.pathname + '/detail/merge-img', {updateType: 'clear', lid: data.lid, pid: data.pid, uuid: data.uuid}, function (result) {
                         data.calc_img = result.calc_img;
                         data.calc_img_org = result.calc_img_org;
-                        self.reLoadDetailData();
+                        const calcImgSrc = data && data.calc_img ? '/' + data.calc_img : '';
+                        $('#show-calc-img').attr('src', calcImgSrc);
+                        $('#calc-img').attr('src', calcImgSrc);
+                        $('#view-calc-img').attr('src', calcImgSrc);
                         $('#edit-img').modal('hide');
                     });
                 }

+ 3 - 1
app/public/js/stage_im.js

@@ -642,7 +642,9 @@ const stageIm = (function () {
         for (const d of datas) {
             const detail = _.find(details, {uuid: d.uuid});
             if (detail) {
-                _.assignIn(detail, d);
+                _.assignInWith(detail, d, function (oV, sV, key) {
+                    return imFields.indexOf(key) > -1 && !_.isUndefined(sV) && !_.isNull(sV) ? sV : oV;
+                });
             } else {
                 details.push(d);
             }