sum_print.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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: ['listItem'],
  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('backListFormDetail');
  71. },
  72. changeType() {
  73. },
  74. // 获取详情
  75. getDetail() {
  76. getDeliverDetail({id: this.listItem[0].id}).then(res => {
  77. this.detailData = res.data;
  78. })
  79. },
  80. getCompanyList() {
  81. getCompanyList().then(res => {
  82. this.company = res.data ? res.data[0].companyName : '';
  83. })
  84. },
  85. // 添加次数
  86. addPrint() {
  87. let ids = this.listItem.map(item => {
  88. return item.invoiceOrderId;
  89. });
  90. addPrint({ids: ids.join(',')}).then(res => {
  91. // this.$successMsg('提交成功');
  92. this.$parent.getList();
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style>
  99. html,body{
  100. height: auto !important;
  101. }
  102. </style>
  103. <style scoped lang="scss">
  104. .detail-container {
  105. width: 100%;
  106. }
  107. .top-container {
  108. margin-bottom: 20px;
  109. }
  110. </style>