小程序:质检报工调整,将输入和扫码事件拆分为
This commit is contained in:
parent
fbab232b17
commit
6f60eed92d
@ -12,6 +12,7 @@ const userId = userStore.userInfo.userId
|
|||||||
const isFinish = ref(false)
|
const isFinish = ref(false)
|
||||||
// 是否继续扫码
|
// 是否继续扫码
|
||||||
const isScan = ref(false)
|
const isScan = ref(false)
|
||||||
|
const isFromScan = ref(false)
|
||||||
// 是否触发下拉刷新
|
// 是否触发下拉刷新
|
||||||
const isTriggered = ref(false)
|
const isTriggered = ref(false)
|
||||||
// 定义 porps
|
// 定义 porps
|
||||||
@ -132,6 +133,10 @@ const handleSearch = async (e) => {
|
|||||||
saveSearchValue(queryParams.subOrDetailName)
|
saveSearchValue(queryParams.subOrDetailName)
|
||||||
await getListData();
|
await getListData();
|
||||||
};
|
};
|
||||||
|
const onInputSearch = (e) => {
|
||||||
|
if (isFromScan.value) return;
|
||||||
|
handleSearch({ inputValue: e.detail?.value ?? searchVal.value });
|
||||||
|
};
|
||||||
const viewClick = async (item) => {
|
const viewClick = async (item) => {
|
||||||
const params = {
|
const params = {
|
||||||
id: item.id
|
id: item.id
|
||||||
@ -145,8 +150,10 @@ const viewClick = async (item) => {
|
|||||||
const handleScan = async() => {
|
const handleScan = async() => {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: async(res) => {
|
success: async(res) => {
|
||||||
|
isFromScan.value = true
|
||||||
searchVal.value = res.result
|
searchVal.value = res.result
|
||||||
await handleSearch({ inputValue: res.result })
|
await handleSearch({ inputValue: res.result })
|
||||||
|
isFromScan.value = false
|
||||||
if (isScan.value){
|
if (isScan.value){
|
||||||
handleScan()
|
handleScan()
|
||||||
}
|
}
|
||||||
@ -230,7 +237,7 @@ const onRefresherrefresh = async () => {
|
|||||||
height: 50px;
|
height: 50px;
|
||||||
line-height: 50px;
|
line-height: 50px;
|
||||||
"
|
"
|
||||||
@input="handleSearch({ inputValue: searchVal })"
|
@input="onInputSearch"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
<view
|
<view
|
||||||
|
|||||||
@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, toRefs,nextTick,onMounted } from 'vue';
|
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 { onLoad, onShow } from '@dcloudio/uni-app'
|
||||||
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
||||||
const title = ref('图片预览');
|
const title = ref('图片预览');
|
||||||
const src = ref([]);
|
const src = ref([]);
|
||||||
const route = useRoute();
|
// const route = useRoute();
|
||||||
const picture = ref('');
|
const picture = ref('');
|
||||||
const previewImage = ref(null);
|
const previewImage = ref(null);
|
||||||
|
|
||||||
|
|||||||
@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, toRefs,nextTick,onMounted } from 'vue';
|
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 { onLoad, onShow } from '@dcloudio/uni-app'
|
||||||
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
||||||
const title = ref('图片预览');
|
const title = ref('图片预览');
|
||||||
const src = ref([]);
|
const src = ref([]);
|
||||||
const route = useRoute();
|
// const route = useRoute();
|
||||||
const picture = ref('');
|
const picture = ref('');
|
||||||
const previewImage = ref(null);
|
const previewImage = ref(null);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user