import{G as Q,H as W,C as X,B as Y,c as Z,P as q,D as ee,k as ae}from"./element-plus.ae8e286c.js";import{P as le}from"./index.a9e38e26.js";import{r as i,a as ue,e as U,d as te}from"./index.71fc8348.js";import"./lodash.e92d81a1.js";import{a as oe}from"./useDictOptions.40b26c73.js";import{d as w,s as A,r as f,b as ne,_ as C,a3 as se,o as s,c,T as u,K as o,u as V,U as F,a6 as v,J as b}from"./@vue.108c970a.js";function he(n){return i.get({url:"/fence_house.fence_house/lists",params:n})}function re(n){return i.post({url:"/fence_house.fence_house/add",params:n})}function de(n){return i.post({url:"/fence_house.fence_house/edit",params:n})}function ge(n){return i.post({url:"/fence_house.fence_house/delete",params:n})}function pe(n){return i.get({url:"/fence_house.fence_house/detail",params:n})}function x(n){return i.get({url:"/farm.farm/datas",params:n})}const ce={class:"edit-popup"},ie=["src"],me={key:1,class:"avatar-uploader-icon"},_e=w({name:"fenceHouseEdit"}),fe=w({..._e,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(n,{expose:P,emit:h}){const g=A(),B=A(),D=f("add"),H=f(".png, .jpg, .jpeg, image/png, image/jpeg"),I=f(`${U.baseUrl}${U.urlPrefix}/upload/image`),L=ue(),S=(t,e)=>{if(t.code==0){ae.error(t.msg);return}l.pic.push(t.data.uri)},j=ne(()=>D.value=="edit"?"\u7F16\u8F91\u680F\u820D\u7BA1\u7406":"\u65B0\u589E\u680F\u820D\u7BA1\u7406"),l=C({id:"",farm_id:"",animal_name:"",fence_house_name:"",animal_type:"",fence_house_type:"",capacity:"",master:"",master_phone:"",status:"",qr_code:"",pic:[]}),R=C({}),{optionsData:E}=oe({farmList:{api:x}}),y=f(!1),O=async t=>{y.value=!0;const e=await x({farm_name:t!=null?t:""});E.farmList=e,y.value=!1},k=async t=>{for(const e in l)t[e]!=null&&t[e]!=null&&(l[e]=t[e])},T=async t=>{const e=await pe({id:t.id});k(e)},M=async()=>{var e,d;await((e=g.value)==null?void 0:e.validate());const t={...l};D.value=="edit"?await de(t):await re(t),(d=B.value)==null||d.close(),h("success")},$=(t="add")=>{var e;D.value=t,(e=B.value)==null||e.open()},z=()=>{h("close")};return P({open:$,setFormData:k,getDetail:T}),(t,e)=>{const d=Q,_=W,r=X,m=Y,G=se("Plus"),J=Z,K=q,N=ee;return s(),c("div",ce,[u(le,{ref_key:"popupRef",ref:B,title:V(j),async:!0,width:"550px",onConfirm:M,onClose:z},{default:o(()=>[u(N,{ref_key:"formRef",ref:g,model:l,"label-width":"90px",rules:R},{default:o(()=>[u(r,{label:"\u517B\u6B96\u57FA\u5730",prop:"farm_id"},{default:o(()=>[u(_,{modelValue:l.farm_id,"onUpdate:modelValue":e[0]||(e[0]=a=>l.farm_id=a),remote:"",filterable:"","remote-method":O,loading:y.value},{default:o(()=>[(s(!0),c(F,null,v(V(E).farmList,(a,p)=>(s(),b(d,{key:p,label:a.farminfo,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),u(r,{label:"\u680F\u820D\u540D\u79F0",prop:"fence_house_name"},{default:o(()=>[u(m,{modelValue:l.fence_house_name,"onUpdate:modelValue":e[1]||(e[1]=a=>l.fence_house_name=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u680F\u820D\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(r,{label:"\u52A8\u7269\u540D\u79F0",prop:"animal_name"},{default:o(()=>[u(m,{modelValue:l.animal_name,"onUpdate:modelValue":e[2]||(e[2]=a=>l.animal_name=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u680F\u820D\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(r,{label:"\u52A8\u7269\u7C7B\u578B",prop:"animal_type"},{default:o(()=>[u(_,{class:"flex-1",modelValue:l.animal_type,"onUpdate:modelValue":e[3]||(e[3]=a=>l.animal_type=a),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u52A8\u7269\u7C7B\u578B"},{default:o(()=>[(s(!0),c(F,null,v(n.dictData.animal_type,(a,p)=>(s(),b(d,{key:p,label:a.name,value:parseInt(a.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(r,{label:"\u680F\u820D\u7C7B\u578B",prop:"fence_house_type"},{default:o(()=>[u(_,{class:"flex-1",modelValue:l.fence_house_type,"onUpdate:modelValue":e[4]||(e[4]=a=>l.fence_house_type=a),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u680F\u820D\u7C7B\u578B"},{default:o(()=>[(s(!0),c(F,null,v(n.dictData.fence_house_type,(a,p)=>(s(),b(d,{key:p,label:a.name,value:parseInt(a.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(r,{label:"\u5BB9\u91CF",prop:"capacity"},{default:o(()=>[u(m,{modelValue:l.capacity,"onUpdate:modelValue":e[5]||(e[5]=a=>l.capacity=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5BB9\u91CF"},null,8,["modelValue"])]),_:1}),u(r,{label:"\u8D1F\u8D23\u4EBA",prop:"master"},{default:o(()=>[u(m,{modelValue:l.master,"onUpdate:modelValue":e[6]||(e[6]=a=>l.master=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8D1F\u8D23\u4EBA"},null,8,["modelValue"])]),_:1}),u(r,{label:"\u8D1F\u8D23\u4EBA\u7535\u8BDD",prop:"master_phone"},{default:o(()=>[u(m,{modelValue:l.master_phone,"onUpdate:modelValue":e[7]||(e[7]=a=>l.master_phone=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8D1F\u8D23\u4EBA\u7535\u8BDD"},null,8,["modelValue"])]),_:1}),u(r,{label:"\u72B6\u6001",prop:"status"},{default:o(()=>[u(_,{class:"flex-1",modelValue:l.status,"onUpdate:modelValue":e[8]||(e[8]=a=>l.status=a),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001"},{default:o(()=>[(s(!0),c(F,null,v(n.dictData.system_disable,(a,p)=>(s(),b(d,{key:p,label:a.name,value:parseInt(a.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(r,{label:"\u56FE\u7247",prop:"pic"},{default:o(()=>[u(K,{class:"avatar-uploader",accept:H.value,modelValue:l.pic,"onUpdate:modelValue":e[9]||(e[9]=a=>l.pic=a),data:{cid:1},headers:{Token:V(L).token},action:I.value,"show-file-list":!1,"on-success":S},{default:o(()=>[l.pic?(s(),c("img",{key:0,src:l.pic,class:"avatar"},null,8,ie)):(s(),c("div",me,[u(J,null,{default:o(()=>[u(G)]),_:1})]))]),_:1},8,["accept","modelValue","headers","action"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});const Fe=te(fe,[["__scopeId","data-v-5895da95"]]),Ee=Object.freeze(Object.defineProperty({__proto__:null,default:Fe},Symbol.toStringTag,{value:"Module"}));export{Fe as E,he as a,ge as b,Ee as e};