diff --git a/apis/request.js b/apis/request.js index e776583..d21491a 100644 --- a/apis/request.js +++ b/apis/request.js @@ -19,8 +19,8 @@ class Http { title: "登录状态过期,请重新登录!", success: () => { uni.reLaunch({ - // url: "/pages/login/login", - url: "/pages/nwLogin/index", + url: "/pages/login/login", + // url: "/pages/nwLogin/index", }); }, }); @@ -56,8 +56,8 @@ class Http { title: "登录状态过期,请重新登录!", success: () => { uni.reLaunch({ - // url: "/pages/login/login", - url: "/pages/nwLogin/index", + url: "/pages/login/login", + // url: "/pages/nwLogin/index", }); }, }); @@ -93,8 +93,8 @@ class Http { title: "登录状态过期,请重新登录!", success: () => { uni.reLaunch({ - // url: "/pages/login/login", - url: "/pages/nwLogin/index", + url: "/pages/login/login", + // url: "/pages/nwLogin/index", }); }, }); @@ -129,8 +129,8 @@ class Http { title: "登录状态过期,请重新登录!", success: () => { uni.reLaunch({ - // url: "/pages/login/login", - url: "/pages/nwLogin/index", + url: "/pages/login/login", + // url: "/pages/nwLogin/index", }); }, }); @@ -163,8 +163,8 @@ class Http { title: "登录状态过期,请重新登录!", success: () => { uni.reLaunch({ - // url: "/pages/login/login", - url: "/pages/nwLogin/index", + url: "/pages/login/login", + // url: "/pages/nwLogin/index", }); }, }); diff --git a/pages/backMaterialReceiveDetail/backMaterialReceiveDetail.vue b/pages/backMaterialReceiveDetail/backMaterialReceiveDetail.vue index dbccee2..a5b5cc6 100644 --- a/pages/backMaterialReceiveDetail/backMaterialReceiveDetail.vue +++ b/pages/backMaterialReceiveDetail/backMaterialReceiveDetail.vue @@ -25,12 +25,13 @@ 待退料数量

{{ fetch.maxBackNum }}

+
+ > 点击退料
@@ -42,10 +43,11 @@ 全选 --> + + > 完成退料 @@ -72,7 +74,7 @@ 二维码 编码接收 - + RFID接收 + RFID出库 + + + + + + + + + + + +

标签编号:

+ {{ qrcode }} +
+ + + + + + RFID: + + +
+ +
+ + + +
+
+
+

{{ promptMessage }}

+
+
+ 开始识别 - 绑定 + 绑定 + 绑定 @@ -71,94 +101,156 @@ data() { return { showStats: false, + showDev: false, + showBid: true, rfidCode: '', maId: '', maCode: '', powerVal: 0, powerRange: [ - + ], - bindStats: {} + bindStats: {}, + showLoading: false, + qrFormData: { + typeVal: '', + specVal: '', + deviceCode: '' + }, + rules: { + typeVal: { + rules: [{ + required: true, + errorMessage: '请输设备类型!' + }] + }, + specVal: { + rules: [{ + required: true, + errorMessage: '请输规格型号!' + }] + }, + deviceCode: { + rules: [{ + required: true, + errorMessage: '请输设备编号!' + }] + }, + }, + + qrcode: '', + typeRange: [], + specRange: [], + rfid: '', + + showPrompt: false, // 控制提示框的显示状态 + promptMessage: '' // 存储提示信息 } }, methods: { - startVeri () { + startVeri() { let that = this - let goVeri = rfidMod.redTag() - console.log(goVeri); - if (goVeri.code == 1001) { - that.rfidCode = goVeri.res - uni.showToast({ - icon: 'none', - title: '识别成功', - success: () => { - // 调用编码获取设备信息 - that.$api.fetchMaterialOutStore.searchRfid({ - rfidCode: goVeri.res - }).then(res => { - console.log(res); - if (res.data.code == 200) { - that.bindStats = res.data.data[0] - that.maCode = res.data.data[0].maCode - that.maId = res.data.data[0].maId - that.showStats = true - } - }).catch(err => { - console.log(err); - }) - } - }) - } else if (goVeri.code == 1000) { - that.showLoading = false - uni.showToast({ - icon: 'none', - title: '获取设备信息失败,请重新扫描!' - }) - } + that.showPrompt = true; + that.promptMessage = '识别中,请稍候...'; + + // 延迟关闭提示,显示Toast + setTimeout(() => { + let goVeri = rfidMod.redTag() + console.log(goVeri); + if (goVeri.code == 1001) { + that.showPrompt = false; // 关闭提示 + that.rfidCode = goVeri.res + uni.showToast({ + icon: 'none', + title: '识别成功', + success: () => { + // 调用编码获取设备信息 + that.$api.fetchMaterialOutStore.searchRfid({ + rfidCode: goVeri.res + }).then(res => { + console.log(res); + console.log(res.data.data[0]); + + if (res.data.data.length > 0) { + that.bindStats = res.data.data[0] + that.maCode = res.data.data[0].maCode + that.maId = res.data.data[0].maId + that.showStats = true + that.showDev = false + that.showBid = true + } else { + that.showDev = true + that.showBid = false + that.showStats = false + that.rfid = that.rfidCode + } + }).catch(err => { + console.log(err); + }) + } + }) + } else if (goVeri.code == 1000) { + that.showPrompt = false; // 关闭提示 + that.showLoading = false + uni.showToast({ + icon: 'none', + title: '获取设备信息失败,请重新扫描!' + }) + } + }, 1000) }, - toggleBind () { + toggleBind() { let that = this - if (that.maCode == '' || that.maId == '') { - uni.showToast({ - icon: 'none', - title: '未识别到绑定设备!' - }) - } else { - that.$api.rfidBinding.bindRfid({ - rfidCode: that.rfidCode, - maId: that.maId, - maCode: that.maCode, - }).then(res => { - console.log(res); - if (res.data.code == 200) { - uni.showToast({ - icon: 'none', - title: res.data.msg, - success: () => { - uni.switchTab({ - url: '/pages/workSpace/workSpace' - }) - } - }) - } else { - uni.showToast({ - icon: 'none', - title: res.data.msg - }) - } - }).catch(err => { - console.log(err); - }) - } + this.showPrompt = true; + this.promptMessage = '正在绑定,请稍候...'; + // 延迟关闭提示,显示Toast + setTimeout(() => { + + if (that.maCode == '' || that.maId == '') { + this.showPrompt = false; // 关闭提示 + uni.showToast({ + icon: 'none', + title: '未识别到绑定设备!' + }) + } else { + that.$api.rfidBinding.bindRfid({ + rfidCode: that.rfidCode, + maId: that.maId, + maCode: that.maCode, + }).then(res => { + this.showPrompt = false; // 关闭提示 + console.log(res); + if (res.data.code == 200) { + uni.showToast({ + icon: 'none', + title: res.data.msg, + success: () => { + uni.switchTab({ + url: '/pages/workSpace/workSpace' + }) + } + }) + } else { + uni.showToast({ + icon: 'none', + title: res.data.msg + }) + } + }).catch(err => { + this.showPrompt = false; // 关闭提示 + console.log(err); + }) + } + }, 1000) }, - clearStat () { + clearStat() { let that = this that.rfidCode = '' that.maCode = '' that.maId = '' that.showStats = false }, - powerChange (e) { + powerChange(e) { console.log(e); const ctrlPower = rfidMod.setPower(e) console.log(ctrlPower); @@ -166,7 +258,88 @@ icon: 'none', title: ctrlPower.res }) + }, + // 根据设备类型获取规格类型 + typeChange(e) { + let that = this + console.log(e); + // 根据设备类型获取规格类型 + that.$api.qrcodeBinding.fetchDeviceSpec({ + level: '4', + parentId: String(e.value) + }).then(res => { + console.log(res); + if (res.data.code == 200) { + that.specRange = res.data.data.map(item => { + return { + text: item['typeName'], + value: item['typeId'], + code: item['code'], + modelCode: item['modelCode'] + } + }) + } + }).catch(err => { + console.log(err); + }) + }, + + specChange(e) { + let that = this + console.log(e, that.specRange); + const confirmedRange = that.specRange.filter(item => { + return item.value == e + }) + console.log(confirmedRange); + if (confirmedRange[0].code && confirmedRange[0].modelCode) { + that.qrFormData.deviceCode = `NS${confirmedRange[0].code}${confirmedRange[0].modelCode}` + } else { + that.qrFormData.deviceCode = '' + } + + }, + toggleBinds() { + let that = this + + this.showPrompt = true; + this.promptMessage = '识别中,请稍候...'; + // 延迟关闭提示,显示Toast + setTimeout(() => { + that.$refs.qrForm.validate().then(formData => { + that.showLoading = true + console.log(formData); + that.$api.rfidBinding.bindRfid({ + rfidCode: that.rfidCode, + maCode: formData.deviceCode, + }).then(res => { + this.showPrompt = false; // 关闭提示 + console.log(res); + if (res.data.code == 200) { + that.showLoading = false + uni.showToast({ + icon: 'none', + title: res.data.msg, + success: () => { + uni.switchTab({ + url: '/pages/workSpace/workSpace' + }) + } + }) + } else { + that.showLoading = false + uni.showToast({ + icon: 'none', + title: res.data.msg + }) + } + }).catch(err => { + this.showPrompt = false; // 关闭提示 + console.log(err); + }) + }) + }, 1000) } + }, onLoad() { // 初始化rfid识别 @@ -179,12 +352,30 @@ text: String(i) }) } + + let that = this + // 获取机具设备类型 + that.$api.qrcodeBinding.fetchDeviceType({ + level: '3' + }).then(res => { + console.log(res); + if (res.data.code == 200) { + that.typeRange = res.data.data.map(item => { + return { + text: item['typeName'], + value: item['typeId'] + } + }) + } + }).catch(err => { + console.log(err); + }) } } + + // 添加新的加载效果样式 + .custom-loading-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 9999; + } + + .custom-loading-content { + background-color: white; + padding: 20px; + border-radius: 10px; + display: flex; + flex-direction: column; + align-items: center; + } + + .custom-spinner { + width: 40px; + height: 40px; + border: 4px solid #f3f3f3; + border-top: 4px solid #3498db; + border-radius: 50%; + animation: spin 1s linear infinite; + margin-bottom: 10px; + } + \ No newline at end of file diff --git a/pages/rfidOutStore/rfidOutStore.vue b/pages/rfidOutStore/rfidOutStore.vue index 831b933..a5dc855 100644 --- a/pages/rfidOutStore/rfidOutStore.vue +++ b/pages/rfidOutStore/rfidOutStore.vue @@ -1,5 +1,16 @@