import{B as U,C as P,G as S,H as T,D as j}from"./element-plus.ae8e286c.js";import{P as G}from"./index.a9e38e26.js";import{r as s}from"./index.71fc8348.js";import"./lodash.e92d81a1.js";import{a as R}from"./monitor_threshold.e3c3ddf3.js";import{a as J}from"./useDictOptions.40b26c73.js";import{d as h,s as b,r as D,b as K,_ as y,o as f,c as E,T as n,K as i,u as g,U as N,a6 as z,J as M}from"./@vue.108c970a.js";function ie(a){return s.get({url:"/rfid.animal_rfid/lists",params:a})}function Q(a){return s.post({url:"/rfid.animal_rfid/add",params:a})}function W(a){return s.post({url:"/rfid.animal_rfid/edit",params:a})}function se(a){return s.post({url:"/rfid.animal_rfid/delete",params:a})}function X(a){return s.get({url:"/rfid.animal_rfid/detail",params:a})}const Y={class:"edit-popup"},Z=h({name:"animalRfidEdit"}),re=h({...Z,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(a,{expose:w,emit:p}){const m=b(),u=b(),d=D("add"),B=K(()=>d.value=="edit"?"\u7F16\u8F91\u6863\u6848RFID":"\u65B0\u589E\u6863\u6848RFID"),o=y({id:"",rfid:"",fence_house_id:""}),k=y({rfid:[{required:!0,message:"\u8BF7\u8F93\u5165",trigger:["blur"]}]}),{optionsData:_}=J({fenceHouse:{api:R}}),c=D(!1),C=async t=>{c.value=!0;const e=await R({fence_house_name:t!=null?t:""});_.fenceHouse=e,c.value=!1},F=async t=>{for(const e in o)t[e]!=null&&t[e]!=null&&(o[e]=t[e])},H=async t=>{const e=await X({id:t.id});F(e)},V=async()=>{var e,r;await((e=m.value)==null?void 0:e.validate());const t={...o};d.value=="edit"?await W(t):await Q(t),(r=u.value)==null||r.close(),p("success")},A=(t="add")=>{var e;d.value=t,(e=u.value)==null||e.open()},x=()=>{p("close")};return w({open:A,setFormData:F,getDetail:H}),(t,e)=>{const r=U,v=P,I=S,L=T,q=j;return f(),E("div",Y,[n(G,{ref_key:"popupRef",ref:u,title:g(B),async:!0,width:"550px",onConfirm:V,onClose:x},{default:i(()=>[n(q,{ref_key:"formRef",ref:m,model:o,"label-width":"90px",rules:k},{default:i(()=>[n(v,{label:"RFID",prop:"rfid"},{default:i(()=>[n(r,{modelValue:o.rfid,"onUpdate:modelValue":e[0]||(e[0]=l=>o.rfid=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1}),n(v,{label:"\u6240\u5C5E\u680F\u820D",prop:"fence_house_id"},{default:i(()=>[n(L,{modelValue:o.fence_house_id,"onUpdate:modelValue":e[1]||(e[1]=l=>o.fence_house_id=l),clearable:"",remote:"",filterable:"",placeholder:"\u8BF7\u9009\u62E9","remote-method":C,loading:c.value},{default:i(()=>[(f(!0),E(N,null,z(g(_).fenceHouse,(l,O)=>(f(),M(I,{key:O,label:l.fencehouseinfo,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{re as _,ie as a,se as b};
