| | |
| | | </div> |
| | | </wd-popup> |
| | | <wd-toast /> |
| | | <!-- 扫码组件 --> |
| | | <Scan ref="scanRef" emit-name="scanJX" /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import AttachmentUpload from "../upload.vue"; |
| | | import { useUserStore } from "@/store/modules/user"; |
| | | import { useScanCode } from "@/composables/useScanCode"; |
| | | import Scan from "@/components/scan/index.vue"; |
| | | |
| | | const paramsType = ref(""); |
| | | const paramsId = ref(""); |
| | |
| | | const attachmentRef = ref<any>(null); |
| | | const detailData = reactive<any>({}); |
| | | const detailDataLoaded = ref(false); |
| | | const scanRef = ref(); // 扫码组件引用 |
| | | |
| | | // 获取当前登录用户信息 |
| | | const userStore = useUserStore(); |
| | |
| | | }; |
| | | |
| | | const openScan = () => { |
| | | console.log("indexJX - 点击扫码按钮(全局扫码模式,无需手动触发)"); |
| | | // 全局扫码模式下,硬件扫码会自动触发,无需手动调用 |
| | | uni.showToast({ |
| | | title: "请使用扫码枪扫描", |
| | | icon: "none", |
| | | }); |
| | | console.log("indexJX - 点击扫码按钮,触发扫码"); |
| | | // 触发扫码 |
| | | if (scanRef.value) { |
| | | scanRef.value.triggerScan(); |
| | | } else { |
| | | uni.showToast({ |
| | | title: "扫码组件未初始化", |
| | | icon: "none", |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 页面显示时的处理 |
| | |
| | | if (!cachedData || !cachedData.uid) { |
| | | console.log("⚠️ 未检测到扫码缓存,用户需要扫描设备二维码"); |
| | | // 在编辑模式下才提示 |
| | | if (isEdit.value) { |
| | | setTimeout(() => { |
| | | uni.showToast({ |
| | | title: "请扫描设备二维码后再保存", |
| | | icon: "none", |
| | | duration: 2000, |
| | | }); |
| | | }, 500); |
| | | } |
| | | // if (isEdit.value) { |
| | | // setTimeout(() => { |
| | | // uni.showToast({ |
| | | // title: "请扫描设备二维码后再保存", |
| | | // icon: "none", |
| | | // duration: 2000, |
| | | // }); |
| | | // }, 500); |
| | | // } |
| | | } |
| | | }); |
| | | </script> |