scanCode.vue 1.3 KB

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