mirror of
https://github.com/silenty4ng/k5web
synced 2024-11-14 14:33:23 +00:00
2 lines
4.8 KiB
JavaScript
2 lines
4.8 KiB
JavaScript
import{v as H,m as L,ak as M,_ as N}from"./index.c5405c09.js";/* empty css *//* empty css *//* empty css */import{d as U,r as y,c as V,bI as O,C as j,D as G,aI as s,aH as r,G as S,aN as m,aM as g,u as h,a6 as J,a$ as W,ba as Z,bJ as q,bL as F}from"./arco.7f845a67.js";import{u as Q}from"./loading.1a4e75f4.js";import{e as v,a as C,u as w,f as X,h as D,s as Y,b,g as ee}from"./serial.c741fbda.js";import{I as P}from"./index.3c1bf074.js";import{M as te,T as ae}from"./index.e0d2d4f4.js";import{B as ne}from"./index.9447cec4.js";import"./chart.3e6cb2f1.js";import"./vue.0bef8fc5.js";import"./useConfig.b5d89e07.js";import"./useGlobalIcon.c6c61ccc.js";import"./helper.4ea41844.js";import"./dep-6deb4e3a.355b5fc9.js";import"./dialog.30d78e3d.js";import"./index.ab8a635e.js";import"./form-model.e2f8f96d.js";import"./useDisabled.5ccd65e2.js";import"./slot.0936fab4.js";const oe={class:"container"},re={name:"Radio"},ie=U({...re,setup(se){const{t:f}=H.exports.useI18n(),o=L(),{loading:I,setLoading:u}=Q(!1),a=y({renderData:Array.from({length:16}).map(e=>({})),pageSize:16,nowPage:1}),z=y({showHide:0}),R=e=>{a.renderData=e.newData},A=V(()=>[{colKey:"drag",title:f("cps.sort"),width:46},{title:"#",colKey:"index",align:"left",width:100},{title:f("cps.contact"),colKey:"name",width:250,align:"left",cell:(e,{row:t})=>t.name?t.name.replace(/[^a-zA-Z0-9_]/g,""):void 0,edit:{component:P,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:f("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:P,props:{clearable:!0},onEdited:e=>{e.newRowData.mdcid=e.newRowData.mdcid?e.newRowData.mdcid.toLowerCase():void 0;const t=[...a.renderData];t.splice((a.nowPage-1)*a.pageSize+e.rowIndex,1,e.newRowData),a.renderData=t}}},{title:f("cps.operate"),colKey:"operate",align:"left",width:150}]),$=async()=>{var d,c;if(o.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}await v(o.connectPort),u(!0);let e=new Uint8Array(256);for(let n=7424;n<7680;n+=16){const i=await C(o.connectPort,n,16,(d=o.configuration)==null?void 0:d.uart);e.set(i,n-7424)}const t=[];for(let n=0;n<256;n+=16)w(e.subarray(n,n+2))!="ffff"?t.push({name:X(e.subarray(n+2,n+16),(c=o.configuration)==null?void 0:c.charset).trim(),mdcid:w(e.subarray(n,n+1))+w(e.subarray(n+1,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 v(o.connectPort),u(!0);for(let i=0;i<256;i+=16)if(a.renderData[i/16].mdcid){const p=new Uint8Array(16).fill(32);p.set(D(a.renderData[i/16].mdcid.padStart(4,"0").substring(0,2))),p.set(D(a.renderData[i/16].mdcid.padStart(4,"0").substring(2,4)),1),p.set(Y(a.renderData[i/16].name),2),await b(o.connectPort,i+7424,p,16,(t=o.configuration)==null?void 0:t.uart)}else await b(o.connectPort,i+7424,D("ffffffffffffffffffffffffffffffff"),16,(d=o.configuration)==null?void 0:d.uart);const e=await C(o.connectPort,8176,16,(c=o.configuration)==null?void 0:c.uart);e.set([16],16-1),await b(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=M,c=J,n=W,i=Z,p=q,B=F,K=ne,x=ae,E=O;return j(),G("div",oe,[s(d,{items:[e.$t("menu.dashboard"),e.$t("menu.cps.mdc")]},null,8,["items"]),s(E,{class:"general-card"},{title:r(()=>[S("span",{onClick:t[0]||(t[0]=()=>{z.showHide+=1})},m(e.$t("menu.cps.mdc")+e.$t("global.onStart")),1)]),default:r(()=>[s(B,{style:{"margin-bottom":"16px"}},{default:r(()=>[s(p,{span:12},{default:r(()=>[s(i,null,{default:r(()=>[s(n,{type:"primary",onClick:$},{icon:r(()=>[s(c)]),default:r(()=>[g(" "+m(e.$t("cps.onDeviceRead")),1)]),_:1}),s(n,{onClick:T},{icon:r(()=>[s(c)]),default:r(()=>[g(" "+m(e.$t("cps.onDeviceWrite")),1)]),_:1})]),_:1})]),_:1})]),_:1}),s(x,{class:"ttable",loading:h(I),size:"medium",columns:A.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:R},{drag:r(({row:l,rowIndex:_})=>[S("span",null,[s(h(te))])]),index:r(({row:l,rowIndex:_})=>[g(m((a.nowPage-1)*a.pageSize+_+1),1)]),operate:r(({row:l,rowIndex:_})=>[s(K,{theme:"default",variant:"dashed",onClick:ce=>k((a.nowPage-1)*a.pageSize+_)},{default:r(()=>[g(m(e.$t("cps.clear")),1)]),_:2},1032,["onClick"])]),_:1},8,["loading","columns","data","pagination"])]),_:1})])}}});const $e=N(ie,[["__scopeId","data-v-dfecd3b2"]]);export{$e as default};
|