Browse Source

重新封装一个扫描组件2024/7/2 15:59:00

hella_vue3
zhang_li 3 months ago
parent
commit
adff8617c9
  1. 10
      .env.development
  2. 105
      src/mycomponents/scan/winScanPackage.vue
  3. 7
      src/pages.json
  4. 8
      src/pages/count/job/countJob.vue

10
.env.development

@ -1,11 +1,11 @@
VITE_BASE_URL=http://localhost:12080/admin-api VITE_BASE_URL=http://172.21.32.14:81/api/admin-api
VITE_BASE_URL_IMAGE=http://172.22.32.9:81/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.14:81/admin-api
# 租户配置 # 租户配置
VITE_TENANT='[{"text":"成都1397","value":2},{"text":"长春2379","value":3}]' VITE_TENANT='[{"text":"长春","value":1}]'
# 是否是测试环境 # 是否是测试环境
VITE_isDevelopment=true VITE_isDevelopment=false
# 积木报表请求路径 # 积木报表请求路径
VITE_JMREPORT_BASE_URL='http://172.22.32.9:90' VITE_JMREPORT_BASE_URL='http://172.21.32.14:90'

105
src/mycomponents/scan/winScanPackage.vue

@ -0,0 +1,105 @@
<template>
<view>
<u-popup v-model="show" mode="bottom" :mask-close-able="false">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx"> 扫描{{ title }} </view>
<view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()"></image>
</view>
</view>
<view class="">
<view class="">
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :headerType="headerType" :isShowHistory="isShowHistory" :clearResult="true"></win-com-scan>
</view>
</view>
</view>
</u-popup>
<!-- 模拟扫描功能 -->
<win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :headerType="headerType" :isShowHistory="false" :clearResult="true"></win-com-scan>
<com-message ref="comMessageRef" />
</view>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance, onMounted, nextTick, watch } from 'vue'
import winComScan from '@/mycomponents/scan/winComScan.vue'
const props = defineProps({
title: {
type: String,
default: '箱标签'
},
isShowHistory: {
type: Boolean,
default: true
},
headerType: {
type: String,
default: 'HPQ'
}
})
const show = ref(false)
const comscansimulate = ref()
const comscan = ref()
const comMessageRef = ref()
const simulateScan = (item) => {
comscansimulate.value.setItemCodeSimulate(item.copyContent)
comscansimulate.value.clickScanMsg()
}
const openScanPopup = () => {
setTimeout((res) => {
show.value = true
}, 200)
}
const closeScanPopup = () => {
show.value = false
emit('close', '')
}
const scanClick = () => {
if (comscan.value) {
comscan.value.clickScanMsg()
}
}
const cancelClick = () => {
if (comscan.value) {
comscan.value.clearScanValue()
}
}
const getScanResult = (result) => {
if (result.success) {
emit('getResult', result)
} else {
showMessage(result.message)
}
}
const getfocus = () => {
if (comscan.value != undefined) {
comscan.value.getfocus()
}
}
const losefocus = () => {
if (comscan.value != undefined) {
comscan.value.losefocus()
}
}
const showMessage = (message) => {
comMessageRef.value.showMessage(message)
}
</script>
<style lang="scss">
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
}
</style>

7
src/pages.json

@ -1794,6 +1794,13 @@
} }
} }
}, },
{
"path": "pages/count/job/countDetail",
"style": {
"navigationBarTitleText": "盘点详细",
"enablePullDownRefresh": false
}
},
{ {
"path": "pages/count/job/countBlindDetail", "path": "pages/count/job/countBlindDetail",
"style": { "style": {

8
src/pages/count/job/countJob.vue

@ -134,7 +134,9 @@ const getList = (type) => {
const params = { const params = {
filters, filters,
pageNo: pageNo.value, pageNo: pageNo.value,
pageSize: pageSize.value pageSize: pageSize.value,
sort: 'number',
by: 'DESC'
} }
getCountJobList(params) getCountJobList(params)
.then((res) => { .then((res) => {
@ -250,7 +252,9 @@ const getDataListByType = (code) => {
const params = { const params = {
filters, filters,
pageNo: 1, pageNo: 1,
pageSize: 100 pageSize: 100,
sort: 'number',
by: 'DESC'
} }
getCountJobList(params) getCountJobList(params)
.then((res) => { .then((res) => {

Loading…
Cancel
Save