detail.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div class="allocateBillDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="allocateBillDetail-back" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle" v-if="!outBizSn">
  7. <a id="allocateBillDetail-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="allocateBillDetail-edit-btn"
  14. @click.stop="handleEdit">编辑</a-button>
  15. </template>
  16. <!-- 操作区,位于 title 行的行尾 -->
  17. <template slot="extra" v-if="!outBizSn">
  18. <print :params="{allocateReturnSn: $route.params.sn || outBizSn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
  19. </template>
  20. </a-page-header>
  21. <a-card size="small" :bordered="false" class="allocateBillDetail-cont">
  22. <a-collapse :activeKey="['1']">
  23. <a-collapse-panel key="1" header="基础信息">
  24. <a-descriptions :column="3">
  25. <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.targetTypeDictValue) || '--' }}</a-descriptions-item>
  26. <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
  27. <a-descriptions-item label="调拨退货类型">{{ (basicInfoData&&basicInfoData.allocateReturnTypeName) || '--' }}</a-descriptions-item>
  28. <a-descriptions-item label="是否抓单">{{ basicInfoData&&basicInfoData.grabFlagDictValue || '--' }}</a-descriptions-item>
  29. <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
  30. </a-descriptions>
  31. </a-collapse-panel>
  32. </a-collapse>
  33. </a-card>
  34. <a-card size="small" :bordered="false" class="allocateBillDetail-cont">
  35. <!-- 总计 -->
  36. <a-alert type="info" style="margin-bottom:10px">
  37. <div slot="message">
  38. 退货总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0)) ? basicInfoData.totalQty : '--' }}</strong> ,
  39. 坏件总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalBadQty || basicInfoData.totalBadQty==0)) ? basicInfoData.totalBadQty : '--' }}</strong> ,
  40. 返库总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalBackStockQty || basicInfoData.totalBackStockQty==0)) ? basicInfoData.totalBackStockQty : '--' }}</strong> ,
  41. <span>退货总金额(¥):<strong>{{ (basicInfoData&&(basicInfoData.totalPrice || basicInfoData.totalPrice==0)) ? basicInfoData.totalPrice : '--' }}</strong></span>;
  42. </div>
  43. </a-alert>
  44. <!-- 列表 -->
  45. <s-table
  46. class="sTable"
  47. ref="table"
  48. size="small"
  49. :rowKey="(record) => record.id"
  50. :columns="columns"
  51. :data="loadData"
  52. :defaultLoadData="false"
  53. bordered>
  54. </s-table>
  55. </a-card>
  56. </a-spin>
  57. </div>
  58. </template>
  59. <script>
  60. import { commonMixin } from '@/utils/mixin'
  61. import { STable, VSelect } from '@/components'
  62. import print from './print.vue'
  63. import { allocReturnDetailQueryPage, allocateReturnQueryBySn } from '@/api/allocateReturn'
  64. export default {
  65. name: 'TransferReturnDetail',
  66. mixins: [commonMixin],
  67. components: { STable, VSelect, print },
  68. props: {
  69. outBizSn: { // 有值则为弹框,无值则为页面
  70. type: [Number, String],
  71. default: ''
  72. }
  73. },
  74. data () {
  75. return {
  76. spinning: false,
  77. // 加载数据方法 必须为 Promise 对象
  78. loadData: parameter => {
  79. this.spinning = true
  80. return allocReturnDetailQueryPage(Object.assign(parameter, { allocateReturnSn: this.outBizSn || this.$route.params.sn })).then(res => {
  81. let data
  82. if (res.status == 200) {
  83. data = res.data
  84. const no = (data.pageNo - 1) * data.pageSize
  85. for (var i = 0; i < data.list.length; i++) {
  86. data.list[i].no = no + i + 1
  87. }
  88. this.localDataSource = data.list
  89. }
  90. this.spinning = false
  91. return data
  92. })
  93. },
  94. basicInfoData: null, // 基本信息
  95. localDataSource: [],
  96. openModal: false,
  97. nowType: null
  98. }
  99. },
  100. computed: {
  101. isEdit () {
  102. return this.basicInfoData && ((this.basicInfoData.state == 'WAIT_SUBMIT') || (this.basicInfoData.state == 'FINANCIAL_REJECT') || (this.basicInfoData.state == 'AUDIT_REJECT')) && this.$hasPermissions('M_transferOut_edit')
  103. },
  104. columns () {
  105. const arr = [
  106. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  107. { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  108. { title: '产品名称', dataIndex: 'product.name', width: '27%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  109. { title: '单位', dataIndex: 'product.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  110. { title: '退货单价(¥)', dataIndex: 'price', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  111. { title: '退货数量', dataIndex: 'returnQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  112. { title: '坏件数量', dataIndex: 'badQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  113. { title: '返库数量', dataIndex: 'backStockQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  114. { title: '退货金额(¥)', dataIndex: 'totalReturnPrice', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  115. ]
  116. if (this.basicInfoData && this.basicInfoData.grabFlag == '1') {
  117. arr.splice(1, 0, { title: '调拨单号', dataIndex: 'allocateReturnNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } })
  118. }
  119. return arr
  120. }
  121. },
  122. methods: {
  123. // 返回列表
  124. handleBack () {
  125. this.$router.push({ name: 'transferReturnList', query: { closeLastOldTab: true } })
  126. },
  127. // 基本信息
  128. getDetail () {
  129. allocateReturnQueryBySn({ allocateReturnSn: this.outBizSn || this.$route.params.sn }).then(res => {
  130. if (res.status == 200) {
  131. this.basicInfoData = res.data
  132. } else {
  133. this.basicInfoData = null
  134. }
  135. })
  136. },
  137. // 编辑
  138. handleEdit (row) {
  139. this.$router.push({ name: row.grapFlag == 1 ? 'transferReturnGrpEdit' : 'transferReturnEdit', params: { sn: row.allocateReturnSn, targetType: row.targetType } })
  140. },
  141. pageInit () {
  142. this.$refs.table.refresh(true)
  143. this.getDetail()
  144. }
  145. },
  146. mounted () {
  147. if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新 或 为弹框时调用
  148. this.pageInit()
  149. }
  150. },
  151. activated () {
  152. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  153. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  154. this.pageInit()
  155. }
  156. },
  157. beforeRouteEnter (to, from, next) {
  158. next(vm => {})
  159. }
  160. }
  161. </script>
  162. <style lang="less">
  163. .allocateBillDetail-wrap{
  164. .allocateBillDetail-back{
  165. margin-bottom: 10px;
  166. }
  167. .allocateBillDetail-cont{
  168. margin-bottom: 10px;
  169. }
  170. }
  171. </style>