scanCode.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <!-- 扫码板块 -->
  3. <div class="icon">
  4. <img class="imgIcon" src="@/assets/icons/shaoma.svg" />
  5. </div>
  6. <div class="body">
  7. <ScanCodeInput v-model="inputValue" @keyup.enter="toProSteps" />
  8. </div>
  9. </template>
  10. <script lang="ts" setup>
  11. import ScanCodeInput from "@/components/ScanCodeInput/index.vue";
  12. import { useProcessStore } from "@/store";
  13. import { getScan } from "@/api/process";
  14. const store = useProcessStore();
  15. const router = useRouter();
  16. const inputValue = ref("");
  17. const toProSteps = () => {
  18. if (inputValue.value == "") return ElMessage.error("二维码不能为空!");
  19. store.odersData.qrCode = inputValue.value;
  20. getScanData();
  21. };
  22. const getScanData = async () => {
  23. const { code, data, msg } = await getScan({
  24. operationId: Number(store.odersData.operationId),
  25. qrCode: store.odersData.qrCode,
  26. workOrderCode: store.odersData.workOrderCode,
  27. //stationId暂时随便传一个
  28. stationId: 1,
  29. });
  30. if (code == "200") {
  31. store.scanInfo = data;
  32. router.push({ path: "/pro-steps" });
  33. }
  34. };
  35. </script>
  36. <style lang="scss" scoped>
  37. .icon {
  38. @include flex;
  39. height: 120px;
  40. .imgIcon {
  41. width: 100px;
  42. height: 100px;
  43. }
  44. }
  45. </style>