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","获取盘点计划列表失败:",l),uni.showToast({title:"获取盘点计划失败",icon:"none"})}finally{this.planLoading=!1}},refreshPlans(){this.getInventoryPlanList(!0)},loadMorePlans(){this.planHasMore&&!this.planLoading&&this.getInventoryPlanList(!1)},getStatusText:e=>({0:"未开始",1:"进行中",2:"已完成"}[e]||"未知状态"),getTypeText:e=>({1:"年度",2:"季度"}[e]||"未知类型"),formatDate(e){if(!e)return"";const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},viewPlanDetail(e){a("log","at pages/index/index.vue:479","查看计划详情:",e);const t=encodeURIComponent(JSON.stringify(e));uni.navigateTo({url:`/pages/plan-detail/plan-detail?planInfo=${t}&planId=${e.id}`})},getProgress(e){if(2===e.status)return 100;if(0===e.status)return 0;const t=new Date,a=new Date(e.start_date),n=new Date(e.end_date);if(tn)return 100;const i=n.getTime()-a.getTime(),l=t.getTime()-a.getTime();return Math.round(l/i*100)},initAndroidComponents(){try{this.main=plus.android.runtimeMainActivity(),this.hhwUHFController=getApp().globalData.hhwUHFController,this.globalEvent=getApp().globalData.globalEvent}catch(e){a("error","at pages/index/index.vue:517","初始化Android组件失败:",e)}},initUHFEvent(){this.globalEvent&&this.globalEvent.addEventListener("uhf_tag_event",(e=>{this.handleUHFEvent(e)}))},handleUHFEvent(e){a("log","at pages/index/index.vue:533",e.tag_info_list);var t=e.tag_info_list;if(null!=t){for(var n=0;n{plus.android.importClass(t);var n=t.getIntExtra("keyCode",0),i=t.getBooleanExtra("keydown",!1);i&&1==s&&137==n?(a("log","at pages/index/index.vue:594","inventory","receive keyUp code: "+n),r?this.startBarcodeScan():this.startInventory(),s++):i||(r?this.stopBarcodeScan():this.stopInventory(),s=1)}}),this.main.registerReceiver(this.receiver,e)}},disableBarcodeScanKey(){if(this.main){var e=new(plus.android.importClass("android.content.Intent"))("com.rfid.KEY_SET");e.putExtra("keyValueArray",["137"]),e.putExtra("137",!1),this.main.sendBroadcast(e)}},bytes2HexString:e=>Array.from(e,(function(e){return("0"+(255&e).toString(16)).slice(-2)})).join(""),hexString2Bytes(e){var t=0,a=e.length;if(a%2!=0)return null;a/=2;for(var n=new Array,i=0;i({id:e.id||e.material_info_id||e.inventory_id||"",zichanmingcheng:e.zichanmingcheng||"",total_num:e.total_num??e.inventorys_total??e.zaikushuliang??0})))},normalizeScannedId(e){if(!e)return"";const t=String(e).trim();if(/^\d+$/.test(t))return t;if(/^\d+(?:\.\d+)?$/.test(t)){const e=Number(t);if(!Number.isNaN(e)&&Number.isFinite(e))return Math.trunc(e).toString()}return""},goInventoryFromList(e){const t=e&&e.id;t?uni.navigateTo({url:`/pages/inventory/inventory?code=${encodeURIComponent(t)}`}):uni.showToast({title:"无法获取物资ID",icon:"none"})},initBarcodeScan(){if(this.main){var e=new(plus.android.importClass("android.content.Intent"))("com.rfid.SCAN_INIT");this.main.sendBroadcast(e)}},startBarcodeScan(){if(this.main){var e=new(plus.android.importClass("android.content.Intent"))("com.rfid.SCAN_CMD");this.main.sendBroadcast(e)}},stopBarcodeScan(){if(this.main){var e=new(plus.android.importClass("android.content.Intent"))("com.rfid.STOP_SCAN");this.main.sendBroadcast(e)}},handleInventory(){"开始盘点"==this.btn1Info?this.startInventory():this.stopInventory()},startInventory(){this.hhwUHFController?(this.btn2Disabled=!0,this.btn3Disabled=!0,this.cbDisabled=!0,this.btn1Info="停止盘点",this.hhwUHFController.setCancleInventoryFilter(),c?this.hhwUHFController.startInventory(30,0,!0,0,d,(e=>{a("log","at pages/index/index.vue:759","inventory inventory","startInventory "+e)})):(a("log","at pages/index/index.vue:763","async_flag"),this.hhwUHFController.startInventory(30,0,!1,0,d,(e=>{a("log","at pages/index/index.vue:765","inventory inventory","startInventory "+e)})))):uni.showToast({title:"UHF控制器未初始化",icon:"none"})},stopInventory(){this.hhwUHFController&&(c?this.hhwUHFController.stopInventory(!0):this.hhwUHFController.stopInventory(!1))},clearTags(){this.dataList=[],this.tempList=[],this.epcList=[],this.tagsAmount=0,this.offset=50,this.taskList=[]},viewMaterials(){const e=this.epcList.length?this.epcList:this.dataList.map((e=>e.epc)).filter(Boolean);if(!e.length)return void uni.showToast({title:"请先获取标签数据",icon:"none"});const t=e.join(",");uni.showLoading({title:"查询中..."}),function(e){const t=uni.getStorageSync("token");return new Promise(((a,i)=>{uni.request({url:n+"api/admin/inventory/index",method:"GET",data:{...e,token:t},success:a,fail:i})}))}({ids:t,page:1,page_size:999}).then((e=>{uni.hideLoading(),a("log","at pages/index/index.vue:810","res:",e);const t=this.formatMaterialList(e);if(0===t.length)return this.taskList=[],void uni.showToast({title:"未查询到物资信息",icon:"none"});this.taskList=t})).catch((e=>{a("error","at pages/index/index.vue:823","viewMaterials error",e),uni.hideLoading(),uni.showToast({title:"获取物资失败",icon:"none"})}))},loadmore(){if(a("log","at pages/index/index.vue:833","inventory loadmore","dataList size1: "+this.dataList.length,"temList size: "+this.tempList.length),this.dataList.length>=this.tempList.length)a("log","at pages/index/index.vue:835","inventory loadmore","nomore");else{var e;e=this.tempList.length-this.offset>=this.pageNum?this.pageNum:this.tempList.length-this.offset;for(var t=this.offset;to.loadMorePlans&&o.loadMorePlans(...e)),"lower-threshold":"100",onRefresherrefresh:a[8]||(a[8]=(...e)=>o.refreshPlans&&o.refreshPlans(...e)),"refresher-enabled":"true","refresher-triggered":l.planLoading},[e.createElementVNode("view",{class:"index-content"},[e.createElementVNode("view",{class:"btn-group"},[e.createElementVNode("button",{class:"main-btn",onClick:a[0]||(a[0]=(...e)=>o.scanInventory&&o.scanInventory(...e))},"扫码盘点"),e.createElementVNode("button",{class:"main-btn outline",onClick:a[1]||(a[1]=(...e)=>o.scanView&&o.scanView(...e))},"扫码查看")]),e.createElementVNode("view",{class:"inventory-section"},[e.createElementVNode("view",{class:"inventory-header"},[e.createElementVNode("text",{class:"inventory-title"},"标签盘点"),e.createElementVNode("text",{class:"tags-amount"},"标签数量: "+e.toDisplayString(l.tagsAmount),1)]),e.createElementVNode("scroll-view",{class:"tag-list","scroll-y":"",onScrolltolower:a[2]||(a[2]=(...e)=>o.loadmore&&o.loadmore(...e)),"lower-threshold":"50"},[e.createElementVNode("view",{class:"list-item-head"},[e.createElementVNode("text",{class:"list-item-text-id"},"序号"),e.createElementVNode("text",{class:"list-item-text-epc"},"标签信息"),e.createElementVNode("text",{class:"list-item-text-count"},"次数"),e.createElementVNode("text",{class:"list-item-text-rssi"},"信号强度")]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.dataList,(t=>(e.openBlock(),e.createElementBlock("view",{class:"list-item",key:t.id},[e.createElementVNode("text",{class:"list-item-text-id"},e.toDisplayString(t.id+1),1),e.createElementVNode("text",{class:"list-item-text-epc"},e.toDisplayString(t.epc),1),e.createElementVNode("text",{class:"list-item-text-count"},e.toDisplayString(t.count),1),e.createElementVNode("text",{class:"list-item-text-rssi"},e.toDisplayString(t.rssi),1)])))),128))],32),e.createElementVNode("view",{class:"inventory-options"}),e.createElementVNode("view",{class:"inventory-btn-box"},[e.createElementVNode("button",{type:"primary",onClick:a[3]||(a[3]=(...e)=>o.handleInventory&&o.handleInventory(...e)),class:"inventory-btn"},e.toDisplayString(l.btn1Info),1),e.createElementVNode("button",{type:"primary",disabled:l.btn2Disabled,onClick:a[4]||(a[4]=(...e)=>o.viewMaterials&&o.viewMaterials(...e)),class:"inventory-btn"},"查看物资",8,["disabled"])]),e.createElementVNode("view",null,[e.createElementVNode("button",{type:"primary",disabled:l.btn3Disabled,onClick:a[5]||(a[5]=(...e)=>o.clearTags&&o.clearTags(...e)),class:"inventory-btn clear-btn"},"清空",8,["disabled"])])]),e.createElementVNode("view",{class:"task-section"},[e.createElementVNode("view",{class:"task-title"},"物资列表"),e.createElementVNode("view",{class:"task-list"},[e.createElementVNode("view",{class:"task-item",style:{"font-weight":"600"}},[e.createElementVNode("view",{class:"task-info"},[e.createElementVNode("text",{class:"task-name"},"物资名称")]),e.createElementVNode("view",{class:"task-info",style:{"flex-direction":"row","align-items":"center",gap:"8rpx"}},[e.createElementVNode("text",{class:"task-time"},"库存")]),e.createElementVNode("view",{class:"task-info",style:{width:"120rpx","text-align":"right"}},[e.createElementVNode("text",{class:"task-time"},"操作")])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.taskList,((t,a)=>(e.openBlock(),e.createElementBlock("view",{class:"task-item",key:a},[e.createElementVNode("view",{class:"task-info"},[e.createElementVNode("text",{class:"task-name"},e.toDisplayString(t.zichanmingcheng),1)]),e.createElementVNode("view",{class:"task-info",style:{"flex-direction":"row","align-items":"center",gap:"8rpx"}},[e.createElementVNode("text",{class:"task-time"},e.toDisplayString(t.total_num),1)]),e.createElementVNode("view",{class:"task-info",style:{width:"120rpx",display:"flex","justify-content":"flex-end"}},[e.createElementVNode("button",{size:"mini",type:"primary",onClick:e.withModifiers((e=>o.goInventoryFromList(t)),["stop"])},"盘点",8,["onClick"])])])))),128))])]),e.createElementVNode("view",{class:"inventory-plan-section"},[e.createElementVNode("view",{class:"inventory-plan-header"},[e.createElementVNode("text",{class:"inventory-plan-title"},"盘点计划")]),e.createElementVNode("view",{class:"plan-list"},[e.createElementVNode("view",{class:"plan-item",style:{"font-weight":"600"}},[e.createElementVNode("view",{class:"plan-info plan-name-col"},[e.createElementVNode("text",{class:"plan-name"},"计划名称")]),e.createElementVNode("view",{class:"plan-info plan-status-col"},[e.createElementVNode("text",{class:"plan-time"},"状态")]),e.createElementVNode("view",{class:"plan-info plan-date-col"},[e.createElementVNode("text",{class:"plan-time"},"开始日期")]),e.createElementVNode("view",{class:"plan-info plan-date-col"},[e.createElementVNode("text",{class:"plan-time"},"结束日期")]),e.createElementVNode("view",{class:"plan-info plan-action-col"},[e.createElementVNode("text",{class:"plan-time"},"操作")])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.inventoryPlanList,(t=>(e.openBlock(),e.createElementBlock("view",{class:"plan-item",key:t.id},[e.createElementVNode("view",{class:"plan-info plan-name-col"},[e.createElementVNode("text",{class:"plan-name"},e.toDisplayString(t.name),1)]),e.createElementVNode("view",{class:"plan-info plan-status-col"},[e.createElementVNode("text",{class:e.normalizeClass(["plan-status","status-"+t.status])},e.toDisplayString(o.getStatusText(t.status)),3)]),e.createElementVNode("view",{class:"plan-info plan-date-col"},[e.createElementVNode("text",{class:"plan-time"},e.toDisplayString(o.formatDate(t.start_date)),1)]),e.createElementVNode("view",{class:"plan-info plan-date-col"},[e.createElementVNode("text",{class:"plan-time"},e.toDisplayString(o.formatDate(t.end_date)),1)]),e.createElementVNode("view",{class:"plan-info plan-action-col"},[e.createElementVNode("button",{size:"mini",type:"primary",onClick:e.withModifiers((e=>o.viewPlanDetail(t)),["stop"])},"查看",8,["onClick"])])])))),128))]),l.planLoading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"load-more"},[e.createElementVNode("view",{class:"loading-spinner"}),e.createElementVNode("text",{class:"loading-text"},"加载中...")])):!l.planHasMore&&l.inventoryPlanList.length>0?(e.openBlock(),e.createElementBlock("view",{key:1,class:"load-more"},[e.createElementVNode("text",{class:"no-more-text"},"— 没有更多数据了 —")])):e.createCommentVNode("",!0)]),l.showH5Scan?(e.openBlock(),e.createElementBlock("div",{key:0,class:"h5-scan-modal"},[e.createElementVNode("div",{id:"reader",style:{width:"300px",height:"300px",margin:"0 auto"}}),e.createElementVNode("button",{onClick:a[6]||(a[6]=(...e)=>o.closeH5Scan&&o.closeH5Scan(...e))},"关闭")])):e.createCommentVNode("",!0)])],40,["refresher-triggered"])}]]);const u=o({data:()=>({userInfo:{}}),onShow(){(function(){const e=uni.getStorageSync("token");return new Promise(((t,a)=>{uni.request({url:n+"api/admin/auth/me",method:"POST",data:{token:e},success:t,fail:a})}))})().then((e=>{e.data?(a("log","at pages/profile/profile.vue:36","返回数据",e.data),this.userInfo=e.data):uni.showToast({title:e.data.errmsg||"获取信息失败",icon:"none"})})).catch((()=>{uni.showToast({title:"网络错误",icon:"none"})}))},methods:{logout(){uni.removeStorageSync("token"),uni.reLaunch({url:"/pages/login/login"})}}},[["render",function(t,a,n,i,l,o){return e.openBlock(),e.createElementBlock("view",{class:"profile-container"},[e.createElementVNode("view",{class:"avatar-section"},[e.createElementVNode("image",{class:"avatar",src:l.userInfo.avatar||"/static/profile/avatar.png",mode:"aspectFill"},null,8,["src"])]),e.createElementVNode("view",{class:"info-section"},[e.createElementVNode("view",{class:"info-item"},[e.createElementVNode("text",{class:"label"},"用户名:"),e.createElementVNode("text",{class:"value"},e.toDisplayString(l.userInfo.username||"-"),1)]),e.createElementVNode("view",{class:"info-item"},[e.createElementVNode("text",{class:"label"},"姓名:"),e.createElementVNode("text",{class:"value"},e.toDisplayString(l.userInfo.name||"-"),1)]),e.createElementVNode("view",{class:"info-item"},[e.createElementVNode("text",{class:"label"},"部门:"),e.createElementVNode("text",{class:"value"},e.toDisplayString(l.userInfo.department&&l.userInfo.department.name||"-"),1)])]),e.createElementVNode("button",{class:"logout-btn",onClick:a[0]||(a[0]=(...e)=>o.logout&&o.logout(...e))},"退出登录")])}]]);const h=o({data:()=>({username:"",password:""}),methods:{handleLogin(){var e,t;this.username&&this.password?(uni.showLoading({title:"登录中...",mask:!0}),(e=this.username,t=this.password,new Promise(((a,i)=>{uni.request({url:n+"api/admin/auth/login",method:"POST",data:{username:e,password:t},success:a,fail:i})}))).then((e=>{uni.hideLoading(),a("log","at pages/login/login.vue:41",e),e.data&&void 0!==e.data.errcode?uni.showToast({title:e.data.errmsg||"登录失败",icon:"none"}):e.data&&(a("log","at pages/login/login.vue:48",e.data.access_token),e.data.access_token&&uni.setStorageSync("token",e.data.access_token),uni.showToast({title:"登录成功",icon:"success",duration:1500}),setTimeout((()=>{uni.switchTab({url:"/pages/index/index"})}),1500))})).catch((()=>{uni.hideLoading(),uni.showToast({title:"网络错误",icon:"none"})}))):uni.showToast({title:"请输入用户名和密码",icon:"none"})}}},[["render",function(t,a,n,i,l,o){return e.openBlock(),e.createElementBlock("view",{class:"login-bg"},[e.createElementVNode("view",{class:"login-card"},[e.createElementVNode("view",{class:"login-title"},"欢迎登录"),e.createElementVNode("view",{class:"login-subtitle"},"河道防汛物资管理系统"),e.createElementVNode("view",{class:"form-group"},[e.createElementVNode("text",{class:"form-label"},"用户名"),e.withDirectives(e.createElementVNode("input",{class:"form-input",type:"text","onUpdate:modelValue":a[0]||(a[0]=e=>l.username=e),placeholder:"请输入用户名"},null,512),[[e.vModelText,l.username]])]),e.createElementVNode("view",{class:"form-group"},[e.createElementVNode("text",{class:"form-label"},"密码"),e.withDirectives(e.createElementVNode("input",{class:"form-input",type:"password","onUpdate:modelValue":a[1]||(a[1]=e=>l.password=e),placeholder:"请输入密码"},null,512),[[e.vModelText,l.password]])]),e.createElementVNode("button",{class:"login-btn",onClick:a[2]||(a[2]=(...e)=>o.handleLogin&&o.handleLogin(...e))},"登 录")])])}]]);const p=o({data:()=>({result:""}),methods:{doScan(){uni.scanCode({success:e=>{this.result=e.result},fail:()=>{uni.showToast({title:"扫码失败",icon:"none"})}})}}},[["render",function(t,a,n,i,l,o){return e.openBlock(),e.createElementBlock("view",{class:"scan-bg"},[e.createElementVNode("view",{class:"scan-title"},"扫码盘点"),e.createElementVNode("button",{class:"scan-btn",onClick:a[0]||(a[0]=(...e)=>o.doScan&&o.doScan(...e))},"点击开始扫码"),l.result?(e.openBlock(),e.createElementBlock("view",{key:0,class:"scan-result"},[e.createElementVNode("text",{class:"result-label"},"扫码结果:"),e.createElementVNode("text",{class:"result-value"},e.toDisplayString(l.result),1)])):e.createCommentVNode("",!0)])}]]);const g=o({data:()=>({isViewMode:!1,stockQty:"",countQty:"",remark:"",photo:"",photos:[],material_info_id:"",firstCategory:"-",secondCategory:"-",categoryName:"-",materialName:"-",materialCode:"-",materialType:"-",materialSpec:"-",materialSize:"-",unit:"-",batchNumber:"-",sequenceNumber:"-",waitNum:"-",productionDate:"-",storageDate:"-",materialStatus:"-",reserveMethod:"-",warehouseName:"-",shelfName:"-",shelfLayer:"-",levelCategory:"-",propertyInfo:"-",isFixedAsset:"-",fixedAssetCode:"-",reserveYears:"-",storageRequirement:"-",maintenanceRequirement:"-",maintenanceFrequency:"-",material_infos_plan_id:"",materialId:""}),onLoad(e){this.isViewMode="1"===e.view,this.date=this.getToday(),this.materialId=e.code,a("log","at pages/inventory/inventory.vue:196","materialId:",this.materialId),this.materialId&&function(e){const t=uni.getStorageSync("token");return new Promise(((a,i)=>{uni.request({url:n+"api/admin/inventory/show",method:"GET",data:{id:e,token:t},success:a,fail:i})}))}(this.materialId).then((e=>{if(a("log","at pages/inventory/inventory.vue:199","response:",e),e.data){const t=e.data;this.material_info_id=t.wuzibianma_material_infos_wuzibianma_relation.id;const a=t.wuzibianma_material_infos_wuzibianma_relation||{},n=a.fenlei_detail||{},i=t.wuzizhuangtai_detail||{},l=t.chubeifangshi_detail||{},o=t.dengjifenlei_detail||{},s=t.chanquanxinxi_detail||{},r=t.materialstorages||{},c=t.shelfs||{},d=t.equipment_maintain_config||{},m=t.material_info_type||"";if(m){const e=m.split("-");this.firstCategory=e[0]||"-",this.secondCategory=e.length>1?e[1]:e[0]||"-"}this.categoryName=n.name||"-",this.materialName=t.zichanmingcheng||"-",this.materialCode=t.wuzibianma||"-",this.materialType=t.wuzileixing||"-",this.materialSpec=a.guigexinghao||t.guigexinghao||"-",this.materialSize=a.wuziguige||"-",this.unit=a.jiliangdanwei||t.jiliangdanwei||"-",this.batchNumber=t.rukupici||"-",this.stockQty=t.zaikushuliang||t.inventorys_total||"0",this.sequenceNumber=t.shunxuhao||"-",this.waitNum=t.wait_num||"-",this.productionDate=t.shengchanriqi||"-",this.storageDate=t.rukuriqi||"-",this.materialStatus=i.value||"-",this.reserveMethod=l.value||"-",this.warehouseName=r.cangkumingcheng||"-",this.shelfName=c.huojiamingcheng||"-",this.shelfLayer=t.huojiaceng||"-",this.levelCategory=o.value||"-",this.propertyInfo=s.value||"-",this.isFixedAsset=t.shifouweigudingzichan||"-",this.fixedAssetCode=t.gudingzichanbianma||"-",this.reserveYears=t.chubeinianxian||"-",this.storageRequirement=t.cunfangyaoqiu||"-",this.maintenanceRequirement=t.weihuyaoqiu||"-",this.maintenanceFrequency=d.name||"-",this.material_infos_plan_id=t.material_infos_plan_id||""}else uni.showToast({title:"未获取到物资信息",icon:"none"})})).catch((()=>{uni.showToast({title:"获取物资信息失败",icon:"none"})}))},methods:{getToday(){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`},choosePhoto(){this.photos.length>=3?uni.showToast({title:"最多上传3张照片",icon:"none"}):uni.chooseImage({count:3-this.photos.length,success:e=>{this.photos=[...this.photos,...e.tempFilePaths]}})},deletePhoto(e){this.photos.splice(e,1)},async submit(){if(!this.countQty)return void uni.showToast({title:"请输入盘点数量",icon:"none"});if(!/^(0|[1-9][0-9]*)$/.test(this.countQty))return void uni.showToast({title:"盘点数量必须为0或正整数",icon:"none"});uni.showLoading({title:"提交中..."});let e=[];for(let a=0;a{a("log","at api.js:87","confirm接口"),uni.request({url:n+"api/admin/material-infos-plan-link/confirm",method:"POST",data:{...e,token:t},success:i,fail:l})}))}(t).then((e=>{a("log","at pages/inventory/inventory.vue:372","res:",e),uni.hideLoading(),!e||e.data&&void 0!==e.data.errcode?uni.showToast({title:e.data.errmsg||"提交失败",icon:"none"}):(uni.showToast({title:"盘点提交成功",icon:"success"}),setTimeout((()=>{uni.reLaunch({url:"/pages/index/index"})}),1200))})).catch((()=>{uni.hideLoading(),uni.showToast({title:"提交失败",icon:"none"})}))}}},[["render",function(t,a,n,i,l,o){return e.openBlock(),e.createElementBlock("view",{class:"inventory-bg"},[e.createElementVNode("view",{class:"inventory-card"},[e.createElementVNode("view",{class:"readonly-group"},[e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"一级分类"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.firstCategory),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"二级分类"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.secondCategory),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"所属种类"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.categoryName),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"物资名称"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.materialName),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"物资类型"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.materialType),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"物资型号"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.materialSpec),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"物资规格"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.materialSize),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"单位"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.unit),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"入库批次"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.batchNumber),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"在库数量"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.stockQty)+e.toDisplayString(l.unit?" "+l.unit:""),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"顺序号"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.sequenceNumber),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"待出库"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.waitNum),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"生产日期"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.productionDate),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"入库日期"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.storageDate),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"物资状态"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.materialStatus),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"储备方式"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.reserveMethod),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"所在仓库"),e.createElementVNode("view",{class:"readonly-value"},e.toDisplayString(l.warehouseName),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"所在货架"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.shelfName),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"所在货架层"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.shelfLayer),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"等级分类"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.levelCategory),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"产权信息"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.propertyInfo),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"是否为固定资产"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.isFixedAsset),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"固定资产编码"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.fixedAssetCode),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"储备年限"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.reserveYears),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"存放要求"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.storageRequirement),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"维护要求"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.maintenanceRequirement),1)]),e.createElementVNode("view",{class:"readonly-item"},[e.createElementVNode("text",{class:"readonly-label"},"保养频次"),e.createElementVNode("text",{class:"readonly-value"},e.toDisplayString(l.maintenanceFrequency),1)])]),l.isViewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("view",{key:0,class:"form-group"},[e.createElementVNode("text",{class:"form-label"},"盘点数量"),e.withDirectives(e.createElementVNode("input",{class:"form-input",type:"number","onUpdate:modelValue":a[0]||(a[0]=e=>l.countQty=e),placeholder:"请输入盘点数量"},null,512),[[e.vModelText,l.countQty]])])),l.isViewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("view",{key:1,class:"form-group"},[e.createElementVNode("text",{class:"form-label"},"盘点备注"),e.withDirectives(e.createElementVNode("textarea",{class:"form-textarea","onUpdate:modelValue":a[1]||(a[1]=e=>l.remark=e),placeholder:"请输入备注信息"},null,512),[[e.vModelText,l.remark]])])),l.isViewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("view",{key:2,class:"form-group"},[e.createElementVNode("text",{class:"form-label"},"照片上传"),e.createElementVNode("view",{class:"photo-upload"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.photos,((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:"photo-preview"},[e.createElementVNode("image",{src:t,mode:"aspectFill",class:"photo-img"},null,8,["src"]),e.createElementVNode("view",{class:"photo-del",onClick:e=>o.deletePhoto(a)},[e.createElementVNode("text",{class:"delete-icon"},"×")],8,["onClick"])])))),128)),l.photos.length<3?(e.openBlock(),e.createElementBlock("button",{key:0,class:"photo-btn",onClick:a[2]||(a[2]=(...e)=>o.choosePhoto&&o.choosePhoto(...e))},[e.createElementVNode("text",{class:"iconfont icon-camera"}),e.createElementVNode("text",{class:"btn-text"},"上传照片")])):e.createCommentVNode("",!0)])])),l.isViewMode?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:3,class:"submit-btn",onClick:a[3]||(a[3]=(...e)=>o.submit&&o.submit(...e))},"提交盘点"))])])}]]);const v=o({data:()=>({planId:null,planInfo:{},materialList:[],materialPage:1,materialPageSize:10,materialTotal:0,materialLoading:!1,materialHasMore:!0}),onLoad(e){if(e.planInfo)try{this.planInfo=JSON.parse(decodeURIComponent(e.planInfo)),this.planId=this.planInfo.id}catch(t){a("error","at pages/plan-detail/plan-detail.vue:139","解析计划信息失败:",t)}e.planId&&(this.planId=e.planId),uni.setNavigationBarTitle({title:this.planInfo.name||"盘点计划详情"}),this.getMaterialList(!0)},methods:{async getMaterialList(e=!1){var t,i;if(!this.materialLoading&&this.planId)try{this.materialLoading=!0,e&&(this.materialPage=1,this.materialHasMore=!0);const l={page:this.materialPage,page_size:this.materialPageSize,"filter[0][key]":"material_infos_plan_id","filter[0][op]":"eq","filter[0][value]":this.planId},o=await function(e){const t=uni.getStorageSync("token");return new Promise(((a,i)=>{uni.request({url:n+"api/admin/material-infos-plan-link/index",method:"GET",data:{...e,token:t},success:a,fail:i})}))}(l);if(a("log","at pages/plan-detail/plan-detail.vue:179","物资列表响应:",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.materialList=e?a:[...this.materialList,...a],this.materialTotal=t.total||0,this.materialHasMore=a.length===this.materialPageSize,this.materialHasMore&&this.materialPage++}else uni.showToast({title:(null==(i=o.data)?void 0:i.message)||"获取物资列表失败",icon:"none"})}catch(l){a("error","at pages/plan-detail/plan-detail.vue:216","获取物资列表失败:",l),uni.showToast({title:"获取物资列表失败",icon:"none"})}finally{this.materialLoading=!1}},refreshMaterials(){this.getMaterialList(!0)},loadMoreMaterials(){this.materialHasMore&&!this.materialLoading&&this.getMaterialList(!1)},getStatusText:e=>({0:"未开始",1:"进行中",2:"已完成"}[e]||"未知状态"),getTypeText:e=>({1:"年度",2:"季度"}[e]||"未知类型"),getInventoryStatusText:e=>({0:"待盘点",1:"已盘点"}[e]||"待盘点"),formatDate(e){if(!e)return"";const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},startInventory(e){a("log","at pages/plan-detail/plan-detail.vue:277","开始盘点物资:",e),e.inventorys_id?uni.navigateTo({url:`/pages/inventory/inventory?code=${e.inventorys_id}`}):uni.showToast({title:"暂无盘点信息",icon:"none"})}}},[["render",function(t,a,n,i,l,o){return e.openBlock(),e.createElementBlock("scroll-view",{class:"plan-detail-container","scroll-y":"",onScrolltolower:a[0]||(a[0]=(...e)=>o.loadMoreMaterials&&o.loadMoreMaterials(...e)),"lower-threshold":"100",onRefresherrefresh:a[1]||(a[1]=(...e)=>o.refreshMaterials&&o.refreshMaterials(...e)),"refresher-enabled":"true","refresher-triggered":l.materialLoading},[e.createElementVNode("view",{class:"plan-info-card"},[e.createElementVNode("view",{class:"plan-info-header"},[e.createElementVNode("text",{class:"plan-info-title"},"盘点计划详情")]),e.createElementVNode("view",{class:"plan-info-content"},[e.createElementVNode("view",{class:"info-row"},[e.createElementVNode("view",{class:"info-item"},[e.createElementVNode("text",{class:"info-label"},"计划名称"),e.createElementVNode("text",{class:"info-value"},e.toDisplayString(l.planInfo.name||"暂无"),1)]),e.createElementVNode("view",{class:"info-item"},[e.createElementVNode("text",{class:"info-label"},"计划编号"),e.createElementVNode("text",{class:"info-value"},e.toDisplayString(l.planInfo.no||"暂无"),1)])]),e.createElementVNode("view",{class:"info-row"},[e.createElementVNode("view",{class:"info-item"},[e.createElementVNode("text",{class:"info-label"},"盘点类型"),e.createElementVNode("text",{class:"info-value type-text"},e.toDisplayString(o.getTypeText(l.planInfo.type)),1)]),e.createElementVNode("view",{class:"info-item"},[e.createElementVNode("text",{class:"info-label"},"物资数量"),e.createElementVNode("text",{class:"info-value count-text"},e.toDisplayString(l.planInfo.chart_total||0)+" 项",1)])]),e.createElementVNode("view",{class:"info-row"},[e.createElementVNode("view",{class:"info-item"},[e.createElementVNode("text",{class:"info-label"},"开始时间"),e.createElementVNode("text",{class:"info-value"},e.toDisplayString(o.formatDate(l.planInfo.start_date)),1)]),e.createElementVNode("view",{class:"info-item"},[e.createElementVNode("text",{class:"info-label"},"结束时间"),e.createElementVNode("text",{class:"info-value"},e.toDisplayString(o.formatDate(l.planInfo.end_date)),1)])]),e.createElementVNode("view",{class:"status-row"},[e.createElementVNode("view",{class:"status-item"},[e.createElementVNode("text",{class:"status-label"},"计划状态"),e.createElementVNode("view",{class:e.normalizeClass(["status-badge","status-"+l.planInfo.status])},[e.createElementVNode("text",{class:"status-text"},e.toDisplayString(o.getStatusText(l.planInfo.status)),1)],2)])])])]),e.createElementVNode("view",{class:"material-list-card"},[e.createElementVNode("view",{class:"material-list-header"},[e.createElementVNode("text",{class:"material-list-title"},"盘点物资列表"),e.createElementVNode("text",{class:"material-count"},"共 "+e.toDisplayString(l.materialTotal)+" 项",1)]),e.createElementVNode("view",{class:"material-list"},[e.createElementVNode("view",{class:"material-item",style:{"font-weight":"600"}},[e.createElementVNode("view",{class:"material-info material-name-col"},[e.createElementVNode("text",{class:"material-name"},"物资名称")]),e.createElementVNode("view",{class:"material-info material-model-col"},[e.createElementVNode("text",{class:"material-time"},"物资型号")]),e.createElementVNode("view",{class:"material-info material-spec-col"},[e.createElementVNode("text",{class:"material-time"},"物资规格")]),e.createElementVNode("view",{class:"material-info material-status-col"},[e.createElementVNode("text",{class:"material-time"},"状态")]),e.createElementVNode("view",{class:"material-info material-action-col"},[e.createElementVNode("text",{class:"material-time"},"操作")])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.materialList,(t=>{var a,n,i;return e.openBlock(),e.createElementBlock("view",{class:"material-item",key:t.id},[e.createElementVNode("view",{class:"material-info material-name-col"},[e.createElementVNode("text",{class:"material-name"},e.toDisplayString((null==(a=t.inventory)?void 0:a.zichanmingcheng)||"未知物资"),1)]),e.createElementVNode("view",{class:"material-info material-model-col"},[e.createElementVNode("text",{class:"material-time"},e.toDisplayString((null==(n=t.inventory)?void 0:n.guigexinghao)||"暂无"),1)]),e.createElementVNode("view",{class:"material-info material-spec-col"},[e.createElementVNode("text",{class:"material-time"},e.toDisplayString((null==(i=t.inventory)?void 0:i.wuziguige)||"暂无"),1)]),e.createElementVNode("view",{class:"material-info material-status-col"},[e.createElementVNode("text",{class:e.normalizeClass(["material-status","status-"+(t.status||0)])},e.toDisplayString(o.getInventoryStatusText(t.status)),3)]),e.createElementVNode("view",{class:"material-info material-action-col"},[e.createElementVNode("view",{class:"inventory-action-btn",onClick:e.withModifiers((e=>o.startInventory(t)),["stop"])},[e.createElementVNode("text",{class:"inventory-btn-text"},"盘点")],8,["onClick"])])])})),128))]),l.materialLoading?(e.openBlock(),e.createElementBlock("view",{key:0,class:"load-more"},[e.createElementVNode("view",{class:"loading-spinner"}),e.createElementVNode("text",{class:"loading-text"},"加载中...")])):!l.materialHasMore&&l.materialList.length>0?(e.openBlock(),e.createElementBlock("view",{key:1,class:"load-more"},[e.createElementVNode("text",{class:"no-more-text"},"— 没有更多数据了 —")])):e.createCommentVNode("",!0)])],40,["refresher-triggered"])}]]);__definePage("pages/index/index",m),__definePage("pages/profile/profile",u),__definePage("pages/login/login",h),__definePage("pages/scan/scan",p),__definePage("pages/inventory/inventory",g),__definePage("pages/plan-detail/plan-detail",v);let y=null;var f;"undefined"!=typeof plus&&plus.android&&(y=plus.android.runtimeMainActivity(),"android"==uni.getSystemInfoSync().platform&&(plus.runtime.quit=function(){setTimeout((()=>{y.finish()}),10)}));const E={globalData:{hhwUHFController:null,globalEvent:null},onLaunch:function(){a("log","at App.vue:28","App Launch"),this.globalData.hhwUHFController=t("HL-HHWUHFController"),this.globalData.globalEvent=t("globalEvent"),f=this.globalData.hhwUHFController;const e=uni.getStorageSync("token");e?uni.reLaunch({url:"/pages/index/index"}):(uni.reLaunch({url:"/pages/login/login"}),a("log","at App.vue:41","App Launch token1234",e))},onShow:function(){if(a("log","at App.vue:47","App Show"),f){f.setDebuggable(!0,(e=>{a("log","at App.vue:54","App Show","setDebuggable: "+e)}));var e=Date.now();f.initUhf((t=>{a("log","at App.vue:61","App Show","initUHF: "+t,"cusTime: "+(Date.now()-e)),uni.showToast({title:"初始化成功",icon:"none",duration:1e3})}))}},onHide:function(){a("log","at App.vue:76","App Hide"),f&&f.closeUhf((e=>{a("log","at App.vue:83","App Hide","closeUhf: "+e),uni.showToast({title:"关闭成功",icon:"none",duration:1e3})}))}};const{app:N,Vuex:w,Pinia:V}=function(){const t=e.createVueApp(E);return t.config.globalProperties.$config=i,{app:t}}();uni.Vuex=w,uni.Pinia=V,N.provide("__globalStyles",__uniConfig.styles),N._component.mpType="app",N._component.render=()=>{},N.mount("#app")}(Vue);