import{b as P,r as b,ah as F,o as i,y as f,q as l,v as D,p as n,P as d,x as m,n as a,c as w,F as B,A as N,t as M,s as S,eu as q,ev as R,S as j,j as x,l as A,k as T,m as z,bv as G,D as H}from"./index.8d733f79.js";const J={class:"dialog-footer"},Q={__name:"alarmPushUrl",emits:["refesh"],setup(K,{expose:L,emit:k}){const{t:p}=P(),{proxy:h}=H(),o=b(!1),e=F({factoryId:"",urlList:[]});function V(t){o.value=!0,e.factoryId=t.id,q({factoryId:t.id}).then(s=>{e.urlList=s.data||[],e.urlList.length||e.urlList.push("")})}const v=()=>{if(e.urlList.length===10){h.$modal.msgError(p("addNumLimit"));return}e.urlList.push("")},$=t=>{h.$modal.confirm(p("confirmDelete")).then(()=>{e.urlList=e.urlList.filter((s,c)=>c!==t)}).catch(()=>{})};function U(){R(e).then(t=>{j.success(t.msg),k("refesh"),_()})}function _(){o.value=!1}return L({showModal:V}),(t,s)=>{const c=x,u=A,C=T,E=z,I=G;return i(),f(I,{title:t.$t("dataPush"),modelValue:a(o),"onUpdate:modelValue":s[0]||(s[0]=y=>S(o)?o.value=y:null),width:"500px","align-center":!0},{footer:l(()=>[D("div",J,[n(u,{onClick:_},{default:l(()=>[d(m(t.$t("cancel")),1)]),_:1}),n(u,{type:"primary",onClick:U},{default:l(()=>[d(m(t.$t("confirm")),1)]),_:1})])]),default:l(()=>[n(E,{ref:"setFormRef",model:a(e),"label-position":"top"},{default:l(()=>[(i(!0),w(B,null,N(a(e).urlList,(y,r)=>(i(),f(C,{key:r,label:r===0?t.$t("alarmUrlPush"):""},{default:l(()=>[n(c,{modelValue:a(e).urlList[r],"onUpdate:modelValue":g=>a(e).urlList[r]=g,placeholder:t.$t("alarmUrlPushP"),style:{width:"70%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"]),n(u,{link:"",type:"primary",onClick:v,style:{"margin-left":"16px"}},{default:l(()=>[d(m(t.$t("add")),1)]),_:1}),a(e).urlList.length>1?(i(),f(u,{key:0,link:"",type:"danger",onClick:g=>$(r)},{default:l(()=>[d(m(t.$t("delete")),1)]),_:2},1032,["onClick"])):M("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["model"])]),_:1},8,["title","modelValue"])}}};export{Q as default};
