detail.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <div class="chainTransferOutDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="chainTransferOutDetail-cont" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle" v-if="!outBizSn">
  7. <a id="chainTransferOutDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <a class="head-order-number">单号:{{ basicInfoData&&basicInfoData.allocationLinkageOutNo || '--' }}</a>
  9. <a-button
  10. v-if="isEdit&&$hasPermissions('B_allocLinkageOutEdit')"
  11. type="primary"
  12. size="small"
  13. style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
  14. id="chainTransferOutDetail-edit-btn"
  15. @click.stop="handleEdit">编辑</a-button>
  16. </template>
  17. <!-- 操作区,位于 title 行的行尾 -->
  18. <template slot="extra" v-if="outBizSn ? $hasPermissions('B_outboundOrderDetail') : $hasPermissions('B_allocLinkageOutPrint')">
  19. <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
  20. </template>
  21. </a-page-header>
  22. <!-- 基础信息 -->
  23. <a-card size="small" :bordered="false" class="chainTransferOutDetail-cont">
  24. <a-collapse :activeKey="['1']">
  25. <a-collapse-panel key="1" header="基础信息">
  26. <a-descriptions :column="3">
  27. <a-descriptions-item label="调往对象">{{ (basicInfoData&&basicInfoData.putTenantName) || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="调出单号">{{ (basicInfoData&&basicInfoData.allocationLinkageOutNo) || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
  30. <a-descriptions-item label="财务状态">{{ (basicInfoData&&basicInfoData.settleStateDictValue) || '--' }}</a-descriptions-item>
  31. <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remark) || '--' }}</a-descriptions-item>
  32. </a-descriptions>
  33. </a-collapse-panel>
  34. </a-collapse>
  35. </a-card>
  36. <!-- 产品详情 -->
  37. <a-card size="small" :bordered="false" class="chainTransferOutDetail-cont">
  38. <a-collapse :activeKey="['1']">
  39. <a-collapse-panel key="1" header="产品详情">
  40. <!-- 总计 -->
  41. <a-alert type="info" style="margin-bottom:10px">
  42. <div slot="message">
  43. 总款数 <strong>{{ (productTotal&&(productTotal.productTotalCategory || productTotal.productTotalCategory==0)) ? productTotal.productTotalCategory : '--' }}</strong> ,
  44. 总数量 <strong>{{ (productTotal&&(productTotal.productTotalQty || productTotal.productTotalQty==0)) ? productTotal.productTotalQty : '--' }}</strong>
  45. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  46. ,总成本 <strong>{{ (productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0)) ? toThousands(productTotal.productTotalCost,2) : '--' }}</strong>
  47. </div>
  48. </div>
  49. </a-alert>
  50. <!-- 列表 -->
  51. <s-table
  52. class="sTable"
  53. ref="table"
  54. size="small"
  55. :rowKey="(record) => record.id"
  56. :columns="columns"
  57. :data="loadData"
  58. :defaultLoadData="false"
  59. bordered>
  60. </s-table>
  61. </a-collapse-panel>
  62. </a-collapse>
  63. </a-card>
  64. </a-spin>
  65. </div>
  66. </template>
  67. <script>
  68. import { commonMixin } from '@/utils/mixin'
  69. import { STable, VSelect } from '@/components'
  70. import { getOperationalPrecision } from '@/libs/tools.js'
  71. import Print from '@/views/common/print.vue'
  72. import { hdPrint } from '@/libs/JGPrint'
  73. import { allocLinkageOutDetailSn, allocLinkageOutDetailList, allocLinkageOutDetailCount, allocLinkageOutDetailPrint } from '@/api/allocLinkageOut'
  74. export default {
  75. name: 'AllocLinkageOutDetail',
  76. components: { STable, VSelect, Print },
  77. mixins: [commonMixin],
  78. props: {
  79. outBizSn: { // 有值则为弹框,无值则为页面
  80. type: [Number, String],
  81. default: ''
  82. }
  83. },
  84. data () {
  85. return {
  86. spinning: false,
  87. // 加载数据方法 必须为 Promise 对象
  88. loadData: parameter => {
  89. this.disabled = true
  90. const params = Object.assign(parameter, { allocationLinkageOutSn: this.outBizSn || this.$route.params.sn })
  91. return allocLinkageOutDetailList(params).then(res => {
  92. let data
  93. if (res.status == 200) {
  94. data = res.data
  95. this.getDetailCount(params)
  96. const no = (data.pageNo - 1) * data.pageSize
  97. for (var i = 0; i < data.list.length; i++) {
  98. data.list[i].no = no + i + 1
  99. // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  100. data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
  101. }
  102. this.disabled = false
  103. this.localDataSource = data.list
  104. }
  105. return data
  106. })
  107. },
  108. basicInfoData: null, // 基本信息
  109. productTotal: null, // 合计
  110. localDataSource: [] // 原始列表数据
  111. }
  112. },
  113. computed: {
  114. // 是否可编辑
  115. isEdit () {
  116. return ((this.basicInfoData && this.basicInfoData.state == 'WAIT_SUBMIT') || (this.basicInfoData && this.basicInfoData.state == 'WAIT_AUDIT')) && this.$hasPermissions('B_allocLinkageOutEdit')
  117. },
  118. // 列定义
  119. columns () {
  120. const _this = this
  121. const arr = [
  122. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  123. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  124. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  125. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
  126. // { title: '成本价', dataIndex: 'outCost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  127. { title: '调出仓库', dataIndex: 'warehouseName', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '调出数量', dataIndex: 'outQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  129. // { title: '成本小计(¥)', dataIndex: 'costSubtotal', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  130. ]
  131. if (this.$hasPermissions('M_ShowAllCost')) {
  132. arr.splice(4, 0, { title: '成本价', dataIndex: 'outCost', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  133. arr.splice(7, 0, { title: '成本小计(¥)', dataIndex: 'costSubtotal', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  134. }
  135. return arr
  136. }
  137. },
  138. methods: {
  139. // 返回列表
  140. handleBack () {
  141. this.$router.push({ path: '/allocationManagement/chainTransferOut/list' })
  142. },
  143. // 基本信息
  144. getDetail () {
  145. allocLinkageOutDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
  146. if (res.status == 200) {
  147. this.basicInfoData = res.data
  148. } else {
  149. this.basicInfoData = null
  150. }
  151. })
  152. },
  153. // 合计
  154. getDetailCount (params) {
  155. allocLinkageOutDetailCount(params).then(res => {
  156. if (res.status == 200) {
  157. this.productTotal = res.data
  158. } else {
  159. this.productTotal = null
  160. }
  161. })
  162. },
  163. // 编辑
  164. handleEdit () {
  165. this.$router.push({ name: 'chainTransferOutEdit', params: { id: this.basicInfoData.id, sn: this.basicInfoData.allocationLinkageOutSn } })
  166. },
  167. // 打印预览/快捷打印
  168. handlePrint (type, printerType) {
  169. const _this = this
  170. _this.spinning = true
  171. const url = allocLinkageOutDetailPrint
  172. const params = { sn: this.outBizSn || this.$route.params.sn, type: printerType, showFlag: this.$hasPermissions('M_ShowAllCost') ? 1 : 0 }
  173. // 打印或导出
  174. hdPrint(printerType, type, url, params, '连锁调出单', function () {
  175. _this.spinning = false
  176. })
  177. }
  178. },
  179. mounted () {
  180. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新 或 为弹框时调用
  181. this.getDetail()
  182. this.$refs.table.refresh(true)
  183. }
  184. },
  185. activated () {
  186. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  187. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  188. this.getDetail()
  189. this.$refs.table.refresh(true)
  190. }
  191. },
  192. beforeRouteEnter (to, from, next) {
  193. next(vm => {})
  194. }
  195. }
  196. </script>
  197. <style lang="less">
  198. .chainTransferOutDetail-cont{
  199. margin-bottom: 10px;
  200. }
  201. </style>