mirror of
https://github.com/silenty4ng/k5web
synced 2024-11-14 22:35:31 +00:00
2 lines
3.9 KiB
JavaScript
2 lines
3.9 KiB
JavaScript
import{v as A,e as K,ak as H,_ as E}from"./index.ed45be5a.js";/* empty css *//* empty css *//* empty css */import{d as M,r as g,c as N,bH as F,C as V,D as L,aI as r,aH as o,G as f,aN as p,aM as m,u as w,a6 as O,a$ as U,ba as j,bI as G,bJ as J}from"./arco.768e32d2.js";import{u as W}from"./loading.c097827a.js";import{e as D,a as q,u as Q,b as S,h,g as X}from"./serial.c741fbda.js";import{I as Y}from"./form-model.10d173e3.js";import{M as Z,T as ee}from"./index.98345adf.js";import{B as te}from"./index.8714e774.js";import"./chart.affe3403.js";import"./vue.5a5bc6a2.js";import"./useConfig.442d698e.js";import"./dialog.3cb279ab.js";import"./index.d87791fe.js";import"./dep-6deb4e3a.042be393.js";import"./slot.da180938.js";const ae={class:"container"},oe={name:"Radio"},ne=M({...oe,setup(re){const{t:_}=A.exports.useI18n(),s=K(),{loading:b,setLoading:d}=W(!1),a=g({renderData:Array.from({length:20}).map(e=>({scanlist:[]})),pageSize:20,nowPage:1}),y=g({showHide:0}),v=e=>{a.renderData=e.newData},x=N(()=>[{colKey:"drag",title:_("cps.sort"),width:46},{title:"#",colKey:"index",align:"left",width:100},{title:_("cps.rx"),colKey:"rx",align:"left",width:200,cell:(e,{row:t})=>parseFloat(t.rx)?parseFloat(t.rx).toFixed(2):void 0,edit:{component:Y,props:{clearable:!0},onEdited:e=>{e.newRowData.rx=e.newRowData.rx?e.newRowData.rx:void 0;const t=[...a.renderData];t.splice((a.nowPage-1)*a.pageSize+e.rowIndex,1,e.newRowData),a.renderData=t}}},{title:_("cps.operate"),colKey:"operate",align:"left",width:150}]),C=async()=>{var i;if(s.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}await D(s.connectPort),d(!0);let e=new Uint8Array(40);for(let n=3648;n<3681;n+=8){const c=await q(s.connectPort,n,8,(i=s.configuration)==null?void 0:i.uart);e.set(c,n-3648)}const t=[];for(let n=0;n<40;n+=2){const c=Q(e.subarray(n,n+2));c!="ffff"?t.push({rx:parseInt(c,16)/10}):t.push({})}a.renderData=t,console.log(e),d(!1)},I=async()=>{var e,t;if(s.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}await D(s.connectPort),d(!0);for(let i=0;i<40;i+=2)a.renderData[i/2].rx?await S(s.connectPort,i+3648,h(parseInt(a.renderData[i/2].rx*10).toString(16).padStart(4,"0")),2,(e=s.configuration)==null?void 0:e.uart):await S(s.connectPort,i+3648,h("0000"),2,(t=s.configuration)==null?void 0:t.uart);await X(s.connectPort),d(!1)},P=async e=>{const t=[...a.renderData];t.splice(e,1,{scanlist:[]}),a.renderData=t};return(e,t)=>{const i=H,n=O,c=U,z=j,R=G,$=J,k=te,B=ee,T=F;return V(),L("div",ae,[r(i,{items:[e.$t("menu.dashboard"),e.$t("menu.cps.radio")]},null,8,["items"]),r(T,{class:"general-card"},{title:o(()=>[f("span",{onClick:t[0]||(t[0]=()=>{y.showHide+=1})},p(e.$t("menu.cps.radio")+e.$t("global.onStart")),1)]),default:o(()=>[r($,{style:{"margin-bottom":"16px"}},{default:o(()=>[r(R,{span:12},{default:o(()=>[r(z,null,{default:o(()=>[r(c,{type:"primary",onClick:C},{icon:o(()=>[r(n)]),default:o(()=>[m(" "+p(e.$t("cps.onDeviceRead")),1)]),_:1}),r(c,{onClick:I},{icon:o(()=>[r(n)]),default:o(()=>[m(" "+p(e.$t("cps.onDeviceWrite")),1)]),_:1})]),_:1})]),_:1})]),_:1}),r(B,{class:"ttable",loading:w(b),size:"medium",columns:x.value,data:a.renderData,pagination:{defaultPageSize:a.pageSize,total:a.renderData.length,defaultCurrent:1,pageSizeOptions:[15,30,50,100,200]},onChange:t[1]||(t[1]=l=>{a.pageSize=l.pagination.pageSize,a.nowPage=l.pagination.current}),bordered:"","lazy-load":"",headerAffixedTop:{offsetTop:60},hover:!0,"drag-sort":"row-handler",onDragSort:v},{drag:o(({row:l,rowIndex:u})=>[f("span",null,[r(w(Z))])]),index:o(({row:l,rowIndex:u})=>[m(p((a.nowPage-1)*a.pageSize+u+1),1)]),operate:o(({row:l,rowIndex:u})=>[r(k,{theme:"default",variant:"dashed",onClick:se=>P((a.nowPage-1)*a.pageSize+u)},{default:o(()=>[m(p(e.$t("cps.clear")),1)]),_:2},1032,["onClick"])]),_:1},8,["loading","columns","data","pagination"])]),_:1})])}}});const xe=E(ne,[["__scopeId","data-v-9023bd14"]]);export{xe as default};
|