|
@@ -9,12 +9,7 @@
|
|
|
</template>
|
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
|
<template v-if="$hasPermissions('B_warehousingDetail_print')" slot="extra">
|
|
|
- <a-radio-group key="3" v-model="printerType">
|
|
|
- <a-radio value="NEEDLE">针式</a-radio>
|
|
|
- <a-radio value="INK">喷墨</a-radio>
|
|
|
- </a-radio-group>
|
|
|
- <a-button key="2" id="warehousingAuditDetail-preview-btn" @click="handlePrint('preview')">打印预览</a-button>
|
|
|
- <a-button key="1" type="primary" id="warehousingAuditDetail-print-btn" @click="handlePrint('print')">快捷打印</a-button>
|
|
|
+ <Print :showExport="false" @handlePrint="handlePrint"></Print>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<!-- 基础信息 -->
|
|
@@ -57,16 +52,16 @@
|
|
|
</a-collapse>
|
|
|
</a-card>
|
|
|
</a-spin>
|
|
|
- <!-- 打印 -->
|
|
|
- <div id="print"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import { receivingDetailList, receivingDetailSn, receivingDetailPrint } from '@/api/receiving'
|
|
|
+import Print from '@/views/common/print.vue'
|
|
|
+import { hdPrint } from '@/libs/JGPrint'
|
|
|
export default {
|
|
|
- components: { STable, VSelect },
|
|
|
+ components: { STable, VSelect, Print },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
@@ -107,39 +102,16 @@ export default {
|
|
|
this.$router.push({ path: '/financialManagement/warehousingAudit/list', query: { closeLastOldTab: true } })
|
|
|
},
|
|
|
// 打印预览/快捷打印
|
|
|
- handlePrint (type) {
|
|
|
+ handlePrint (type, printerType) {
|
|
|
const _this = this
|
|
|
_this.spinning = true
|
|
|
- receivingDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
|
|
|
+ const url = receivingDetailPrint
|
|
|
+ const params = { sn: this.$route.params.sn, type: this.printerType }
|
|
|
+ // 打印
|
|
|
+ hdPrint(printerType, type, url, params, '入库审核', function () {
|
|
|
_this.spinning = false
|
|
|
- if (res.type == 'application/json') {
|
|
|
- var reader = new FileReader()
|
|
|
- reader.addEventListener('loadend', function () {
|
|
|
- const obj = JSON.parse(reader.result)
|
|
|
- _this.$notification.error({
|
|
|
- message: '提示',
|
|
|
- description: obj.message
|
|
|
- })
|
|
|
- })
|
|
|
- reader.readAsText(res)
|
|
|
- } else {
|
|
|
- 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="printfwad" name="printfwad" src="' + url + '" hidden></iframe>'
|
|
|
- if (type == 'preview') { // 预览
|
|
|
- window.open(url)
|
|
|
- } else if (type == 'print') { // 打印
|
|
|
- window.frames['printfwad'].focus()
|
|
|
- window.frames['printfwad'].print()
|
|
|
- }
|
|
|
- },
|
|
|
getDetail () {
|
|
|
receivingDetailSn({ sn: this.$route.params.sn }).then(res => {
|
|
|
if (res.status == 200) {
|