import{_ as z}from"./dialogContent.8cf6deaf.js";import{b as x,r as g,ah as _,e as H,cr as j,cE as O,o as u,c as w,p as l,q as n,n as a,F as q,A,y as v,P as f,x as y,aH as E,aj as G,s as J,v as K,ai as Q,S as T,j as W,k as X,E as Z,i as ee,l as te,m as ae,D as oe}from"./index.8d733f79.js";import{E as le}from"./el-date-picker-panel.089dbe6d.js";import{D as ne,E as re,F as se}from"./collector.4eeb72e6.js";import ie from"./vtageTrendModal.5f147787.js";import"./panel-time-pick.b2dd8e75.js";import"./index.28f6da25.js";/* empty css                        */const me={class:"page-content"},pe=K("div",{class:"page-title"},"\u7535\u6C60\u72B6\u6001\u5206\u6790",-1),De={__name:"index",setup(de){const{t:D}=x(),{proxy:$}=oe(),k=g(),m=g(!1),r=_({sn:"",factoryId:"",pageNo:1,pageSize:10}),i=_({id:"",time:""}),V=g([]),p=_({total:0,tableData:[],columns:[{prop:"sn",label:"sensorSn"},{prop:"deviceNames",label:"associatedDevice"},{prop:"factoryName",label:"belongTofactory"},{prop:"currentBattery",label:"currentBattery",sortable:!0},{prop:"batteryReplaceTime",label:"newBatteryTime"},{label:"batterInfo",type:"action",width:350,fixed:"right"}]});H(()=>{d(),S()});async function d(){const e=await ne(r);p.total=e.data.totalElements,p.tableData=e.data.content}async function S(){const e=await j();V.value=e.data}const C=()=>{k.value.resetFields(),d()};function B(e){$.$refs.vtageTrendRef.showModal(e)}const N=e=>{i.id=e.id,i.time=Q(new Date).format("YYYY-MM-DD HH:mm:ss"),i.sn=e.sn,m.value=!0},F=async()=>{if(!i.time){T.error("\u8BF7\u9009\u62E9\u66F4\u6362\u65F6\u95F4");return}re(i).then(e=>{e.code===200&&(T.success(e.msg),m.value=!1,d())})},I=()=>{se(r).then(e=>{const o=new Blob([e]),s=document.createElement("a");s.href=URL.createObjectURL(o),s.download=`${D("batteryAnalysis")}.xls`,s.style.display="none",document.body.appendChild(s),s.click(),s.remove(),$.$modal.msgSuccess(D("exportSuccess"))})};return(e,o)=>{const s=W,b=X,M=Z,P=ee,c=te,R=ae,U=le,Y=z,h=O("hasPermi");return u(),w("div",me,[pe,l(R,{ref_key:"formRef",ref:k,model:a(r),inline:!0},{default:n(()=>[l(b,{label:e.$t("sensorSn"),prop:"sn"},{default:n(()=>[l(s,{modelValue:a(r).sn,"onUpdate:modelValue":o[0]||(o[0]=t=>a(r).sn=t),placeholder:e.$t("sensorSnP"),maxlength:"20",style:{width:"236px"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(b,{label:e.$t("factory"),prop:"factoryId"},{default:n(()=>[l(P,{modelValue:a(r).factoryId,"onUpdate:modelValue":o[1]||(o[1]=t=>a(r).factoryId=t),placeholder:e.$t("factoryP"),filterable:""},{default:n(()=>[(u(!0),w(q,null,A(a(V),t=>(u(),v(M,{key:t.id,label:t.name,value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),l(b,null,{default:n(()=>[l(c,{type:"primary",onClick:d},{default:n(()=>[f(y(e.$t("query")),1)]),_:1}),l(c,{onClick:C},{default:n(()=>[f(y(e.$t("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"]),l(c,{onClick:I,style:{position:"absolute",top:"16px",right:"16px"}},{default:n(()=>[f(y(e.$t("export")),1)]),_:1}),l(a(G),{class:"f-h",columns:a(p).columns,tableData:a(p).tableData,total:a(p).total,pageNum:a(r).pageNo,"onUpdate:pageNum":o[2]||(o[2]=t=>a(r).pageNo=t),pageSize:a(r).pageSize,"onUpdate:pageSize":o[3]||(o[3]=t=>a(r).pageSize=t),onPagination:d},{action:n(({scope:t})=>[E((u(),v(c,{type:"primary",link:"",onClick:L=>B(t.row)},{default:n(()=>[f(y(e.$t("batteryOrVoltage")),1)]),_:2},1032,["onClick"])),[[h,["hardware_battery_all"]]]),E((u(),v(c,{type:"primary",link:"",onClick:L=>N(t.row)},{default:n(()=>[f(y(e.$t("recordbatteryTime")),1)]),_:2},1032,["onClick"])),[[h,["hardware_battery_all"]]])]),_:1},8,["columns","tableData","total","pageNum","pageSize"]),l(Y,{modelValue:a(m),"onUpdate:modelValue":o[5]||(o[5]=t=>J(m)?m.value=t:null),title:e.$t("recordbatteryTime"),onConfirm:F,onCancel:o[6]||(o[6]=t=>m.value=!1)},{main:n(()=>[l(b,{label:e.$t("batteryTime"),prop:"time"},{default:n(()=>[l(U,{modelValue:a(i).time,"onUpdate:modelValue":o[4]||(o[4]=t=>a(i).time=t),type:"datetime","value-format":"YYYY-MM-DD HH:mm:ss",placeholder:e.$t("batteryTimeP"),clearable:!1},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["modelValue","title"]),l(a(ie),{ref:"vtageTrendRef"},null,512)])}}};export{De as default};
