slodOutModal.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. :style="{ height: '450px' }"
  40. :scroll="{ y: 400 }"
  41. :showPagination="false"
  42. bordered>
  43. <template slot="shelfName" slot-scope="text, record">
  44. {{ text }}<span style="color:#ff5500;margin-left:5px;" v-if="record.state!=='ENABLE'">(状态为“已暂停”)</span>
  45. </template>
  46. <template slot="action" slot-scope="text, record">
  47. <span class="table-td-link" @click.stop="handleDetail(record)">产品明细</span>
  48. </template>
  49. </s-table>
  50. </div>
  51. </a-spin>
  52. <!-- 生成补货单 -->
  53. <creatReplenishmentOrder :openModal="openCreatRoModal" :nowData="nowData" @ok="resetSearchForm" @close="openCreatRoModal=false" />
  54. </div>
  55. </a-modal>
  56. </template>
  57. <script>
  58. import { commonMixin } from '@/utils/mixin'
  59. import { STable, VSelect } from '@/components'
  60. import shelfSList from '@/views/common/shelfList'
  61. import { queryListForReplenish } from '@/api/shelf'
  62. import creatReplenishmentOrder from './creatReplenishmentOrder.vue'
  63. export default {
  64. name: 'SlodOutModal',
  65. components: { STable, VSelect, shelfSList, creatReplenishmentOrder },
  66. mixins: [commonMixin],
  67. props: {
  68. openModal: { // 弹框显示状态
  69. type: Boolean,
  70. default: false
  71. }
  72. },
  73. data () {
  74. return {
  75. isShow: this.openModal, // 是否打开弹框
  76. spinning: false,
  77. openCreatRoModal: false,
  78. disabled: false,
  79. queryParam: {
  80. shelfSn: undefined
  81. },
  82. // 表头
  83. columns: [
  84. { title: '序号', dataIndex: 'no', width: '5%', align: 'center', customRender: function (text) { return text } },
  85. { title: '货架名称', dataIndex: 'shelfName', scopedSlots: { customRender: 'shelfName' }, width: '35%', align: 'left' },
  86. { title: '待补产品款数', dataIndex: 'productCategory', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, sorter: true },
  87. { title: '待补产品数量', dataIndex: 'productQty', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, sorter: true },
  88. { title: '最近一次补货时间', dataIndex: 'lastDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  89. { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
  90. ],
  91. // 加载数据方法 必须为 Promise 对象
  92. loadData: parameter => {
  93. this.disabled = true
  94. this.spinning = true
  95. if (parameter.sortOrder) {
  96. this.queryParam.queryWord = parameter.sortField
  97. this.queryParam.orderBy = parameter.sortOrder == 'ascend' ? 'ASC' : 'DESC'
  98. } else {
  99. this.queryParam.queryWord = undefined
  100. this.queryParam.orderBy = undefined
  101. }
  102. return queryListForReplenish(this.queryParam).then(res => {
  103. let data
  104. if (res.status == 200) {
  105. data = res.data
  106. for (var i = 0; i < data.length; i++) {
  107. data[i].no = i + 1
  108. }
  109. this.disabled = false
  110. }
  111. this.spinning = false
  112. return data
  113. })
  114. },
  115. localDataSource: [],
  116. detailData: null, // 详情数据
  117. nowData: null
  118. }
  119. },
  120. methods: {
  121. // 重置
  122. resetSearchForm () {
  123. this.queryParam.shelfSn = undefined
  124. this.$refs.table.refresh(true)
  125. },
  126. handleDetail (row) {
  127. if (row.productCategory && row.productQty) {
  128. this.nowData = row
  129. this.openCreatRoModal = true
  130. } else {
  131. this.$message.info('此货架没有待补货产品')
  132. }
  133. },
  134. pageInit () {
  135. const vm = this
  136. vm.$nextTick(() => {
  137. vm.spinning = false
  138. vm.disabled = false
  139. })
  140. }
  141. },
  142. watch: {
  143. // 父页面传过来的弹框状态
  144. openModal (newValue, oldValue) {
  145. this.isShow = newValue
  146. },
  147. // 重定义的弹框状态
  148. isShow (newValue, oldValue) {
  149. if (!newValue) {
  150. this.$emit('close')
  151. } else {
  152. this.pageInit()
  153. }
  154. }
  155. }
  156. }
  157. </script>
  158. <style lang="less">
  159. .replenishmentManagement-confirm-modal {
  160. .btn-cont {
  161. text-align: center;
  162. margin: 35px 0 10px;
  163. }
  164. }
  165. </style>