import{G as O,H as S,C as T,B as j,D as G}from"./element-plus.ae8e286c.js";import{P as H}from"./index.a9e38e26.js";import{r as d}from"./index.71fc8348.js";import"./lodash.e92d81a1.js";import{d as x,s as B,r as f,b as J,_ as g,o as r,c as C,T as o,K as s,u as K,U as E,a6 as V,J as w}from"./@vue.108c970a.js";function N(a){return d.get({url:"/land.land_plant/lists",params:a})}function ae(a){return d.get({url:"/land.land_plant_action/lists",params:a})}function z(a){return d.post({url:"/land.land_plant_action/add",params:a})}function M(a){return d.post({url:"/land.land_plant_action/edit",params:a})}function ue(a){return d.post({url:"/land.land_plant_action/delete",params:a})}function Q(a){return d.get({url:"/land.land_plant_action/detail",params:a})}const W={class:"edit-popup"},X=x({name:"landPlantActionEdit"}),ne=x({...X,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(a,{expose:k,emit:D}){const F=B(),m=B(),_=f("add"),L=J(()=>_.value=="edit"?"\u7F16\u8F91\u571F\u5730\u79CD\u690D\u64CD\u4F5C":"\u65B0\u589E\u571F\u5730\u79CD\u690D\u64CD\u4F5C"),u=g({id:"",plant_id:"",type:"",type_text:"",detail:""}),P=g({plant_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u79CD\u690DID",trigger:["blur"]}],type:[{required:!0,message:"\u8BF7\u9009\u62E9\u64CD\u4F5C\u7C7B\u578B",trigger:["blur"]}]}),v=async l=>{for(const e in u)l[e]!=null&&l[e]!=null&&(u[e]=l[e])},A=async l=>{const e=await Q({id:l.id});v(e)},i=f([]),p=f(!1),I=async l=>{if(l){p.value=!0;const e=await N({keyword:l});p.value=!1,e.count>0?i.value=e.lists.map(n=>({value:`${n.id}`,label:`ID: ${n.id} / \u79CD\u7C7B: ${n.kind} / \u54C1\u724C: ${n.breed}`})):i.value=[],p.value=!1}else i.value=[]},R=async()=>{var e,n;await((e=F.value)==null?void 0:e.validate());const l={...u};_.value=="edit"?await M(l):await z(l),(n=m.value)==null||n.close(),D("success")},h=(l="add")=>{var e;_.value=l,(e=m.value)==null||e.open()},U=()=>{D("close")};return k({open:h,setFormData:v,getDetail:A}),(l,e)=>{const n=O,y=S,c=T,b=j,$=G;return r(),C("div",W,[o(H,{ref_key:"popupRef",ref:m,title:K(L),async:!0,width:"550px",onConfirm:R,onClose:U},{default:s(()=>[o($,{ref_key:"formRef",ref:F,model:u,"label-width":"90px",rules:P},{default:s(()=>[o(c,{label:"\u79CD\u690DID",prop:"land_id"},{default:s(()=>[o(y,{modelValue:u.plant_id,"onUpdate:modelValue":e[0]||(e[0]=t=>u.plant_id=t),filterable:"",remote:"","reserve-keyword":"",placeholder:"\u8BF7\u8F93\u5165\u79CD\u690D\u4FE1\u606F","remote-method":I,loading:p.value},{default:s(()=>[(r(!0),C(E,null,V(i.value,t=>(r(),w(n,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),o(c,{label:"\u64CD\u4F5C\u7C7B\u578B",prop:"type"},{default:s(()=>[o(y,{class:"flex-1",modelValue:u.type,"onUpdate:modelValue":e[1]||(e[1]=t=>u.type=t),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u64CD\u4F5C\u7C7B\u578B"},{default:s(()=>[(r(!0),C(E,null,V(a.dictData.land_plant_action,(t,q)=>(r(),w(n,{key:q,label:t.name,value:parseInt(t.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),o(c,{label:"\u64CD\u4F5C",prop:"type_text"},{default:s(()=>[o(b,{modelValue:u.type_text,"onUpdate:modelValue":e[2]||(e[2]=t=>u.type_text=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u64CD\u4F5C"},null,8,["modelValue"])]),_:1}),o(c,{label:"\u64CD\u4F5C\u8BE6\u60C5",prop:"detail"},{default:s(()=>[o(b,{class:"flex-1",modelValue:u.detail,"onUpdate:modelValue":e[3]||(e[3]=t=>u.detail=t),type:"textarea",rows:"4",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u64CD\u4F5C\u8BE6\u60C5"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{ne as _,ae as a,ue as b};
