k5web/assets/index.67025a88.js
2024-07-20 11:44:29 +08:00

2 lines
4.4 KiB
JavaScript

import{v as K,s as M,ac as N,N as H,_ as F}from"./index.046706a8.js";/* empty css *//* empty css *//* empty css */import{d as L,r as S,c as O,bI as U,C as V,D as j,aI as i,aH as s,G as h,aN as u,aM as m,u as b,a6 as G,b8 as J,bi as W,bJ as q,bL as Q}from"./arco.c29bba08.js";import{u as X}from"./loading.d503f2cd.js";import{e as x,a as y,u as v,b as g,h as w,g as Y}from"./serial.c6b76da8.js";import{I as Z}from"./index.2e37277f.js";import{M as ee,T as te}from"./index.348d5806.js";import"./chart.34708d29.js";import"./vue.437ba699.js";import"./dep-6deb4e3a.bbd6159e.js";import"./form-model.3b2aca7d.js";import"./slot.7c7adb29.js";const ae={class:"container"},oe={name:"Radio"},ne=L({...oe,setup(re){const{t:D}=K.exports.useI18n(),o=M(),{loading:P,setLoading:f}=X(!1),a=S({renderData:Array.from({length:20}).map(t=>({})),pageSize:50,nowPage:1}),I=S({showHide:0}),C=t=>{a.renderData=t.newData},R=O(()=>[{colKey:"drag",title:D("cps.sort"),width:46},{title:"#",colKey:"index",align:"left",width:100},{title:D("cps.rx"),colKey:"rx",align:"left",width:200,cell:(t,{row:n})=>parseFloat(n.rx)?parseFloat(n.rx).toFixed(2):void 0,edit:{component:Z,props:{clearable:!0},onEdited:t=>{t.newRowData.rx=t.newRowData.rx?t.newRowData.rx:void 0;const n=[...a.renderData];n.splice((a.nowPage-1)*a.pageSize+t.rowIndex,1,t.newRowData),a.renderData=n}}},{title:D("cps.operate"),colKey:"operate",align:"left",width:150}]),z=async()=>{var t,n,p;if(o.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}if(await x(o.connectPort),f(!0),(t=o.configuration)!=null&&t.fm30){let c=new Uint8Array(60);for(let e=131008;e<131057;e+=8){const l=await y(o.connectPort,e,8,(n=o.configuration)==null?void 0:n.uart);c.set(l,e-131008)}const r=[];for(let e=0;e<60;e+=2){const l=v(c.subarray(e,e+2));l!="ffff"?r.push({rx:parseInt(l,16)/10}):r.push({})}a.renderData=r}else{let c=new Uint8Array(40);for(let e=3648;e<3681;e+=8){const l=await y(o.connectPort,e,8,(p=o.configuration)==null?void 0:p.uart);c.set(l,e-3648)}const r=[];for(let e=0;e<40;e+=2){const l=v(c.subarray(e,e+2));l!="ffff"?r.push({rx:parseInt(l,16)/10}):r.push({})}a.renderData=r}f(!1)},$=async()=>{var t,n,p,c,r;if(o.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}if(await x(o.connectPort),f(!0),(t=o.configuration)!=null&&t.fm30)for(let e=0;e<60;e+=2)a.renderData[e/2].rx?await g(o.connectPort,e+131008,w(parseInt(a.renderData[e/2].rx*10).toString(16).padStart(4,"0")),2,(n=o.configuration)==null?void 0:n.uart):await g(o.connectPort,e+131008,w("0000"),2,(p=o.configuration)==null?void 0:p.uart);else for(let e=0;e<40;e+=2)a.renderData[e/2].rx?await g(o.connectPort,e+3648,w(parseInt(a.renderData[e/2].rx*10).toString(16).padStart(4,"0")),2,(c=o.configuration)==null?void 0:c.uart):await g(o.connectPort,e+3648,w("0000"),2,(r=o.configuration)==null?void 0:r.uart);await Y(o.connectPort),f(!1)},k=async t=>{const n=[...a.renderData];n.splice(t,1,{scanlist:[]}),a.renderData=n};return(t,n)=>{const p=N,c=G,r=J,e=W,l=q,A=Q,T=H,B=te,E=U;return V(),j("div",ae,[i(p,{items:[t.$t("menu.dashboard"),t.$t("menu.cps.radio")]},null,8,["items"]),i(E,{class:"general-card"},{title:s(()=>[h("span",{onClick:n[0]||(n[0]=()=>{I.showHide+=1})},u(t.$t("menu.cps.radio")+t.$t("global.onStart")),1)]),default:s(()=>[i(A,{style:{"margin-bottom":"16px"}},{default:s(()=>[i(l,{span:12},{default:s(()=>[i(e,null,{default:s(()=>[i(r,{type:"primary",onClick:z},{icon:s(()=>[i(c)]),default:s(()=>[m(" "+u(t.$t("cps.onDeviceRead")),1)]),_:1}),i(r,{onClick:$},{icon:s(()=>[i(c)]),default:s(()=>[m(" "+u(t.$t("cps.onDeviceWrite")),1)]),_:1})]),_:1})]),_:1})]),_:1}),i(B,{class:"ttable",loading:b(P),size:"medium",columns:R.value,data:a.renderData,pagination:{defaultPageSize:a.pageSize,total:a.renderData.length,defaultCurrent:1,pageSizeOptions:[15,30,50,100,200]},onChange:n[1]||(n[1]=d=>{a.pageSize=d.pagination.pageSize,a.nowPage=d.pagination.current}),bordered:"","lazy-load":"",headerAffixedTop:{offsetTop:60},hover:!0,"drag-sort":"row-handler",onDragSort:C},{drag:s(({row:d,rowIndex:_})=>[h("span",null,[i(b(ee))])]),index:s(({row:d,rowIndex:_})=>[m(u((a.nowPage-1)*a.pageSize+_+1),1)]),operate:s(({row:d,rowIndex:_})=>[i(T,{theme:"default",variant:"dashed",onClick:se=>k((a.nowPage-1)*a.pageSize+_)},{default:s(()=>[m(u(t.$t("cps.clear")),1)]),_:2},1032,["onClick"])]),_:1},8,["loading","columns","data","pagination"])]),_:1})])}}});const be=F(ne,[["__scopeId","data-v-be263a43"]]);export{be as default};