|
@@ -9,19 +9,7 @@
|
|
</template>
|
|
</template>
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
<template slot="extra" v-if="$hasPermissions('B_salesReturnPrint')">
|
|
<template slot="extra" v-if="$hasPermissions('B_salesReturnPrint')">
|
|
- <a-radio-group key="4" v-model="printerType">
|
|
|
|
- <a-radio value="NEEDLE">针式</a-radio>
|
|
|
|
- <a-radio value="INK">喷墨</a-radio>
|
|
|
|
- </a-radio-group>
|
|
|
|
- <a-button key="3" id="salesReturnEdit-preview-btn" :disabled="chooseLoadData.length==0" @click="handlePrint('preview')">打印预览</a-button>
|
|
|
|
- <a-button key="2" type="primary" id="salesReturnEdit-print-btn" :disabled="chooseLoadData.length==0" @click="handlePrint('print')">快捷打印</a-button>
|
|
|
|
- <a-button
|
|
|
|
- key="1"
|
|
|
|
- type="primary"
|
|
|
|
- class="button-warning"
|
|
|
|
- id="salesReturnEdit-export-btn"
|
|
|
|
- :disabled="chooseLoadData.length==0"
|
|
|
|
- @click="handlePrint('export')">导出Excel</a-button>
|
|
|
|
|
|
+ <Print :disabled="chooseLoadData.length==0" @handlePrint="handlePrint"></Print>
|
|
</template>
|
|
</template>
|
|
</a-page-header>
|
|
</a-page-header>
|
|
<a-card size="small" :bordered="false" class="pages-wrap">
|
|
<a-card size="small" :bordered="false" class="pages-wrap">
|
|
@@ -186,25 +174,25 @@
|
|
</div>
|
|
</div>
|
|
<!-- 选择客户弹框 -->
|
|
<!-- 选择客户弹框 -->
|
|
<choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
|
|
<choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
|
|
- <!-- 打印 -->
|
|
|
|
- <div id="print"></div>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import moment from 'moment'
|
|
|
|
import { STable, VSelect } from '@/components'
|
|
import { STable, VSelect } from '@/components'
|
|
import queryPart from './queryPart.vue'
|
|
import queryPart from './queryPart.vue'
|
|
import chooseCustomModal from './chooseCustomModal.vue'
|
|
import chooseCustomModal from './chooseCustomModal.vue'
|
|
import { warehouseCascadeList } from '@/api/warehouse'
|
|
import { warehouseCascadeList } from '@/api/warehouse'
|
|
import { salesReturnDetail, salesReturnQueryCount, salesReturnDetailList, salesReturnDiscount, salesReturnDelAll, salesReturnDetailDel, salesReturnSaveProduct, salesReturnSubmit, salesReturnDetailPrint, salesDetailExport } from '@/api/salesReturn'
|
|
import { salesReturnDetail, salesReturnQueryCount, salesReturnDetailList, salesReturnDiscount, salesReturnDelAll, salesReturnDetailDel, salesReturnSaveProduct, salesReturnSubmit, salesReturnDetailPrint, salesDetailExport } from '@/api/salesReturn'
|
|
|
|
+import Print from '@/views/common/print.vue'
|
|
|
|
+import { hdPrint } from '@/libs/JGPrint'
|
|
export default {
|
|
export default {
|
|
name: 'SalesDetail',
|
|
name: 'SalesDetail',
|
|
components: {
|
|
components: {
|
|
STable,
|
|
STable,
|
|
VSelect,
|
|
VSelect,
|
|
queryPart,
|
|
queryPart,
|
|
- chooseCustomModal
|
|
|
|
|
|
+ chooseCustomModal,
|
|
|
|
+ Print
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
@@ -494,61 +482,19 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 打印预览/快捷打印
|
|
// 打印预览/快捷打印
|
|
- handlePrint (type) {
|
|
|
|
|
|
+ handlePrint (type, printerType) {
|
|
const _this = this
|
|
const _this = this
|
|
_this.spinning = true
|
|
_this.spinning = true
|
|
let url = salesReturnDetailPrint
|
|
let url = salesReturnDetailPrint
|
|
- let params = { sn: this.$route.params.sn, type: this.printerType }
|
|
|
|
|
|
+ const params = { sn: this.$route.params.sn }
|
|
if (type == 'export') { // 导出
|
|
if (type == 'export') { // 导出
|
|
url = salesDetailExport
|
|
url = salesDetailExport
|
|
- params = { sn: this.$route.params.sn }
|
|
|
|
}
|
|
}
|
|
- url(params).then(res => {
|
|
|
|
|
|
+ // 打印或导出
|
|
|
|
+ hdPrint(printerType, type, url, params, '销售退货', function () {
|
|
_this.spinning = false
|
|
_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 {
|
|
|
|
- if (type == 'export') { // 导出
|
|
|
|
- this.download(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="printfsre" name="printfsre" src="' + url + '" hidden></iframe>'
|
|
|
|
- if (type == 'preview') { // 预览
|
|
|
|
- window.open(url)
|
|
|
|
- } else if (type == 'print') { // 打印
|
|
|
|
- window.frames['printfsre'].focus()
|
|
|
|
- window.frames['printfsre'].print()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- download (data) {
|
|
|
|
- if (!data) { return }
|
|
|
|
- const url = window.URL.createObjectURL(new Blob([data]))
|
|
|
|
- const link = document.createElement('a')
|
|
|
|
- link.style.display = 'none'
|
|
|
|
- link.href = url
|
|
|
|
- const a = moment().format('YYYYMMDDHHmmss')
|
|
|
|
- const fname = '销售退货' + a
|
|
|
|
- link.setAttribute('download', fname + '.xlsx')
|
|
|
|
- document.body.appendChild(link)
|
|
|
|
- link.click()
|
|
|
|
- },
|
|
|
|
pageInit () {
|
|
pageInit () {
|
|
this.orderId = this.$route.params.id
|
|
this.orderId = this.$route.params.id
|
|
this.orderSn = this.$route.params.sn
|
|
this.orderSn = this.$route.params.sn
|