2024-06-09 01:26:55 +00:00
|
|
|
import{v as H,e as M,ak as N,_ as U}from"./index.ca5b2f7e.js";/* empty css *//* empty css *//* empty css */import{d as V,r as S,c as L,bH as O,C as j,D as G,aI as s,aH as r,G as b,aN as f,aM as g,u as h,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 v,a as P,u as w,f as Y,h as D,s as Z,b as y,g as ee}from"./serial.c741fbda.js";import{I as C}from"./form-model.ea91f0ac.js";import{M as te,T as ae}from"./index.f156bb6d.js";import{B as ne}from"./index.ae3329ec.js";import"./chart.affe3403.js";import"./vue.5a5bc6a2.js";import"./useConfig.e2f085de.js";import"./dialog.89c5077d.js";import"./index.abff64e0.js";import"./dep-6deb4e3a.75c3c33f.js";import"./slot.10361ebc.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=S({renderData:Array.from({length:16}).map(e=>({})),pageSize:16,nowPage:1}),z=S({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 v(o.connectPort),u(!0);let e=new Uint8Array(256);for(let n=7424;n<7680;n+=16){const i=await P(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:Y(e.subarray(n+2,n+16),(c=o.configuration)==null?void 0:c.charset),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 l=new Uint8Array(16).fill(32);l.set(D(a.renderData[i/16].mdcid.padStart(4,"0").substring(0,2))),l.set(D(a.renderData[i/16].mdcid.padStart(4,"0").substring(2,4)),1),l.set(Z(a.renderData[i/16].name),2),await y(o.connectPort,i+7424,l,16,(t=o.configuration)==null?void 0:t.uart)}else await y(o.connectPort,i+7424,D("ffffffffffffffffffffffffffffffff"),16,(d=o.configuration)==null?void 0:d.uart);const e=await P(o.connectPort,8176,16,(c=o.configuration)==null?void 0:c.uart);e.set([16],16-1),await y(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,i=q,l=F,B=Q,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(()=>[b("span",{onClick:t[0]||(t[0]=()=>{z.showHide+=1})},f(e.$t("menu.cps.mdc")+e.$t("global.onStart")),1)]),default:r(()=>[s(B,{style:{"margin-bottom":"16px"}},{default:r(()=>[s(l,{span:12},{default:r(()=>[s(i,null,{default:r(()=>[s(n,{type:"primary",onClick:A},{icon:r(()=>[s(c)]),default:r(()=>[g(" "+f(e.$t("cps.onDeviceRead")),1)]),_:1}),s(n,{onClick:T},{icon:r(()=>[s(c)]),default:r(()=>[g(" "+f(e.$t("cps.onDeviceWrite")),1)]),_:1})]),_:1})]),_:1})]),_:1}),s(x,{class:"ttable",loading:h(I),size:"medium",columns:$.value,data:a.renderData,pagination:{defaultPageSize:a.pageSize,total:a.renderData.length,defaultCurrent:1,pageSizeOptions:[15,30,50,100,200]},onChan
|