王志国
3 weeks ago
16 changed files with 158 additions and 152 deletions
@ -1,143 +1,156 @@ |
|||||
<template> |
<template> |
||||
<view> |
<view> |
||||
<u-popup v-model="show" mode="bottom" :mask-close-able="false"> |
<u-popup v-model="show" mode="bottom"> |
||||
<view class="popup_box"> |
<view class="popup_box"> |
||||
<view class="pop_title uni-flex space-between"> |
<view class="pop_title uni-flex space-between"> |
||||
<view class="" style="font-size: 35rpx"> 扫描{{ title }} </view> |
<view class="" style="font-size: 35rpx"> 扫描{{ title }}</view> |
||||
|
|
||||
<view class=""> |
<view class=""> |
||||
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()"> |
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()"> |
||||
</image> |
</image> |
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
<view class="uni-flex uni-row" |
<view class="uni-flex uni-row" |
||||
style="align-items: center; background-color: #fff; margin-left: 20rpx; margin-right: 20rpx; border-radius: 8rpx"> |
style="align-items: center; background-color: #fff; margin-left: 20rpx; margin-right: 20rpx; border-radius: 8rpx"> |
||||
<view class="uni-center" style="width: 25%; font-size: 32rpx; font-weight: bold"> 优先级 </view> |
<view class="uni-center" style="width: 25%; font-size: 32rpx; font-weight: bold"> 优先级</view> |
||||
<view style="width: 100%"> |
<view style="width: 100%"> |
||||
<uni-data-select style="padding: 20rpx;" v-model="priorityCode" :localdata="priorityList" @change="change" |
<uni-data-select style="padding: 20rpx;" v-model="priorityCode" :localdata="priorityList" @change="change" |
||||
:clear="false"></uni-data-select> |
:clear="false"></uni-data-select> |
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
<view class=""> |
<view class=""> |
||||
<view class=""> |
<view class=""> |
||||
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :headerType="headerType" |
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :headerType="headerType" |
||||
:isShowHistory="isShowHistory" :clearResult="true"></win-com-scan> |
:isShowHistory="isShowHistory" :clearResult="true"></win-com-scan> |
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
</u-popup> |
</u-popup> |
||||
<com-message ref="comMessageRef" /> |
<com-message ref="comMessageRef"/> |
||||
</view> |
</view> |
||||
</template> |
</template> |
||||
|
|
||||
<script setup lang="ts"> |
<script setup lang="ts"> |
||||
import { ref, getCurrentInstance, nextTick } from 'vue' |
import {ref, getCurrentInstance, nextTick} from 'vue' |
||||
import { onLoad, onNavigationBarButtonTap, onPullDownRefresh } from '@dcloudio/uni-app' |
import {onLoad, onNavigationBarButtonTap, onPullDownRefresh} from '@dcloudio/uni-app' |
||||
import { getLabelInfo } from '@/common/label.js' |
import {getLabelInfo} from '@/common/label.js' |
||||
import winComScan from '@/mycomponents/scan/winComScan.vue' |
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
|
||||
const props = defineProps({ |
const props = defineProps({ |
||||
title: { |
title: { |
||||
type: String, |
type: String, |
||||
default: '箱标签' |
default: '箱标签' |
||||
}, |
}, |
||||
isShowHistory: { |
isShowHistory: { |
||||
type: Boolean, |
type: Boolean, |
||||
default: true |
default: true |
||||
}, |
}, |
||||
headerType: { |
headerType: { |
||||
type: String, |
type: String, |
||||
default: 'HPQ' |
default: 'HPQ' |
||||
} |
} |
||||
}) |
}) |
||||
const emit = defineEmits(['close']) |
const emit = defineEmits(['close']) |
||||
const show = ref(false) |
const show = ref(false) |
||||
const priorityList = ref([ |
const comMessageRef = ref(null) |
||||
{ |
const priorityList = ref([ |
||||
value: 0, |
{ |
||||
text: '低' |
value: 0, |
||||
}, |
text: '低' |
||||
{ |
}, |
||||
value: 1, |
{ |
||||
text: '中' |
value: 1, |
||||
}, |
text: '中' |
||||
{ |
}, |
||||
value: 2, |
{ |
||||
text: '高' |
value: 2, |
||||
} |
text: '高' |
||||
]) |
} |
||||
const priorityCode = ref(1) |
]) |
||||
const comscan = ref() |
const priorityCode = ref(1) |
||||
const simulateScan = (scanMessage) => { |
const comscan = ref() |
||||
getLabelInfo(scanMessage, headerType.value, (callback) => { |
const simulateScan = (scanMessage) => { |
||||
if (callback.success) { |
getLabelInfo(scanMessage, headerType.value, (callback) => { |
||||
getScanResult(callback) |
if (callback.success) { |
||||
} else { |
getScanResult(callback) |
||||
showMessage(callback.message) |
} else { |
||||
} |
showMessage(callback.message) |
||||
}) |
} |
||||
} |
}) |
||||
const openScanPopup = () => { |
} |
||||
show.value = true |
const openScanPopup = () => { |
||||
setTimeout((res) => { |
show.value = true |
||||
getfocus() |
setTimeout((res) => { |
||||
}, 200) |
getfocus() |
||||
} |
}, 200) |
||||
const closeScanPopup = () => { |
} |
||||
losefocus() |
const closeScanPopup = () => { |
||||
show.value = false |
losefocus() |
||||
emit('close', '') |
show.value = false |
||||
} |
emit('close', '') |
||||
|
} |
||||
|
|
||||
|
|
||||
const scanClick = () => { |
const scanClick = () => { |
||||
if (comscan.value) { |
if (comscan.value) { |
||||
comscan.value.clickScanMsg() |
comscan.value.clickScanMsg() |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
|
|
||||
const cancelClick = () => { |
const cancelClick = () => { |
||||
if (comscan.value) { |
if (comscan.value) { |
||||
comscan.value.clearScanValue() |
comscan.value.clearScanValue() |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
|
|
||||
const getScanResult = (result) => { |
const getScanResult = (result) => { |
||||
if (result.success) { |
if (result.success) { |
||||
result.priorityCode = priorityCode.value |
result.priorityCode = priorityCode.value |
||||
emit('getResult', result) |
emit('getResult', result) |
||||
} else { |
} else { |
||||
showMessage(result.message) |
showMessage(result.message) |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
|
|
||||
const getfocus = () => { |
const getfocus = () => { |
||||
if (comscan.value) { |
if (comscan.value) { |
||||
comscan.value.getfocus() |
comscan.value.getfocus() |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
|
|
||||
const losefocus = () => { |
const losefocus = () => { |
||||
if (comscan.value) { |
if (comscan.value) { |
||||
comscan.value.losefocus() |
comscan.value.losefocus() |
||||
} |
} |
||||
} |
} |
||||
const showMessage = (message) => { |
const showMessage = (message) => { |
||||
comMessageRef.value.showMessage(message) |
comMessageRef.value.showMessage(message) |
||||
} |
} |
||||
const change = (e) => { |
const change = (e) => { |
||||
console.log(e) |
console.log(e) |
||||
} |
} |
||||
|
defineExpose({ |
||||
|
simulateScan, |
||||
|
openScanPopup, |
||||
|
closeScanPopup, |
||||
|
scanClick, |
||||
|
cancelClick, |
||||
|
getScanResult, |
||||
|
getfocus, |
||||
|
losefocus, |
||||
|
showMessage, |
||||
|
change |
||||
|
}) |
||||
</script> |
</script> |
||||
|
|
||||
<style lang="scss"> |
<style lang="scss"> |
||||
.scroll-view { |
.scroll-view { |
||||
overflow-y: scroll; |
overflow-y: scroll; |
||||
height: auto; |
height: auto; |
||||
max-height: 300rpx; |
max-height: 300rpx; |
||||
} |
} |
||||
</style> |
</style> |
Loading…
Reference in new issue