2 lines
5.6 KiB
JavaScript
2 lines
5.6 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.0d3bed35.js";import{r as p,a as ue,e as C,d as te}from"./index.fccb4ef5.js";import"./lodash.e92d81a1.js";import{a as oe}from"./useDictOptions.7b4b6189.js";import{d as w,s as U,r as f,b as ne,_ as x,a3 as se,o as s,c as i,T as u,K as o,u as V,U as F,a6 as v,J as b}from"./@vue.108c970a.js";function De(n){return p.get({url:"/fence_house.fence_house/lists",params:n})}function re(n){return p.post({url:"/fence_house.fence_house/add",params:n})}function de(n){return p.post({url:"/fence_house.fence_house/edit",params:n})}function he(n){return p.post({url:"/fence_house.fence_house/delete",params:n})}function ce(n){return p.get({url:"/fence_house.fence_house/detail",params:n})}function A(n){return p.get({url:"/farm.farm/datas",params:n})}const ie={class:"edit-popup"},pe=["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:D}){const h=U(),y=U(),B=f("add"),H=f(".png, .jpg, .jpeg, image/png, image/jpeg"),I=f(`${C.baseUrl}${C.urlPrefix}/upload/image`),L=ue(),S=(t,e)=>{if(t.code==0){ae.error(t.msg);return}l.image=t.data.uri},j=ne(()=>B.value=="edit"?"\u7F16\u8F91\u680F\u820D\u7BA1\u7406":"\u65B0\u589E\u680F\u820D\u7BA1\u7406"),l=x({id:"",farm_id:"",animal_name:"",fence_house_name:"",animal_type:"",fence_house_type:"",capacity:"",master:"",status:"",qr_code:"",image:""}),R=x({}),{optionsData:E}=oe({farmList:{api:A}}),g=f(!1),O=async t=>{g.value=!0;const e=await A({farm_name:t!=null?t:""});E.farmList=e,g.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 ce({id:t.id});k(e)},M=async()=>{var e,d;await((e=h.value)==null?void 0:e.validate());const t={...l};B.value=="edit"?await de(t):await re(t),(d=y.value)==null||d.close(),D("success")},$=(t="add")=>{var e;B.value=t,(e=y.value)==null||e.open()},z=()=>{D("close")};return P({open:$,setFormData:k,getDetail:T}),(t,e)=>{const d=Q,m=W,r=X,_=Y,G=se("Plus"),J=Z,K=q,N=ee;return s(),i("div",ie,[u(le,{ref_key:"popupRef",ref:y,title:V(j),async:!0,width:"550px",onConfirm:M,onClose:z},{default:o(()=>[u(N,{ref_key:"formRef",ref:h,model:l,"label-width":"90px",rules:R},{default:o(()=>[u(r,{label:"\u517B\u6B96\u57FA\u5730",prop:"farm_id"},{default:o(()=>[u(m,{modelValue:l.farm_id,"onUpdate:modelValue":e[0]||(e[0]=a=>l.farm_id=a),remote:"",filterable:"","remote-method":O,loading:g.value},{default:o(()=>[(s(!0),i(F,null,v(V(E).farmList,(a,c)=>(s(),b(d,{key:c,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(_,{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(_,{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(m,{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),i(F,null,v(n.dictData.animal_type,(a,c)=>(s(),b(d,{key:c,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(m,{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),i(F,null,v(n.dictData.fence_house_type,(a,c)=>(s(),b(d,{key:c,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(_,{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(_,{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:"\u72B6\u6001",prop:"status"},{default:o(()=>[u(m,{class:"flex-1",modelValue:l.status,"onUpdate:modelValue":e[7]||(e[7]=a=>l.status=a),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001"},{default:o(()=>[(s(!0),i(F,null,v(n.dictData.system_disable,(a,c)=>(s(),b(d,{key:c,label:a.name,value:parseInt(a.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(r,{label:"\u56FE\u7247",prop:"image"},{default:o(()=>[u(K,{class:"avatar-uploader",accept:H.value,modelValue:l.image,"onUpdate:modelValue":e[8]||(e[8]=a=>l.image=a),data:{cid:1},headers:{Token:V(L).token},action:I.value,"show-file-list":!1,"on-success":S},{default:o(()=>[l.image?(s(),i("img",{key:0,src:l.image,class:"avatar"},null,8,pe)):(s(),i("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-2c41a616"]]),Ee=Object.freeze(Object.defineProperty({__proto__:null,default:Fe},Symbol.toStringTag,{value:"Module"}));export{Fe as E,De as a,he as b,Ee as e};
|