detail.vue 9.2 KB

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