import{a5 as R,r as H,I as M,a6 as z,aH as K,aG as W,F as Q,K as X,W as Y}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import{_ as Z}from"./index.vue_vue_type_script_setup_true_name_PermissionButton_lang.1703796278973.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897314.js";import"./index.1703796278973311.js";import"./index.170379627897325.js";import"./index.170379627897316.js";import"./index.170379627897317.js";import{g as ee,h as ae}from"./collector.1703796278973.js";import{j as ne}from"./index.1703796278973313.js";import{L as c}from"./data.1703796278973.js";import{d as te,k as s,l as oe,m as T,o as f,c as I,a as i,b as o,t as D,u as e,B as h,z as C,A as j,x as le,G as ie,H as re}from"./vue.1703796278973.js";import{_ as se}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897320.js";import"./index.170379627897321.js";import"./permission.1703796278973.js";import"./system.1703796278973.js";import"./comm.1703796278973.js";import"./index.170379627897332.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const ue=u=>(ie("data-v-3b5624ad"),u=u(),re(),u),ce={style:{color:"#616161"}},de={key:3,style:{color:"#616161"}},pe=ue(()=>C("p",null," 只有4字节数据类型(int32、ieee754 float) 具有4种内存布局,其它只有ABCD、DCBA两种内存布局(以双字配置为准) ",-1)),me=te({__name:"index",props:{data:{type:Object,default:()=>{}}},emits:["change"],setup(u,{emit:k}){const y=u,B=s(!1),_=s(),w=s(),v=s(!1),L=s(!1),g=y.data.id,x=s(),S=oe(()=>{const{endian:t,endianIn:a}=n.value.configuration;if(t)return a?t==="BIG"?a==="BIG"?"ABCD":"BADC":a==="BIG"?"CDBA":"DCBA":t==="BIG"?"ABCD":"DCBA"}),n=s({channelId:void 0,name:"",configuration:{unitId:"",type:"LowerFrequency",endian:"BIG",endianIn:"BIG",requsetTimeout:2e3},circuitBreaker:{type:"LowerFrequency"},description:""}),G=async()=>{var p;const t=await((p=x.value)==null?void 0:p.validate()),{provider:a,name:d}=_.value.find(m=>m.id===n.value.channelId),r={...t,provider:a,channelName:d};B.value=!0;const b=g?await ae(g,{...y.data,...r}).catch(()=>{}):await ee(r).catch(()=>{});B.value=!1,b.success&&k("change",!0)},U=t=>t==="LowerFrequency"?"连续20次异常,降低连接频率至原有频率的1/10(重试间隔不超过1分钟),故障处理后自动恢复至设定连接频率":t==="Break"?"连续10分钟异常,停止采集数据进入断开状态,设备重新启用后恢复采集状态":"忽略异常,保持原采集频率超时时间为5s",A=()=>{k("change",!1)},q=t=>{n.value.circuitBreaker.type=t[0]},N=t=>{n.value.configuration.endian=t[0]},E=t=>{n.value.configuration.endianIn=t[0]};(async()=>{_.value=ne.Store.get("channelListAll"),w.value=_.value.map(t=>({value:t.id,label:t.name}))})();const F=(t,a)=>a.label.toLowerCase().indexOf(t.toLowerCase())>=0;return T(()=>n.value.channelId,t=>{const a=_.value.find(d=>d.id===t);L.value=v.value=(a==null?void 0:a.provider)&&(a==null?void 0:a.provider)==="MODBUS_TCP"},{deep:!0}),T(()=>y.data,t=>{t.id&&(n.value=t)},{immediate:!0,deep:!0}),(t,a)=>{const d=R,r=H,b=M,p=z,m=K,P=W,O=Q,V=X,$=Z,J=Y;return f(),I(J,{title:u.data.id?"编辑":"新增",visible:!0,width:"700px",onCancel:A},{footer:i(()=>[o(V,{key:"back",onClick:A},{default:i(()=>[D("取消")]),_:1}),o($,{key:"submit",type:"primary",loading:e(B),onClick:G,style:{"margin-left":"8px"},hasPermission:`DataCollect/Collector:${e(g)?"update":"add"}`},{default:i(()=>[D(" 确认 ")]),_:1},8,["loading","hasPermission"])]),default:i(()=>[o(O,{class:"form",layout:"vertical",model:e(n),name:"basic",autocomplete:"off",ref_key:"formRef",ref:x},{default:i(()=>[o(r,{label:"所属通道",name:"channelId",rules:e(c).channelId},{default:i(()=>[o(d,{style:{width:"100%"},value:e(n).channelId,"onUpdate:value":a[0]||(a[0]=l=>e(n).channelId=l),options:e(w),placeholder:"请选择所属通道",allowClear:"","show-search":"","filter-option":F,disabled:!!e(g)},null,8,["value","options","disabled"])]),_:1},8,["rules"]),o(r,{label:"采集器名称",name:"name",rules:e(c).name},{default:i(()=>[o(b,{placeholder:"请输入采集器名称",value:e(n).name,"onUpdate:value":a[1]||(a[1]=l=>e(n).name=l)},null,8,["value"])]),_:1},8,["rules"]),e(L)?(f(),I(r,{key:0,label:"从机地址",name:["configuration","unitId"],rules:e(c).unitId},{default:i(()=>[o(p,{style:{width:"100%"},placeholder:"请输入从机地址",value:e(n).configuration.unitId,"onUpdate:value":a[2]||(a[2]=l=>e(n).configuration.unitId=l),min:0,max:255},null,8,["value"])]),_:1},8,["rules"])):h("",!0),o(r,{name:["circuitBreaker","type"],rules:e(c).type,label:"故障处理"},{default:i(()=>[o(m,{showImage:!1,value:e(n).circuitBreaker.type,"onUpdate:value":a[3]||(a[3]=l=>e(n).circuitBreaker.type=l),options:[{label:"降频",value:"LowerFrequency"},{label:"断开",value:"Break"},{label:"忽略",value:"Ignore"}],onChange:q},null,8,["value"])]),_:1},8,["rules"]),C("p",ce,j(U(e(n).circuitBreaker.type)),1),e(v)?(f(),I(r,{key:1,label:"双字高低位切换",name:["configuration","endian"],rules:e(c).endian},{default:i(()=>[o(m,{showImage:!1,value:e(n).configuration.endian,"onUpdate:value":a[4]||(a[4]=l=>e(n).configuration.endian=l),options:[{label:"AB",value:"BIG"},{label:"BA",value:"LITTLE"}],onChange:N,column:2},null,8,["value"])]),_:1},8,["rules"])):h("",!0),e(v)?(f(),I(r,{key:2,label:"单字高低位切换",name:["configuration","endianIn"],rules:e(c).endianIn},{default:i(()=>[o(m,{showImage:!1,value:e(n).configuration.endianIn,"onUpdate:value":a[5]||(a[5]=l=>e(n).configuration.endianIn=l),options:[{label:"AB",value:"BIG"},{label:"BA",value:"LITTLE"}],onChange:E,column:2},null,8,["value"])]),_:1},8,["rules"])):h("",!0),e(v)?(f(),le("div",de,[C("p",null,"当前内存布局: "+j(e(S)),1),pe])):h("",!0),o(r,{label:"请求超时时间配置",name:["configuration","requsetTimeout"]},{default:i(()=>[o(p,{style:{width:"100%"},placeholder:"请输入请求超时时间配置",value:e(n).configuration.requsetTimeout,"onUpdate:value":a[6]||(a[6]=l=>e(n).configuration.requsetTimeout=l),"addon-after":"ms",max:9999999999999998,min:1},null,8,["value"])]),_:1}),o(r,{label:"说明",name:"description"},{default:i(()=>[o(P,{placeholder:"请输入说明",value:e(n).description,"onUpdate:value":a[7]||(a[7]=l=>e(n).description=l),maxlength:200,rows:3,showCount:""},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])}}});const Ke=se(me,[["__scopeId","data-v-3b5624ad"]]);export{Ke as default};