pages-navigation-navigationLog.ym3ZEaNO.js 3.5 KB

1
  1. import{_ as t,s as e,r as s,n as a,y as o,k as i,c,w as d,o as r,b as n,d as l,l as h,m as u,F as m,i as f,S as p,p as g,t as L,e as _}from"./index-DTYl77VF.js";import{A as y}from"./AdminLayout.V94VehU1.js";const w=t({components:{AdminLayout:y},data:()=>({IP:"",recordList:[],translateX:0,startX:0,delWidth:160}),onLoad(){this.IP=localStorage.getItem("ip")},onShow(){this.getRecordList()},methods:{handleSingleDownload(t){const s="http://"+this.IP+":9002/static/rec/"+t+"/data.csv",a=s.replace(/[\n\t\r]/g,"").trim(),o=s.replace(/[\\\/:*?"<>|\n\r\t]/g,"_"),i=document.createElement("a");i.href=a,i.download=o,document.body.appendChild(i),i.click(),document.body.removeChild(i),e({title:`开始下载${s}`,icon:"none"})},touchStart(t,e){this.recordList.forEach(((t,s)=>{s!==e&&(t.offset=0,t.right=-160)})),this.startX=t.touches[0].pageX,this.currentIndex=e},touchMove(t,e){if(this.currentIndex!==e)return;let s=t.touches[0].pageX-this.startX,a=-this.delWidth;s<0?(this.recordList[e].offset=Math.max(a,s),this.recordList[e].right=Math.max(a,s)):(this.recordList[e].offset=0,this.recordList[e].right=-160)},touchEnd(t,e){this.recordList[e].offset<-this.delWidth/2?(this.recordList[e].offset=-this.delWidth,this.recordList[e].right=0):(this.recordList[e].offset=0,this.recordList[e].right=-160),this.currentIndex=-1},async getRecordList(){const t=await new Promise(((t,e)=>{s({url:"http://"+this.IP+":9002",method:"POST",header:{"Content-Type":"application/json"},data:JSON.stringify({code:"",cmd:1025,msg:"",data:{op:1}}),success:t,fail:e})}));t.data.data&&(this.recordList=t.data.data.map((t=>({name:t,offset:0,right:-160}))))},goDetail(t){a({url:`/pages/navigation/view?item=${t}`})},deleteHandle(t,a){o({title:"提示",content:"删除后文件不可恢复,确认删除吗?",confirmText:"确认",cancelText:"取消",success:async o=>{o.confirm&&s({url:"http://"+this.IP+":9002",method:"POST",header:{"Content-Type":"application/json"},data:JSON.stringify({code:"",cmd:1025,msg:"",data:{op:3,number:a}}),success:s=>{s.data.data&&(this.recordList.splice(t,1),e({title:"删除成功"}))},fail:t=>console.error(t)})}})}}},[["render",function(t,e,s,a,o,y){const w=f,T=_,x=p,S=i("AdminLayout");return r(),c(S,{active:"导航记录",breadcrumb:["地图导航","导航记录"]},{default:d((()=>[n(w,{class:"ota"},{default:d((()=>[n(w,{class:"panel"},{default:d((()=>[n(w,{class:"panel-title"},{default:d((()=>[l("导航记录")])),_:1}),n(x,{class:"list-scroll","scroll-y":"true"},{default:d((()=>[n(w,{class:"list-wrap"},{default:d((()=>[(r(!0),h(m,null,u(o.recordList,((t,e)=>(r(),c(w,{class:"swipe-item",key:e},{default:d((()=>[n(w,{class:"swipe-main",style:g({transform:`translateX(${t.offset}px)`}),onTouchstart:t=>y.touchStart(t,e),onTouchmove:t=>y.touchMove(t,e),onTouchend:t=>y.touchEnd(t,e)},{default:d((()=>[n(w,{class:"list-item"},{default:d((()=>[n(w,{class:"download-btn",onClick:e=>y.handleSingleDownload(t.name)},{default:d((()=>[n(T,{class:"down-icon"},{default:d((()=>[l("⬇")])),_:1})])),_:2},1032,["onClick"]),n(w,{class:"item-info",onClick:e=>y.goDetail(t.name)},{default:d((()=>[n(T,{class:"item-name"},{default:d((()=>[l(L(t.name),1)])),_:2},1024)])),_:2},1032,["onClick"]),n(w,{class:"arrow"},{default:d((()=>[l("›")])),_:1})])),_:2},1024)])),_:2},1032,["style","onTouchstart","onTouchmove","onTouchend"]),n(w,{class:"swipe-del",style:g({right:`${t.right}px`}),onClick:s=>y.deleteHandle(e,t.name)},{default:d((()=>[l("删除")])),_:2},1032,["style","onClick"])])),_:2},1024)))),128))])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-e80b0d74"]]);export{w as default};