mirror of
https://github.com/silenty4ng/k5web
synced 2024-11-14 14:33:23 +00:00
2 lines
4.6 KiB
JavaScript
2 lines
4.6 KiB
JavaScript
import{v as K,m as M,ak as H,_ as N}from"./index.51ef80f0.js";/* empty css *//* empty css *//* empty css */import{d as F,r as S,c as L,bI as O,C as U,D as V,aI as s,aH as i,G as h,aN as u,aM as _,u as x,a6 as j,a$ as G,ba as J,bJ as W,bL as q}from"./arco.7f845a67.js";import{u as Q}from"./loading.1a4e75f4.js";import{e as b,a as y,u as v,b as g,h as w,g as X}from"./serial.c6b76da8.js";import{I as Y}from"./index.f1229680.js";import{M as Z,T as ee}from"./index.ef93ea5e.js";import{B as te}from"./index.2a30503f.js";import"./chart.3e6cb2f1.js";import"./vue.0bef8fc5.js";import"./useConfig.f39818e8.js";import"./useGlobalIcon.b2ec211b.js";import"./helper.edfcb01e.js";import"./dep-6deb4e3a.72b9cb59.js";import"./dialog.8d863194.js";import"./index.35294b75.js";import"./form-model.0587a70f.js";import"./useDisabled.c43fe4a9.js";import"./slot.ff55d934.js";const ae={class:"container"},oe={name:"Radio"},ne=F({...oe,setup(re){const{t:D}=K.exports.useI18n(),o=M(),{loading:P,setLoading:m}=Q(!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=L(()=>[{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:Y,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,l;if(o.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}if(await b(o.connectPort),m(!0),(t=o.configuration)!=null&&t.fm30){let c=new Uint8Array(60);for(let e=131008;e<131057;e+=8){const p=await y(o.connectPort,e,8,(n=o.configuration)==null?void 0:n.uart);c.set(p,e-131008)}const r=[];for(let e=0;e<60;e+=2){const p=v(c.subarray(e,e+2));p!="ffff"?r.push({rx:parseInt(p,16)/10}):r.push({})}a.renderData=r}else{let c=new Uint8Array(40);for(let e=3648;e<3681;e+=8){const p=await y(o.connectPort,e,8,(l=o.configuration)==null?void 0:l.uart);c.set(p,e-3648)}const r=[];for(let e=0;e<40;e+=2){const p=v(c.subarray(e,e+2));p!="ffff"?r.push({rx:parseInt(p,16)/10}):r.push({})}a.renderData=r}m(!1)},$=async()=>{var t,n,l,c,r;if(o.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}if(await b(o.connectPort),m(!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,(l=o.configuration)==null?void 0:l.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 X(o.connectPort),m(!1)},k=async t=>{const n=[...a.renderData];n.splice(t,1,{scanlist:[]}),a.renderData=n};return(t,n)=>{const l=H,c=j,r=G,e=J,p=W,A=q,B=te,T=ee,E=O;return U(),V("div",ae,[s(l,{items:[t.$t("menu.dashboard"),t.$t("menu.cps.radio")]},null,8,["items"]),s(E,{class:"general-card"},{title:i(()=>[h("span",{onClick:n[0]||(n[0]=()=>{I.showHide+=1})},u(t.$t("menu.cps.radio")+t.$t("global.onStart")),1)]),default:i(()=>[s(A,{style:{"margin-bottom":"16px"}},{default:i(()=>[s(p,{span:12},{default:i(()=>[s(e,null,{default:i(()=>[s(r,{type:"primary",onClick:z},{icon:i(()=>[s(c)]),default:i(()=>[_(" "+u(t.$t("cps.onDeviceRead")),1)]),_:1}),s(r,{onClick:$},{icon:i(()=>[s(c)]),default:i(()=>[_(" "+u(t.$t("cps.onDeviceWrite")),1)]),_:1})]),_:1})]),_:1})]),_:1}),s(T,{class:"ttable",loading:x(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:i(({row:d,rowIndex:f})=>[h("span",null,[s(x(Z))])]),index:i(({row:d,rowIndex:f})=>[_(u((a.nowPage-1)*a.pageSize+f+1),1)]),operate:i(({row:d,rowIndex:f})=>[s(B,{theme:"default",variant:"dashed",onClick:ie=>k((a.nowPage-1)*a.pageSize+f)},{default:i(()=>[_(u(t.$t("cps.clear")),1)]),_:2},1032,["onClick"])]),_:1},8,["loading","columns","data","pagination"])]),_:1})])}}});const Re=N(ne,[["__scopeId","data-v-be263a43"]]);export{Re as default};
|