|
@@ -8,8 +8,12 @@
|
|
|
</template>
|
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
|
<template slot="extra">
|
|
|
- <a-button key="2" id="chainTransferOutEdit-preview-btn">打印预览</a-button>
|
|
|
- <a-button key="1" type="primary" id="chainTransferOutEdit-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="chainTransferOutEdit-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
|
|
|
+ <a-button key="1" type="primary" id="chainTransferOutEdit-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<!-- 选择产品 -->
|
|
@@ -146,7 +150,7 @@
|
|
|
</div>
|
|
|
</a-col>
|
|
|
<a-col :span="7" style="text-align: right;">
|
|
|
- <a-button size="small" style="margin-left: 8px" id="chainTransferOutEdit-import-btn">导入明细</a-button>
|
|
|
+ <!-- <a-button size="small" style="margin-left: 8px" id="chainTransferOutEdit-import-btn">导入明细</a-button> -->
|
|
|
<a-button size="small" type="danger" style="margin-left: 8px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -179,13 +183,15 @@
|
|
|
style="padding: 0 60px;">提交</a-button>
|
|
|
</div>
|
|
|
</a-affix>
|
|
|
+ <!-- 打印 -->
|
|
|
+ <div id="print"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import { getOperationalPrecision } from '@/libs/tools.js'
|
|
|
-import { allocLinkageOutDetailSn, allocLinkageOutDetailList, allocLinkageOutDetailSave, allocLinkageOutDetailDel, allocLinkageOutDetailCount, allocLinkageOutSubmit, allocLinkageOutDetailDelAll } from '@/api/allocLinkageOut'
|
|
|
+import { allocLinkageOutDetailSn, allocLinkageOutDetailList, allocLinkageOutDetailSave, allocLinkageOutDetailDel, allocLinkageOutDetailCount, allocLinkageOutSubmit, allocLinkageOutDetailDelAll, allocLinkageOutDetailPrint } from '@/api/allocLinkageOut'
|
|
|
import { productQuery } from '@/api/allocWarehouse'
|
|
|
import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
|
|
|
import { dealerProductTypeList } from '@/api/dealerProductType'
|
|
@@ -269,11 +275,14 @@ export default {
|
|
|
}
|
|
|
this.chooseDisabled = false
|
|
|
this.getDetailCount(params)
|
|
|
+ this.localDataSource = data.list
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
basicInfoData: null, // 基本信息
|
|
|
- productTotal: null // 合计
|
|
|
+ productTotal: null, // 合计
|
|
|
+ localDataSource: [],
|
|
|
+ printerType: 'INK' // 打印机类型
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -468,6 +477,38 @@ export default {
|
|
|
this.warehouseList = []
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 打印预览/快捷打印
|
|
|
+ handlePrint (type) {
|
|
|
+ const _this = this
|
|
|
+ allocLinkageOutDetailPrint({ 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()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|