print.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div>
  3. <a-button
  4. key="1"
  5. type="primary"
  6. class="button-info"
  7. v-if="$hasPermissions('B_transferReturnPrint')"
  8. id="transferReturn-db-print-btn"
  9. :disabled="disabled"
  10. @click="handlePrint('preview')">打印预览</a-button>
  11. <a-button
  12. key="2"
  13. type="primary"
  14. class="button-info"
  15. v-if="$hasPermissions('B_transferReturnPrint')"
  16. id="transferReturn-dbfl-print-btn"
  17. :disabled="disabled"
  18. @click="handlePrint('print')">快捷打印</a-button>
  19. <a-divider type="vertical" />
  20. <a-button
  21. key="3"
  22. type="default"
  23. class="button-warning"
  24. v-if="$hasPermissions('B_transferReturnExport')"
  25. id="transferReturn-export-btn"
  26. :disabled="disabled"
  27. @click="handleExcel">导出Excel</a-button>
  28. <!-- 打印导出 -->
  29. <print-modal :openModal="openModal" :itemData="basicInfoData" :nowType="nowType" @ok="handleOk" @close="openModal=false" />
  30. <!-- 打印 -->
  31. <div id="print"></div>
  32. </div>
  33. </template>
  34. <script>
  35. import { printFun, exportExcel } from '@/libs/JGPrint.js'
  36. // 组件
  37. import printModal from './printModal.vue'
  38. // 接口
  39. import { allocateReturnExcel, allocateReturnPrint } from '@/api/allocateReturn'
  40. export default {
  41. components: { printModal },
  42. props: {
  43. params: {
  44. type: Object,
  45. default: function () {
  46. return {}
  47. }
  48. },
  49. basicInfoData: {
  50. type: Object,
  51. default: function () {
  52. return {}
  53. }
  54. },
  55. disabled: {
  56. type: Boolean,
  57. default: false
  58. }
  59. },
  60. data () {
  61. return {
  62. openModal: false, // 打开打印导出
  63. nowType: null// 打印类型
  64. }
  65. },
  66. methods: {
  67. // 打印预览/快捷打印
  68. handlePrint (type) {
  69. this.nowType = type
  70. this.openModal = true
  71. },
  72. // 打印导出
  73. handleOk (obj) {
  74. const _this = this
  75. const params = {
  76. allocateReturnSn: obj.allocateReturnSn || '',
  77. printType: obj.printType
  78. }
  79. // 打印货位编号
  80. if (obj.orderBy) {
  81. params.orderBy = obj.orderBy
  82. }
  83. _this.$emit('loading')
  84. printFun(allocateReturnPrint, params, obj.isPreview, '调拨退货单', () => {
  85. _this.$emit('unloading')
  86. _this.$store.state.app.curActionPermission = ''
  87. })
  88. },
  89. // 导出
  90. handleExcel () {
  91. const _this = this
  92. _this.$emit('loading')
  93. const params = { allocateReturnSn: this.params.allocateReturnSn || '' }
  94. _this.$store.state.app.curActionPermission = 'B_transferReturnExport'
  95. exportExcel(allocateReturnExcel, params, '调拨退货单明细', function () {
  96. _this.$emit('unloading')
  97. _this.$store.state.app.curActionPermission = ''
  98. })
  99. }
  100. }
  101. }
  102. </script>
  103. <style>
  104. </style>