detail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="bulkWarehousingOrderDetail-wrap">
  3. <a-page-header :ghost="false" :backIcon="false" class="bulkWarehousingOrderDetail-cont" >
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="bulkWarehousingOrderDetail-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="bulkWarehousingOrderDetail-edit-btn"
  13. @click.stop="handleEdit">编辑</a-button>
  14. <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.sparePartsPurchaseNo) || '' }}</p>
  15. </template>
  16. <template slot="tags">
  17. <a-tag color="red" v-if="basicInfoData&&basicInfoData.stateDictValue">{{ basicInfoData.stateDictValue }}</a-tag>
  18. <a-tag color="orange" v-if="basicInfoData&&basicInfoData.settleStateDictValue">{{ basicInfoData.settleStateDictValue }}</a-tag>
  19. </template>
  20. <!-- 操作区,位于 title 行的行尾 -->
  21. <template slot="extra">
  22. <a-button key="2" id="bulkWarehousingOrderDetail-preview-btn">打印预览</a-button>
  23. <a-button key="1" type="primary" id="bulkWarehousingOrderDetail-print-btn">快速打印</a-button>
  24. </template>
  25. </a-page-header>
  26. <!-- 基础信息 -->
  27. <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  28. <a-collapse :activeKey="['1']">
  29. <a-collapse-panel key="1" header="基础信息">
  30. <a-descriptions :column="3">
  31. <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
  32. <a-descriptions-item label="散件入库类型">{{ (basicInfoData&&basicInfoData.sparePartsTypeName) || '--' }}</a-descriptions-item>
  33. <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="联系人">
  35. {{ (basicInfoData&&basicInfoData.supplierContactPerson) || '--' }}
  36. <span v-if="basicInfoData&&basicInfoData.supplierContactTel">({{ basicInfoData.supplierContactTel }})</span>
  37. </a-descriptions-item>
  38. <a-descriptions-item label="联系地址">
  39. {{ (basicInfoData&&basicInfoData.supplierProvinceName) || '' }}
  40. {{ (basicInfoData&&basicInfoData.supplierCityName) || '' }}
  41. {{ (basicInfoData&&basicInfoData.supplierCountyName) || '' }}
  42. {{ (basicInfoData&&basicInfoData.supplierAddress) || '' }}
  43. </a-descriptions-item>
  44. </a-descriptions>
  45. </a-collapse-panel>
  46. </a-collapse>
  47. </a-card>
  48. <!-- 产品详情 -->
  49. <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  50. <a-collapse :activeKey="['1']">
  51. <a-collapse-panel key="1" header="产品详情">
  52. <!-- 总计 -->
  53. <a-alert type="info" showIcon style="margin-bottom:15px">
  54. <div slot="message">总款数 <strong>{{ (productTotal&&productTotal.productTotalCategory) || 0 }}</strong> ,总数量 <strong>{{ (productTotal&&productTotal.productTotalQty) || 0 }}</strong> ,总成本¥<strong>{{ (productTotal&&productTotal.productTotalCost) || 0 }}</strong></div>
  55. </a-alert>
  56. <!-- 列表 -->
  57. <s-table
  58. class="sTable"
  59. ref="table"
  60. size="small"
  61. :rowKey="(record) => record.id"
  62. :columns="columns"
  63. :data="loadData"
  64. :scroll="{ x: 1280 }"
  65. bordered>
  66. </s-table>
  67. </a-collapse-panel>
  68. </a-collapse>
  69. </a-card>
  70. <!-- 单据记录 -->
  71. <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  72. <a-collapse :activeKey="['1']">
  73. <a-collapse-panel key="1" header="单据记录">
  74. <a-timeline class="timeline-box">
  75. <a-timeline-item>2021-02-01 15:22:38 王凯 审核通过</a-timeline-item>
  76. <a-timeline-item>
  77. <p>2021-02-01 15:22:38 王凯 审核通过</p>
  78. <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
  79. <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
  80. </a-timeline-item>
  81. <a-timeline-item>Technical testing 2015-09-01</a-timeline-item>
  82. <a-timeline-item>Network problems being solved 2015-09-01</a-timeline-item>
  83. </a-timeline>
  84. </a-collapse-panel>
  85. </a-collapse>
  86. </a-card>
  87. </div>
  88. </template>
  89. <script>
  90. import { STable, VSelect } from '@/components'
  91. import { getOperationalPrecision } from '@/libs/tools.js'
  92. import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount } from '@/api/sparePartsPur'
  93. export default {
  94. components: { STable, VSelect },
  95. data () {
  96. return {
  97. // 表头
  98. columns: [
  99. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  100. { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  101. { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
  102. { title: '采购单价', dataIndex: 'putCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  103. { title: '采购数量', dataIndex: 'putQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  104. { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  105. { title: '采购金额', dataIndex: 'purchaseAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  106. { title: '仓库', dataIndex: 'warehouseName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  107. { title: '仓位', dataIndex: 'warehouseLocationName', width: 200, align: 'center', customRender: function (text) { return text || '--' } }
  108. ],
  109. // 加载数据方法 必须为 Promise 对象
  110. loadData: parameter => {
  111. this.disabled = true
  112. return sparePartsPurDetailList(Object.assign(parameter, { sparePartsPurchaseSn: this.$route.params.sn })).then(res => {
  113. const data = res.data
  114. const no = (data.pageNo - 1) * data.pageSize
  115. for (var i = 0; i < data.list.length; i++) {
  116. data.list[i].no = no + i + 1
  117. // 采购金额 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  118. data.list[i].purchaseAmount = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
  119. }
  120. this.disabled = false
  121. return data
  122. })
  123. },
  124. basicInfoData: null, // 基本信息
  125. productTotal: null // 合计
  126. }
  127. },
  128. computed: {
  129. isEdit () {
  130. return this.basicInfoData && this.basicInfoData.state != 'FINISH'
  131. }
  132. },
  133. methods: {
  134. // 返回列表
  135. handleBack () {
  136. this.$router.push({ path: '/bulkManagement/bulkWarehousingOrder/list' })
  137. },
  138. // 基本信息
  139. getDetail () {
  140. sparePartsPurDetail({ id: this.$route.params.id }).then(res => {
  141. if (res.status == 200) {
  142. this.basicInfoData = res.data
  143. } else {
  144. this.basicInfoData = null
  145. }
  146. })
  147. },
  148. // 合计
  149. getDetailCount () {
  150. sparePartsPurDetailCount({ sparePartsPurchaseSn: this.$route.params.sn }).then(res => {
  151. if (res.status == 200) {
  152. this.productTotal = res.data
  153. } else {
  154. this.productTotal = null
  155. }
  156. })
  157. },
  158. // 编辑
  159. handleEdit () {
  160. this.$router.push({ path: `/bulkManagement/bulkWarehousingOrder/edit/${this.basicInfoData.id}/${this.basicInfoData.sparePartsPurchaseSn}` })
  161. }
  162. },
  163. beforeRouteEnter (to, from, next) {
  164. next(vm => {
  165. vm.getDetail()
  166. vm.getDetailCount()
  167. })
  168. }
  169. }
  170. </script>
  171. <style lang="less">
  172. .bulkWarehousingOrderDetail-cont{
  173. margin-bottom: 15px;
  174. .timeline-box{
  175. margin-top: 30px;
  176. .auxiliary-txt{
  177. color: #808695;
  178. }
  179. }
  180. }
  181. </style>