detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="bulkWarehousingOrderDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="bulkWarehousingOrderDetail-cont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="bulkWarehousingOrderDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <a-button
  9. v-if="isEdit"
  10. type="primary"
  11. size="small"
  12. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  13. id="bulkWarehousingOrderDetail-edit-btn"
  14. @click.stop="handleEdit">编辑</a-button>
  15. <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.sparePartsPurchaseNo) || '--' }}</p>
  16. </template>
  17. <template slot="tags">
  18. <a-tag color="red" v-if="basicInfoData&&basicInfoData.stateDictValue">{{ basicInfoData.stateDictValue }}</a-tag>
  19. <a-tag color="orange" v-if="basicInfoData&&basicInfoData.settleStateDictValue">{{ basicInfoData.settleStateDictValue }}</a-tag>
  20. </template>
  21. <!-- 操作区,位于 title 行的行尾 -->
  22. <template slot="extra" v-if="$hasPermissions('B_bulkWarehousingOrder_print')">
  23. <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
  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. <div v-if="basicInfoData&&(basicInfoData.supplierProvinceName || basicInfoData.supplierCityName || basicInfoData.supplierCountyName || basicInfoData.supplierAddress)">
  40. {{ (basicInfoData&&basicInfoData.supplierProvinceName) || '' }}
  41. {{ (basicInfoData&&basicInfoData.supplierCityName) || '' }}
  42. {{ (basicInfoData&&basicInfoData.supplierCountyName) || '' }}
  43. {{ (basicInfoData&&basicInfoData.supplierAddress) || '' }}
  44. </div>
  45. <span v-else>--</span>
  46. </a-descriptions-item>
  47. </a-descriptions>
  48. </a-collapse-panel>
  49. </a-collapse>
  50. </a-card>
  51. <!-- 产品详情 -->
  52. <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  53. <a-collapse :activeKey="['1']">
  54. <a-collapse-panel key="1" header="产品详情">
  55. <!-- 总计 -->
  56. <a-alert type="info" style="margin-bottom:10px">
  57. <div slot="message">
  58. 总款数 <strong>{{ (productTotal&&(productTotal.productTotalCategory || productTotal.productTotalCategory==0)) ? productTotal.productTotalCategory : '--' }}</strong> ,
  59. 总数量 <strong>{{ (productTotal&&(productTotal.productTotalQty || productTotal.productTotalQty==0)) ? productTotal.productTotalQty : '--' }}</strong> ,
  60. 总成本 <strong>{{ (productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0)) ? '¥'+productTotal.productTotalCost : '--' }}</strong>
  61. </div>
  62. </a-alert>
  63. <!-- 列表 -->
  64. <s-table
  65. class="sTable"
  66. ref="table"
  67. size="small"
  68. :rowKey="(record) => record.id"
  69. :columns="columns"
  70. :data="loadData"
  71. :defaultLoadData="false"
  72. bordered>
  73. </s-table>
  74. </a-collapse-panel>
  75. </a-collapse>
  76. </a-card>
  77. <!-- 单据记录 二期 -->
  78. <!-- <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
  79. <a-collapse :activeKey="['1']">
  80. <a-collapse-panel key="1" header="单据记录">
  81. <a-timeline class="timeline-box">
  82. <a-timeline-item>2021-02-01 15:22:38 王凯 审核通过</a-timeline-item>
  83. <a-timeline-item>
  84. <p>2021-02-01 15:22:38 王凯 审核通过</p>
  85. <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
  86. <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
  87. </a-timeline-item>
  88. <a-timeline-item>Technical testing 2015-09-01</a-timeline-item>
  89. <a-timeline-item>Network problems being solved 2015-09-01</a-timeline-item>
  90. </a-timeline>
  91. </a-collapse-panel>
  92. </a-collapse>
  93. </a-card> -->
  94. </a-spin>
  95. </div>
  96. </template>
  97. <script>
  98. import { commonMixin } from '@/utils/mixin'
  99. import { STable, VSelect } from '@/components'
  100. import { getOperationalPrecision } from '@/libs/tools.js'
  101. import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount, sparePartsPurDetailPrint } from '@/api/sparePartsPur'
  102. import Print from '@/views/common/print.vue'
  103. import { hdPrint } from '@/libs/JGPrint'
  104. export default {
  105. name: 'BulkWarehousingDetail',
  106. components: { STable, VSelect, Print },
  107. mixins: [commonMixin],
  108. data () {
  109. return {
  110. spinning: false,
  111. // 表头
  112. columns: [
  113. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  114. { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  115. { title: '产品名称', dataIndex: 'productName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  116. { title: '采购单价', dataIndex: 'putCost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  117. { title: '采购数量', dataIndex: 'putQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  118. { title: '单位', dataIndex: 'productUnit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  119. { title: '采购金额', dataIndex: 'purchaseAmount', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  120. { title: '仓库', dataIndex: 'warehouseName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  121. { title: '仓位', dataIndex: 'warehouseLocationName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
  122. ],
  123. // 加载数据方法 必须为 Promise 对象
  124. loadData: parameter => {
  125. this.disabled = true
  126. this.spinning = true
  127. return sparePartsPurDetailList(Object.assign(parameter, { sparePartsPurchaseSn: this.$route.params.sn })).then(res => {
  128. let data
  129. if (res.status == 200) {
  130. data = res.data
  131. const no = (data.pageNo - 1) * data.pageSize
  132. for (var i = 0; i < data.list.length; i++) {
  133. data.list[i].no = no + i + 1
  134. // 采购金额 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  135. data.list[i].purchaseAmount = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
  136. }
  137. this.localDataSource = data.list
  138. this.disabled = false
  139. }
  140. this.spinning = false
  141. return data
  142. })
  143. },
  144. localDataSource: [],
  145. basicInfoData: null, // 基本信息
  146. productTotal: null // 合计
  147. }
  148. },
  149. computed: {
  150. isEdit () {
  151. return this.basicInfoData && this.basicInfoData.state != 'FINISH' && this.$hasPermissions('B_bulkWarehousingOrder_edit')
  152. }
  153. },
  154. methods: {
  155. // 返回列表
  156. handleBack () {
  157. this.$router.push({ path: '/bulkManagement/bulkWarehousingOrder/list' })
  158. },
  159. // 打印预览/快捷打印
  160. handlePrint (type, printerType) {
  161. const _this = this
  162. _this.spinning = true
  163. const url = sparePartsPurDetailPrint
  164. const params = { sn: this.$route.params.sn, type: printerType }
  165. // 打印或导出
  166. hdPrint(printerType, type, url, params, '散件入库单', function () {
  167. _this.spinning = false
  168. })
  169. },
  170. // 基本信息
  171. getDetail () {
  172. sparePartsPurDetail({ id: this.$route.params.id }).then(res => {
  173. if (res.status == 200) {
  174. this.basicInfoData = res.data
  175. } else {
  176. this.basicInfoData = null
  177. }
  178. })
  179. },
  180. // 合计
  181. getDetailCount () {
  182. sparePartsPurDetailCount({ sparePartsPurchaseSn: this.$route.params.sn }).then(res => {
  183. if (res.status == 200) {
  184. this.productTotal = res.data
  185. } else {
  186. this.productTotal = null
  187. }
  188. })
  189. },
  190. // 编辑
  191. handleEdit () {
  192. this.$router.push({ path: `/bulkManagement/bulkWarehousingOrder/edit/${this.basicInfoData.id}/${this.basicInfoData.sparePartsPurchaseSn}/${this.basicInfoData.supplierSn}` })
  193. }
  194. },
  195. mounted () {
  196. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  197. this.$refs.table.refresh(true)
  198. this.getDetail()
  199. this.getDetailCount()
  200. }
  201. },
  202. activated () {
  203. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  204. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  205. this.$refs.table.refresh(true)
  206. this.getDetail()
  207. this.getDetailCount()
  208. }
  209. },
  210. beforeRouteEnter (to, from, next) {
  211. next(vm => {})
  212. }
  213. }
  214. </script>
  215. <style lang="less">
  216. .bulkWarehousingOrderDetail-cont{
  217. margin-bottom: 10px;
  218. .timeline-box{
  219. margin-top: 30px;
  220. .auxiliary-txt{
  221. color: #808695;
  222. }
  223. }
  224. }
  225. </style>