common_print.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div class="detail-container">
  3. <!-- <div class="top-container">
  4. <el-radio-group v-model="currentType" size="medium" @change="changeType()">
  5. <el-radio-button v-for="(item, index) in typeList" :key="index" :label="item.value">{{item.label}}</el-radio-button>
  6. </el-radio-group>
  7. </div> -->
  8. <div id="printMe">
  9. <PrintCommon :detailData="detailData" :company="company" v-if="currentType === 0" />
  10. <PrintFoshan :detailData="detailData" :company="company" v-if="currentType === 1" />
  11. <PrintGuangzhou :detailData="detailData" :company="company" v-if="currentType === 2" />
  12. <PrintShaoguan :detailData="detailData" :company="company" v-if="currentType === 3" />
  13. </div>
  14. <div class="page-footer">
  15. <div class="footer">
  16. <el-button type="primary" icon="el-icon-printer" v-print="printObj">打 印</el-button>
  17. <el-button @click="goBack">关 闭</el-button>
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import print from 'vue-print-nb'
  24. import { getDeliverDetail, getEnginDetail } from "@/api/supply/deliver";
  25. import { addPrint } from "@/api/supply/pickup";
  26. import { getCompanyList } from "@/api/user";
  27. import PrintCommon from "@/components/Common/print-common";
  28. import PrintFoshan from "@/components/Common/print-foshan";
  29. import PrintGuangzhou from "@/components/Common/print-guangzhou";
  30. import PrintShaoguan from "@/components/Common/print-shaoguan";
  31. export default {
  32. name: 'ReturnDetail',
  33. componentName: 'ReturnDetail',
  34. props: ['printId', 'printType'],
  35. components: {
  36. PrintFoshan,
  37. PrintGuangzhou,
  38. PrintShaoguan,
  39. PrintCommon,
  40. },
  41. directives: {
  42. print
  43. },
  44. data() {
  45. return {
  46. currentType: 0,
  47. typeList: [
  48. { label: '通用', value: 0 },
  49. { label: '佛山', value: 1 },
  50. { label: '广州', value: 2 },
  51. { label: '韶关', value: 3 },
  52. ],
  53. printObj: {
  54. id: 'printMe',
  55. closeCallback: () => {
  56. this.addPrint();
  57. }
  58. },
  59. detailData: {},
  60. company: '',
  61. }
  62. },
  63. created() {
  64. this.getDetail();
  65. this.getCompanyList();
  66. },
  67. methods: {
  68. // 返回列表
  69. goBack() {
  70. this.$emit('backDetail');
  71. },
  72. changeType() {
  73. },
  74. // 获取详情
  75. getDetail() {
  76. // if(this.printType === 1) {
  77. getDeliverDetail({id: this.printId}).then(res => {
  78. this.detailData = res.data;
  79. })
  80. // }else {
  81. // getEnginDetail({id: this.printId}).then(res => {
  82. // this.detailData = res.data;
  83. // })
  84. // }
  85. },
  86. getCompanyList() {
  87. getCompanyList().then(res => {
  88. this.company = res.data ? res.data[0].companyName : '';
  89. })
  90. },
  91. // 添加次数
  92. addPrint() {
  93. addPrint({ids: this.printId}).then(res => {
  94. // this.$successMsg('提交成功');
  95. this.$parent.getList();
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style scoped lang="scss">
  102. .detail-container {
  103. width: 100%;
  104. height: 100%;
  105. }
  106. .top-container {
  107. margin-top: 20px;
  108. }
  109. </style>