detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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="4">
  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="4" 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="采购总成本" v-if="$hasPermissions('M_ShowAllCost')">{{ 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="入库总成本" v-if="$hasPermissions('M_ShowAllCost')">{{ 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. :defaultLoadData="false"
  48. bordered>
  49. </s-table>
  50. </a-collapse-panel>
  51. </a-collapse>
  52. </a-card>
  53. </a-spin>
  54. </div>
  55. </template>
  56. <script>
  57. import { commonMixin } from '@/utils/mixin'
  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. name: 'WarehousingAuditDetail',
  64. components: { STable, VSelect, Print },
  65. mixins: [commonMixin],
  66. data () {
  67. return {
  68. spinning: false,
  69. // 加载数据方法 必须为 Promise 对象
  70. loadData: parameter => {
  71. this.disabled = true
  72. this.spinning = true
  73. return receivingDetailList(Object.assign(parameter, { receivingBillSn: this.$route.params.sn })).then(res => {
  74. let data
  75. if (res.status == 200) {
  76. data = res.data
  77. const no = (data.pageNo - 1) * data.pageSize
  78. for (var i = 0; i < data.list.length; i++) {
  79. data.list[i].no = no + i + 1
  80. }
  81. this.localDataSource = data.list
  82. this.disabled = false
  83. }
  84. this.spinning = false
  85. return data
  86. })
  87. },
  88. localDataSource: [],
  89. basicInfoData: null, // 基本信息
  90. printerType: 'NEEDLE' // 打印机类型
  91. }
  92. },
  93. computed: {
  94. columns () {
  95. const arr = [
  96. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  97. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  98. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  99. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  100. { title: '采购数量', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  101. { title: '入库数量', dataIndex: 'putQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  102. // { title: '成本价', dataIndex: 'discountedPrice', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  103. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  104. // { title: '入库小计', dataIndex: 'discountedAmount', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  105. { title: '仓库', dataIndex: 'warehouseEntity.name', width: '9%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  106. { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: '9%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  107. ]
  108. if (this.$hasPermissions('M_ShowAllCost')) {
  109. arr.splice(6, 0, { title: '成本价', dataIndex: 'discountedPrice', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  110. arr.splice(8, 0, { title: '入库小计', dataIndex: 'discountedAmount', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  111. }
  112. return arr
  113. }
  114. },
  115. methods: {
  116. // 返回列表
  117. handleBack () {
  118. this.$router.push({ path: '/financialManagement/warehousingAudit/list' })
  119. },
  120. // 打印预览/快捷打印
  121. handlePrint (type, printerType) {
  122. const _this = this
  123. _this.spinning = true
  124. const url = receivingDetailPrint
  125. const params = { sn: this.$route.params.sn, type: printerType }
  126. // 打印或导出
  127. hdPrint(printerType, type, url, params, '入库审核', function () {
  128. _this.spinning = false
  129. })
  130. },
  131. getDetail () {
  132. receivingDetailSn({ sn: this.$route.params.sn }).then(res => {
  133. if (res.status == 200) {
  134. this.basicInfoData = res.data
  135. } else {
  136. this.basicInfoData = null
  137. }
  138. })
  139. }
  140. },
  141. mounted () {
  142. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  143. this.$refs.table.refresh(true)
  144. this.getDetail()
  145. }
  146. },
  147. activated () {
  148. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  149. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  150. this.$refs.table.refresh(true)
  151. this.getDetail()
  152. }
  153. },
  154. beforeRouteEnter (to, from, next) {
  155. next(vm => {})
  156. }
  157. }
  158. </script>
  159. <style lang="less">
  160. .warehousingAuditDetail-cont{
  161. margin-bottom: 10px;
  162. }
  163. </style>