|
@@ -12,13 +12,13 @@
|
|
<template v-slot:body>
|
|
<template v-slot:body>
|
|
<view class="ml-6" style="font-size: 14px;">
|
|
<view class="ml-6" style="font-size: 14px;">
|
|
<view class="name">
|
|
<view class="name">
|
|
- {{item}}
|
|
|
|
|
|
+ {{item.materialName}}
|
|
</view>
|
|
</view>
|
|
<view>
|
|
<view>
|
|
- {{item}}
|
|
|
|
|
|
+ {{item.specificationNumber}}
|
|
</view>
|
|
</view>
|
|
<view>
|
|
<view>
|
|
- {{item}}
|
|
|
|
|
|
+ {{item.proposedPosition}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
@@ -30,7 +30,7 @@
|
|
</scroll-view>
|
|
</scroll-view>
|
|
<view class="button-container" v-if="type==1">
|
|
<view class="button-container" v-if="type==1">
|
|
|
|
|
|
- <button class="btn" type="default" @click='startScan' v-if="isShowStartBtn" :loading="scanLoad">
|
|
|
|
|
|
+ <button class="btn" type="default" @click='startScan(1)' v-if="isShowStartBtn" :loading="scanLoad">
|
|
<uni-icons type="scan"></uni-icons>
|
|
<uni-icons type="scan"></uni-icons>
|
|
|
|
|
|
开始扫描
|
|
开始扫描
|
|
@@ -40,12 +40,12 @@
|
|
<uni-icons type="circle-filled"></uni-icons>
|
|
<uni-icons type="circle-filled"></uni-icons>
|
|
|
|
|
|
停止扫描</button>
|
|
停止扫描</button>
|
|
- <button class="btn" type="default" @click="toStorageClick">
|
|
|
|
|
|
+ <button class="btn" type="default" @click="toStorageClick" :loading="manualStorageLoading">
|
|
<uni-icons type="upload-filled"></uni-icons>
|
|
<uni-icons type="upload-filled"></uni-icons>
|
|
一键入库</button>
|
|
一键入库</button>
|
|
</view>
|
|
</view>
|
|
<view class="button-container" v-if="type==2">
|
|
<view class="button-container" v-if="type==2">
|
|
- <button class="btn" type="default" @click='startScan' v-if="isShowStartBtn" :loading="scanLoad">
|
|
|
|
|
|
+ <button class="btn" type="default" @click='startScan(2)' v-if="isShowStartBtn" :loading="scanLoad">
|
|
<uni-icons type="scan"></uni-icons>
|
|
<uni-icons type="scan"></uni-icons>
|
|
开始扫描</button>
|
|
开始扫描</button>
|
|
<button class="btn" type="default" @click='stopScan' v-if="!isShowStartBtn">
|
|
<button class="btn" type="default" @click='stopScan' v-if="!isShowStartBtn">
|
|
@@ -55,29 +55,29 @@
|
|
<uni-icons type="upload"></uni-icons>
|
|
<uni-icons type="upload"></uni-icons>
|
|
一键生成报告</button>
|
|
一键生成报告</button>
|
|
</view>
|
|
</view>
|
|
- <LottieAnimation :animationData="animationData" v-if="!isShowStartBtn" />
|
|
|
|
|
|
+
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
- import LottieAnimation from './LottieAnimation.vue';
|
|
|
|
- import animationData from '/static/lotte/circle.json'; // 导入你的动画 JSON 数据
|
|
|
|
- import {
|
|
|
|
- onMounted,
|
|
|
|
- ref,
|
|
|
|
- watch
|
|
|
|
- } from "vue";
|
|
|
|
|
|
+
|
|
|
|
+import {
|
|
|
|
+ onMounted,
|
|
|
|
+ ref,
|
|
|
|
+ watch
|
|
|
|
+} from "vue";
|
|
import {onLoad, onReady, onUnload} from '@dcloudio/uni-app'
|
|
import {onLoad, onReady, onUnload} from '@dcloudio/uni-app'
|
|
import {getArrValue} from "js-fast-way";
|
|
import {getArrValue} from "js-fast-way";
|
|
|
|
+import mainApi from '~api/storage.js';
|
|
|
|
|
|
|
|
|
|
// 获取 module
|
|
// 获取 module
|
|
-// const rfidModule = uni.requireNativePlugin("DeviceModule_RFID");
|
|
|
|
|
|
+const rfidModule = uni.requireNativePlugin("DeviceModule_RFID");
|
|
|
|
|
|
//渲染完成
|
|
//渲染完成
|
|
onReady(() => {
|
|
onReady(() => {
|
|
// #ifdef APP-PLUS
|
|
// #ifdef APP-PLUS
|
|
- // rfidModuleInit()
|
|
|
|
|
|
+ rfidModuleInit()
|
|
// #endif
|
|
// #endif
|
|
})
|
|
})
|
|
|
|
|
|
@@ -139,8 +139,11 @@ const keyListener = ({keyCode}) => {
|
|
}
|
|
}
|
|
|
|
|
|
//开始扫描
|
|
//开始扫描
|
|
|
|
+//开始扫描
|
|
|
|
+const isShowStartBtn=ref(true)
|
|
|
|
+const scanLoad=ref(false)
|
|
const isScan = ref(false)
|
|
const isScan = ref(false)
|
|
-const startScan = () => {
|
|
|
|
|
|
+const startScan = (type) => {
|
|
isShowStartBtn.value=false
|
|
isShowStartBtn.value=false
|
|
if (isRfidInit.value) return
|
|
if (isRfidInit.value) return
|
|
isScan.value = true
|
|
isScan.value = true
|
|
@@ -151,14 +154,15 @@ const startScan = () => {
|
|
title: '开启扫描成功'
|
|
title: '开启扫描成功'
|
|
})
|
|
})
|
|
} else if (res.code === 1) {
|
|
} else if (res.code === 1) {
|
|
- startScanData(res.data)
|
|
|
|
|
|
+ startScanData(res.data,type)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
//扫描结果处理
|
|
//扫描结果处理
|
|
|
|
+const codeIds=ref('')
|
|
const scanDatas = ref([])
|
|
const scanDatas = ref([])
|
|
-const startScanData = async (data) => {
|
|
|
|
|
|
+const startScanData = async (data,type) => {
|
|
const arr = getArrValue(data)
|
|
const arr = getArrValue(data)
|
|
let epcs = scanDatas.value
|
|
let epcs = scanDatas.value
|
|
for (let i = 0; i < arr.length; i++) {
|
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -168,10 +172,27 @@ const startScanData = async (data) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
scanDatas.value = epcs
|
|
scanDatas.value = epcs
|
|
- console.log(scanDatas.value,'scanDatas.value');
|
|
|
|
- listArr.value=scanDatas.value
|
|
|
|
|
|
+ codeIds.value=epcs.join(',')
|
|
|
|
+ getResult(type)
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+//获取扫描结果
|
|
|
|
+const getResult=async(type)=>{
|
|
|
|
+ console.log('发请求');
|
|
|
|
+ const { response,error, code, data } = await mainApi.getSelectRfidListById({
|
|
|
|
+ rids:codeIds.value,
|
|
|
|
+ state:type
|
|
|
|
+ });
|
|
|
|
+ //处理数据
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ console.log( listArr.value,' listArr.value');
|
|
|
|
+ listArr.value = getArrValue(data);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ listArr.value = [];
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+}
|
|
//停止扫描
|
|
//停止扫描
|
|
const stopScan = () => {
|
|
const stopScan = () => {
|
|
|
|
|
|
@@ -199,30 +220,53 @@ onUnload(()=>{
|
|
rfidModule.free();
|
|
rfidModule.free();
|
|
// #endif
|
|
// #endif
|
|
})
|
|
})
|
|
-const listArr=ref([
|
|
|
|
- {name:' 水泥(42.5级散装)',num:'SN20015678',postion:'路基、路面、桥梁、隧道'},
|
|
|
|
- {name:' 水泥(42.5级散装)',num:'SN20015678',postion:'路基、路面、桥梁、隧道'},
|
|
|
|
-
|
|
|
|
-])
|
|
|
|
-//开始扫描
|
|
|
|
-const isShowStartBtn=ref(true)
|
|
|
|
-const scanLoad=ref(false)
|
|
|
|
|
|
+const listArr=ref([])
|
|
|
|
|
|
-const toStorageClick=()=>{
|
|
|
|
|
|
+//一键入库
|
|
|
|
+const manualStorageLoading=ref(false)
|
|
|
|
+const toStorageClick=async()=>{
|
|
if(!isShowStartBtn.value){
|
|
if(!isShowStartBtn.value){
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '请先停止扫描',
|
|
title: '请先停止扫描',
|
|
icon: 'none',
|
|
icon: 'none',
|
|
duration: 3000
|
|
duration: 3000
|
|
})
|
|
})
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
+ manualStorageLoading.value = true;
|
|
|
|
+ console.log(codeIds.value,'codeIds.value');
|
|
|
|
+ if(codeIds.value.length<1){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const { error, code, msg,response } = await mainApi.update({
|
|
|
|
+ id: codeIds.value,
|
|
|
|
+ sampleStatus: 2,
|
|
|
|
+ });
|
|
|
|
+ console.log(response,'response');
|
|
|
|
+ manualStorageLoading.value = false;
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title:'操作成功',
|
|
|
|
+ duration: 2000,
|
|
|
|
+ mask: true
|
|
|
|
+ });
|
|
|
|
+ getResult().then();
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title:'操作失败',
|
|
|
|
+ duration: 2000,
|
|
|
|
+ mask: true
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
const clearItem=(item,index)=>{
|
|
const clearItem=(item,index)=>{
|
|
listArr.value.splice(index,1)
|
|
listArr.value.splice(index,1)
|
|
}
|
|
}
|
|
-//一键入库
|
|
|
|
-const storageLoad=ref(false)
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//一键生成报告
|
|
//一键生成报告
|
|
|
|
+
|
|
|
|
+
|
|
const toReport=()=>{
|
|
const toReport=()=>{
|
|
if(!isShowStartBtn.value){
|
|
if(!isShowStartBtn.value){
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -230,6 +274,7 @@ const toReport=()=>{
|
|
icon: 'none',
|
|
icon: 'none',
|
|
duration: 3000
|
|
duration: 3000
|
|
})
|
|
})
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|