You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
44 KiB

1 week ago
if("undefined"==typeof Promise||Promise.prototype.finally||(Promise.prototype.finally=function(e){const t=this.constructor;return this.then((a=>t.resolve(e()).then((()=>a))),(a=>t.resolve(e()).then((()=>{throw a}))))}),"undefined"!=typeof uni&&uni&&uni.requireGlobal){const e=uni.requireGlobal();ArrayBuffer=e.ArrayBuffer,Int8Array=e.Int8Array,Uint8Array=e.Uint8Array,Uint8ClampedArray=e.Uint8ClampedArray,Int16Array=e.Int16Array,Uint16Array=e.Uint16Array,Int32Array=e.Int32Array,Uint32Array=e.Uint32Array,Float32Array=e.Float32Array,Float64Array=e.Float64Array,BigInt64Array=e.BigInt64Array,BigUint64Array=e.BigUint64Array}uni.restoreGlobal&&uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval),function(e){"use strict";function t(e){return weex.requireModule(e)}function a(e,t,...a){uni.__log__?uni.__log__(e,t,...a):console[e].apply(console,[...a,t])}const n="http://192.168.60.99:9004/",i={BASE_API:n};function l(e){const t=uni.getStorageSync("token");return new Promise(((a,i)=>{uni.uploadFile({url:n+"api/admin/upload-file",filePath:e,name:"file",formData:{token:t},success:e=>{try{const t=JSON.parse(e.data);a(t)}catch(t){i(t)}},fail:i})}))}const o=(e,t)=>{const a=e.__vccOpts||e;for(const[n,i]of t)a[n]=i;return a};let s=1,r=!1,c=!1,d=!0;const m=o({data:()=>({currentDate:"",taskList:[],showH5Scan:!1,html5QrCode:null,scanType:"",btn1Info:"开始盘点",tagsAmount:0,btn2Disabled:!1,btn3Disabled:!1,cbDisabled:!1,dataList:[],pageNum:100,offset:50,epcList:[],tempList:[],asyncFlag:!1,voiceFlag:!0,barcodeFlag:!1,main:null,hhwUHFController:null,globalEvent:null,receiver:null,inventoryPlanList:[],planPage:1,planPageSize:5,planTotal:0,planLoading:!1,planHasMore:!0}),created(){c=this.asyncFlag,d=this.voiceFlag,r=this.barcodeFlag},onLoad(){this.updateDate(),this.initAndroidComponents(),this.initUHFEvent(),this.getInventoryPlanList(!0)},onShow(){a("log","at pages/index/index.vue:221","inventory Show"),this.initBarcodeScan(),this.disableBarcodeScanKey(),this.registerKeyReceiver()},onHide(){a("log","at pages/index/index.vue:232","inventory Hide"),this.main&&this.receiver&&this.main.unregisterReceiver(this.receiver)},methods:{updateDate(){const e=new Date,t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");this.currentDate=`${t}-${a}-${n}`},handleScan(e){this.scanType=e,uni.scanCode({success:t=>{let n=t.result.trim();a("log","at pages/index/index.vue:336","id2:",n),n=this.normalizeScannedId(n),n?/^\d+$/.test(n)?"inventory"===e?uni.navigateTo({url:`/pages/inventory/inventory?code=${encodeURIComponent(n)}`}):uni.navigateTo({url:`/pages/inventory/inventory?code=${encodeURIComponent(n)}&view=1`}):uni.showToast({title:"二维码信息错误",icon:"none"}):uni.showToast({title:"二维码无效",icon:"none"})},fail:()=>{uni.showToast({title:"扫码失败",icon:"none"})}})},scanInventory(){this.handleScan("inventory")},scanView(){this.handleScan("view")},closeH5Scan(){this.showH5Scan=!1,this.html5QrCode&&this.html5QrCode.stop().then((()=>{this.html5QrCode.clear()}))},async getInventoryPlanList(e=!1){var t,i;if(!this.planLoading)try{this.planLoading=!0,e&&(this.planPage=1,this.planHasMore=!0);const l={page:this.planPage,page_size:this.planPageSize},o=await function(e){const t=uni.getStorageSync("token");return new Promise(((a,i)=>{uni.request({url:n+"api/admin/material-infos-plan/index",method:"GET",data:{...e,token:t},success:a,fail:i})}))}(l);if(a("log","at pages/index/index.vue:393","盘点计划列表响应:",o),o.data&&40001===o.data.errcode)return uni.showToast({title:(null==(t=o.data)?void 0:t.errmsg)||"获取盘点计划失败",icon:"none"}),void uni.reLaunch({url:"/pages/login/login"});if(o.data&&o.data.list){const t=o.data.list,a=t.data||[];this.inventoryPlanList=e?a:[...this.inventoryPlanList,...a],this.planTotal=t.total||0,this.planHasMore=a.length===this.planPageSize,this.planHasMore&&this.planPage++}else uni.showToast({title:(null==(i=o.data)?void 0:i.message)||"获取盘点计划失败",icon:"none"})}catch(l){a("error","at pages/index/index.vue:427","获取盘点计<EFBFBD><EFBFBD>