电子标签优化
This commit is contained in:
parent
c6fc20f751
commit
8f8a20ba4a
|
|
@ -12,7 +12,7 @@
|
||||||
<!-- <button @click="handleRecognition" class="recognition-btn">识别</button> -->
|
<!-- <button @click="handleRecognition" class="recognition-btn">识别</button> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="optionList.length > 0" class="select-container">
|
<div v-if="optionList.length > 1" class="select-container">
|
||||||
<uni-data-select
|
<uni-data-select
|
||||||
v-model="maId"
|
v-model="maId"
|
||||||
:localdata="optionList"
|
:localdata="optionList"
|
||||||
|
|
@ -283,12 +283,19 @@ const handQuery = () => {
|
||||||
})
|
})
|
||||||
getSelectionList({ maCode: code.value, maId: 0 }).then((response) => {
|
getSelectionList({ maCode: code.value, maId: 0 }).then((response) => {
|
||||||
if (response.data && response.data.length !== 0) {
|
if (response.data && response.data.length !== 0) {
|
||||||
|
if (response.data.length === 1) {
|
||||||
|
const option = response.data[0]
|
||||||
|
maCodeTwo.value = code.value
|
||||||
|
maId.value = option.maId
|
||||||
|
getTagInfo(option.devType)
|
||||||
|
}
|
||||||
optionList.value = response.data.map((option) => ({
|
optionList.value = response.data.map((option) => ({
|
||||||
value: option.maId,
|
value: option.maId,
|
||||||
text: option.maCode,
|
text: option.maCode,
|
||||||
devType: option.devType,
|
devType: option.devType,
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
|
isJj.value = null
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '未查询到该编号信息',
|
title: '未查询到该编号信息',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|
@ -296,6 +303,7 @@ const handQuery = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
isJj.value = null
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -309,13 +317,16 @@ const changeTag = async (e) => {
|
||||||
maCodeTwo.value = option.text || ''
|
maCodeTwo.value = option.text || ''
|
||||||
console.log('🚀 ~ changeTag ~ maCodeTwo:', maCodeTwo.value)
|
console.log('🚀 ~ changeTag ~ maCodeTwo:', maCodeTwo.value)
|
||||||
if (!maCodeTwo.value) return
|
if (!maCodeTwo.value) return
|
||||||
|
getTagInfo(option.devType)
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTagInfo = async (devType) => {
|
||||||
try {
|
try {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中...',
|
title: '加载中...',
|
||||||
mask: true,
|
mask: true,
|
||||||
})
|
})
|
||||||
const response = await getListTag({ maCode: maCodeTwo.value, maId: maId.value, devType: option.devType })
|
const response = await getListTag({ maCode: maCodeTwo.value, maId: maId.value, devType: devType })
|
||||||
if (response.data && response.data.length !== 0) {
|
if (response.data && response.data.length !== 0) {
|
||||||
tagInfo.value = response.data[0]
|
tagInfo.value = response.data[0]
|
||||||
isJj.value = tagInfo.value.isJj
|
isJj.value = tagInfo.value.isJj
|
||||||
|
|
@ -338,11 +349,19 @@ const changeTag = async (e) => {
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取标签信息失败', error)
|
console.error('获取标签信息失败', error)
|
||||||
uni.showToast({
|
if (error.data && error.data.msg && error.data.msg.includes('检验时间')) {
|
||||||
title: '获取信息失败',
|
uni.showModal({
|
||||||
icon: 'none',
|
title: '提示',
|
||||||
duration: 2000,
|
content: '该工器具已临近下次检验时间,请及时退还至机具(物流)分公司!',
|
||||||
})
|
showCancel: false,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取信息失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue