detail.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <div class="chainTransferInDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="chainTransferInDetail-cont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="chainTransferInDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <a-button
  9. v-if="isEdit&&$hasPermissions('B_allocLinkagePutEdit')"
  10. type="primary"
  11. size="small"
  12. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  13. id="chainTransferInDetail-edit-btn"
  14. @click.stop="handleEdit">编辑</a-button>
  15. </template>
  16. <!-- 操作区,位于 title 行的行尾 -->
  17. <template slot="extra" v-if="$hasPermissions('B_allocLinkagePutPrint')">
  18. <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
  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" 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. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  41. ,总成本 <strong>{{ (productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0)) ? '¥'+productTotal.productTotalCost : '--' }}</strong>
  42. </div>
  43. </div>
  44. </a-alert>
  45. <!-- 列表 -->
  46. <s-table
  47. class="sTable"
  48. ref="table"
  49. size="small"
  50. :rowKey="(record) => record.id"
  51. :columns="columns"
  52. :data="loadData"
  53. :defaultLoadData="false"
  54. bordered>
  55. </s-table>
  56. </a-card>
  57. </a-spin>
  58. </div>
  59. </template>
  60. <script>
  61. import { commonMixin } from '@/utils/mixin'
  62. import { STable, VSelect } from '@/components'
  63. import { getOperationalPrecision } from '@/libs/tools.js'
  64. import { allocLinkagePutDetailList, allocLinkagePutDetailSn, allocLinkagePutDetailCount, allocLinkagePutDetailPrint } from '@/api/allocLinkagePut'
  65. import Print from '@/views/common/print.vue'
  66. import { hdPrint } from '@/libs/JGPrint'
  67. export default {
  68. name: 'AllocLinkagePutDetail',
  69. components: { STable, VSelect, Print },
  70. mixins: [commonMixin],
  71. data () {
  72. return {
  73. spinning: false,
  74. // 加载数据方法 必须为 Promise 对象
  75. loadData: parameter => {
  76. const params = Object.assign(parameter, { allocationLinkagePutSn: this.$route.params.sn })
  77. this.spinning = true
  78. return allocLinkagePutDetailList(params).then(res => {
  79. let data
  80. if (res.status == 200) {
  81. data = res.data
  82. this.getDetailCount(params)
  83. const no = (data.pageNo - 1) * data.pageSize
  84. for (var i = 0; i < data.list.length; i++) {
  85. data.list[i].no = no + i + 1
  86. // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  87. data.list[i].costSubtotal = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
  88. }
  89. this.localDataSource = data.list
  90. }
  91. this.spinning = false
  92. return data
  93. })
  94. },
  95. basicInfoData: null, // 基本信息
  96. productTotal: null, // 合计
  97. localDataSource: []
  98. }
  99. },
  100. computed: {
  101. isEdit () {
  102. return (this.basicInfoData && this.basicInfoData.state == 'WAIT_AUDIT' && this.$hasPermissions('B_allocLinkagePutEdit'))
  103. },
  104. columns () {
  105. const arr = [
  106. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  107. { title: '产品编码', dataIndex: 'productCode', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  108. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '18%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  109. { title: '原厂编码', dataIndex: 'productOrigCode', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  110. // { title: '成本价(¥)', dataIndex: 'putCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  111. { title: '调入数量', dataIndex: 'putQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  112. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  113. // { title: '成本小计(¥)', dataIndex: 'costSubtotal', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  114. { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  115. { title: '仓位', dataIndex: 'warehouseLocationName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
  116. ]
  117. if (this.$hasPermissions('M_ShowAllCost')) {
  118. arr.splice(4, 0, { title: '成本价', dataIndex: 'putCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  119. arr.splice(7, 0, { title: '成本小计', dataIndex: 'costSubtotal', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  120. }
  121. return arr
  122. }
  123. },
  124. methods: {
  125. // 返回列表
  126. handleBack () {
  127. this.$router.push({ path: '/allocationManagement/chainTransferIn/list' })
  128. },
  129. // 基本信息
  130. getDetail () {
  131. allocLinkagePutDetailSn({ sn: this.$route.params.sn }).then(res => {
  132. if (res.status == 200) {
  133. this.basicInfoData = res.data
  134. } else {
  135. this.basicInfoData = null
  136. }
  137. })
  138. },
  139. // 合计
  140. getDetailCount (params) {
  141. allocLinkagePutDetailCount(params).then(res => {
  142. if (res.status == 200) {
  143. this.productTotal = res.data
  144. } else {
  145. this.productTotal = null
  146. }
  147. })
  148. },
  149. // 编辑
  150. handleEdit () {
  151. this.$router.push({ path: `/allocationManagement/chainTransferIn/edit/${this.basicInfoData.id}/${this.basicInfoData.allocationLinkagePutSn}` })
  152. },
  153. // 打印预览/快捷打印
  154. handlePrint (type, printerType) {
  155. const _this = this
  156. _this.spinning = true
  157. const url = allocLinkagePutDetailPrint
  158. const params = { sn: this.$route.params.sn, type: printerType, showFlag: this.$hasPermissions('M_ShowAllCost') ? 1 : 0 }
  159. // 打印或导出
  160. hdPrint(printerType, type, url, params, '连锁调入单', function () {
  161. _this.spinning = false
  162. })
  163. }
  164. },
  165. mounted () {
  166. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  167. this.$refs.table.refresh(true)
  168. this.getDetail()
  169. }
  170. },
  171. activated () {
  172. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  173. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  174. this.$refs.table.refresh(true)
  175. this.getDetail()
  176. }
  177. },
  178. beforeRouteEnter (to, from, next) {
  179. next(vm => {})
  180. }
  181. }
  182. </script>
  183. <style lang="less">
  184. .chainTransferInDetail-wrap{
  185. .chainTransferInDetail-cont{
  186. margin-bottom: 10px;
  187. }
  188. }
  189. </style>