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
62 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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/",o={BASE_API:n};function l(e){const t=uni.getStorageSync("token");return new Promise(((a,o)=>{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){o(t)}},fail:o})}))}const i=(e,t)=>{const a=e.__vccOpts||e;for(const[n,o]of t)a[n]=o;return a};let s=1,r=!1,c=!1,d=!0;const m=i({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:227","inventory Show"),this.initBarcodeScan(),this.disableBarcodeScanKey(),this.registerKeyReceiver()},onHide(){a("log","at pages/index/index.vue:238","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:342","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,o;if(!this.planLoading)try{this.planLoading=!0,e&&(this.planPage=1,this.planHasMore=!0);const l={page:this.planPage,page_size:this.planPageSize},i=await function(e){const t=uni.getStorageSync("token");return new Promise(((a,o)=>{uni.request({url:n+"api/admin/material-infos-plan/index",method:"GET",data:{...e,token:t},success:a,fail:o})}))}(l);if(a("log","at pages/index/index.vue:399","盘点计划列表响应:",i),i.data&&40001===i.data.errcode)return uni.showToast({title:(null==(t=i.data)?void 0:t.errmsg)||"获取盘点计划失败",icon:"none"}),void uni.reLaunch({url:"/pages/login/login"});if(i.data&&i.data.list){const t=i.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==(o=i.data)?void 0:o.message)||"获取盘点计划失败",icon:"none"})}catch(l){a("error","at pages/index/index.vue:433","获取盘点计划列表失败:",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:485","查看计划详情:",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(t<a)return 0;if(t>n)return 100;const o=n.getTime()-a.getTime(),l=t.getTime()-a.getTime();return Math.round(l/o*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:523","初始化Android组件失败:",e)}},initUHFEvent(){this.globalEvent&&this.globalEvent.addEventListener("uhf_tag_event",(e=>{this.handleUHFEvent(e)}))},handleUHFEvent(e){a("log","at pages/index/index.vue:539",e.tag_info_list);var t=e.tag_info_list;if(null!=t){for(var n=0;n<t.length;n++){var o=n,l=this.bytes2HexString(t[n].EpcId),i=this.hexToString(l),s={id:o,epc:i,count:1,rssi:t[n].RSSI},r=this.epcList.indexOf(i);-1==r?(s.id=this.epcList.length,this.dataList.length<this.offset&&this.dataList.push(s),this.tempList.push(s),this.epcList.push(i)):(s.id=r,s.count=this.tempList[r].count+1,r<this.dataList.length&&this.$set(this.dataList,r,s),this.$set(this.tempList,r,s))}this.tagsAmount=this.epcList.length}else{"stopInventory"==e.inventory_event&&(uni.showToast({title:"停止盘点",icon:"none"}),this.btn2Disabled=!1,this.btn3Disabled=!1,this.cbDisabled=!1,this.btn1Info="开始盘点")}},registerKeyReceiver(){if(this.main){var e=new(plus.android.importClass("android.content.IntentFilter"));e.addAction("android.rfid.FUN_KEY"),this.receiver=plus.android.implements("io.dcloud.feature.internal.reflect.BroadcastReceiver",{onReceive:(e,t)=>{plus.android.importClass(t);var n=t.getIntExtra("keyCode",0),o=t.getBooleanExtra("keydown",!1);o&&1==s&&137==n?(a("log","at pages/index/index.vue:600","inventory","receive keyUp code: "+n),r?this.startBarcodeScan():this.startInventory(),s++):o||(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,o=0;o<a;o++){var l=e.substr(t,2),i=parseInt(l,16);n.push(i),t+=2}return n},hexToString(e){if(!e)return"";let t=e.replace(/\s+/g,"").toUpperCase();const a=parseInt(t,16);return isNaN(a)?e:a.toString()},formatMaterialList(e){const t=e&&e.data&&e.data.list&&e.data.list.data?e.data.list.data:[];return a("log","at pages/index/index.vue:674","list:",t),t.map((e=>({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:765","inventory inventory","startInventory "+e)})):(a("log","at pages/index/index.vue:769","async_flag"),this.hhwUHFController.startInventory(30,0,!1,0,d,(e=>{a("log","at pages/index/index.vue:771","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,o)=>{uni.request({url:n+"api/admin/inventory/index",method:"GET",data:{...e,token:t},success:a,fail:o})}))}({ids:t,page:1,page_size:999}).then((e=>{uni.hideLoading(),a("log","at pages/index/index.vue:816","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:829","viewMaterials error",e),uni.hideLoading(),uni.showToast({title:"获取物资失败",icon:"none"})}))},loadmore(){if(a("log","at pages/index/index.vue:839","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:841","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;t<e+this.offset;t++)this.dataList.push(this.tempList[t]);this.offset=this.offset+e}},onAsyncChange(e){this.asyncFlag="async_checkbox"===e.detail.value[0],c=this.asyncFlag},onVoiceChange(e){this.voiceFlag="voice_checkbox"===e.detail.value[0],d=this.voiceFlag},onBarcodeChange(e){this.barcodeFlag="barcode_checkbox"===e.detail.value[0],r=this.barcodeFlag}}},[["render",function(t,a,n,o,l,i){return e.openBlock(),e.createElementBlock("scroll-view",{class:"index-bg","scroll-y":"",onScrolltolower:a[7]||(a[7]=(...e)=>i.loadMorePlans&&i.loadMorePlans(...e)),"lower-threshold":"100",onRefresherrefresh:a[8]||(a[8]=(...e)=>i.refreshPlans&&i.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)=>i.scanInventory&&i.scanInventory(...e))},"扫码盘点"),e.createElementVNode("button",{class:"main-btn outline",onClick:a[1]||(a[1]=(...e)=>i.scanView&&i.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)=>i.loadmore&&i.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)=>i.handleInventory&&i.handleInventory(...e)),class:"inventory-btn"},e.toDisplayString(l.btn1Info),1),e.createElementVNode("button",{type:"primary",disabled:l.btn2Disabled,onClick:a[4]||(a[4]=(...e)=>i.viewMaterials&&i.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)=>i.clearTags&&i.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:{"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.shunxuhao),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=>i.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(i.getStatusText(t.status)),3)]),e.createElementVNode("view",{class:"plan-info plan-date-col"},[e.createElementVNode("text",{class:"plan-time"},e.toDisplayString(i.formatDate(t.start_date)),1)]),e.createElementVNode("view",{class:"plan-info plan-date-col"},[e.createElementVNode("text",{class:"plan-time"},e.toDisplayString(i.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=>i.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)=>i.closeH5Scan&&i.closeH5Scan(...e))},"关闭")])):e.createCommentVNode("",!0)])],40,["refresher-triggered"])}]]);const u=i({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,o,l,i){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)=>i.logout&&i.logout(...e))},"退出登录")])}]]);const p=i({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,o)=>{uni.request({url:n+"api/admin/auth/login",method:"POST",data:{username:e,password:t},success:a,fail:o})}))).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,o,l,i){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)=>i.handleLogin&&i.handleLogin(...e))},"登 录")])])}]]);const h=i({data:()=>({result:""}),methods:{doScan(){uni.scanCode({success:e=>{this.result=e.result},fail:()=>{uni.showToast({title:"扫码失败",icon:"none"})}})}}},[["render",function(t,a,n,o,l,i){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)=>i.doScan&&i.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=i({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:"",maintenanceRecords:[],showModal:!1,showDetailModal:!1,currentRecord:{},showCompleteModal:!1,completeForm:{actual_date:"",notes:"",photos:[],signature:""},currentMaintenanceRecord:null,signatureCtx:null,signaturePoints:[],isDrawing:!1}),onLoad(e){this.isViewMode="1"===e.view,this.date=this.getToday(),this.materialId=e.code,a("log","at pages/inventory/inventory.vue:434","materialId:",this.materialId),this.materialId&&(function(e){const t=uni.getStorageSync("token");return new Promise(((a,o)=>{uni.request({url:n+"api/admin/inventory/show",method:"GET",data:{id:e,token:t},success:a,fail:o})}))}(this.materialId).then((e=>{if(a("log","at pages/inventory/inventory.vue:437","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||{},o=t.wuzizhuangtai_detail||{},l=t.chubeifangshi_detail||{},i=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=o.value||"-",this.reserveMethod=l.value||"-",this.warehouseName=r.cangkumingcheng||"-",this.shelfName=c.huojiamingcheng||"-",this.shelfLayer=t.huojiaceng||"-",this.levelCategory=i.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"})})),this.getMaintenanceRecords())},methods:{showInventoryModal(){this.showModal=!0},closeInventoryModal(){this.showModal=!1},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<this.photos.length;a++)try{const t=await l(this.photos[a]);t&&t.id&&e.push(t.id)}catch(o){return uni.hideLoading(),void uni.showToast({title:"图片上传失败",icon:"none"})}const t={status:"1",inventorys_id:this.materialId,check_num:this.countQty,remark:this.remark,file_ids:e};a("log","at pages/inventory/inventory.vue:618","data:",t),function(e){const t=uni.getStorageSync("token");return new Promise(((o,l)=>{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:o,fail:l})}))}(t).then((e=>{a("log","at pages/inventory/inventory.vue:621","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"})}))},async getMaintenanceRecords(){if(this.materialId)try{const e={page:1,page_size:999,"filter[0][key]":"inventorys_id","filter[0][op]":"eq","filter[0][value]":this.materialId},t=await function(e){const t=uni.getStorageSync("token");return new Promise(((a,o)=>{uni.request({url:n+"api/admin/equipment-operation/index",method:"GET",data:{...e,token:t},success:a,fail:o})}))}(e);a("log","at pages/inventory/inventory.vue:650","运维记录响应:",t),t.data&&t.data.list&&t.data.list.data?this.maintenanceRecords=t.data.list.data:this.maintenanceRecords=[]}catch(e){a("error","at pages/inventory/inventory.vue:658","获取运维记录失败:",e),this.maintenanceRecords=[]}},formatDate(e){if(!e)return"-";if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const t=new Date(e);if(isNaN(t.getTime()))return e;return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`},getDateDifferenceInDays(e){if(!e)return 0;const t=new Date(e),a=new Date;a.setHours(0,0,0,0),t.setHours(0,0,0,0);const n=t-a;return Math.ceil(n/864e5)},getBadgeText(e){if(!e)return"-";const t=this.getDateDifferenceInDays(e);return t>=0?`还有 ${t}`:`已超期 ${Math.abs(t)}`},getBadgeClass(e){if(!e)return"status-default";const t=this.getDateDifferenceInDays(e);return t<0?"status-overdue":t<=3?"status-urgent":"status-normal"},completeMaintenance(e){a("log","at pages/inventory/inventory.vue:720","完成维护:",e),this.currentMaintenanceRecord=e,this.completeForm={actual_date:this.getToday(),notes:"",photos:[],signature:""},this.showCompleteModal=!0,this.$nextTick((()=>{this.initSignatureCanvas()}))},closeCompleteModal(){this.showCompleteModal=!1,this.currentMaintenanceRecord=null,this.completeForm={actual_date:"",notes:"",photos:[],signature:""}},onDateChange(e){this.completeForm.actual_date=e.detail.value},chooseCompletePhoto(){this.completeForm.photos.length>=9?uni.showToast({title:"最多上传9张照片",icon:"none"}):uni.chooseImage({count:9-this.completeForm.photos.length,success:async e=>{uni.showLoading({title:"上传中..."});try{for(let t=0;t<e.tempFilePaths.length;t++){const a=await l(e.tempFilePaths[t]);a&&a.id&&this.completeForm.photos.push({id:a.id,url:a.url||e.tempFilePaths[t]})}uni.hideLoading()}catch(t){uni.hideLoading(),uni.showToast({title:"图片上传失败",icon:"none"})}}})},removeCompletePhoto(e){this.completeForm.photos.splice(e,1)},initSignatureCanvas(){this.$nextTick((()=>{const e=uni.createCanvasContext("signatureCanvas",this);e.setStrokeStyle("#000000"),e.setLineWidth(3),e.setLineCap("round"),e.setLineJoin("round"),this.signatureCtx=e,this.signaturePoints=[],this.isDrawing=!1}))},onTouchStart(e){if(!this.signatureCtx)return void this.initSignatureCanvas();this.isDrawing=!0;const t=e.touches[0],a={x:t.x,y:t.y};this.signaturePoints=[a],this.signatureCtx.beginPath(),this.signatureCtx.moveTo(a.x,a.y)},onTouchMove(e){if(!this.isDrawing||!this.signatureCtx)return;e.preventDefault();const t=e.touches[0],a={x:t.x,y:t.y};if(this.signaturePoints.length>0){const e=this.signaturePoints[this.signaturePoints.length-1];this.signatureCtx.moveTo(e.x,e.y),this.signatureCtx.lineTo(a.x,a.y),this.signatureCtx.stroke(),this.signatureCtx.draw(!0)}this.signaturePoints.push(a)},onTouchEnd(){this.isDrawing=!1,this.saveSignature()},saveSignature(){this.signatureCtx&&uni.canvasToTempFilePath({canvasId:"signatureCanvas",success:e=>{this.completeForm.signature=e.tempFilePath},fail:e=>{a("error","at pages/inventory/inventory.vue:844","保存签名失败:",e)}},this)},clearSignature(){this.signatureCtx&&(this.signatureCtx.clearRect(0,0,1e3,1e3),this.signatureCtx.draw(!0),this.completeForm.signature="",this.signaturePoints=[],this.isDrawing=!1)},async submitCompleteMaintenance(){var e;if(this.completeForm.actual_date)if(this.currentMaintenanceRecord&&this.currentMaintenanceRecord.id){uni.showLoading({title:"提交中..."});try{let t=null;if(this.completeForm.signature){const e=await l(this.completeForm.signature);e&&e.id&&(t=e.id)}const o={id:this.currentMaintenanceRecord.id,maintenance_date:this.formatDate(this.completeForm.actual_date),maintenance_content:this.completeForm.notes,file_ids:this.completeForm.photos.map((e=>e.id)),sign_id:t,status:1};a("log","at pages/inventory/inventory.vue:893","提交完成维护数据:",o);const i=await function(e){const t=uni.getStorageSync("token");return new Promise(((a,o)=>{uni.request({url:n+"api/admin/equipment-operation/save",method:"POST",data:{...e,token:t},success:a,fail:o})}))}(o);a("log","at pages/inventory/inventory.vue:896","提交完成维护响应:",i),uni.hideLoading(),!i||i.data&&void 0!==i.data.errcode?uni.showToast({title:(null==(e=i.data)?void 0:e.errmsg)||"提交失败",icon:"none"}):(uni.showToast({title:"完成维护成功",icon:"success"}),this.closeCompleteModal(),this.getMaintenanceRecords())}catch(t){a("error","at pages/inventory/inventory.vue:909","提交完成维护失败:",t),uni.hideLoading(),uni.showToast({title:"提交失败",icon:"none"})}}else uni.showToast({title:"维护记录信息错误",icon:"none"});else uni.showToast({title:"请选择实际维护日期",icon:"none"})},async viewMaintenance(e){if(a("log","at pages/inventory/inventory.vue:916","查看维护记录:",e),e.id){uni.showLoading({title:"加载中..."});try{const t=await function(e){const t=uni.getStorageSync("token");return new Promise(((a,o)=>{uni.request({url:n+"api/admin/equipment-operation/show",method:"GET",data:{id:e,token:t},success:a,fail:o})}))}(e.id);a("log","at pages/inventory/inventory.vue:928","运维记录详情:",t),t.data?(this.currentRecord=t.data,this.showDetailModal=!0):uni.showToast({title:"获取详情失败",icon:"none"})}catch(t){a("error","at pages/inventory/inventory.vue:940","获取运维记录详情失败:",t),uni.showToast({title:"获取详情失败",icon:"none"})}finally{uni.hideLoading()}}else uni.showToast({title:"记录ID不存在",icon:"none"})},closeDetailModal(){this.showDetailModal=!1,this.currentRecord={}},previewImage(e,t){t&&0!==t.length||(t=[e]),uni.previewImage({current:e,urls:t})}}},[["render",function(t,a,n,o,l,i){return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("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:"inventory-action-section"},[e.createElementVNode("button",{class:"inventory-action-btn",onClick:a[0]||(a[0]=(...e)=>i.showInventoryModal&&i.showInventoryModal(...e))},"盘点")])),e.createElementVNode("view",{class:"maintenance-section"},[e.createElementVNode("view",{class:"section-title"},"运维记录"),l.maintenanceRecords.length>0?(e.openBlock(),e.createElementBlock("view",{key:0,class:"maintenance-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.maintenanceRecords,((t,a)=>(e.openBlock(),e.createElementBlock("view",{class:"maintenance-item",key:a},[e.createElementVNode("view",{class:"maintenance-row"},[e.createElementVNode("text",{class:"maintenance-label"},"记录编号:"),e.createElementVNode("text",{class:"maintenance-value"},e.toDisplayString(t.no||"-"),1)]),e.createElementVNode("view",{class:"maintenance-row"},[e.createElementVNode("text",{class:"maintenance-label"},"计划维护日期:"),e.createElementVNode("text",{class:"maintenance-value"},e.toDisplayString(i.formatDate(t.planned_maintenance_date)||"-"),1)]),e.createElementVNode("view",{class:"maintenance-row"},[e.createElementVNode("text",{class:"maintenance-label"},"截止日期:"),e.createElementVNode("text",{class:"maintenance-value"},e.toDisplayString(i.formatDate(t.end_date)||"-"),1)]),e.createElementVNode("view",{class:"maintenance-row"},[e.createElementVNode("text",{class:"maintenance-label"},"负责人:"),e.createElementVNode("text",{class:"maintenance-value"},e.toDisplayString(t.responsible_admin?t.responsible_admin.name:"-"),1)]),e.createElementVNode("view",{class:"maintenance-row"},[e.createElementVNode("text",{class:"maintenance-label"},"运维内容:"),e.createElementVNode("text",{class:"maintenance-value"},[t.equipment_maintain_config_id&&t.equipment_maintain_config&&t.equipment_maintain_config.name?(e.openBlock(),e.createElementBlock("span",{key:0},e.toDisplayString(t.equipment_maintain_config.name),1)):t.content?(e.openBlock(),e.createElementBlock("span",{key:1},e.toDisplayString(t.content),1)):(e.openBlock(),e.createElementBlock("span",{key:2},"-"))])]),e.createElementVNode("view",{class:"maintenance-row"},[e.createElementVNode("text",{class:"maintenance-label"},"状态:"),e.createElementVNode("text",{class:"maintenance-value"},e.toDisplayString(1===t.status?"已完成":"待处理"),1)]),e.createElementVNode("view",{class:"maintenance-row"},[e.createElementVNode("text",{class:"maintenance-label"},"实际维护日期/状态:"),e.createElementVNode("view",{class:"maintenance-value"},[1===t.status?(e.openBlock(),e.createElementBlock("text",{key:0},e.toDisplayString(i.formatDate(t.maintenance_date)||"-"),1)):(e.openBlock(),e.createElementBlock("view",{key:1,class:e.normalizeClass(["status-badge",i.getBadgeClass(t.end_date)])},e.toDisplayString(i.getBadgeText(t.end_date)),3))])]),e.createElementVNode("view",{class:"maintenance-actions"},[0===t.status?(e.openBlock(),e.createElementBlock("button",{key:0,class:"action-btn complete-btn",onClick:e=>i.completeMaintenance(t)},"完成维护",8,["onClick"])):e.createCommentVNode("",!0),1===t.status?(e.openBlock(),e.createElementBlock("button",{key:1,class:"action-btn view-btn",onClick:e=>i.viewMaintenance(t)},"查看",8,["onClick"])):e.createCommentVNode("",!0)])])))),128))])):(e.openBlock(),e.createElementBlock("view",{key:1,class:"empty-maintenance"},[e.createElementVNode("text",null,"暂无运维记录")]))])])]),l.showModal?(e.openBlock(),e.createElementBlock("view",{key:0,class:"inventory-modal",onClick:a[8]||(a[8]=(...e)=>i.closeInventoryModal&&i.closeInventoryModal(...e))},[e.createElementVNode("view",{class:"modal-content",onClick:a[7]||(a[7]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:"modal-header"},[e.createElementVNode("text",{class:"modal-title"},"物资盘点"),e.createElementVNode("view",{class:"modal-close",onClick:a[1]||(a[1]=(...e)=>i.closeInventoryModal&&i.closeInventoryModal(...e))},[e.createElementVNode("text",{class:"close-icon"},"×")])]),e.createElementVNode("view",{class:"modal-body"},[e.createElementVNode("view",{class:"form-group"},[e.createElementVNode("text",{class:"form-label"},"盘点数量"),e.withDirectives(e.createElementVNode("input",{class:"form-input",type:"number","onUpdate:modelValue":a[2]||(a[2]=e=>l.countQty=e),placeholder:"请输入盘点数量"},null,512),[[e.vModelText,l.countQty]])]),e.createElementVNode("view",{class:"form-group"},[e.createElementVNode("text",{class:"form-label"},"盘点备注"),e.withDirectives(e.createElementVNode("textarea",{class:"form-textarea","onUpdate:modelValue":a[3]||(a[3]=e=>l.remark=e),placeholder:"请输入备注信息"},null,512),[[e.vModelText,l.remark]])]),e.createElementVNode("view",{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=>i.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[4]||(a[4]=(...e)=>i.choosePhoto&&i.choosePhoto(...e))},[e.createElementVNode("text",{class:"iconfont icon-camera"}),e.createElementVNode("text",{class:"btn-text"},"上传照片")])):e.createCommentVNode("",!0)])])]),e.createElementVNode("view",{class:"modal-footer"},[e.createElementVNode("button",{class:"modal-btn cancel-btn",onClick:a[5]||(a[5]=(...e)=>i.closeInventoryModal&&i.closeInventoryModal(...e))},"取消"),e.createElementVNode("button",{class:"modal-btn submit-btn",onClick:a[6]||(a[6]=(...e)=>i.submit&&i.submit(...e))},"提交盘点")])])])):e.createCommentVNode("",!0),l.showDetailModal?(e.openBlock(),e.createElementBlock("view",{key:1,class:"detail-modal",onClick:a[13]||(a[13]=(...e)=>i.closeDetailModal&&i.closeDetailModal(...e))},[e.createElementVNode("view",{class:"detail-modal-content",onClick:a[12]||(a[12]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:"detail-modal-header"},[e.createElementVNode("text",{class:"detail-modal-title"},"运维记录详情"),e.createElementVNode("view",{class:"detail-modal-close",onClick:a[9]||(a[9]=(...e)=>i.closeDetailModal&&i.closeDetailModal(...e))},[e.createElementVNode("text",{class:"close-icon"},"×")])]),e.createElementVNode("scroll-view",{class:"detail-modal-body","scroll-y":""},[e.createElementVNode("view",{class:"detail-form-group"},[e.createElementVNode("text",{class:"detail-form-label"},"计划维护日期:"),e.createElementVNode("text",{class:"detail-form-value"},e.toDisplayString(i.formatDate(l.currentRecord.planned_maintenance_date)||"-"),1)]),e.createElementVNode("view",{class:"detail-form-group"},[e.createElementVNode("text",{class:"detail-form-label"},"实际维护日期:"),e.createElementVNode("text",{class:"detail-form-value"},e.toDisplayString(i.formatDate(l.currentRecord.maintenance_date)||"-"),1)]),e.createElementVNode("view",{class:"detail-form-group"},[e.createElementVNode("text",{class:"detail-form-label"},"负责人:"),e.createElementVNode("text",{class:"detail-form-value"},e.toDisplayString(l.currentRecord.responsible_admin?l.currentRecord.responsible_admin.name:"-"),1)]),e.createElementVNode("view",{class:"detail-form-group"},[e.createElementVNode("text",{class:"detail-form-label"},"运维内容:"),e.createElementVNode("text",{class:"detail-form-value"},e.toDisplayString(l.currentRecord.content||"-"),1)]),e.createElementVNode("view",{class:"detail-form-group"},[e.createElementVNode("text",{class:"detail-form-label"},"维护备注:"),e.createElementVNode("text",{class:"detail-form-value"},e.toDisplayString(l.currentRecord.maintenance_content||"-"),1)]),e.createElementVNode("view",{class:"detail-form-group"},[e.createElementVNode("text",{class:"detail-form-label"},"维护照片:"),l.currentRecord.files&&l.currentRecord.files.length?(e.openBlock(),e.createElementBlock("view",{key:0,class:"detail-photo-gallery"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.currentRecord.files,((t,a)=>(e.openBlock(),e.createElementBlock("image",{key:"file-"+a,src:t.url,class:"detail-photo-preview",mode:"aspectFill",onClick:e=>i.previewImage(t.url,l.currentRecord.files.map((e=>e.url)))},null,8,["src","onClick"])))),128))])):(e.openBlock(),e.createElementBlock("text",{key:1,class:"detail-form-value"},"-"))]),e.createElementVNode("view",{class:"detail-form-group"},[e.createElementVNode("text",{class:"detail-form-label"},"签名照片:"),l.currentRecord.sign&&l.currentRecord.sign.url?(e.openBlock(),e.createElementBlock("view",{key:0,class:"detail-photo-gallery"},[e.createElementVNode("image",{src:l.currentRecord.sign.url,class:"detail-sign-preview",mode:"aspectFill",onClick:a[10]||(a[10]=e=>i.previewImage(l.currentRecord.sign.url,[l.currentRecord.sign.url]))},null,8,["src"])])):(e.openBlock(),e.createElementBlock("text",{key:1,class:"detail-form-value"},"-"))])]),e.createElementVNode("view",{class:"detail-modal-footer"},[e.createElementVNode("button",{class:"modal-btn submit-btn",onClick:a[11]||(a[11]=(...e)=>i.closeDetailModal&&i.closeDetailModal(...e))},"关闭")])])])):e.createCommentVNode("",!0),l.showCompleteModal?(e.openBlock(),e.createElementBlock("view",{key:2,class:"complete-modal",onClick:a[25]||(a[25]=(...e)=>i.closeCompleteModal&&i.closeCompleteModal(...e))},[e.createElementVNode("view",{class:"complete-modal-content",onClick:a[24]||(a[24]=e.withModifiers((()=>{}),["stop"]))},[e.createElementVNode("view",{class:"complete-modal-header"},[e.createElementVNode("text",{class:"complete-modal-title"},"完成维护"),e.createElementVNode("view",{class:"complete-modal-close",onClick:a[14]||(a[14]=(...e)=>i.closeCompleteModal&&i.closeCompleteModal(...e))},[e.createElementVNode("text",{class:"close-icon"},"×")])]),e.createElementVNode("scroll-view",{class:"complete-modal-body","scroll-y":""},[e.createElementVNode("view",{class:"complete-form-group"},[e.createElementVNode("text",{class:"complete-form-label"},"实际维护日期"),e.createElementVNode("picker",{mode:"date",value:l.completeForm.actual_date,onChange:a[15]||(a[15]=(...e)=>i.onDateChange&&i.onDateChange(...e))},[e.createElementVNode("view",{class:"complete-form-input"},[e.createElementVNode("text",{class:e.normalizeClass(l.completeForm.actual_date?"input-value":"input-placeholder")},e.toDisplayString(l.completeForm.actual_date||"请选择实际维护日期"),3)])],40,["value"])]),e.createElementVNode("view",{class:"complete-form-group"},[e.createElementVNode("text",{class:"complete-form-label"},"维护备注"),e.withDirectives(e.createElementVNode("textarea",{class:"complete-form-textarea","onUpdate:modelValue":a[16]||(a[16]=e=>l.completeForm.notes=e),placeholder:"请输入维护备注",maxlength:500},null,512),[[e.vModelText,l.completeForm.notes]])]),e.createElementVNode("view",{class:"complete-form-group"},[e.createElementVNode("text",{class:"complete-form-label"},"上传图片"),e.createElementVNode("view",{class:"complete-photo-upload"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.completeForm.photos,((t,a)=>(e.openBlock(),e.createElementBlock("view",{key:a,class:"complete-photo-preview"},[e.createElementVNode("image",{src:t.url,mode:"aspectFill",class:"complete-photo-img"},null,8,["src"]),e.createElementVNode("view",{class:"complete-photo-del",onClick:e=>i.removeCompletePhoto(a)},[e.createElementVNode("text",{class:"delete-icon"},"×")],8,["onClick"])])))),128)),l.completeForm.photos.length<9?(e.openBlock(),e.createElementBlock("button",{key:0,class:"complete-photo-btn",onClick:a[17]||(a[17]=(...e)=>i.chooseCompletePhoto&&i.chooseCompletePhoto(...e))},[e.createElementVNode("text",{class:"iconfont icon-camera"}),e.createElementVNode("text",{class:"btn-text"},"上传照片")])):e.createCommentVNode("",!0)])]),e.createElementVNode("view",{class:"complete-form-group"},[e.createElementVNode("text",{class:"complete-form-label"},"签名"),e.createElementVNode("view",{class:"signature-wrapper"},[e.createElementVNode("canvas",{"canvas-id":"signatureCanvas",class:"signature-canvas","disable-scroll":"true",onTouchstart:a[18]||(a[18]=(...e)=>i.onTouchStart&&i.onTouchStart(...e)),onTouchmove:a[19]||(a[19]=(...e)=>i.onTouchMove&&i.onTouchMove(...e)),onTouchend:a[20]||(a[20]=(...e)=>i.onTouchEnd&&i.onTouchEnd(...e))},null,32),e.createElementVNode("view",{class:"signature-actions"},[e.createElementVNode("button",{class:"signature-btn",onClick:a[21]||(a[21]=(...e)=>i.clearSignature&&i.clearSignature(...e))},"清除签名")])])])]),e.createElementVNode("view",{class:"complete-modal-footer"},[e.createElementVNode("button",{class:"modal-btn cancel-btn",onClick:a[22]||(a[22]=(...e)=>i.closeCompleteModal&&i.closeCompleteModal(...e))},"取消"),e.createElementVNode("button",{class:"modal-btn submit-btn",onClick:a[23]||(a[23]=(...e)=>i.submitCompleteMaintenance&&i.submitCompleteMaintenance(...e))},"确认完成")])])])):e.createCommentVNode("",!0)],64)}]]);const v=i({data:()=>({planId:null,planInfo:{},materialList:[],materialPage:1,materialPageSize:100,materialTotal:0,materialLoading:!1,materialHasMore:!0,materialKeyword:""}),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:143","解析计划信息失败:",t)}e.planId&&(this.planId=e.planId),uni.setNavigationBarTitle({title:this.planInfo.name||"盘点计划详情"}),this.getMaterialList(!0)},methods:{searchMaterials(){this.getMaterialList(!0)},async getMaterialList(e=!1){var t,o;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,sort_type:"DESC",sort_name:"status",keyword:this.materialKeyword,"filter[0][key]":"material_infos_plan_id","filter[0][op]":"eq","filter[0][value]":this.planId},i=await function(e){const t=uni.getStorageSync("token");return new Promise(((a,o)=>{uni.request({url:n+"api/admin/material-infos-plan-link/index",method:"GET",data:{...e,token:t},success:a,fail:o})}))}(l);if(a("log","at pages/plan-detail/plan-detail.vue:194","物资列表响应:",i),i.data&&40001===i.data.errcode)return uni.showToast({title:(null==(t=i.data)?void 0:t.errmsg)||"获取物资列表失败",icon:"none"}),void uni.reLaunch({url:"/pages/login/login"});if(i.data&&i.data.list){const t=i.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==(o=i.data)?void 0:o.message)||"获取物资列表失败",icon:"none"})}catch(l){a("error","at pages/plan-detail/plan-detail.vue:231","获取物资列表失败:",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:292","开始盘点物资:",e),e.inventorys_id?uni.navigateTo({url:`/pages/inventory/inventory?code=${e.inventorys_id}`}):uni.showToast({title:"暂无盘点信息",icon:"none"})}}},[["render",function(t,a,n,o,l,i){return e.openBlock(),e.createElementBlock("scroll-view",{class:"plan-detail-container","scroll-y":"",onScrolltolower:a[2]||(a[2]=(...e)=>i.loadMoreMaterials&&i.loadMoreMaterials(...e)),"lower-threshold":"100",onRefresherrefresh:a[3]||(a[3]=(...e)=>i.refreshMaterials&&i.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(i.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(i.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(i.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(i.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-search-bar"},[e.withDirectives(e.createElementVNode("input",{type:"text",placeholder:"请输入物资名称","onUpdate:modelValue":a[0]||(a[0]=e=>l.materialKeyword=e)},null,512),[[e.vModelText,l.materialKeyword]]),e.createElementVNode("button",{size:"mini",type:"primary",onClick:a[1]||(a[1]=(...e)=>i.searchMaterials&&i.searchMaterials(...e))},"搜索")]),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,o;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==(o=t.inventory)?void 0:o.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(i.getInventoryStatusText(t.status)),3)]),e.createElementVNode("view",{class:"material-info material-action-col"},[e.createElementVNode("view",{class:"inventory-action-btn",onClick:e.withModifiers((e=>i.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",p),__definePage("pages/scan/scan",h),__definePage("pages/inventory/inventory",g),__definePage("pages/plan-detail/plan-detail",v);let y=null;var E;"undefined"!=typeof plus&&plus.android&&(y=plus.android.runtimeMainActivity(),"android"==uni.getSystemInfoSync().platform&&(plus.runtime.quit=function(){setTimeout((()=>{y.finish()}),10)}));const w={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"),E=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"),E){E.setDebuggable(!0,(e=>{a("log","at App.vue:54","App Show","setDebuggable: "+e)}));var e=Date.now();E.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"),E&&E.closeUhf((e=>{a("log","at App.vue:83","App Hide","closeUhf: "+e),uni.showToast({title:"关闭成功",icon:"none",duration:1e3})}))}};const{app:f,Vuex:N,Pinia:V}=function(){const t=e.createVueApp(w);return t.config.globalProperties.$config=o,{app:t}}();uni.Vuex=N,uni.Pinia=V,f.provide("__globalStyles",__uniConfig.styles),f._component.mpType="app",f._component.render=()=>{},f.mount("#app")}(Vue);