import{e as z,q as F,S as b,_ as M}from"./index.8c439602.js";/* empty css *//* empty css *//* empty css */import{d as N,r as j,c as L,bi as O,C as H,D as J,aE as u,b0 as d,aV as _,u as Q,b3 as q,a6 as $,bd as G,bs as W,bN as X,bQ as Y,bP as Z}from"./arco.b143604e.js";import{u as tt}from"./loading.dfebc5d0.js";import{e as T,a as I,u as A,b as et,h as v,s as at,f as h,g as ot}from"./serial.3518333f.js";import"./chart.9aa904c5.js";import"./vue.12fb94d8.js";const nt={class:"container"},rt={name:"SearchTable"},it=N({...rt,setup(st){const f=z(),{loading:B,setLoading:y}=tt(!1),r={bandwidthOption:{0:"25KHz",1:"12.5KHz"},modeOption:{0:"FM",1:"AM",2:"USB"},powerOption:{0:"\u4F4E",1:"\u4E2D",2:"\u9AD8"},toneOption:{1:"\u4E9A\u97F3\u9891",2:"\u6570\u5B57\u4E9A\u97F3",3:"\u53CD\u5411\u6570\u5B57\u4E9A\u97F3"},CTCSSOption:[67,69.3,71.9,74.4,77,79.7,82.5,85.4,88.5,91.5,94.8,97.4,100,103.5,107.2,110.9,114.8,118.8,123,127.3,131.8,136.5,141.3,146.2,151.4,156.7,159.8,162.2,165.5,167.9,171.3,173.8,177.3,179.9,183.5,186.2,189.9,192.8,196.6,199.5,203.5,206.5,210.7,218.1,225.7,229.1,233.6,241.8,250.3,254.1],DCSOption:[23,25,26,31,32,36,43,47,51,53,54,65,71,72,73,74,114,115,116,122,125,131,132,134,143,145,152,155,156,162,165,172,174,205,212,223,225,226,243,244,245,246,251,252,255,261,263,265,266,271,274,306,311,315,325,331,332,343,346,351,356,364,365,371,411,412,413,423,431,432,445,446,452,454,455,462,464,465,466,503,506,516,523,526,532,546,565,606,612,624,627,631,632,654,662,664,703,712,723,731,732,734,743,754],stepOption:[2.5,5,6.25,10,12.5,25,8.33,.01,.05,.1,.25,.5,1,1.25,9,15,20,30,50,100,125,200,250,500],scrambOption:["1","2","3","4","5","6","7","8","9","10"],pttidOption:["\u4E0A\u7EBF\u7801","\u4E0B\u7EBF\u7801","\u4E0A\u7EBF+\u4E0B\u7EBF\u7801","Quindar\u7801"]},n=j({renderData:Array.from({length:200}).map(t=>({})),pageSize:15,nowPage:1}),R=L(()=>[{title:"#",colKey:"index",align:"left",width:100},{title:"\u4FE1\u9053\u540D\u79F0",colKey:"name",width:250,align:"left",edit:{component:F,props:{clearable:!0},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u5E26\u5BBD",colKey:"bandwidth",align:"left",width:150,cell:(t,{row:e})=>{var i;return(i=r.bandwidthOption[e.bandwidth])!=null?i:""},edit:{component:b,props:{clearable:!0,options:Object.keys(r.bandwidthOption).map(t=>({value:t,label:r.bandwidthOption[t]}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u63A5\u6536\u9891\u7387",colKey:"rx",align:"left",width:200,cell:(t,{row:e})=>parseFloat(e.rx)?parseFloat(e.rx).toFixed(5):void 0,edit:{component:F,props:{clearable:!0},onEdited:t=>{t.newRowData.rx=t.newRowData.rx?t.newRowData.rx:void 0;const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u53D1\u9001\u9891\u7387",colKey:"tx",align:"left",width:200,cell:(t,{row:e})=>parseFloat(e.tx)?parseFloat(e.tx).toFixed(5):void 0,edit:{component:F,props:{clearable:!0},onEdited:t=>{t.newRowData.tx=t.newRowData.tx?t.newRowData.tx:void 0;const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u53D1\u9001\u529F\u7387",colKey:"power",align:"left",width:150,cell:(t,{row:e})=>{var i;return(i=r.powerOption[e.power])!=null?i:""},edit:{component:b,props:{clearable:!0,options:Object.keys(r.powerOption).map(t=>({value:t,label:r.powerOption[t]}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u63A5\u6536\u4E9A\u97F3\u7C7B\u578B",colKey:"rxTone",align:"left",width:180,cell:(t,{row:e})=>{var i;return(i=r.toneOption[e.rxTone])!=null?i:""},edit:{component:b,props:{clearable:!0,options:Object.keys(r.toneOption).map(t=>({value:t,label:r.toneOption[t]}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u63A5\u6536\u4E9A\u97F3\u9891\uFF08Hz\uFF09",colKey:"rxCTCSS",align:"left",width:150,cell:(t,{row:e})=>{var i;return r.CTCSSOption.indexOf(e.rxCTCSS)>=0?(i=e.rxCTCSS)==null?void 0:i.toFixed(1):void 0},edit:{component:b,props:{clearable:!0,options:r.CTCSSOption.map(t=>({value:t,label:t.toFixed(1)}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u63A5\u6536\u4E9A\u97F3\u6570\u7801",colKey:"rxDCS",align:"left",width:150,cell:(t,{row:e})=>r.DCSOption.indexOf(e.rxDCS)>=0?"0"+e.rxDCS:void 0,edit:{component:b,props:{clearable:!0,options:r.DCSOption.map(t=>({value:t,label:"0"+t}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u53D1\u9001\u4E9A\u97F3\u7C7B\u578B",colKey:"txTone",align:"left",width:180,cell:(t,{row:e})=>{var i;return(i=r.toneOption[e.txTone])!=null?i:""},edit:{component:b,props:{clearable:!0,options:Object.keys(r.toneOption).map(t=>({value:t,label:r.toneOption[t]}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u53D1\u9001\u4E9A\u97F3\u9891\uFF08Hz\uFF09",colKey:"txCTCSS",align:"left",width:150,cell:(t,{row:e})=>{var i;return r.CTCSSOption.indexOf(e.txCTCSS)>=0?(i=e.txCTCSS)==null?void 0:i.toFixed(1):void 0},edit:{component:b,props:{clearable:!0,options:r.CTCSSOption.map(t=>({value:t,label:t.toFixed(1)}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u53D1\u9001\u4E9A\u97F3\u6570\u7801",colKey:"txDCS",align:"left",width:150,cell:(t,{row:e})=>r.DCSOption.indexOf(e.txDCS)>=0?"0"+e.txDCS:void 0,edit:{component:b,props:{clearable:!0,options:r.DCSOption.map(t=>({value:t,label:"0"+t}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u9891\u7387\u6B65\u8FDB",colKey:"step",align:"left",width:150,cell:(t,{row:e})=>{var i;return r.stepOption.indexOf(e.step)>=0?(i=e.step)==null?void 0:i.toFixed(1):void 0},edit:{component:b,props:{clearable:!0,options:r.stepOption.map(t=>({value:t,label:t.toFixed(1)}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u5012\u9891",colKey:"reverse",align:"left",width:150},{title:"\u52A0\u5BC6",colKey:"scramb",align:"left",width:150,edit:{component:b,props:{clearable:!0,options:r.scrambOption.map(t=>({value:t,label:t}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u7E41\u5FD9\u7981\u53D1",colKey:"busy",align:"left",width:150},{title:"\u4FE1\u4EE4\u7801",colKey:"pttid",align:"left",width:150,edit:{component:b,props:{clearable:!0,options:r.pttidOption.map(t=>({value:t,label:t}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"\u4FE1\u9053\u6A21\u5F0F",colKey:"mode",align:"left",width:150,cell:(t,{row:e})=>{var i;return(i=r.modeOption[e.mode])!=null?i:""},edit:{component:b,props:{clearable:!0,options:Object.keys(r.modeOption).map(t=>({value:t,label:r.modeOption[t]}))},onEdited:t=>{const e=[...n.renderData];e.splice(t.rowIndex,1,t.newRowData),n.renderData=e}}},{title:"DTMF\u89E3\u7801",colKey:"dtmf",align:"left",width:150},{title:"\u626B\u63CF\u5217\u8868",colKey:"scanlist",align:"left",width:150},{title:"\u64CD\u4F5C",colKey:"operate",align:"left",width:150}]),k=async()=>{var D,S,o,g;if(f.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await T(f.connectPort),y(!0);let t=new Uint8Array(3200);for(let l=0;l<3200;l+=128){const s=await I(f.connectPort,l,128,(D=f.configuration)==null?void 0:D.uart);t.set(s,l)}let e=new Uint8Array(192);for(let l=3424;l<3616;l+=64){const s=await I(f.connectPort,l,64,(S=f.configuration)==null?void 0:S.uart);e.set(s,l-3424)}let i=new Uint8Array(3200);for(let l=3920;l<7120;l+=128){const s=await I(f.connectPort,l,128,(o=f.configuration)==null?void 0:o.uart);i.set(s,l-3920)}const p=[];for(let l=0;l<3200;l+=16){const s=A(t.subarray(l,l+16)),x=A(e.subarray(l/16,l/16+1)),a={};a.rx=s.substr(24,8)!="ffffffff"?parseInt(s.substr(24,8),16)/1e5:void 0,a.rx&&x!="ff"?(console.info(s),console.info(x),a.offset=s.substr(16,8)!="00000000"?parseInt(s.substr(16,8),16)/1e5:void 0,a.txcodeflag=s.substr(9,1),a.txcodeflag=="1"&&(a.tx=a.rx+a.offset),a.txcodeflag=="2"&&(a.tx=a.rx-a.offset),a.txTone=parseInt(s.substr(10,1),16)>0?parseInt(s.substr(10,1),16).toString():void 0,a.rxTone=parseInt(s.substr(11,1),16)>0?parseInt(s.substr(11,1),16).toString():void 0,a.txTone=="1"&&(a.txCTCSS=r.CTCSSOption[parseInt(s.substr(12,2),16)]),(a.txTone=="2"||a.txTone=="3")&&(a.txDCS=r.DCSOption[parseInt(s.substr(12,2),16)]),a.rxTone=="1"&&(a.rxCTCSS=r.CTCSSOption[parseInt(s.substr(14,2),16)]),(a.rxTone=="2"||a.rxTone=="3")&&(a.rxDCS=r.DCSOption[parseInt(s.substr(14,2),16)]),a.step=r.stepOption[parseInt(s.substr(2,2),16)],a.scramb=parseInt(s.substr(0,2),16)>0?parseInt(s.substr(0,2),16).toString():void 0,a.power_reverse_busy_width=parseInt(s.substr(6,2),16),a.reverse=!!(a.power_reverse_busy_width>>0&1),a.bandwidth=(a.power_reverse_busy_width>>1&1).toString(),a.power=(a.power_reverse_busy_width>>2&3).toString(),a.busy=!!(a.power_reverse_busy_width>>4&1),a.pttid_dtmf=parseInt(s.substr(4,2),16),a.pttid=r.pttidOption[(a.pttid_dtmf>>1)-1],a.dtmf=!!(a.pttid_dtmf>>0&1),a.mode=parseInt(s.substr(8,1),16).toString(),a.name=et(i.subarray(l,l+16),(g=f.configuration)==null?void 0:g.charset),a.scanlist=[],parseInt(x.substr(0,1),16)&8&&a.scanlist.push("I"),parseInt(x.substr(0,1),16)&4&&a.scanlist.push("II")):a.rx=void 0,p.push(a)}n.renderData=p,y(!1)},K=async()=>{var D,S;if(f.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await T(f.connectPort),y(!0);let t=new Uint8Array(3200),e=new Uint8Array(200),i=new Uint8Array(3200),p=0;n.renderData.map(o=>{var g,l,s,x;if(o.rx){let a="";a+=parseInt(o.scramb)>0?parseInt(o.scramb).toString(16).padStart(2,"0"):"00",a+=r.stepOption.indexOf(o.step)>=0?r.stepOption.indexOf(o.step).toString(16).padStart(2,"0"):"00";let E=r.pttidOption.indexOf(o.pttid)+1<<1;E+=o.dtmf?1:0,a+=E.toString(16).padStart(2,"0");let C=o.busy?1<<4:0;switch(C+=o.power<<2,C+=o.bandwidth<<1,C+=o.reverse?1:0,a+=C.toString(16).padStart(2,"0"),a+=o.mode?o.mode.toString(16):"0",o.tx>0&&o.tx>o.rx?a+="1":o.tx>0&&o.tx0?o.txTone.toString(16):"0",a+=parseInt(o.rxTone)>0?o.rxTone.toString(16):"0",o.txTone){case"1":a+=r.CTCSSOption.indexOf(o.txCTCSS).toString(16).padStart(2,"0");break;case"2":case"3":a+=r.DCSOption.indexOf(o.txDCS).toString(16).padStart(2,"0");break;default:a+="00"}switch(o.rxTone){case"1":a+=r.CTCSSOption.indexOf(o.rxCTCSS).toString(16).padStart(2,"0");break;case"2":case"3":a+=r.DCSOption.indexOf(o.rxDCS).toString(16).padStart(2,"0");break;default:a+="00"}const c=o.tx&&o.rx?Math.abs(parseInt((o.tx*1e5).toFixed(0))-parseInt((o.rx*1e5).toFixed(0))):NaN;a+=Number.isNaN(c)?"00000000":c.toString(16).padStart(8,"0"),a+=parseInt((o.rx*1e5).toFixed(0)).toString(16).padStart(8,"0"),console.log(a),t.set(v(a),p);let w=0;((g=o.scanlist)==null?void 0:g.indexOf("I"))>=0&&(w+=8),((l=o.scanlist)==null?void 0:l.indexOf("II"))>=0&&(w+=4),console.log((w<<4)+0),e.set([(w<<4)+0],p/16);const m=new Uint8Array(16);m.set(at((s=o.name)!=null?s:"",(x=f.configuration)==null?void 0:x.charset).subarray(0,16),0),i.set(m,p)}else t.set(v("ffffffffffffffffffffffffffffffff"),p),e.set([255],p/16),i.set(v("ffffffffffffffffffffffffffffffff"),p);p+=16});for(let o=0;o<3200;o+=128)await h(f.connectPort,o,t.slice(o,o+128),128,(D=f.configuration)==null?void 0:D.uart);await h(f.connectPort,3424,e,200);for(let o=3920;o<7120;o+=128)await h(f.connectPort,o,i.slice(o-3920,o-3920+128),128,(S=f.configuration)==null?void 0:S.uart);await ot(f.connectPort),y(!1)},P=async t=>{const e=[...n.renderData];e.splice(t,1,{}),n.renderData=e},U=()=>{const t=JSON.stringify(n.renderData),e=new Blob([t],{type:"application/octet-stream"}),i=URL.createObjectURL(e),p=document.createElement("a");p.download="channel.json",p.href=i,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(i)},V=()=>{const t=document.createElement("input");t.type="file",t.onchange=async()=>{const i=await new Blob([t.files[0]],{type:"application/octet-stream"}).text();n.renderData=JSON.parse(i)},t.click()};return(t,e)=>{const i=O("Breadcrumb"),p=$,D=G,S=W,o=X,g=Y,l=O("t-switch"),s=O("t-checkbox"),x=O("t-checkbox-group"),a=O("t-button"),E=O("t-table"),C=Z;return H(),J("div",nt,[u(i,{items:["\u5199\u9891","\u4FE1\u9053\u7BA1\u7406"]}),u(C,{class:"general-card",title:"\u4FE1\u9053\u7BA1\u7406"},{default:d(()=>[u(g,{style:{"margin-bottom":"16px"}},{default:d(()=>[u(o,{span:12},{default:d(()=>[u(S,null,{default:d(()=>[u(D,{type:"primary",onClick:k},{icon:d(()=>[u(p)]),default:d(()=>[_(" \u4ECE\u8BBE\u5907\u8BFB\u53D6 ")]),_:1}),u(D,{onClick:K},{icon:d(()=>[u(p)]),default:d(()=>[_(" \u5199\u5165\u8BBE\u5907 ")]),_:1})]),_:1})]),_:1}),u(o,{span:12,style:{"text-align":"right"}},{default:d(()=>[u(S,null,{default:d(()=>[u(D,{type:"primary",onClick:U},{default:d(()=>[_(" \u4FDD\u5B58 ")]),_:1}),u(D,{onClick:V},{default:d(()=>[_(" \u52A0\u8F7D ")]),_:1})]),_:1})]),_:1})]),_:1}),u(E,{loading:Q(B),size:"large",columns:R.value,data:n.renderData,pagination:{defaultPageSize:n.pageSize,total:n.renderData.length,defaultCurrent:1,pageSizeOptions:[15,30,50,100,200]},onChange:e[0]||(e[0]=c=>{n.pageSize=c.pagination.pageSize,n.nowPage=c.pagination.current}),bordered:"","lazy-load":"",headerAffixedTop:{offsetTop:60},hover:!0},{index:d(({row:c,rowIndex:w})=>[_(q((n.nowPage-1)*n.pageSize+w+1),1)]),reverse:d(({row:c,rowIndex:w})=>[u(l,{modelValue:c.reverse,"onUpdate:modelValue":m=>c.reverse=m},null,8,["modelValue","onUpdate:modelValue"])]),busy:d(({row:c,rowIndex:w})=>[u(l,{modelValue:c.busy,"onUpdate:modelValue":m=>c.busy=m},null,8,["modelValue","onUpdate:modelValue"])]),dtmf:d(({row:c,rowIndex:w})=>[u(l,{modelValue:c.dtmf,"onUpdate:modelValue":m=>c.dtmf=m},null,8,["modelValue","onUpdate:modelValue"])]),scanlist:d(({row:c,rowIndex:w})=>[u(x,{modelValue:c.scanlist,"onUpdate:modelValue":m=>c.scanlist=m},{default:d(()=>[u(s,{key:"I",label:"I",value:"I"}),u(s,{key:"II",label:"II",value:"II"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),operate:d(({row:c,rowIndex:w})=>[u(a,{theme:"default",variant:"dashed",onClick:m=>P((n.nowPage-1)*n.pageSize+w)},{default:d(()=>[_("\u6E05\u7A7A")]),_:2},1032,["onClick"])]),_:1},8,["loading","columns","data","pagination"])]),_:1})])}}});const Dt=M(it,[["__scopeId","data-v-a1b95b3e"]]);export{Dt as default};