detailModal.vue 7.3 KB

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