From 1a2dc09f3443a72a0595c47d4f96728bcc9d8c77 Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Tue, 29 Jul 2025 18:04:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E6=96=99=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/back/backCode.vue | 35 +++++++++++++++----------- src/pages/devicesSearch/codeSearch.vue | 1 - 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/pages/back/backCode.vue b/src/pages/back/backCode.vue index 113e362..e07728a 100644 --- a/src/pages/back/backCode.vue +++ b/src/pages/back/backCode.vue @@ -78,14 +78,13 @@ 设备编码: - + > 编码检索 @@ -163,7 +162,7 @@ const bmFileInfos = ref([]) // 上传后的图片信息 const scanQrCodeRef = ref(null) const codeList = ref([]) const isExpanded = ref(false) - +const flag = ref(false) const leftClick = () => { // 返回 uni.navigateBack({ @@ -188,9 +187,8 @@ const getMaCodeList = async () => { if (!res.data || res.data.length === 0) return codeList.value = res.data.map((item) => { return { - id: item.maCode, - name: item.maCode, - parentId: 0, + value: item.maCode, + text: item.maCode } }) } catch (error) { @@ -200,7 +198,7 @@ const getMaCodeList = async () => { const changeMaCode = (e) => { console.log('🚀 ~ changeMaCode ~ e:', e) - maCode.value = e.id + maCode.value = e } const clearMaCode = () => { @@ -219,6 +217,7 @@ const clearMaCode = () => { } //根据编码获取设备类型 const getMaInfo = () => { + flag.value = false console.log(maCode.value) if (!maCode.value) { uni.showToast({ title: '请选择设备编码!', icon: 'none' }) @@ -240,6 +239,7 @@ const getMaInfo = () => { maStatusName.value = res.data[0].maStatusName maId.value = res.data[0].maId typeId.value = res.data[0].typeId + } else { uni.showToast({ title: '该编码非该单位工程领用,不可退料!', icon: 'none' }) } @@ -252,8 +252,8 @@ const getMaInfo = () => { const qrCode = ref('') //图片展示 // 二维码扫码 const scanStart = async () => { + qrCode.value = '' - if (scanQrCodeRef.value) { scanQrCodeRef.value.scanQrCode() } @@ -337,23 +337,28 @@ const getMaInfoScan = () => { url: '/material/back_apply_info/getMachine', method: 'get', data: param, - success: (res) => { + success: async (res) => { console.log(res) + await getMaCodeList(); if(!res.data.code){ res = JSON.parse(decryptWithSM4(res.data)) }else{ - res = JSON.parse(res.data) + res = res.data } console.log("xxxxxxxxxxxxxxxx",res) if (res.code == 200) { + console.log(res) console.log(res.data[0]) - maCode.value = res.data[0].maCode + maCode.value = res.data[0].maCode; + console.log("333333333333",maCode.value) + console.log('codeList:', JSON.stringify(codeList.value)) typeName.value = res.data[0].typeName materialName.value = res.data[0].typeModelName maStatusName.value = res.data[0].maStatusName maId.value = res.data[0].maId typeId.value = res.data[0].typeId + flag.value = true }else{ uni.showModal({ title: '错误提示', @@ -480,7 +485,9 @@ const submitCode = () => { // uni.navigateBack({ // delta: 1 // 返回到已存在的页面 // }); - scanStart() + if(flag.value){ + scanStart() + } } else { uni.showToast({ title: res.msg, icon: 'none' }) } diff --git a/src/pages/devicesSearch/codeSearch.vue b/src/pages/devicesSearch/codeSearch.vue index 017a9e7..aae68e2 100644 --- a/src/pages/devicesSearch/codeSearch.vue +++ b/src/pages/devicesSearch/codeSearch.vue @@ -173,7 +173,6 @@ const getCodeDeviceInfoData = async () => { }) } }) - console.log(res) } // 标签变更处理