web100 hace 2 años
padre
commit
87f5c5b3fa

+ 10 - 27
src/views/tirePartsMall/purchasingManagement/warehouseEntryOrder/detailsPage.vue

@@ -61,6 +61,7 @@
                     </el-tab-pane>
                 </el-tabs>
             </trade-card>
+            <report-dialog :switchDialog="switchDialog" @onClose="onClose()"></report-dialog>
         </div>
         <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px"
             :close-on-click-modal="false" v-dialog-drag>
@@ -92,11 +93,12 @@ import {
 import { dateFormat } from "@/util/date";
 import { getToken } from "@/util/auth";
 import { getMenu } from "@/api/system/menu";
-
+import reportDialog from "@/components/report-dialog/main";
 export default {
     name: "detailsPage",
     data() {
         return {
+            switchDialog: false,
             activeName: "sale_detail",
             disabled: false,
             excelBox: false,
@@ -498,6 +500,9 @@ export default {
             this.refresh(this.onLoad.id, true)
         }
     },
+    components: {
+        reportDialog
+    },
     methods: {
         derivation() {
             window.open(
@@ -610,32 +615,10 @@ export default {
             done(form);
         },
         handlePrint() {
-            // 获取表格的表头和内容的HTML代码
-            const tableHeader = this.$refs.formContacts.$el.querySelector('.el-table__header-wrapper').outerHTML;
-            const tableContent = this.$refs.formContacts.$el.querySelector('.el-table__body-wrapper').outerHTML;
-            // 创建一个新的打印页面
-            const printWindow = window.open('', '_blank');
-
-            // 将新窗口的内容设置为表头和内容的HTML代码
-            printWindow.document.open();
-            printWindow.document.write(`
-        <html>
-          <head>
-            <style>
-              /* 添加打印样式 */
-            </style>
-          </head>
-          <body>
-            ${tableHeader}
-            ${tableContent}
-          </body>
-        </html>
-      `);
-            printWindow.document.close();
-
-            // 在新窗口中调用浏览器的打印功能
-            printWindow.print();
-            printWindow.close();
+            this.switchDialog = !this.switchDialog;
+        },
+        onClose(val) {
+            this.switchDialog = val;
         },
         //自定义列保存
         async saveColumnTwo(ref, option, optionBack, code) {