|
@@ -9,12 +9,7 @@
|
|
|
</template>
|
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
|
<template slot="extra" v-if="$hasPermissions('B_storeCallOutPrint')">
|
|
|
- <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="storeTransferOutEdit-preview-btn" :disabled="chooseLoadDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
|
|
|
- <a-button key="1" type="primary" id="storeTransferOutEdit-print-btn" :disabled="chooseLoadDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
|
|
|
+ <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<!-- 选择产品 -->
|
|
@@ -186,8 +181,6 @@
|
|
|
@click="handleSubmit"
|
|
|
style="padding: 0 60px;">提交</a-button>
|
|
|
</div>
|
|
|
- <!-- 打印 -->
|
|
|
- <div id="print"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -199,8 +192,10 @@ import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
|
|
|
import { dealerProductTypeList } from '@/api/dealerProductType'
|
|
|
import { warehouseAllList } from '@/api/warehouse'
|
|
|
import { productQuery } from '@/api/allocWarehouse'
|
|
|
+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,
|
|
@@ -263,12 +258,6 @@ export default {
|
|
|
{ title: '成本小计(¥)', dataIndex: 'costSubtotal', width: 115, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
- // chooseLoadData: [],
|
|
|
- // choosePaginationProps: {
|
|
|
- // total: 0, // 分页总条数
|
|
|
- // current: 1,
|
|
|
- // pageSize: 20
|
|
|
- // },
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
chooseLoadData: parameter => {
|
|
|
this.chooseDisabled = true
|
|
@@ -290,8 +279,7 @@ export default {
|
|
|
},
|
|
|
chooseLoadDataSource: [],
|
|
|
basicInfoData: null, // 基本信息
|
|
|
- productTotal: null, // 合计
|
|
|
- printerType: 'NEEDLE' // 打印机类型
|
|
|
+ productTotal: null // 合计
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -308,39 +296,16 @@ export default {
|
|
|
this.$refs.table.refresh(true)
|
|
|
},
|
|
|
// 打印预览/快捷打印
|
|
|
- handlePrint (type) {
|
|
|
+ handlePrint (type, printerType) {
|
|
|
const _this = this
|
|
|
_this.spinning = true
|
|
|
- storeCallOutDetailPrint({ sn: this.$route.params.sn, type: this.printerType, costFlag: '0' }).then(res => {
|
|
|
+ const url = storeCallOutDetailPrint
|
|
|
+ const params = { sn: this.$route.params.sn, type: printerType, costFlag: '0' }
|
|
|
+ // 打印或导出
|
|
|
+ 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="printfsoe" name="printfsoe" src="' + url + '" hidden></iframe>'
|
|
|
- if (type == 'preview') { // 预览
|
|
|
- window.open(url)
|
|
|
- } else if (type == 'print') { // 打印
|
|
|
- window.frames['printfsoe'].focus()
|
|
|
- window.frames['printfsoe'].print()
|
|
|
- }
|
|
|
- },
|
|
|
// 双击快速添加
|
|
|
handleClickRow (record) {
|
|
|
return {
|