import{C as A,D as G,Q as M,R as O,F as P}from"./element-plus.9cae3cb1.js";import{_ as j}from"./picker.b9386bc9.js";import{P as z}from"./index.b375235f.js";import{f as N}from"./goods.da5748c3.js";import{r as i}from"./index.7f83e315.js";import"./lodash.fc1b942f.js";import"./dayjs.37feae28.js";import{d as y,s as E,r as _,b as Q,_ as V,o as f,c as D,V as s,M as r,u as t,U as T,aa as J,L as K}from"./@vue.96c135a1.js";function ne(l){return i.get({url:"/home_service.home_service/lists",params:l})}function W(l){return i.post({url:"/home_service.home_service/add",params:l})}function X(l){return i.post({url:"/home_service.home_service/edit",params:l})}function ie(l){return i.post({url:"/home_service.home_service/delete",params:l})}function Y(l){return i.get({url:"/home_service.home_service/detail",params:l})}const Z={class:"edit-popup"},$=y({name:"homeServiceEdit"}),de=y({...$,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(l,{expose:w,emit:B}){const v=B,g=E(),m=E(),c=_("add"),k=Q(()=>c.value=="edit"?"\u7F16\u8F91\u9996\u9875\u670D\u52A1\u8868":"\u65B0\u589E\u9996\u9875\u670D\u52A1\u8868"),u=V({id:"",name:"",goods_id:"",picture:"",sort:""}),C=V({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0",trigger:["blur"]}],goods_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1ID",trigger:["change"]}],picture:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247",trigger:["blur"]}]}),F=async o=>{for(const e in u)o[e]!=null&&o[e]!=null&&(u[e]=o[e])},p=_(!1),h=_([]),b=async o=>{p.value=!0;const e=await N({goods_name:o,page_size:200});p.value=!1,h.value=e==null?void 0:e.lists};b(void 0);const S=async o=>{const e=await Y({id:o.id});F(e)},R=async()=>{var e,n;await((e=g.value)==null?void 0:e.validate());const o={...u};c.value=="edit"?await X(o):await W(o),(n=m.value)==null||n.close(),v("success")},x=(o="add")=>{var e;c.value=o,(e=m.value)==null||e.open()},H=()=>{v("close")};return w({open:x,setFormData:F,getDetail:S}),(o,e)=>{const n=A,d=G,L=M,U=O,q=j,I=P;return f(),D("div",Z,[s(z,{ref_key:"popupRef",ref:m,title:t(k),async:!0,width:"550px",onConfirm:R,onClose:H},{default:r(()=>[s(I,{ref_key:"formRef",ref:g,model:t(u),"label-width":"90px",rules:t(C)},{default:r(()=>[s(d,{label:"\u540D\u79F0",prop:"name"},{default:r(()=>[s(n,{modelValue:t(u).name,"onUpdate:modelValue":e[0]||(e[0]=a=>t(u).name=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0"},null,8,["modelValue"])]),_:1}),s(d,{label:"\u5546\u54C1",prop:"goods_id"},{default:r(()=>[s(U,{modelValue:t(u).goods_id,"onUpdate:modelValue":e[1]||(e[1]=a=>t(u).goods_id=a),filterable:"",remote:"","reserve-keyword":"",placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1","remote-method":b,loading:t(p)},{default:r(()=>[(f(!0),D(T,null,J(t(h),a=>(f(),K(L,{key:a.id,label:a.goods_name,value:parseInt(a.id)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),s(d,{label:"\u56FE\u7247",prop:"picture"},{default:r(()=>[s(q,{modelValue:t(u).picture,"onUpdate:modelValue":e[2]||(e[2]=a=>t(u).picture=a)},null,8,["modelValue"])]),_:1}),s(d,{label:"\u6392\u5E8F",prop:"sort"},{default:r(()=>[s(n,{modelValue:t(u).sort,"onUpdate:modelValue":e[3]||(e[3]=a=>t(u).sort=a),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6392\u5E8F"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{de as _,ie as a,ne as b};
