detail.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="chainTransferInDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="chainTransferInDetail-cont" >
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="chainTransferInDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  7. <a-button
  8. v-if="isEdit"
  9. type="primary"
  10. size="small"
  11. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  12. id="chainTransferInDetail-edit-btn"
  13. @click.stop="handleEdit">编辑</a-button>
  14. </template>
  15. <!-- 操作区,位于 title 行的行尾 -->
  16. <template slot="extra">
  17. <a-button key="2" id="chainTransferInDetail-preview-btn">打印预览</a-button>
  18. <a-button key="1" type="primary" id="chainTransferInDetail-print-btn">快速打印</a-button>
  19. </template>
  20. </a-page-header>
  21. <!-- 基础信息 -->
  22. <a-card size="small" :bordered="false" class="chainTransferInDetail-cont">
  23. <a-collapse :activeKey="['1']">
  24. <a-collapse-panel key="1" header="基础信息">
  25. <a-descriptions :column="3">
  26. <a-descriptions-item label="调入单号">{{ (basicInfoData&&basicInfoData.allocationLinkagePutNo) || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="调出对象">{{ (basicInfoData&&basicInfoData.outTenantName) || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="财务状态">{{ (basicInfoData&&basicInfoData.settleStateDictValue) || '--' }}</a-descriptions-item>
  30. </a-descriptions>
  31. </a-collapse-panel>
  32. </a-collapse>
  33. </a-card>
  34. <a-card size="small" :bordered="false" class="chainTransferInDetail-cont">
  35. <!-- 总计 -->
  36. <a-alert type="info" showIcon style="margin-bottom:15px">
  37. <div slot="message">总款数 <strong>{{ (productTotal&&productTotal.productTotalCategory) || 0 }}</strong> ,总数量 <strong>{{ (productTotal&&productTotal.productTotalQty) || 0 }}</strong> ,总成本¥<strong>{{ (productTotal&&productTotal.productTotalCost) || 0 }}</strong></div>
  38. </a-alert>
  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: 1335 }"
  48. bordered>
  49. </s-table>
  50. </a-card>
  51. </div>
  52. </template>
  53. <script>
  54. import { STable, VSelect } from '@/components'
  55. import { getOperationalPrecision } from '@/libs/tools.js'
  56. import { allocLinkagePutDetailList, allocLinkagePutDetailSn, allocLinkagePutDetailCount } from '@/api/allocLinkagePut'
  57. export default {
  58. components: { STable, VSelect },
  59. data () {
  60. return {
  61. // 表头
  62. columns: [
  63. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  64. { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  65. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  66. { title: '原厂编码', dataIndex: 'productOrigCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  67. { title: '成本价(¥)', dataIndex: 'putCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  68. { title: '调入数量', dataIndex: 'putQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  69. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  70. { title: '成本小计(¥)', dataIndex: 'costSubtotal', width: 115, align: 'center' },
  71. { title: '仓库', dataIndex: 'warehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  72. { title: '仓位', dataIndex: 'warehouseLocationName', width: 140, align: 'center', customRender: function (text) { return text || '--' } }
  73. ],
  74. // 加载数据方法 必须为 Promise 对象
  75. loadData: parameter => {
  76. const params = Object.assign(parameter, { allocationLinkagePutSn: this.$route.params.sn })
  77. return allocLinkagePutDetailList(params).then(res => {
  78. const data = res.data
  79. const no = (data.pageNo - 1) * data.pageSize
  80. for (var i = 0; i < data.list.length; i++) {
  81. data.list[i].no = no + i + 1
  82. // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  83. data.list[i].costSubtotal = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
  84. }
  85. this.getDetailCount(params)
  86. return data
  87. })
  88. },
  89. basicInfoData: null, // 基本信息
  90. productTotal: null // 合计
  91. }
  92. },
  93. computed: {
  94. isEdit () {
  95. return (this.basicInfoData && this.basicInfoData.state == 'WAIT_AUDIT')
  96. }
  97. },
  98. methods: {
  99. // 返回列表
  100. handleBack () {
  101. this.$router.push({ path: '/allocationManagement/chainTransferIn/list' })
  102. },
  103. // 基本信息
  104. getDetail () {
  105. allocLinkagePutDetailSn({ sn: this.$route.params.sn }).then(res => {
  106. if (res.status == 200) {
  107. this.basicInfoData = res.data
  108. } else {
  109. this.basicInfoData = null
  110. }
  111. })
  112. },
  113. // 合计
  114. getDetailCount (params) {
  115. allocLinkagePutDetailCount(params).then(res => {
  116. if (res.status == 200) {
  117. this.productTotal = res.data
  118. } else {
  119. this.productTotal = null
  120. }
  121. })
  122. },
  123. // 编辑
  124. handleEdit () {
  125. this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${this.basicInfoData.id}/${this.basicInfoData.allocationLinkagePutSn}` })
  126. }
  127. },
  128. beforeRouteEnter (to, from, next) {
  129. next(vm => {
  130. vm.getDetail()
  131. })
  132. }
  133. }
  134. </script>
  135. <style lang="less">
  136. .chainTransferInDetail-wrap{
  137. .chainTransferInDetail-cont{
  138. margin-bottom: 15px;
  139. }
  140. }
  141. </style>