| | |
| | | <template /> |
| | | <template> |
| | | <div> |
| | | <h3>报表直接打印,通过AJAX方式获取报表模板与报表数据</h3> |
| | | <p><a href="javascript:void" @click.prevent="ws_ajax_print">直接打印</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' |
| | | |
| | | export default { |
| | | name: 'Crkjl' |
| | | data() { |
| | | return { |
| | | OBJ: {} |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getData() |
| | | webapp_urlprotocol_startup() |
| | | }, |
| | | methods: { |
| | | async getData() { |
| | | const data = { |
| | | username: getCookie('admin'), |
| | | mesordercode: 'PO202206280001_4' |
| | | } |
| | | const res = await MesOrderPrintSearch(data) |
| | | this.OBJ = res.data |
| | | // console.log(JSON.stringify(this.OBJ), 1) |
| | | }, |
| | | ws_ajax_print() { |
| | | // 参数具体说明请参考帮助文档中的“WEB报表(B/S报表)->WEB报表客户端->启动参数说明”部分 |
| | | var args = { |
| | | type: 'print', // preview |
| | | showOptionDlg: false, // 如果不显示打印对话框而直接打印,将此行注释去掉即可 |
| | | report: { |
| | | 'Version': '6.8.5.5', |
| | | 'Title': '你的报表标题', |
| | | 'PrintAsDesignPaper': false, |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 105000, |
| | | 'Weight': 400, |
| | | 'Charset': 134 |
| | | }, |
| | | 'WatermarkAlignment': 'BottomRight', |
| | | 'Printer': { |
| | | 'Size': 11, |
| | | 'Width': 14.8, |
| | | 'Height': 21, |
| | | 'Oriention': 'Landscape', |
| | | 'LeftMargin': 0.5, |
| | | 'TopMargin': 0.4, |
| | | 'RightMargin': 0.5, |
| | | 'BottomMargin': 0.5 |
| | | }, |
| | | 'DetailGrid': { |
| | | 'CenterView': true, |
| | | 'Border': { |
| | | 'Pen': { |
| | | 'Width': 1.5 |
| | | } |
| | | }, |
| | | 'Recordset': { |
| | | 'Field': [ |
| | | { |
| | | 'Name': '工单号', |
| | | 'DBFieldName': 'wo_code' |
| | | }, |
| | | { |
| | | 'Name': '产品编码', |
| | | 'DBFieldName': 'partcode' |
| | | }, |
| | | { |
| | | 'Name': '产品名称', |
| | | 'DBFieldName': 'partname' |
| | | }, |
| | | { |
| | | 'Name': '产品规格', |
| | | 'DBFieldName': 'partspec' |
| | | }, |
| | | { |
| | | 'Name': '工艺路线', |
| | | 'DBFieldName': 'routename' |
| | | }, |
| | | { |
| | | 'Name': '工单数量', |
| | | 'DBFieldName': 'orderqty' |
| | | }, |
| | | { |
| | | 'Name': '打印人员', |
| | | 'DBFieldName': 'lm_user' |
| | | }, |
| | | { |
| | | 'Name': '打印时间', |
| | | 'DBFieldName': 'lm_date' |
| | | }, |
| | | { |
| | | 'Name': '工序号', |
| | | 'DBFieldName': 'seq' |
| | | }, |
| | | { |
| | | 'Name': '工序', |
| | | 'DBFieldName': 'stepname' |
| | | }, |
| | | { |
| | | 'Name': '加工数量', |
| | | 'DBFieldName': 'plan_qty' |
| | | }, |
| | | { |
| | | 'Name': '合格数量', |
| | | 'DBFieldName': 'good_qty' |
| | | }, |
| | | { |
| | | 'Name': '不良数量', |
| | | 'DBFieldName': 'ng_qty' |
| | | }, |
| | | { |
| | | 'Name': '二维码', |
| | | 'DBFieldName': 'stepqrcode' |
| | | } |
| | | ] |
| | | }, |
| | | 'Column': [ |
| | | { |
| | | 'Name': '工序号', |
| | | 'Width': 1.74625 |
| | | }, |
| | | { |
| | | 'Name': 'Column5', |
| | | 'Width': 2.98979 |
| | | }, |
| | | { |
| | | 'Name': '辅数量', |
| | | 'Width': 4.60375 |
| | | }, |
| | | { |
| | | 'Name': '收料仓库', |
| | | 'Width': 1.98438 |
| | | }, |
| | | { |
| | | 'Name': '批号', |
| | | 'Width': 2.01083 |
| | | }, |
| | | { |
| | | 'Name': 'Column2', |
| | | 'Width': 2.40771 |
| | | }, |
| | | { |
| | | 'Name': 'Column4', |
| | | 'Width': 4.20688 |
| | | } |
| | | ], |
| | | 'ColumnContent': { |
| | | 'Height': 1.40229, |
| | | 'AdjustRowHeight': false, |
| | | 'ColumnContentCell': [ |
| | | { |
| | | 'Column': '工序号', |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 90000, |
| | | 'Weight': 400, |
| | | 'Charset': 134 |
| | | }, |
| | | 'WordWrap': true, |
| | | 'TextAlign': 'MiddleCenter', |
| | | 'ShrinkFontToFit': true, |
| | | 'DataField': '工序号' |
| | | }, |
| | | { |
| | | 'Column': 'Column5', |
| | | 'FreeCell': true, |
| | | 'Control': [ |
| | | { |
| | | 'Type': 'Barcode', |
| | | 'Name': 'Barcode2', |
| | | 'Left': 0.608542, |
| | | 'Top': 0.1, |
| | | 'Width': 1.5875, |
| | | 'Height': 1.19063, |
| | | 'BarcodeType': 'QRCode', |
| | | 'CaptionPosition': 'None', |
| | | 'Text': '[#二维码#]' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | 'Column': '辅数量', |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 90000, |
| | | 'Weight': 400, |
| | | 'Charset': 134 |
| | | }, |
| | | 'WordWrap': true, |
| | | 'DataField': '工序' |
| | | }, |
| | | { |
| | | 'Column': '收料仓库', |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 90000, |
| | | 'Weight': 400, |
| | | 'Charset': 134 |
| | | }, |
| | | 'WordWrap': true, |
| | | 'DataField': '加工数量' |
| | | }, |
| | | { |
| | | 'Column': '批号', |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 90000, |
| | | 'Weight': 400, |
| | | 'Charset': 134 |
| | | }, |
| | | 'WordWrap': true, |
| | | 'DataField': '合格数量' |
| | | }, |
| | | { |
| | | 'Column': 'Column2', |
| | | 'WordWrap': true, |
| | | 'DataField': '不良数量' |
| | | }, |
| | | { |
| | | 'Column': 'Column4', |
| | | 'WordWrap': true |
| | | } |
| | | ] |
| | | }, |
| | | 'ColumnTitle': { |
| | | 'Height': 0.79375, |
| | | 'RepeatStyle': 'OnPage', |
| | | 'ColumnTitleCell': [ |
| | | { |
| | | 'GroupTitle': false, |
| | | 'Column': '工序号', |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 90000, |
| | | 'Weight': 400, |
| | | 'Charset': 134 |
| | | }, |
| | | 'TextAlign': 'MiddleCenter', |
| | | 'Text': '工序号' |
| | | }, |
| | | { |
| | | 'GroupTitle': false, |
| | | 'Column': 'Column5', |
| | | 'TextAlign': 'MiddleCenter', |
| | | 'Text': '二维码' |
| | | }, |
| | | { |
| | | 'GroupTitle': false, |
| | | 'Column': '辅数量', |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 90000, |
| | | 'Weight': 400, |
| | | 'Charset': 134 |
| | | }, |
| | | 'TextAlign': 'MiddleCenter', |
| | | 'Text': '工序' |
| | | }, |
| | | { |
| | | 'GroupTitle': false, |
| | | 'Column': '收料仓库', |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 90000, |
| | | 'Weight': 400, |
| | | 'Charset': 134 |
| | | }, |
| | | 'TextAlign': 'MiddleCenter', |
| | | 'Text': '加工数' |
| | | }, |
| | | { |
| | | 'GroupTitle': false, |
| | | 'Column': '批号', |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 90000, |
| | | 'Weight': 400, |
| | | 'Charset': 134 |
| | | }, |
| | | 'TextAlign': 'MiddleCenter', |
| | | 'Text': '合格数' |
| | | }, |
| | | { |
| | | 'GroupTitle': false, |
| | | 'Column': 'Column2', |
| | | 'TextAlign': 'MiddleCenter', |
| | | 'Text': '不良数量' |
| | | }, |
| | | { |
| | | 'GroupTitle': false, |
| | | 'Column': 'Column4', |
| | | 'TextAlign': 'MiddleCenter', |
| | | 'Text': '备注' |
| | | } |
| | | ] |
| | | } |
| | | }, |
| | | 'Parameter': [ |
| | | { |
| | | 'Name': 'Parameter1' |
| | | }, |
| | | { |
| | | 'Name': 'Parameter2' |
| | | } |
| | | ], |
| | | 'ReportHeader': [ |
| | | { |
| | | 'Name': 'ReportHeader1', |
| | | 'Height': 3.41313, |
| | | 'Control': [ |
| | | { |
| | | 'Type': 'FreeGrid', |
| | | 'Name': 'FreeGrid1', |
| | | 'Dock': 'Fill', |
| | | 'Border': { |
| | | 'Styles': '[DrawLeft|DrawTop|DrawRight|DrawBottom]', |
| | | 'Pen': { |
| | | 'Color': 'FFFFFF' |
| | | } |
| | | }, |
| | | 'ColLine': { |
| | | 'Color': 'FFFFFF' |
| | | }, |
| | | 'RowLine': { |
| | | 'Color': 'FFFFFF' |
| | | }, |
| | | 'FreeGridColumn': [ |
| | | { |
| | | 'index': 1, |
| | | 'Width': 1.87854 |
| | | }, |
| | | { |
| | | 'index': 2, |
| | | 'Width': 5.97958 |
| | | }, |
| | | { |
| | | 'index': 3, |
| | | 'Width': 1.82563 |
| | | }, |
| | | { |
| | | 'index': 4, |
| | | 'Width': 6.21771 |
| | | }, |
| | | { |
| | | 'index': 5, |
| | | 'Width': 4.10104 |
| | | } |
| | | ], |
| | | 'FreeGridRow': [ |
| | | { |
| | | 'index': 1, |
| | | 'Height': 0.79375 |
| | | }, |
| | | { |
| | | 'index': 5, |
| | | 'Height': 0.687917 |
| | | } |
| | | ], |
| | | 'FreeGridCell': [ |
| | | { |
| | | 'row': 1, |
| | | 'col': 1, |
| | | 'Font': { |
| | | 'Name': '宋体', |
| | | 'Size': 142500, |
| | | 'Bold': true, |
| | | 'Charset': 134 |
| | | }, |
| | | 'TextAlign': 'MiddleCenter', |
| | | 'Text': '流程单', |
| | | 'ColSpan': 5 |
| | | }, |
| | | { |
| | | 'row': 2, |
| | | 'col': 1, |
| | | 'Text': '工单号:' |
| | | }, |
| | | { |
| | | 'row': 2, |
| | | 'col': 2, |
| | | 'Text': '[#工单号#]' |
| | | }, |
| | | { |
| | | 'row': 2, |
| | | 'col': 3, |
| | | 'Text': '产品编码:' |
| | | }, |
| | | { |
| | | 'row': 2, |
| | | 'col': 4, |
| | | 'Text': '[#产品编码#]' |
| | | }, |
| | | { |
| | | 'row': 2, |
| | | 'col': 5, |
| | | 'FreeCell': true, |
| | | 'Control': [ |
| | | { |
| | | 'Type': 'Barcode', |
| | | 'Name': 'Barcode1', |
| | | 'Dock': 'Right', |
| | | 'Center': 'Both', |
| | | 'Left': 1.29646, |
| | | 'Width': 2.77813, |
| | | 'BarcodeType': 'QRCode', |
| | | 'CaptionPosition': 'None', |
| | | 'Text': '[#工单号#]' |
| | | } |
| | | ], |
| | | 'RowSpan': 4 |
| | | }, |
| | | { |
| | | 'row': 3, |
| | | 'col': 1, |
| | | 'Text': '产品名称:' |
| | | }, |
| | | { |
| | | 'row': 3, |
| | | 'col': 2, |
| | | 'Text': '[#产品名称#]' |
| | | }, |
| | | { |
| | | 'row': 3, |
| | | 'col': 3, |
| | | 'Text': '产品规格:' |
| | | }, |
| | | { |
| | | 'row': 3, |
| | | 'col': 4, |
| | | 'Text': '[#产品规格#]' |
| | | }, |
| | | { |
| | | 'row': 4, |
| | | 'col': 1, |
| | | 'Text': '工单数量:' |
| | | }, |
| | | { |
| | | 'row': 4, |
| | | 'col': 2, |
| | | 'Text': '[#工单数量#]' |
| | | }, |
| | | { |
| | | 'row': 4, |
| | | 'col': 3, |
| | | 'Text': '工艺路线:' |
| | | }, |
| | | { |
| | | 'row': 4, |
| | | 'col': 4, |
| | | 'Text': '[#工艺路线#]' |
| | | }, |
| | | { |
| | | 'row': 5, |
| | | 'col': 1, |
| | | 'Text': '打印人员:' |
| | | }, |
| | | { |
| | | 'row': 5, |
| | | 'col': 2, |
| | | 'Text': '[#打印人员#]' |
| | | }, |
| | | { |
| | | 'row': 5, |
| | | 'col': 3, |
| | | 'Text': '打印时间:' |
| | | }, |
| | | { |
| | | 'row': 5, |
| | | 'col': 4, |
| | | 'Text': '[#打印时间#]' |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | 'RepeatOnPage': true |
| | | } |
| | | ] |
| | | }, |
| | | data: this.OBJ |
| | | } |
| | | console.log(args, 1) |
| | | webapp_ws_ajax_run(args) |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | <style> |
| | | </style> |