import{a as R,r as f,ah as B,o as i,y,q as o,v as C,p as n,P as v,x as _,n as r,c as I,F as M,A as N,s as S,S as U,E as q,i as x,k as K,m as L,l as O,bv as P,D as A}from"./index.8d733f79.js";import{g as j,b as z}from"./deviceModel.43e61fe5.js";const G={class:"dialog-footer"},W={__name:"bindDeviceType",emits:["refesh"],setup(H,{expose:T,emit:b}){const g=R(),{proxy:d}=A(),l=f(!1),s=B({deviceType:""}),p=f([]);let u;function h(e){l.value=!0,E(),u=e,s.deviceType=e.deviceType}const E=async()=>{const e=await j({factoryId:g.query.factoryId});e.data.length&&(p.value=e.data)};function V(){!d.$refs.setFormRef||d.$refs.setFormRef.validate(e=>{e?(z({...u,deviceType:s.deviceType}).then(a=>{U.success(a.msg),b("refesh")}),c()):console.log("error submit!")})}function c(){l.value=!1}return T({showModal:h}),(e,a)=>{const F=q,k=x,D=K,$=L,m=O,w=P;return i(),y(w,{title:e.$t("bindDeviceType"),modelValue:r(l),"onUpdate:modelValue":a[1]||(a[1]=t=>S(l)?l.value=t:null),width:"400px","align-center":!0,onClose:c},{footer:o(()=>[C("div",G,[n(m,{onClick:c},{default:o(()=>[v(_(e.$t("cancel")),1)]),_:1}),n(m,{type:"primary",onClick:V},{default:o(()=>[v(_(e.$t("confirm")),1)]),_:1})])]),default:o(()=>[n($,{ref:"setFormRef",model:r(s)},{default:o(()=>[n(D,{label:e.$t("deviceType"),prop:"deviceType"},{default:o(()=>[n(k,{modelValue:r(s).deviceType,"onUpdate:modelValue":a[0]||(a[0]=t=>r(s).deviceType=t),filterable:"",placeholder:e.$t("deviceTypeP"),clearable:"",teleported:!1},{default:o(()=>[(i(!0),I(M,null,N(r(p),t=>(i(),y(F,{key:t.productKey,label:t.name,value:t.productKey},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["title","modelValue"])}}};export{W as default};
