|
@ -4,10 +4,7 @@ |
|
|
<view class="pop_tab"> |
|
|
<view class="pop_tab"> |
|
|
<view class="tab_info"> |
|
|
<view class="tab_info"> |
|
|
<view class="conbox"> |
|
|
<view class="conbox"> |
|
|
<textarea v-model="scanMsg" trim="all" maxlength="1000" style="margin-left: 5px; width: 90%" |
|
|
<textarea v-model="scanMsg" trim="all" maxlength="1000" style="margin-left: 5px; width: 90%" :focus="boxfocus" :placeholder="placeholderValue" @input="handelScanMsg" @blur="handleBlur" @focus="handleFocus"></textarea> |
|
|
:focus="boxfocus" :placeholder="placeholderValue" @input="handelScanMsg" |
|
|
|
|
|
@blur="handleBlur" @focus="handleFocus" |
|
|
|
|
|
:cursor="cursorIndex"></textarea> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="uni-flex uni-row space-between u-col-center"> |
|
|
<view class="uni-flex uni-row space-between u-col-center"> |
|
@ -52,9 +49,8 @@ |
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue' |
|
|
import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue' |
|
|
import { getLabelInfo } from '@/common/label.js' |
|
|
import { getLabelInfo } from '@/common/label.js' |
|
|
import { |
|
|
import { getManagementPrecisions } from '@/common/balance.js' |
|
|
getManagementPrecisions |
|
|
|
|
|
} from '@/common/balance.js'; |
|
|
|
|
|
const props = defineProps({ |
|
|
const props = defineProps({ |
|
|
placeholder: { |
|
|
placeholder: { |
|
|
type: String, |
|
|
type: String, |
|
@ -76,7 +72,7 @@ const props = defineProps({ |
|
|
type: String, |
|
|
type: String, |
|
|
default: 'HPQ' // HLB HMQ HCQ HPQ |
|
|
default: 'HPQ' // HLB HMQ HCQ HPQ |
|
|
}, |
|
|
}, |
|
|
locationCode:{ |
|
|
locationCode: { |
|
|
type: String, |
|
|
type: String, |
|
|
default: '' |
|
|
default: '' |
|
|
} |
|
|
} |
|
@ -92,9 +88,7 @@ const expendIcon = ref('arrow-down') |
|
|
const cursorIndex = ref(0) |
|
|
const cursorIndex = ref(0) |
|
|
const comMessageRef = ref(null) |
|
|
const comMessageRef = ref(null) |
|
|
placeholderValue.value = `请扫描${props.placeholder}` |
|
|
placeholderValue.value = `请扫描${props.placeholder}` |
|
|
onMounted(() => { |
|
|
onMounted(() => {}) |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
// 监视属性 |
|
|
// 监视属性 |
|
|
watch( |
|
|
watch( |
|
|
() => props.placeholder, |
|
|
() => props.placeholder, |
|
@ -133,7 +127,7 @@ const clickScanMsg = () => { |
|
|
} |
|
|
} |
|
|
const handelScanMsg = () => { |
|
|
const handelScanMsg = () => { |
|
|
// 点击了回车 |
|
|
// 点击了回车 |
|
|
if (scanMsg.value.indexOf('\n')) { |
|
|
if (scanMsg.value.includes('\n')) { |
|
|
// that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50'; |
|
|
// that.scanMsg = 'HPQ;V1.0;ICE115F11161AG;PP20230427000027;B20230427002;Q50'; |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
losefocus() |
|
|
losefocus() |
|
@ -151,49 +145,55 @@ const handelScanMsg = () => { |
|
|
if (props.isShowHistory) { |
|
|
if (props.isShowHistory) { |
|
|
scanList.value.unshift(content) |
|
|
scanList.value.unshift(content) |
|
|
} |
|
|
} |
|
|
getLabelInfo(content, props.headerType, (callback) => { |
|
|
getLabelInfo( |
|
|
// uni.hideLoading(); |
|
|
content, |
|
|
const scanResult = callback |
|
|
props.headerType, |
|
|
scanResult.scanMessage = content |
|
|
(callback) => { |
|
|
if (scanResult.success) { |
|
|
// uni.hideLoading(); |
|
|
clear() |
|
|
const scanResult = callback |
|
|
// that.getfocus();//不能自动获取焦点 |
|
|
scanResult.scanMessage = content |
|
|
emit('getResult', scanResult) |
|
|
if (scanResult.success) { |
|
|
} else { |
|
|
clear() |
|
|
clear() |
|
|
// that.getfocus();//不能自动获取焦点 |
|
|
losefocus() |
|
|
emit('getResult', scanResult) |
|
|
comMessageRef.value.showErrorMessage(scanResult.message, (res) => { |
|
|
} else { |
|
|
if (res) { |
|
|
clear() |
|
|
getfocus() |
|
|
losefocus() |
|
|
} |
|
|
comMessageRef.value.showErrorMessage(scanResult.message, (res) => { |
|
|
}) |
|
|
if (res) { |
|
|
} |
|
|
getfocus() |
|
|
},props.locationCode) |
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
props.locationCode |
|
|
|
|
|
) |
|
|
}, 200) |
|
|
}, 200) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
const handleFocus = ()=> {} |
|
|
const handleFocus = () => {} |
|
|
|
|
|
|
|
|
const handleBlur = ()=> { |
|
|
const handleBlur = () => { |
|
|
// setTimeout(res=>{ |
|
|
// setTimeout(res=>{ |
|
|
// uni.hideKeyboard(); |
|
|
// uni.hideKeyboard(); |
|
|
// },200) |
|
|
// },200) |
|
|
} |
|
|
} |
|
|
const getfocus = () => { |
|
|
const getfocus = () => { |
|
|
nextTick((r) => { |
|
|
nextTick(() => { |
|
|
boxfocus.value = true |
|
|
boxfocus.value = true |
|
|
}) |
|
|
}) |
|
|
// hide() |
|
|
// hide() |
|
|
} |
|
|
} |
|
|
const losefocus = () => { |
|
|
const losefocus = () => { |
|
|
nextTick((r) => { |
|
|
nextTick(() => { |
|
|
boxfocus.value = false |
|
|
boxfocus.value = false |
|
|
uni.hideKeyboard() |
|
|
uni.hideKeyboard() |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
const clear = () => { |
|
|
const clear = () => { |
|
|
if(props.clearResult){ |
|
|
console.log('清除', props.clearResult) |
|
|
cursorIndex.value = 0 |
|
|
if (props.clearResult) { |
|
|
|
|
|
// cursorIndex.value = 0 |
|
|
scanMsg.value = '' |
|
|
scanMsg.value = '' |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -241,7 +241,7 @@ defineExpose({ |
|
|
clear, |
|
|
clear, |
|
|
clickScanMsg, |
|
|
clickScanMsg, |
|
|
losefocus, |
|
|
losefocus, |
|
|
setItemCodeSimulate, |
|
|
setItemCodeSimulate |
|
|
}) |
|
|
}) |
|
|
</script> |
|
|
</script> |
|
|
<script module="textarea" lang="renderjs"> |
|
|
<script module="textarea" lang="renderjs"> |
|
|