feat:样品库管理
This commit is contained in:
@@ -69,6 +69,7 @@
|
||||
<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 changeType = ref('sample')
|
||||
@@ -134,24 +135,23 @@ function handleChangeType(e) {
|
||||
let isFirstInput = ref(true)
|
||||
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/execChangeLocation/index') return
|
||||
try {
|
||||
console.log(newVal)
|
||||
|
||||
const isJson = nx.$helper.isJsonString(newVal)
|
||||
console.log(isJson)
|
||||
|
||||
const isJson = nx.$helper.isJsonString(val)
|
||||
if (isFirstInput.value) {
|
||||
handleFirstScan(newVal, isJson)
|
||||
handleFirstScan(val, isJson)
|
||||
} else {
|
||||
handleSecondScan(newVal, isJson)
|
||||
handleSecondScan(val, isJson)
|
||||
}
|
||||
} catch (error) {
|
||||
uni.showToast({ title: '扫码内容解析失败', icon: 'none' })
|
||||
}
|
||||
})
|
||||
}, 300)
|
||||
function handleFirstScan(rawValue, isJson) {
|
||||
if (changeType.value === 'sample') {
|
||||
// 按样品变更:首扫应为纯字符串(样品编号)
|
||||
|
||||
Reference in New Issue
Block a user