小程序:质检报工调整,将输入和扫码事件拆分为

This commit is contained in:
郑庆 2025-11-15 19:16:11 +08:00
parent fbab232b17
commit 6f60eed92d
3 changed files with 13 additions and 6 deletions

View File

@ -12,6 +12,7 @@ const userId = userStore.userInfo.userId
const isFinish = ref(false)
//
const isScan = ref(false)
const isFromScan = ref(false)
//
const isTriggered = ref(false)
// porps
@ -132,6 +133,10 @@ const handleSearch = async (e) => {
saveSearchValue(queryParams.subOrDetailName)
await getListData();
};
const onInputSearch = (e) => {
if (isFromScan.value) return;
handleSearch({ inputValue: e.detail?.value ?? searchVal.value });
};
const viewClick = async (item) => {
const params = {
id: item.id
@ -145,8 +150,10 @@ const viewClick = async (item) => {
const handleScan = async() => {
uni.scanCode({
success: async(res) => {
isFromScan.value = true
searchVal.value = res.result
await handleSearch({ inputValue: res.result })
await handleSearch({ inputValue: res.result })
isFromScan.value = false
if (isScan.value){
handleScan()
}
@ -230,7 +237,7 @@ const onRefresherrefresh = async () => {
height: 50px;
line-height: 50px;
"
@input="handleSearch({ inputValue: searchVal })"
@input="onInputSearch"
clearable
/>
<view

View File

@ -7,12 +7,12 @@
<script setup>
import { reactive, ref, toRefs,nextTick,onMounted } from 'vue';
import { useRoute } from 'vue-router';
// import { useRoute } from 'vue-router';
import { onLoad, onShow } from '@dcloudio/uni-app'
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
const title = ref('图片预览');
const src = ref([]);
const route = useRoute();
// const route = useRoute();
const picture = ref('');
const previewImage = ref(null);

View File

@ -7,12 +7,12 @@
<script setup>
import { reactive, ref, toRefs,nextTick,onMounted } from 'vue';
import { useRoute } from 'vue-router';
// import { useRoute } from 'vue-router';
import { onLoad, onShow } from '@dcloudio/uni-app'
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
const title = ref('图片预览');
const src = ref([]);
const route = useRoute();
// const route = useRoute();
const picture = ref('');
const previewImage = ref(null);