| | |
| | | <template /> |
| | | <template> |
| | | <div> |
| | | <h3>报表直接打印,通过AJAX方式获取报表模板与报表数据</h3> |
| | | <p><a href="javascript:void" @click.prevent="printClick">直接打印</a></p> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { webapp_ws_ajax_run, webapp_urlprotocol_startup, urlAddRandomNo } from '@/utils/grwebapp' |
| | | import { MesOrderPrintSearch, MesOrderPrintSearch1 } from '@/api/utils' |
| | | import { getCookie } from '@/utils/auth' |
| | | // import a from 'public/static/grf/simple.grf' |
| | | export default { |
| | | name: 'Gdpg' |
| | | data() { |
| | | return { |
| | | OBJ: {}, |
| | | TEXT: '' |
| | | } |
| | | }, |
| | | mounted() { |
| | | webapp_urlprotocol_startup() |
| | | // const a = require('public/static/grf/simple.grf') |
| | | // console.log(a, 1) |
| | | }, |
| | | methods: { |
| | | async printClick() { |
| | | const data = { |
| | | username: getCookie('admin'), |
| | | mesordercode: 'PO202206280001_4' |
| | | } |
| | | const res = await MesOrderPrintSearch1(data) |
| | | this.OBJ = res.data |
| | | if (res.code === '200') { |
| | | this.ws_ajax_print() |
| | | } |
| | | // console.log(JSON.stringify(this.OBJ), 1) |
| | | }, |
| | | ws_ajax_print() { |
| | | // 参数具体说明请参考帮助文档中的“WEB报表(B/S报表)->WEB报表客户端->启动参数说明”部分 |
| | | var args = { |
| | | type: 'print', // preview |
| | | showOptionDlg: false, // 如果不显示打印对话框而直接打印,将此行注释去掉即可 |
| | | report: urlAddRandomNo('./static/grf/产品流传单A4.grf'), |
| | | data: this.OBJ |
| | | } |
| | | |
| | | webapp_ws_ajax_run(args) |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | <style> |
| | | </style> |