feat:样品库管理

This commit is contained in:
houjunxiang
2025-11-21 17:56:33 +08:00
parent 7ee3df9ab9
commit 753766893b
24 changed files with 818 additions and 218 deletions

View File

@@ -29,16 +29,26 @@
<script setup>
import { ref, reactive, computed, onMounted, toRefs, watch } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash'
import nx from '@/nx'
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (!newVal) return
debouncedHandleScan(newVal)
})
const debouncedHandleScan = debounce(val => {
if (!val) return
scanQRInfo.value = ''
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/returnToStock/index') return
try {
if (nx.$helper.isJsonString(newVal)) {
const codeObj = JSON.parse(newVal)
if (nx.$helper.isJsonString(val)) {
const codeObj = JSON.parse(val)
if (codeObj.code === locationCode.value) {
return uni.showToast({
title: '请勿重复扫描',
icon: 'none'
})
}
locationCode.value = codeObj.code
} else {
if (!locationCode.value) {
@@ -48,7 +58,7 @@ watch(scanQRInfo, newVal => {
})
return
} else {
sampleCode.value = newVal
sampleCode.value = val
// 执行归库
handleReturnToStock()
}
@@ -56,7 +66,7 @@ watch(scanQRInfo, newVal => {
} catch (error) {
uni.showToast({ title: '扫码内容解析失败', icon: 'none' })
}
})
}, 300)
onShow(() => {
scanQRInfo.value = ''
})
@@ -69,11 +79,11 @@ function handleReturnToStock() {
nx.$api.sampleWarehouse
.execReturnToStock({
warehouseLocationCode: locationCode.value,
sampleCode: sampleCode.value
sampleReturnCode: sampleCode.value
})
.then(res => {
successCount.value++
if (res.print) {
if (res.isPrint) {
uni.showToast({
title: `归库成功,归库码为【${res.code}`,
duration: 3000,