|
@@ -98,7 +98,7 @@ import { getOperationalPrecision } from '@/libs/tools.js'
|
|
import { STable, VSelect } from '@/components'
|
|
import { STable, VSelect } from '@/components'
|
|
import { salesDetailBySn, salesDetailPrint, salesDetailExport } from '@/api/sales'
|
|
import { salesDetailBySn, salesDetailPrint, salesDetailExport } from '@/api/sales'
|
|
import { salesDetailList } from '@/api/salesDetail'
|
|
import { salesDetailList } from '@/api/salesDetail'
|
|
-import { getLodop } from '@/libs/LodopFuncs'
|
|
|
|
|
|
+import { JGPrint } from '@/libs/JGPrint'
|
|
export default {
|
|
export default {
|
|
name: 'SalesDetail',
|
|
name: 'SalesDetail',
|
|
components: { STable, VSelect },
|
|
components: { STable, VSelect },
|
|
@@ -207,57 +207,11 @@ export default {
|
|
if (type == 'export') { // 导出
|
|
if (type == 'export') { // 导出
|
|
this.download(res)
|
|
this.download(res)
|
|
} else {
|
|
} else {
|
|
- this.print(res, type)
|
|
|
|
|
|
+ JGPrint(res, type, this.printerType)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- print (data, type) {
|
|
|
|
- if (!data) {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- // 针式打印
|
|
|
|
- if (this.printerType == 'NEEDLE') {
|
|
|
|
- const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
|
|
|
|
- console.log(LODOP)
|
|
|
|
- if (!LODOP) {
|
|
|
|
- this.$confirm({
|
|
|
|
- title: '提示?',
|
|
|
|
- content: h => <div>打印控件未安装,请先下载并安装。/n安装完成后,刷新页面即可打印。</div>,
|
|
|
|
- okText: '立即下载',
|
|
|
|
- okType: 'danger',
|
|
|
|
- cancelText: '暂不打印',
|
|
|
|
- onOk () {
|
|
|
|
- window.open('http://www.lodop.net/demolist/CLodop_Setup_for_Win32NT.zip')
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- const rx = /<body[^>]*>([\s\S]+?)<\/body>/i///
|
|
|
|
- let m = rx.exec(data)
|
|
|
|
- if (m) m = m[1]
|
|
|
|
- LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) // 隐藏底图上有模拟走纸板的条纹线
|
|
|
|
- LODOP.SET_PRINT_PAGESIZE(3, '2140', '45', '') // 这里3表示纵向打印且纸高“按内容的高度”;2140表示纸宽214.0mm;45表示页底空白4.5mm
|
|
|
|
- LODOP.ADD_PRINT_HTM(0, 0, '100%', '100%', m)
|
|
|
|
- // LODOP.ADD_PRINT_TABLE(0, 0, '100%', '100%', m)
|
|
|
|
- if (type == 'preview') {
|
|
|
|
- LODOP.PREVIEW()
|
|
|
|
- }
|
|
|
|
- if (type == 'print') {
|
|
|
|
- LODOP.PRINT()
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
|
|
|
|
- document.getElementById('print').innerHTML = '<iframe id="printfsqd" name="printfsqd" src="' + url + '" hidden></iframe>'
|
|
|
|
- // 喷墨打印
|
|
|
|
- if (type == 'preview') { // 预览
|
|
|
|
- window.open(url)
|
|
|
|
- } else if (type == 'print') { // 打印
|
|
|
|
- window.frames['printfsqd'].focus()
|
|
|
|
- window.frames['printfsqd'].print()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
download (data) {
|
|
download (data) {
|
|
if (!data) { return }
|
|
if (!data) { return }
|
|
const url = window.URL.createObjectURL(new Blob([data]))
|
|
const url = window.URL.createObjectURL(new Blob([data]))
|