| | |
| | | recordset: [], |
| | | }, |
| | | grfPath: "", |
| | | oriention: null, |
| | | }; |
| | | }, |
| | | async mounted() { |
| | | // 获取 打印的数据 |
| | | await this.getPrintData(); |
| | | // 获取打印纸张大小 |
| | | rubylong.grhtml5.barcodeURL = this.baseUrl + "/Utility/Barcode.ashx"; |
| | | rubylong.grhtml5.barcodeURL = this.$baseUrl + "/Utility/Barcode.ashx"; |
| | | this.reportViewer = rubylong.grhtml5.insertReportViewer( |
| | | "report_holder", |
| | | this.grfPath, |
| | |
| | | return datajson; |
| | | }, |
| | | async getPrintData() { |
| | | console.log(this.$route.query.Type) |
| | | // 在大批量打印的时候 url长度可能超get允许的长度 后端需按需求 改成POST请求 |
| | | let OpenTmp = decodeURIComponent(this.$route.query.OpenTmp); |
| | | let sql = ""; |
| | |
| | | "select * from h_v_IF_BarCodeBillList where hmainid in(" + |
| | | this.handleMessage.linterid.toString() + |
| | | ") order by hmainid desc"; |
| | | } else if (this.$route.query.Type == "HGy_BarCodeBillList") { |
| | | sql = |
| | | "select * from h_v_IF_BarCodeBillList where hmainid in(" + |
| | | this.handleMessage.linterid.toString() + |
| | | ") order by hmainid desc"; |
| | | } else if (this.$route.query.Type == "HPOInStockBill") { |
| | | sql = |
| | | "select * from h_v_Sc_PrintMouldProdOutBillList where hmainid=" + |
| | |
| | | " order by hmainid"; |
| | | } else if (this.$route.query.Type == "HGyStockPlaceBarCode") { |
| | | let condition = decodeURI(this.handleMessage.linterid.toString()); |
| | | sql = `SELECT |
| | | CEILING(CAST(t.row_num AS FLOAT) / 2) AS orderid, |
| | | MAX(CASE WHEN t.row_num % 2 = 1 THEN t.条码编号 END) AS 条码编号1, |
| | | MAX(CASE WHEN t.row_num % 2 = 1 THEN t.仓位名称 END) AS 仓位名称1, |
| | | MAX(CASE WHEN t.row_num % 2 = 0 THEN t.条码编号 END) AS 条码编号2, |
| | | MAX(CASE WHEN t.row_num % 2 = 0 THEN t.仓位名称 END) AS 仓位名称2 |
| | | FROM ( |
| | | SELECT |
| | | 条码编号, 仓位名称, |
| | | ROW_NUMBER() OVER (ORDER BY t1.HItemID) AS row_num |
| | | FROM h_v_IF_StockPlaceList t1 where 条码编号 in (${condition}) |
| | | ) AS t |
| | | GROUP BY CEILING(CAST(t.row_num AS FLOAT) / 2) |
| | | ORDER BY orderid;`; |
| | | condition = condition.split(',').map(e => `'${e}'`).join(',') |
| | | sql = `exec h_p_GetSPBarCode_Swell N'${condition}'`; |
| | | } else if (this.$route.query.Type == "WL_YayBill") { |
| | | sql = "select * from h_v_WL_YayBilllist where hmainid in(" + |
| | | this.handleMessage.linterid.toString() + |
| | | ") order by hmainid desc"; |
| | | console.log(sql) |
| | | |
| | | } |
| | | try { |
| | | let res = await axios.get(this.baseUrl + "/CommonModel/searchMethod", { |
| | | try{ |
| | | let res = await axios.get(this.$baseUrl + "/CommonModel/searchMethod", { |
| | | params: { |
| | | sql: sql, |
| | | user: sessionStorage["HUserName"], |
| | |
| | | }, |
| | | }); |
| | | // 将 渲染数据 和 模板加载到本地 |
| | | console.log(res) |
| | | |
| | | let result = res.data; |
| | | this.json_data.recordset = result.data; |
| | | this.grfPath = "./static/grf/" + OpenTmp + ".grf"; |
| | |
| | | this.pageSize.width = grfMeta.Printer.Width * 10 + "mm"; |
| | | this.pageSize.height = grfMeta.Printer.Height * 10 + "mm"; |
| | | console.log("pageSize: ",this.pageSize) |
| | | this.oriention = grfMeta.Printer.Oriention.toLowerCase() |
| | | }, |
| | | getTemp() { |
| | | // 对每个要打印的对象添加分页 |
| | |
| | | type: "html", |
| | | style: |
| | | this.styleList[0].innerText + |
| | | ` @media print { |
| | | ` |
| | | .printable { |
| | | page-break-inside: avoid; |
| | | page-break-after: always; |
| | | box-sizing: border-box !important; /* 内边距不影响宽高 */ |
| | | } |
| | | |
| | | @page { |
| | |
| | | padding: 0; |
| | | } |
| | | |
| | | table { border-collapse: collapse !important; } |
| | | |
| | | * { |
| | | margin: 0; |
| | | padding: 0; |
| | | color: #000 !important; |
| | | opacity: 1 !important; |
| | | filter: none !important; |
| | | text-shadow: none !important; |
| | | -webkit-print-color-adjust: exact; /* 强制还原颜色(避免淡色) */ |
| | | } |
| | | `, |
| | | }); |
| | |
| | | }; |
| | | </script> |
| | | |
| | | <style></style> |
| | | <style> |
| | | </style> |