detail.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <div class="warehouseAllocationDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="warehouseAllocationDetail-back" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }" >
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle" v-if="!outBizSn">
  6. <a id="warehouseAllocationDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. <a-button
  8. v-if="warehouse&&warehouse.stateDictValue!='已完结'&&$hasPermissions('B_warehouseAllocationEdit')"
  9. type="primary"
  10. size="small"
  11. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  12. id="warehouseAllocationEdit-btn"
  13. @click.stop="handleEdit">
  14. 编辑
  15. </a-button>
  16. </template>
  17. </a-page-header>
  18. <!-- 基础信息 -->
  19. <a-card size="small" :bordered="false" class="warehouseAllocationDetail-cont">
  20. <a-collapse :activeKey="['1']">
  21. <a-collapse-panel key="1" header="基础信息">
  22. <a-descriptions :column="3">
  23. <a-descriptions-item label="调出仓库">{{ (warehouse&&warehouse.outWarehouseName) || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="调入仓库">{{ (warehouse&&warehouse.putWarehouseName) || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="调拨单号">{{ (warehouse&&warehouse.allocationWarehouseNo) || '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="关联单号">{{ (warehouse&&warehouse.relevanceNo) || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="单据状态">{{ (warehouse&&warehouse.stateDictValue) || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="备注">{{ (warehouse&&warehouse.remark) || '--' }}</a-descriptions-item>
  29. </a-descriptions>
  30. </a-collapse-panel>
  31. </a-collapse>
  32. </a-card>
  33. <a-card size="small" :bordered="false" class="warehouseAllocationDetail-cont">
  34. <!-- 总计 -->
  35. <a-alert type="info" style="margin-bottom:10px">
  36. <div slot="message">
  37. 总款数: <strong>{{ productTotal&&(productTotal.productTotalCategory || productTotal.productTotalCategory==0) ? productTotal.productTotalCategory : '--' }}</strong> ,
  38. 总数量: <strong>{{ productTotal&&(productTotal.productTotalQty || productTotal.productTotalQty==0) ? productTotal.productTotalQty : '--' }}</strong> ,
  39. 总成本: <strong>{{ productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0) ? '¥'+productTotal.productTotalCost : '--' }}</strong>
  40. </div>
  41. </a-alert>
  42. <!-- 列表 -->
  43. <s-table
  44. class="sTable"
  45. ref="table"
  46. size="small"
  47. :rowKey="(record) => record.id"
  48. :columns="columns"
  49. :data="loadData"
  50. bordered>
  51. <!-- 产品类别 -->
  52. <template slot="productType" slot-scope="text, record">
  53. <a-tooltip placement="top">
  54. <template slot="title">
  55. <span>{{ record.productTypeName }}</span>
  56. </template>
  57. {{ record.productTypeName3 }}
  58. </a-tooltip>
  59. </template>
  60. <!-- 成本小计 -->
  61. <template slot="totalCost" slot-scope="text, record">
  62. <span>{{ (record.allocationCost * record.allocationQty) || 0 }}</span>
  63. </template>
  64. </s-table>
  65. </a-card>
  66. </div>
  67. </template>
  68. <script>
  69. import { STable, VSelect } from '@/components'
  70. import { allocWarehouseDetailSn, allocWarehouseDetailCount, allocWarehouseDetailList } from '@/api/allocWarehouse.js'
  71. export default {
  72. components: { STable, VSelect },
  73. props: {
  74. outBizSn: { // 有值则为弹框,无值则为页面
  75. type: [Number, String],
  76. default: ''
  77. }
  78. },
  79. data () {
  80. return {
  81. exportLoading: false, // 导出loading
  82. warehouse: null, // 基础信息
  83. productTotal: null,
  84. // 表头
  85. columns: [
  86. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  87. { title: '产品编码', dataIndex: 'productCode', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  88. { title: '产品名称', dataIndex: 'productName', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  89. { title: '原厂编码', dataIndex: 'productOrigCode', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  90. { title: '类别', scopedSlots: { customRender: 'productType' }, width: '14%', align: 'center' },
  91. { title: '数量', dataIndex: 'allocationQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  92. { title: '单位', dataIndex: 'productUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  93. { title: '成本小计(¥)', scopedSlots: { customRender: 'totalCost' }, width: '8%', align: 'center' },
  94. { title: '调出仓位', dataIndex: 'outWarehouseLocationName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  95. { title: '调入仓位', dataIndex: 'putWarehouseLocationName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } }
  96. ],
  97. // 加载数据方法 必须为 Promise 对象
  98. loadData: parameter => {
  99. this.disabled = true
  100. return allocWarehouseDetailList(Object.assign(parameter, { allocationWarehouseSn: this.outBizSn || this.$route.params.sn })).then(res => {
  101. const data = res.data
  102. const no = (data.pageNo - 1) * data.pageSize
  103. for (var i = 0; i < data.list.length; i++) {
  104. data.list[i].no = no + i + 1
  105. }
  106. this.getProduceTotal()
  107. this.disabled = false
  108. return data
  109. })
  110. }
  111. }
  112. },
  113. methods: {
  114. // 返回列表
  115. handleBack () {
  116. this.$router.push({ path: '/allocationManagement/warehouseAllocation/list', query: { closeLastOldTab: true } })
  117. },
  118. // 新增/编辑
  119. handleEdit () {
  120. this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${this.warehouse.id}/${this.warehouse.allocationWarehouseSn}` })
  121. },
  122. // 查询基础信息
  123. getHouse () {
  124. allocWarehouseDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
  125. if (res.status == 200) {
  126. this.warehouse = res.data
  127. // this.queryParam.outWarehouseSn = res.data.outWarehouseSn
  128. } else {
  129. this.warehouse = null
  130. }
  131. })
  132. },
  133. // 已选产品总计查询
  134. getProduceTotal () {
  135. allocWarehouseDetailCount({ allocationWarehouseSn: this.outBizSn || this.$route.params.sn }).then(res => {
  136. if (res.status == 200) {
  137. this.productTotal = res.data
  138. } else {
  139. this.productTotal = null
  140. }
  141. })
  142. }
  143. },
  144. mounted () {
  145. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新 或 为弹框时调用
  146. this.$refs.table.refresh(true)
  147. this.getHouse()
  148. }
  149. },
  150. activated () {
  151. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  152. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  153. this.$refs.table.refresh(true)
  154. this.getHouse()
  155. }
  156. },
  157. beforeRouteEnter (to, from, next) {
  158. next(vm => {})
  159. }
  160. }
  161. </script>
  162. <style lang="less">
  163. .warehouseAllocationDetail-cont, .warehouseAllocationDetail-back{
  164. margin-bottom: 10px;
  165. }
  166. </style>