2 lines
5.8 KiB
JavaScript
2 lines
5.8 KiB
JavaScript
|
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,["
|