PickingNoInput.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <div class="picking-no-container">
  3. <van-dialog v-model:show="pickingNoTrueFalseBy"
  4. :beforeClose="beforeClose"
  5. title="拣货任务号" show-cancel-button>
  6. <van-field class="code-input"
  7. v-model="pickingCode"
  8. ref="pickingNoRef"
  9. clearable
  10. @keydown.enter="onKeydown"
  11. placeholder="请扫描拣货任务号" />
  12. </van-dialog>
  13. </div>
  14. </template>
  15. <script setup lang="ts">
  16. import { ref } from 'vue'
  17. import { showToast } from 'vant'
  18. const store = useStore()
  19. const warehouse = store.warehouse
  20. import { useStore } from '@/store/modules/user'
  21. const pickingNoTrueFalseBy=ref(false)
  22. const pickingNoRef=ref(null)
  23. const pickingCode=ref('');
  24. const show = () => {
  25. pickingNoTrueFalseBy.value = true
  26. pickingCode.value=''
  27. setTimeout(()=>{
  28. pickingNoRef.value.focus()
  29. },300)
  30. }
  31. //输入拣货任务号查询任务
  32. const emit = defineEmits()
  33. const beforeClose= (action) =>
  34. new Promise(async (resolve) => {
  35. if (action === 'confirm') {
  36. if (pickingCode.value == '') {
  37. showToast('请输入拣货任务号')
  38. return resolve(false)
  39. }
  40. emit('loadData', pickingCode.value)
  41. // const { taskList } = await getPickingTask(warehouse, pickingCode.value)
  42. // if (taskList.value.length > 0) {
  43. //
  44. // resolve(true)
  45. // } else {
  46. // showToast('当前拣货任务号暂未查询到任务,请重新输入')
  47. // return resolve(false)
  48. // }
  49. }
  50. resolve(true)
  51. });
  52. const onKeydown=()=>{
  53. setTimeout(()=>{
  54. pickingNoRef.value.blur()
  55. },300)
  56. }
  57. defineExpose({show})
  58. </script>
  59. <style scoped lang="sass">
  60. .picking-no-container
  61. .code-input
  62. font-size: 22px
  63. font-weight: bold
  64. border-bottom: 2px solid #0077ff
  65. </style>