creatReplenishmentOrder.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <a-modal
  3. centered
  4. class="creatReplenish-confirm-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="生成补货单"
  8. v-model="isShow"
  9. @cancel="isShow = false"
  10. :width="800">
  11. <a-spin :spinning="spinning" tip="Loading...">
  12. <div style="padding:0 0 20px;text-align: center;">
  13. <h4>请选择需要生成补货单的数字货架</h4>
  14. <div style="color:#999;font-size:14px;">(请从左侧选择货架并移动到右侧区域)</div>
  15. </div>
  16. <!-- 列表 -->
  17. <div>
  18. <a-transfer
  19. :titles="['货架列表', '已选货架']"
  20. :listStyle="{width:'45%',height:'400px'}"
  21. :data-source="shelfList"
  22. show-search
  23. :filter-option="filterOption"
  24. :target-keys="targetKeys"
  25. :render="item => item.title"
  26. @change="handleChange"
  27. />
  28. </div>
  29. <div class="btn-cont">
  30. <a-button type="primary" id="creatReplenish-confirm-modal-save" @click="handleSave">确定</a-button>
  31. <a-button id="creatReplenish-confirm-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
  32. </div>
  33. </a-spin>
  34. </a-modal>
  35. </template>
  36. <script>
  37. import { commonMixin } from '@/utils/mixin'
  38. import { queryListForSettle, shelfTaskInsertBill } from '@/api/shelfReplenish'
  39. export default {
  40. name: 'ConfirmModal',
  41. mixins: [commonMixin],
  42. props: {
  43. openModal: { // 弹框显示状态
  44. type: Boolean,
  45. default: false
  46. },
  47. nowData: {
  48. type: Object,
  49. default: () => {
  50. return {}
  51. }
  52. }
  53. },
  54. data () {
  55. return {
  56. spinning: false,
  57. isShow: this.openModal, // 是否打开弹框
  58. shelfList: [],
  59. targetKeys: []
  60. }
  61. },
  62. methods: {
  63. getShelf () {
  64. this.spinning = true
  65. queryListForSettle().then(res => {
  66. if (res.status == 200) {
  67. this.shelfList = res.data || []
  68. this.shelfList.map(item => {
  69. item.title = item.shelfName
  70. item.key = item.shelfSn
  71. })
  72. } else {
  73. this.shelfList = []
  74. }
  75. this.spinning = false
  76. })
  77. },
  78. filterOption (inputValue, option) {
  79. return option.title.indexOf(inputValue) > -1
  80. },
  81. handleChange (targetKeys, direction, moveKeys) {
  82. console.log(targetKeys, direction, moveKeys)
  83. this.targetKeys = targetKeys
  84. },
  85. // 确认补货
  86. handleSave () {
  87. if (this.targetKeys.length == 0) {
  88. this.$message.info('请选择货架!')
  89. return false
  90. }
  91. this.spinning = true
  92. shelfTaskInsertBill(this.targetKeys).then(res => {
  93. if (res.status == 200) {
  94. this.$message.success(res.message)
  95. this.$emit('ok')
  96. }
  97. this.spinning = false
  98. })
  99. }
  100. },
  101. watch: {
  102. // 父页面传过来的弹框状态
  103. openModal (newValue, oldValue) {
  104. this.isShow = newValue
  105. },
  106. // 重定义的弹框状态
  107. isShow (newValue, oldValue) {
  108. if (!newValue) {
  109. this.$emit('close')
  110. } else {
  111. const _this = this
  112. this.$nextTick(() => { // 页面渲染完成后的回调
  113. _this.getShelf()
  114. })
  115. }
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="less">
  121. .creatReplenish-confirm-modal {
  122. .btn-cont {
  123. text-align: center;
  124. margin: 35px 0 10px;
  125. }
  126. }
  127. </style>