mirror of
https://github.com/silenty4ng/k5web
synced 2024-11-14 22:35:31 +00:00
2 lines
4.5 KiB
JavaScript
2 lines
4.5 KiB
JavaScript
import{v as H,e as M,ak as N,_ as U}from"./index.77e506b7.js";/* empty css *//* empty css *//* empty css */import{d as V,r as D,c as L,bH as O,C as j,D as G,aI as i,aH as r,G as y,aN as f,aM as g,u as S,a6 as J,a$ as W,ba as q,bI as F,bJ as Q}from"./arco.768e32d2.js";import{u as X}from"./loading.c097827a.js";import{e as h,a as b,u as v,f as Y,h as P,s as Z,b as w,g as ee}from"./serial.c741fbda.js";import{I as C}from"./form-model.71f84e3f.js";import{M as te,T as ae}from"./index.d5e8a3fd.js";import{B as ne}from"./index.16730ad8.js";import"./chart.affe3403.js";import"./vue.5a5bc6a2.js";import"./useConfig.c8c4aaa5.js";import"./dialog.fde1aef6.js";import"./index.d821571f.js";import"./dep-6deb4e3a.84894bd5.js";import"./slot.ac9049d4.js";const oe={class:"container"},re={name:"Radio"},ie=V({...re,setup(se){const{t:m}=H.exports.useI18n(),o=M(),{loading:I,setLoading:u}=X(!1),a=D({renderData:Array.from({length:16}).map(e=>({})),pageSize:16,nowPage:1}),z=D({showHide:0}),R=e=>{a.renderData=e.newData},$=L(()=>[{colKey:"drag",title:m("cps.sort"),width:46},{title:"#",colKey:"index",align:"left",width:100},{title:m("cps.contact"),colKey:"name",width:250,align:"left",cell:(e,{row:t})=>t.name?t.name.replace(/[^a-z0-9_]/g,""):void 0,edit:{component:C,props:{clearable:!0},onEdited:e=>{const t=[...a.renderData];t.splice((a.nowPage-1)*a.pageSize+e.rowIndex,1,e.newRowData),a.renderData=t}}},{title:m("cps.mdcid"),colKey:"mdcid",align:"left",width:200,cell:(e,{row:t})=>parseInt(t.mdcid,16)<=65535?parseInt(t.mdcid,16).toString(16):void 0,edit:{component:C,props:{clearable:!0},onEdited:e=>{e.newRowData.mdcid=e.newRowData.mdcid?e.newRowData.mdcid:void 0;const t=[...a.renderData];t.splice((a.nowPage-1)*a.pageSize+e.rowIndex,1,e.newRowData),a.renderData=t}}},{title:m("cps.operate"),colKey:"operate",align:"left",width:150}]),A=async()=>{var d,c;if(o.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}await h(o.connectPort),u(!0);let e=new Uint8Array(256);for(let n=7424;n<7680;n+=16){const s=await b(o.connectPort,n,16,(d=o.configuration)==null?void 0:d.uart);e.set(s,n-7424)}const t=[];for(let n=0;n<256;n+=16)v(e.subarray(n,n+2))!="ffff"?t.push({name:Y(e.subarray(n+2,n+16),(c=o.configuration)==null?void 0:c.charset),mdcid:v(e.subarray(n,n+2))}):t.push({});a.renderData=t,u(!1)},T=async()=>{var t,d,c,n;if(o.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}await h(o.connectPort),u(!0);for(let s=0;s<256;s+=16)if(a.renderData[s/16].mdcid){const l=new Uint8Array(16).fill(32);l.set(P(a.renderData[s/16].mdcid.padStart(4,"0"))),l.set(Z(a.renderData[s/16].name),2),await w(o.connectPort,s+7424,l,16,(t=o.configuration)==null?void 0:t.uart)}else await w(o.connectPort,s+7424,P("ffffffffffffffffffffffffffffffff"),16,(d=o.configuration)==null?void 0:d.uart);const e=await b(o.connectPort,8176,16,(c=o.configuration)==null?void 0:c.uart);e.set([16],16-1),await w(o.connectPort,8176,e,16,(n=o.configuration)==null?void 0:n.uart),await ee(o.connectPort),u(!1)},k=async e=>{const t=[...a.renderData];t.splice(e,1,{scanlist:[]}),a.renderData=t};return(e,t)=>{const d=N,c=J,n=W,s=q,l=F,B=Q,K=ne,x=ae,E=O;return j(),G("div",oe,[i(d,{items:[e.$t("menu.dashboard"),e.$t("menu.cps.mdc")]},null,8,["items"]),i(E,{class:"general-card"},{title:r(()=>[y("span",{onClick:t[0]||(t[0]=()=>{z.showHide+=1})},f(e.$t("menu.cps.mdc")+e.$t("global.onStart")),1)]),default:r(()=>[i(B,{style:{"margin-bottom":"16px"}},{default:r(()=>[i(l,{span:12},{default:r(()=>[i(s,null,{default:r(()=>[i(n,{type:"primary",onClick:A},{icon:r(()=>[i(c)]),default:r(()=>[g(" "+f(e.$t("cps.onDeviceRead")),1)]),_:1}),i(n,{onClick:T},{icon:r(()=>[i(c)]),default:r(()=>[g(" "+f(e.$t("cps.onDeviceWrite")),1)]),_:1})]),_:1})]),_:1})]),_:1}),i(x,{class:"ttable",loading:S(I),size:"medium",columns:$.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]=p=>{a.pageSize=p.pagination.pageSize,a.nowPage=p.pagination.current}),bordered:"","lazy-load":"",headerAffixedTop:{offsetTop:60},hover:!0,"drag-sort":"row-handler",onDragSort:R},{drag:r(({row:p,rowIndex:_})=>[y("span",null,[i(S(te))])]),index:r(({row:p,rowIndex:_})=>[g(f((a.nowPage-1)*a.pageSize+_+1),1)]),operate:r(({row:p,rowIndex:_})=>[i(K,{theme:"default",variant:"dashed",onClick:ce=>k((a.nowPage-1)*a.pageSize+_)},{default:r(()=>[g(f(e.$t("cps.clear")),1)]),_:2},1032,["onClick"])]),_:1},8,["loading","columns","data","pagination"])]),_:1})])}}});const Ie=U(ie,[["__scopeId","data-v-d03a33a5"]]);export{Ie as default};
|