Jelajahi Sumber

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

MaiXinRong 4 tahun lalu
induk
melakukan
b679125609
1 mengubah file dengan 9 tambahan dan 6 penghapusan
  1. 9 6
      app/view/stage/audit_modal.ejs

+ 9 - 6
app/view/stage/audit_modal.ejs

@@ -1593,20 +1593,23 @@
         // $('#hide-all').hide();
         // return false;
     });
+
+    // 定位到审批框高度
     $('.modal').on('shown.bs.modal', function () {
-        const height = $(this)[0].scrollHeight
-        const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
-        const hdheight = hdiv ? hdiv.parents('.list-group-item').offset().top : 0;
+        const height = $(this)[0].scrollHeight;
         const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
         const bdiv = scrollBox.offset().top;
+
         // 450是modal没有滚动条时的最大高度,超过则出现滚动条,需要自动下拉到底部
         // if (scrollBox.length && scrollBox[0].scrollHeight > 450) {
         //     scrollBox.scrollTop(height);
         // }
-        if (hdiv && hdheight - bdiv > 300) {
+        scrollBox.scrollTop(0);
+        const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
+        const hdheight = hdiv ? hdiv.parents('.list-group-item').offset().top : null;
+        console.log(hdheight);
+        if (hdiv && scrollBox.length &&  scrollBox[0].scrollHeight > 450 && hdheight - bdiv > 450) {
             scrollBox.scrollTop(hdheight - bdiv);
-        } else if (scrollBox.length && scrollBox[0].scrollHeight > 450) {
-            scrollBox.scrollTop(height);
         }
     });