单据打印网页时通过hidden-print隐藏元素

pull/257/head
RuoYi 2021-01-18 10:33:59 +08:00
parent 3026e9f158
commit bfde76cc2c
1 changed files with 4 additions and 5 deletions

View File

@ -101,8 +101,9 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="text-right"> <!-- 打印网页时通过hidden-print隐藏元素 -->
<button class="btn btn-primary" onclick="printPage(this)"><i class="fa fa-print"></i> 打印</button> <div class="text-right hidden-print">
<button class="btn btn-primary" onclick="printPage()"><i class="fa fa-print"></i> 打印</button>
</div> </div>
<div class="well m-t"><strong>注意:</strong> 请在30日内完成付款否则订单会自动取消。 <div class="well m-t"><strong>注意:</strong> 请在30日内完成付款否则订单会自动取消。
@ -113,10 +114,8 @@
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<script type="text/javascript"> <script type="text/javascript">
function printPage(obj) { function printPage() {
$(obj).hide();
window.print(); window.print();
$(obj).show();
} }
</script> </script>
</body> </body>