feat:样品库管理
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="p8">
|
||||
<navbar-back title="样品归库"></navbar-back>
|
||||
<uni-section type="line" title="库位编码"> </uni-section>
|
||||
<uni-section type="line" title="库位编码" titleFontSize="15px"> </uni-section>
|
||||
<up-input
|
||||
v-model="locationCode"
|
||||
placeholder="请扫描库位编码"
|
||||
@@ -10,7 +10,7 @@
|
||||
prefixIconStyle="font-size: 30px;"
|
||||
>
|
||||
</up-input>
|
||||
<uni-section type="line" title="样品编号"> </uni-section>
|
||||
<uni-section type="line" title="样品编号" titleFontSize="15px"> </uni-section>
|
||||
<up-input
|
||||
v-model="sampleCode"
|
||||
placeholder="请扫描样品编号"
|
||||
@@ -31,46 +31,30 @@ import { ref, reactive, computed, onMounted, toRefs, watch } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import nx from '@/nx'
|
||||
|
||||
function isJsonString(str) {
|
||||
if (typeof str !== 'string') return false
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(str)
|
||||
return typeof parsed === 'object' && parsed !== null
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const { scanQRInfo } = toRefs(nx.$store('biz'))
|
||||
watch(scanQRInfo, newVal => {
|
||||
if (newVal && nx.$router.getCurrentPage().route == 'pages/sampleWarehouse/returnToStock/index') {
|
||||
try {
|
||||
if (!isJsonString(newVal)) {
|
||||
if (!locationCode.value) {
|
||||
uni.showToast({
|
||||
title: '请先扫描库位码',
|
||||
icon: 'none'
|
||||
})
|
||||
scanQRInfo.value = ''
|
||||
return
|
||||
} else {
|
||||
sampleCode.value = newVal
|
||||
// 执行归库
|
||||
handleReturnToStock()
|
||||
}
|
||||
if (!newVal) return
|
||||
scanQRInfo.value = ''
|
||||
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/returnToStock/index') return
|
||||
try {
|
||||
if (nx.$helper.isJsonString(newVal)) {
|
||||
const codeObj = JSON.parse(newVal)
|
||||
locationCode.value = codeObj.code
|
||||
} else {
|
||||
if (!locationCode.value) {
|
||||
uni.showToast({
|
||||
title: '请先扫描库位码',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
} else {
|
||||
const codeObj = JSON.parse(newVal)
|
||||
locationCode.value = codeObj.code
|
||||
sampleCode.value = newVal
|
||||
// 执行归库
|
||||
handleReturnToStock()
|
||||
}
|
||||
scanQRInfo.value = ''
|
||||
} catch (error) {
|
||||
scanQRInfo.value = ''
|
||||
uni.showToast({
|
||||
title: '请扫描样品编码',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
uni.showToast({ title: '扫码内容解析失败', icon: 'none' })
|
||||
}
|
||||
})
|
||||
onShow(() => {
|
||||
@@ -100,7 +84,7 @@ function handleReturnToStock() {
|
||||
})
|
||||
}
|
||||
|
||||
const successCount = ref(2)
|
||||
const successCount = ref(0)
|
||||
function handleReset() {
|
||||
locationCode.value = ''
|
||||
sampleCode.value = ''
|
||||
|
||||
Reference in New Issue
Block a user