detail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div class="warehousingAuditDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="warehousingAuditDetail-cont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="warehousingAuditDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.receivingBillNo) || '--' }}</p>
  9. </template>
  10. <!-- 操作区,位于 title 行的行尾 -->
  11. <template v-if="$hasPermissions('B_warehousingDetail_print')" slot="extra">
  12. <a-radio-group key="3" v-model="printerType">
  13. <a-radio value="NEEDLE">针式</a-radio>
  14. <a-radio value="INK">喷墨</a-radio>
  15. </a-radio-group>
  16. <a-button key="2" id="warehousingAuditDetail-preview-btn" @click="handlePrint('preview')">打印预览</a-button>
  17. <a-button key="1" type="primary" id="warehousingAuditDetail-print-btn" @click="handlePrint('print')">快捷打印</a-button>
  18. </template>
  19. </a-page-header>
  20. <!-- 基础信息 -->
  21. <a-card size="small" :bordered="false" class="warehousingAuditDetail-cont">
  22. <a-collapse :activeKey="['1']">
  23. <a-collapse-panel key="1" header="基础信息">
  24. <a-descriptions :column="3">
  25. <a-descriptions-item label="供应商">{{ basicInfoData&&basicInfoData.purchaseTargetName ? basicInfoData.purchaseTargetName : '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="入库时间">{{ basicInfoData&&basicInfoData.stockPutTime ? basicInfoData.stockPutTime : '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="采购单号">{{ basicInfoData&&basicInfoData.purchaseBillNo ? basicInfoData.purchaseBillNo : '--' }}</a-descriptions-item>
  28. </a-descriptions>
  29. <a-descriptions :column="3" bordered>
  30. <a-descriptions-item label="采购总款数">{{ basicInfoData&&(basicInfoData.totalCategory || basicInfoData.totalCategory==0) ? basicInfoData.totalCategory : '--' }}</a-descriptions-item>
  31. <a-descriptions-item label="采购总数量">{{ basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0) ? basicInfoData.totalQty : '--' }}</a-descriptions-item>
  32. <a-descriptions-item label="采购总成本">{{ basicInfoData&&(basicInfoData.totalAmount || basicInfoData.totalAmount==0) ? '¥'+basicInfoData.totalAmount : '--' }}</a-descriptions-item>
  33. <a-descriptions-item label="入库总款数">{{ basicInfoData&&(basicInfoData.totalPutCategory || basicInfoData.totalPutCategory==0) ? basicInfoData.totalPutCategory : '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="入库总数量">{{ basicInfoData&&(basicInfoData.totalPutQty || basicInfoData.totalPutQty==0) ? basicInfoData.totalPutQty : '--' }}</a-descriptions-item>
  35. <a-descriptions-item label="入库总成本">{{ basicInfoData&&(basicInfoData.totalPutAmount || basicInfoData.totalPutAmount==0) ? '¥'+basicInfoData.totalPutAmount : '--' }}</a-descriptions-item>
  36. </a-descriptions>
  37. </a-collapse-panel>
  38. </a-collapse>
  39. </a-card>
  40. <!-- 入库明细 -->
  41. <a-card size="small" :bordered="false" class="warehousingAuditDetail-cont">
  42. <a-collapse :activeKey="['1']">
  43. <a-collapse-panel key="1" header="入库明细">
  44. <!-- 列表 -->
  45. <s-table
  46. class="sTable"
  47. ref="table"
  48. size="small"
  49. :rowKey="(record) => record.id"
  50. :columns="columns"
  51. :data="loadData"
  52. :scroll="{ x: 1520 }"
  53. bordered>
  54. </s-table>
  55. </a-collapse-panel>
  56. </a-collapse>
  57. </a-card>
  58. </a-spin>
  59. <!-- 打印 -->
  60. <div id="print"></div>
  61. </div>
  62. </template>
  63. <script>
  64. import { STable, VSelect } from '@/components'
  65. import { receivingDetailList, receivingDetailSn, receivingDetailPrint } from '@/api/receiving'
  66. export default {
  67. components: { STable, VSelect },
  68. data () {
  69. return {
  70. spinning: false,
  71. // 表头
  72. columns: [
  73. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  74. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  75. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  76. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  77. { title: '采购数量', dataIndex: 'qty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  78. { title: '入库数量', dataIndex: 'putQty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  79. { title: '成本价', dataIndex: 'discountedPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  80. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  81. { title: '入库小计', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '仓库', dataIndex: 'warehouseEntity.name', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  83. { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  84. ],
  85. // 加载数据方法 必须为 Promise 对象
  86. loadData: parameter => {
  87. this.disabled = true
  88. return receivingDetailList(Object.assign(parameter, { receivingBillSn: this.$route.params.sn })).then(res => {
  89. const data = res.data
  90. const no = (data.pageNo - 1) * data.pageSize
  91. for (var i = 0; i < data.list.length; i++) {
  92. data.list[i].no = no + i + 1
  93. }
  94. this.disabled = false
  95. return data
  96. })
  97. },
  98. basicInfoData: null, // 基本信息
  99. printerType: 'NEEDLE' // 打印机类型
  100. }
  101. },
  102. methods: {
  103. // 返回列表
  104. handleBack () {
  105. this.$router.push({ path: '/financialManagement/warehousingAudit/list', query: { closeLastOldTab: true } })
  106. },
  107. // 打印预览/快捷打印
  108. handlePrint (type) {
  109. const _this = this
  110. _this.spinning = true
  111. receivingDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
  112. _this.spinning = false
  113. if (res.type == 'application/json') {
  114. var reader = new FileReader()
  115. reader.addEventListener('loadend', function () {
  116. const obj = JSON.parse(reader.result)
  117. _this.$notification.error({
  118. message: '提示',
  119. description: obj.message
  120. })
  121. })
  122. reader.readAsText(res)
  123. } else {
  124. this.print(res, type)
  125. }
  126. })
  127. },
  128. print (data, type) {
  129. if (!data) {
  130. return
  131. }
  132. const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
  133. document.getElementById('print').innerHTML = '<iframe id="printf" name="printf" src="' + url + '" hidden></iframe>'
  134. if (type == 'preview') { // 预览
  135. window.open(url)
  136. } else if (type == 'print') { // 打印
  137. window.frames['printf'].focus()
  138. window.frames['printf'].print()
  139. }
  140. },
  141. getDetail () {
  142. receivingDetailSn({ sn: this.$route.params.sn }).then(res => {
  143. if (res.status == 200) {
  144. this.basicInfoData = res.data
  145. } else {
  146. this.basicInfoData = null
  147. }
  148. })
  149. }
  150. },
  151. beforeRouteEnter (to, from, next) {
  152. next(vm => {
  153. vm.getDetail()
  154. })
  155. }
  156. }
  157. </script>
  158. <style lang="less">
  159. .warehousingAuditDetail-cont{
  160. margin-bottom: 15px;
  161. }
  162. </style>