|
@@ -14,8 +14,13 @@
|
|
|
</template>
|
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
|
<template slot="extra">
|
|
|
- <a-button key="2" id="storeTransferOutDetail-preview-btn">打印预览</a-button>
|
|
|
- <a-button key="1" type="primary" id="storeTransferOutDetail-print-btn">快速打印</a-button>
|
|
|
+ <a-checkbox key="4" v-model="printCostChecked">打印成本</a-checkbox>
|
|
|
+ <a-radio-group key="3" v-model="printerType">
|
|
|
+ <a-radio value="INK">针式</a-radio>
|
|
|
+ <a-radio value="NEEDLE">喷墨</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ <a-button key="2" id="storeTransferOutDetail-preview-btn" @click="handlePrint('preview')">打印预览</a-button>
|
|
|
+ <a-button key="1" type="primary" id="storeTransferOutDetail-print-btn" @click="handlePrint('print')">快捷打印</a-button>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<a-card size="small" :bordered="false" class="storeTransferOutDetail-cont">
|
|
@@ -49,13 +54,15 @@
|
|
|
bordered>
|
|
|
</s-table>
|
|
|
</a-card>
|
|
|
+ <!-- 打印 -->
|
|
|
+ <div id="print"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import { getOperationalPrecision } from '@/libs/tools.js'
|
|
|
-import { storeCallOutDetailList, storeCallOutDetailCount, storeCallOutDetailSn } from '@/api/storeCallOut'
|
|
|
+import { storeCallOutDetailList, storeCallOutDetailCount, storeCallOutDetailSn, storeCallOutDetailPrint } from '@/api/storeCallOut'
|
|
|
export default {
|
|
|
components: { STable, VSelect },
|
|
|
data () {
|
|
@@ -85,7 +92,9 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
basicInfoData: null, // 基本信息
|
|
|
- productTotal: null // 合计
|
|
|
+ productTotal: null, // 合计
|
|
|
+ printerType: 'INK', // 打印机类型
|
|
|
+ printCostChecked: true // 打印成本
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -98,6 +107,25 @@ export default {
|
|
|
handleBack () {
|
|
|
this.$router.push({ path: '/allocationManagement/storeTransferOut/list' })
|
|
|
},
|
|
|
+ // 打印预览/快捷打印
|
|
|
+ handlePrint (type) {
|
|
|
+ storeCallOutDetailPrint({ sn: this.$route.params.sn, type: this.printerType, costFlag: this.printCostChecked ? '1' : '0' }).then(res => {
|
|
|
+ this.print(res, type)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ print (data, type) {
|
|
|
+ if (!data) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
|
|
|
+ document.getElementById('print').innerHTML = '<iframe id="printf" name="printf" src="' + url + '" hidden></iframe>'
|
|
|
+ if (type == 'preview') { // 预览
|
|
|
+ window.open(url)
|
|
|
+ } else if (type == 'print') { // 打印
|
|
|
+ window.frames['printf'].focus()
|
|
|
+ window.frames['printf'].print()
|
|
|
+ }
|
|
|
+ },
|
|
|
// 基本信息
|
|
|
getDetail () {
|
|
|
storeCallOutDetailSn({ sn: this.$route.params.sn }).then(res => {
|