detail.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
  13. </template>
  14. </a-page-header>
  15. <!-- 基础信息 -->
  16. <a-card size="small" :bordered="false" class="warehousingAuditDetail-cont">
  17. <a-collapse :activeKey="['1']">
  18. <a-collapse-panel key="1" header="基础信息">
  19. <a-descriptions :column="3">
  20. <a-descriptions-item label="供应商">{{ basicInfoData&&basicInfoData.purchaseTargetName ? basicInfoData.purchaseTargetName : '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="入库时间">{{ basicInfoData&&basicInfoData.stockPutTime ? basicInfoData.stockPutTime : '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="采购单号">{{ basicInfoData&&basicInfoData.purchaseBillNo ? basicInfoData.purchaseBillNo : '--' }}</a-descriptions-item>
  23. </a-descriptions>
  24. <a-descriptions :column="3" bordered size="small">
  25. <a-descriptions-item label="采购总款数">{{ basicInfoData&&(basicInfoData.totalCategory || basicInfoData.totalCategory==0) ? basicInfoData.totalCategory : '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="采购总数量">{{ basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0) ? basicInfoData.totalQty : '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="采购总成本">{{ basicInfoData&&(basicInfoData.totalAmount || basicInfoData.totalAmount==0) ? '¥'+basicInfoData.totalAmount : '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="入库总款数">{{ basicInfoData&&(basicInfoData.totalPutCategory || basicInfoData.totalPutCategory==0) ? basicInfoData.totalPutCategory : '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="入库总数量">{{ basicInfoData&&(basicInfoData.totalPutQty || basicInfoData.totalPutQty==0) ? basicInfoData.totalPutQty : '--' }}</a-descriptions-item>
  30. <a-descriptions-item label="入库总成本">{{ basicInfoData&&(basicInfoData.totalPutAmount || basicInfoData.totalPutAmount==0) ? '¥'+basicInfoData.totalPutAmount : '--' }}</a-descriptions-item>
  31. </a-descriptions>
  32. </a-collapse-panel>
  33. </a-collapse>
  34. </a-card>
  35. <!-- 入库明细 -->
  36. <a-card size="small" :bordered="false" class="warehousingAuditDetail-cont">
  37. <a-collapse :activeKey="['1']">
  38. <a-collapse-panel key="1" header="入库明细">
  39. <!-- 列表 -->
  40. <s-table
  41. class="sTable"
  42. ref="table"
  43. size="small"
  44. :rowKey="(record) => record.id"
  45. :columns="columns"
  46. :data="loadData"
  47. :scroll="{ x: 1520 }"
  48. :defaultLoadData="false"
  49. bordered>
  50. </s-table>
  51. </a-collapse-panel>
  52. </a-collapse>
  53. </a-card>
  54. </a-spin>
  55. </div>
  56. </template>
  57. <script>
  58. import { STable, VSelect } from '@/components'
  59. import { receivingDetailList, receivingDetailSn, receivingDetailPrint } from '@/api/receiving'
  60. import Print from '@/views/common/print.vue'
  61. import { hdPrint } from '@/libs/JGPrint'
  62. export default {
  63. components: { STable, VSelect, Print },
  64. data () {
  65. return {
  66. spinning: false,
  67. // 表头
  68. columns: [
  69. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  70. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  71. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  72. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  73. { title: '采购数量', dataIndex: 'qty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  74. { title: '入库数量', dataIndex: 'putQty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  75. { title: '成本价', dataIndex: 'discountedPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  76. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  77. { title: '入库小计', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  78. { title: '仓库', dataIndex: 'warehouseEntity.name', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  79. { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  80. ],
  81. // 加载数据方法 必须为 Promise 对象
  82. loadData: parameter => {
  83. this.disabled = true
  84. return receivingDetailList(Object.assign(parameter, { receivingBillSn: this.$route.params.sn })).then(res => {
  85. const data = res.data
  86. const no = (data.pageNo - 1) * data.pageSize
  87. for (var i = 0; i < data.list.length; i++) {
  88. data.list[i].no = no + i + 1
  89. }
  90. this.localDataSource = data.list
  91. this.disabled = false
  92. return data
  93. })
  94. },
  95. localDataSource: [],
  96. basicInfoData: null, // 基本信息
  97. printerType: 'NEEDLE' // 打印机类型
  98. }
  99. },
  100. methods: {
  101. // 返回列表
  102. handleBack () {
  103. this.$router.push({ path: '/financialManagement/warehousingAudit/list', query: { closeLastOldTab: true } })
  104. },
  105. // 打印预览/快捷打印
  106. handlePrint (type, printerType) {
  107. const _this = this
  108. _this.spinning = true
  109. const url = receivingDetailPrint
  110. const params = { sn: this.$route.params.sn, type: printerType }
  111. // 打印或导出
  112. hdPrint(printerType, type, url, params, '入库审核', function () {
  113. _this.spinning = false
  114. })
  115. },
  116. getDetail () {
  117. receivingDetailSn({ sn: this.$route.params.sn }).then(res => {
  118. if (res.status == 200) {
  119. this.basicInfoData = res.data
  120. } else {
  121. this.basicInfoData = null
  122. }
  123. })
  124. }
  125. },
  126. mounted () {
  127. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  128. this.$refs.table.refresh(true)
  129. this.getDetail()
  130. }
  131. },
  132. activated () {
  133. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  134. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  135. this.$refs.table.refresh(true)
  136. this.getDetail()
  137. }
  138. },
  139. beforeRouteEnter (to, from, next) {
  140. next(vm => {})
  141. }
  142. }
  143. </script>
  144. <style lang="less">
  145. .warehousingAuditDetail-cont{
  146. margin-bottom: 10px;
  147. }
  148. </style>