import{aG as F,r as H,a6 as R,a5 as V,D as G,I as K,F as S,K as W,W as z}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import{_ as E}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.170379627897322.js";import"./index.170379627897323.js";import"./index.170379627897316.js";import"./index.170379627897317.js";import"./index.170379627897325.js";import{w as Q}from"./collector.1703796278973.js";import{d as X,k as f,o as s,c as r,a as u,b as d,t as D,u as a}from"./vue.1703796278973.js";const pe=X({__name:"index",props:{data:{type:Object,default:()=>{}}},emits:["change"],setup(o,{emit:v}){var k,h,w,C,g,x;const n=o,p=(((k=n.data)==null?void 0:k.provider)==="OPC_UA"?((w=(h=n==null?void 0:n.data)==null?void 0:h.configuration)==null?void 0:w.type)||"Number":((x=(g=(C=n.data)==null?void 0:C.configuration)==null?void 0:g.codec)==null?void 0:x.provider)||"int8").toLocaleLowerCase(),I=["int8","int16","int32","ieee754_float","ieee754_double","hex,","number"],_=f(!1),y=f(),L=n.data.collectorId,O=n.data.id,t=f({value:""}),P=(m,e)=>{t.value.value=e},U=async()=>{var c;const e={...await((c=y.value)==null?void 0:c.validate()),pointId:O};_.value=!0;const i=await Q(L,[e]).catch(()=>{});v("change",(i==null?void 0:i.status)===200),_.value=!1},b=()=>{v("change",!1)},B=(m,e)=>e.label.toLowerCase().indexOf(m.toLowerCase())>=0;return(m,e)=>{const i=F,c=H,M=R,N=V,T=G,Y=K,$=S,J=W,q=E,A=z;return s(),r(A,{title:"写入",visible:!0,width:"500px",onCancel:b},{footer:u(()=>[d(J,{key:"back",onClick:b},{default:u(()=>[D("取消")]),_:1}),d(q,{key:"submit",type:"primary",loading:a(_),onClick:U,style:{"margin-left":"8px"},hasPermission:"DataCollect/Collector:update"},{default:u(()=>[D(" 确认 ")]),_:1},8,["loading"])]),default:u(()=>[d($,{class:"form",layout:"vertical",model:a(t),name:"basic",autocomplete:"off",ref_key:"formRef",ref:y},{default:u(()=>{var j;return[o.data.provider==="MODBUS_TCP"&&((j=o.data)==null?void 0:j.configuration.function)==="Coils"?(s(),r(c,{key:0,label:o.data.name,name:"value",rules:[{required:!0,message:`请输入${o.data.name}`}]},{default:u(()=>[d(i,{placeholder:"请输入",value:a(t).value,"onUpdate:value":e[0]||(e[0]=l=>a(t).value=l),maxlength:200,rows:3,showCount:""},null,8,["value"])]),_:1},8,["label","rules"])):(s(),r(c,{key:1,label:o.data.name,name:"value",rules:[{required:!0,message:`请输入${o.data.name}`}]},{default:u(()=>[I.includes(a(p))?(s(),r(M,{key:0,style:{width:"100%"},placeholder:"请输入",value:a(t).value,"onUpdate:value":e[1]||(e[1]=l=>a(t).value=l)},null,8,["value"])):["boolean"].includes(a(p))?(s(),r(N,{key:1,style:{width:"100%"},value:a(t).value,"onUpdate:value":e[2]||(e[2]=l=>a(t).value=l),options:[{label:"是",value:!0},{label:"否",value:!1}],placeholder:"请选择",allowClear:"","show-search":"","filter-option":B},null,8,["value"])):["datetime"].includes(a(p))?(s(),r(T,{key:2,style:{width:"100%"},format:"YYYY-MM-DD HH:mm:ss","show-time":"",placeholder:"请选择",onChange:P})):(s(),r(Y,{key:3,placeholder:"请输入",value:a(t).value,"onUpdate:value":e[3]||(e[3]=l=>a(t).value=l)},null,8,["value"]))]),_:1},8,["label","rules"]))]}),_:1},8,["model"])]),_:1})}}});export{pe as _};
