detailModal.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <a-modal
  3. centered
  4. class="confirmationDetail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="采购退货详情"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. :width="960">
  11. <div>
  12. <a-descriptions size="small" :column="3" style="margin-bottom: 10px;">
  13. <a-descriptions-item label="采购退货单号">{{ detailsData&&detailsData.sparePartsReturnNo || '--' }}</a-descriptions-item>
  14. <a-descriptions-item label="供应商名称">{{ detailsData&&detailsData.supplier&&detailsData.supplier.supplierName || '--' }}</a-descriptions-item>
  15. <a-descriptions-item label="退货原因">{{ detailsData&&detailsData.returnReasonDictValue || '--' }}</a-descriptions-item>
  16. <a-descriptions-item label="创建时间">{{ detailsData&&detailsData.createDate || '--' }}</a-descriptions-item>
  17. <a-descriptions-item label="出库时间">{{ detailsData&&detailsData.updateDate || '--' }}</a-descriptions-item>
  18. <a-descriptions-item label="业务状态">{{ detailsData&&detailsData.stateDictValue || '--' }}</a-descriptions-item>
  19. <a-descriptions-item label="补充说明" :span="3">{{ detailsData&&detailsData.explainInfo || '--' }}</a-descriptions-item>
  20. <a-descriptions-item label="附件" :span="3">
  21. <span v-if="detailsData&&detailsData.attachmentList&&detailsData.attachmentList.length>0">
  22. <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailsData.attachmentList" :key="item.id">
  23. {{ item.fileName }}
  24. </a>
  25. </span>
  26. <span v-else>--</span>
  27. </a-descriptions-item>
  28. </a-descriptions>
  29. <a-alert type="info" style="margin-bottom:10px">
  30. <div slot="message">
  31. <span>产品款数:<strong>{{ statisticsObj&&statisticsObj.totalCategory|| '--' }}</strong>;</span>
  32. <span>申请退货总数量:<strong>{{ statisticsObj&&statisticsObj.qty||'--' }}</strong>;</span>
  33. <span>退货金额:<strong>{{ statisticsObj&&statisticsObj.totalCost || '--' }}</strong></span>
  34. </div>
  35. </a-alert>
  36. <s-table
  37. class="sTable"
  38. ref="tableDetail"
  39. size="small"
  40. :rowKey="(record) => record.id"
  41. :columns="columns"
  42. :data="loadData"
  43. :defaultLoadData="true"
  44. bordered>
  45. </s-table>
  46. <div class="btn-cont"><a-button id="confirmationDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
  47. </div>
  48. </a-modal>
  49. </template>
  50. <script>
  51. import { STable } from '@/components'
  52. import { sparePartsReturnQueryPage, queryPageCount, sparePartsReturnInfo } from '@/api/sparePartsReturn'
  53. import { toFixedDecimal } from '@/libs/tools.js'
  54. export default {
  55. name: 'ConfirmationDetailModal',
  56. components: { STable },
  57. props: {
  58. openModal: { // 弹框显示状态
  59. type: Boolean,
  60. default: false
  61. },
  62. itemSn: {
  63. type: [Number, String],
  64. default: ''
  65. },
  66. nowData: {
  67. type: Object,
  68. default: () => {
  69. return {}
  70. }
  71. }
  72. },
  73. data () {
  74. return {
  75. isShow: this.openModal, // 是否打开弹框
  76. detailsData: null, // 详情数据
  77. statisticsObj: null, // 统计金额数据
  78. // 加载数据方法 必须为 Promise 对象
  79. loadData: parameter => {
  80. return sparePartsReturnQueryPage(Object.assign(parameter, { sparePartsReturnSn: this.itemSn })).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.disabled = false
  89. }
  90. return data
  91. })
  92. },
  93. columns: [
  94. { title: '序号', dataIndex: 'no', width: '7%', align: 'center' },
  95. { title: '入库单号', dataIndex: 'sparePartsNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  96. { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  97. { title: '产品名称', dataIndex: 'product.name', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  98. { title: '单位', dataIndex: 'product.unit', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  99. { title: '批次号', dataIndex: 'stockBatchNo', width: '20%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  100. { title: '入库数量', dataIndex: 'putQty', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  101. { title: '退货单价', dataIndex: 'cost', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  102. { title: '申请退货数量', dataIndex: 'qty', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  103. { title: '退货金额', dataIndex: 'totalCost', width: '14%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  104. ]
  105. }
  106. },
  107. methods: {
  108. getBasicsInfo () {
  109. sparePartsReturnInfo({ sn: this.itemSn }).then(res => {
  110. if (res.status == 200) {
  111. this.detailsData = res.data
  112. } else {
  113. this.detailsData = null
  114. }
  115. })
  116. },
  117. // 获取金额统计
  118. getStatisticsData () {
  119. queryPageCount({ sparePartsReturnSn: this.itemSn }).then(res => {
  120. if (res.status == 200) {
  121. if (res.data) {
  122. res.data.totalCost = (res.data && (res.data.totalCost || res.data.totalCost == 0)) ? toFixedDecimal(res.data.totalCost, 2) : '--'
  123. this.statisticsObj = res.data
  124. } else {
  125. this.statisticsObj = null
  126. }
  127. } else {
  128. this.statisticsObj = null
  129. }
  130. })
  131. }
  132. },
  133. watch: {
  134. // 父页面传过来的弹框状态
  135. openModal (newValue, oldValue) {
  136. this.isShow = newValue
  137. },
  138. // 重定义的弹框状态
  139. isShow (newValue, oldValue) {
  140. if (!newValue) {
  141. this.$emit('close')
  142. this.$refs.tableDetail.clearTable()
  143. } else {
  144. this.getStatisticsData()
  145. this.getBasicsInfo()
  146. }
  147. },
  148. itemSn (newValue, oldValue) {
  149. if (this.isShow && newValue) {
  150. const _this = this
  151. setTimeout(() => {
  152. _this.$refs.tableDetail.refresh(true)
  153. }, 200)
  154. }
  155. }
  156. }
  157. }
  158. </script>
  159. <style lang="less">
  160. .confirmationDetail-modal{
  161. .ant-modal-body {
  162. padding: 40px 40px 24px;
  163. }
  164. .btn-cont {
  165. text-align: center;
  166. margin-top:24px;
  167. }
  168. }
  169. .auditProgress{
  170. margin-top:24px;
  171. }
  172. .ant-divider-horizontal{
  173. margin:20px 0 4px;
  174. }
  175. .tip{
  176. line-height: 30px;
  177. }
  178. </style>