print.vue 2.3 KB

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