Browse Source

成本分配表-打印-备注栏动态高度

jbb 1 year ago
parent
commit
bfc44e72b3
1 changed files with 11 additions and 2 deletions
  1. 11 2
      src/views/reportForms/cost-allocation-table.vue

+ 11 - 2
src/views/reportForms/cost-allocation-table.vue

@@ -851,8 +851,17 @@ export default {
          + '</style>';
          win.document.write(style+html);
          win.focus();
-         win.print();
-         win.close();
+         setTimeout(function(){
+          let textArea = win.document.getElementsByTagName('textarea')
+          for (let i = 0; i < textArea.length; i++) {
+             textArea[i].style.height = 'auto' // 先设置成auto,再设置高度,删除文字的时候高度才会改变
+             textArea[i].style.height = textArea[i].scrollHeight+100 + 'px'
+          }
+            win.print();
+            win.close();
+         },500)
+        //  win.print();
+        //  win.close();
 		     this.showSelect = 0
         })