Browse Source

lib_detail.js 修改

laiguoran 7 năm trước cách đây
mục cha
commit
c315435c71
1 tập tin đã thay đổi với 9 bổ sung7 xóa
  1. 9 7
      app/public/js/lib_detail.js

+ 9 - 7
app/public/js/lib_detail.js

@@ -92,18 +92,20 @@ $(document).ready(function() {
     }
 
     $('body').on('blur', '#paramList input', function () {
-        if($(this).val() != $(this).attr('data-old-value')){
+        const self = $(this);
+        if(self.val() != self.attr('data-old-value')){
             const postInfo = {
-                lib_id: parseInt($(this).attr('data-lib-id')),
-                node_id: parseInt($(this).attr('data-node-id')),
-                code: $(this).attr('data-code'),
+                lib_id: parseInt(self.attr('data-lib-id')),
+                node_id: parseInt(self.attr('data-node-id')),
+                code: self.attr('data-code'),
                 updateType: 'modify',
-                value: parseFloat($(this).val())
+                value: parseFloat(self.val())
             };
-            $(this).attr('data-old-value', $(this).val());
             const postUrl = '/lib/updateParamValue';
             postData(postUrl, postInfo, function (result) {
-                // console.log(result);
+                self.attr('data-old-value', result.param.calc_value);
+            },function (result) {
+                self.val(self.attr('data-old-value'));
             });
         }
     })