detail.vue 7.8 KB

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