|
@@ -8,8 +8,12 @@
|
|
|
</template>
|
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
|
<template slot="extra">
|
|
|
- <a-button key="2" id="salesReturnEdit-preview-btn">打印预览</a-button>
|
|
|
- <a-button key="1" type="primary" id="salesReturnEdit-print-btn">快速打印</a-button>
|
|
|
+ <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="salesReturnEdit-preview-btn" :disabled="chooseLoadData.length==0" @click="handlePrint('preview')">打印预览</a-button>
|
|
|
+ <a-button key="1" type="primary" id="salesReturnEdit-print-btn" :disabled="chooseLoadData.length==0" @click="handlePrint('print')">快捷打印</a-button>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<a-card size="small" :bordered="false" class="pages-wrap">
|
|
@@ -57,7 +61,7 @@
|
|
|
</a-col>
|
|
|
<a-col :span="6">
|
|
|
<div style="float:right;overflow: hidden;">
|
|
|
- <a-button id="salesReturn-dru">导入明细</a-button>
|
|
|
+ <!-- <a-button id="salesReturn-dru">导入明细</a-button> -->
|
|
|
<a-button
|
|
|
size="small"
|
|
|
type="primary"
|
|
@@ -151,6 +155,8 @@
|
|
|
</a-affix>
|
|
|
<!-- 选择客户弹框 -->
|
|
|
<choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
|
|
|
+ <!-- 打印 -->
|
|
|
+ <div id="print"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -160,7 +166,7 @@ import queryPart from './queryPart.vue'
|
|
|
import EditableCell from '@/views/common/editInput.js'
|
|
|
import chooseCustomModal from './chooseCustomModal.vue'
|
|
|
import { warehouseCascadeList } from '@/api/warehouse'
|
|
|
-import { salesReturnDetail, salesReturnQueryCount, salesReturnDetailList, salesReturnDiscount, salesReturnDelAll, salesReturnDetailDel, salesReturnSaveProduct, salesReturnSubmit } from '@/api/salesReturn'
|
|
|
+import { salesReturnDetail, salesReturnQueryCount, salesReturnDetailList, salesReturnDiscount, salesReturnDelAll, salesReturnDetailDel, salesReturnSaveProduct, salesReturnSubmit, salesReturnDetailPrint } from '@/api/salesReturn'
|
|
|
export default {
|
|
|
name: 'SalesDetail',
|
|
|
components: {
|
|
@@ -192,7 +198,7 @@ export default {
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', align: 'center', width: 80 },
|
|
|
{ title: '产品编码', dataIndex: 'dealerProductEntity.code', align: 'center', width: 220, customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
{ title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', align: 'center', width: 220, customRender: function (text) { return text || '--' } },
|
|
|
{ title: '售价', dataIndex: 'price', align: 'center', width: 150, scopedSlots: { customRender: 'price' } },
|
|
|
{ title: '单位', dataIndex: 'dealerProductEntity.unit', align: 'center', width: 100, customRender: function (text) { return text || '--' } },
|
|
@@ -229,7 +235,8 @@ export default {
|
|
|
this.chooseLoadData = data.list
|
|
|
return data
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+ printerType: 'INK' // 打印机类型
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -421,6 +428,38 @@ export default {
|
|
|
this.$message.success(res.message)
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 打印预览/快捷打印
|
|
|
+ handlePrint (type) {
|
|
|
+ const _this = this
|
|
|
+ salesReturnDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
|
|
|
+ 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="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()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|