slodOutModal.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <a-modal
  3. centered
  4. class="replenishmentManagement-confirm-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="待补货产品"
  8. v-model="isShow"
  9. @cancel="isShow = false"
  10. width="80%">
  11. <div>
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <div class="table-page-search-wrapper">
  14. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  15. <a-row :gutter="15">
  16. <a-col :md="8" :sm="24">
  17. <a-form-item label="货架名称">
  18. <shelfSList v-model="queryParam.shelfSn"></shelfSList>
  19. </a-form-item>
  20. </a-col>
  21. <a-col :md="8" :sm="24">
  22. <span class="table-page-search-submitButtons">
  23. <a-button type="primary" style="margin-left: 5px" @click="$refs.table.refresh(true)" :disabled="disabled">查询</a-button>
  24. <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled">重置</a-button>
  25. </span>
  26. </a-col>
  27. </a-row>
  28. </a-form>
  29. </div>
  30. <div class="pages-wrap" style="margin-top:10px;">
  31. <!-- 列表 -->
  32. <s-table
  33. class="sTable"
  34. ref="table"
  35. size="small"
  36. :rowKey="(record) => record.id"
  37. :columns="columns"
  38. :data="loadData"
  39. :scroll="{ y: 400 }"
  40. bordered>
  41. <template slot="action" slot-scope="text, record">
  42. <span class="table-td-link" @click.stop="handleDetail(record)">产品明细</span>
  43. </template>
  44. </s-table>
  45. </div>
  46. </a-spin>
  47. <!-- 生成补货单 -->
  48. <creatReplenishmentOrder :openModal="openCreatRoModal" :nowData="nowData" @ok="resetSearchForm" @close="openCreatRoModal=false" />
  49. </div>
  50. </a-modal>
  51. </template>
  52. <script>
  53. import { commonMixin } from '@/utils/mixin'
  54. import { STable, VSelect } from '@/components'
  55. import shelfSList from '@/views/common/shelfList'
  56. import { shelfReplenishList } from '@/api/shelfReplenish'
  57. import creatReplenishmentOrder from './creatReplenishmentOrder.vue'
  58. export default {
  59. name: 'SlodOutModal',
  60. components: { STable, VSelect, shelfSList, creatReplenishmentOrder },
  61. mixins: [commonMixin],
  62. props: {
  63. openModal: { // 弹框显示状态
  64. type: Boolean,
  65. default: false
  66. }
  67. },
  68. data () {
  69. return {
  70. isShow: this.openModal, // 是否打开弹框
  71. spinning: false,
  72. openCreatRoModal: false,
  73. disabled: false,
  74. queryParam: {
  75. shelfSn: undefined
  76. },
  77. // 表头
  78. columns: [
  79. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  80. { title: '货架名称', dataIndex: 'shelfInfo.shelfName', width: '35%', align: 'center', customRender: function (text) { return text || '--' } },
  81. { title: '待补产品款数', dataIndex: 'totalConfirmQty', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  82. { title: '待补产品数量', dataIndex: 'totalPutQty', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  83. { title: '最近一次补货时间', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  84. { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
  85. ],
  86. // 加载数据方法 必须为 Promise 对象
  87. loadData: parameter => {
  88. this.disabled = true
  89. this.spinning = true
  90. return shelfReplenishList(Object.assign(parameter, this.queryParam)).then(res => {
  91. let data
  92. if (res.status == 200) {
  93. data = res.data
  94. const no = (data.pageNo - 1) * data.pageSize
  95. for (var i = 0; i < data.list.length; i++) {
  96. data.list[i].no = no + i + 1
  97. }
  98. this.listData = data.list || []
  99. this.disabled = false
  100. }
  101. this.spinning = false
  102. return data
  103. })
  104. },
  105. localDataSource: [],
  106. detailData: null, // 详情数据
  107. nowData: null
  108. }
  109. },
  110. methods: {
  111. // 重置
  112. resetSearchForm () {
  113. this.queryParam.shelfSn = undefined
  114. this.$refs.table.refresh(true)
  115. },
  116. handleDetail (row) {
  117. this.nowData = row
  118. this.openCreatRoModal = true
  119. },
  120. pageInit () {
  121. const vm = this
  122. vm.$nextTick(() => {
  123. vm.spinning = false
  124. vm.disabled = false
  125. })
  126. }
  127. },
  128. watch: {
  129. // 父页面传过来的弹框状态
  130. openModal (newValue, oldValue) {
  131. this.isShow = newValue
  132. },
  133. // 重定义的弹框状态
  134. isShow (newValue, oldValue) {
  135. if (!newValue) {
  136. this.$emit('close')
  137. } else {
  138. this.pageInit()
  139. }
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="less">
  145. .replenishmentManagement-confirm-modal {
  146. .btn-cont {
  147. text-align: center;
  148. margin: 35px 0 10px;
  149. }
  150. }
  151. </style>