import{J as U,D as I,S as G,T as O,C as j,F as A}from"./element-plus.55d71530.js";import{P as J}from"./index.8e3b20a1.js";import{r as n,t as F}from"./index.75e08341.js";import{a as N}from"./goods.2ecc1535.js";import{d as v,s as B,r as E,b as z,_ as D,o as m,c as b,V as l,M as s,u as r,U as H,aa as K,L as Q}from"./@vue.96c135a1.js";function le(o){return n.get({url:"/performance.performance_rules/lists",params:o})}function W(o){return n.post({url:"/performance.performance_rules/add",params:o})}function X(o){return n.post({url:"/performance.performance_rules/edit",params:o})}function se(o){return n.post({url:"/performance.performance_rules/delete",params:o})}function Y(o){return n.get({url:"/performance.performance_rules/detail",params:o})}const Z={class:"edit-popup"},$=v({name:"performanceRulesEdit"}),ne=v({...$,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(o,{expose:C,emit:h}){const f=h,_=B(),p=B(),i=E("add"),R=z(()=>i.value=="edit"?"\u7F16\u8F91\u7EE9\u6548\u89C4\u5219":"\u65B0\u589E\u7EE9\u6548\u89C4\u5219"),t=D({id:"",goods_category_ids:"",type:"",rate:""}),w=D({goods_category_ids:[{required:!0,message:"\u8BF7\u8F93\u5165\u5206\u7C7B\u96C6\u5408",trigger:["blur"]}],type:[{required:!0,message:"\u8BF7\u9009\u62E9\u7ED3\u7B97\u65B9\u5F0F",trigger:["blur"]}],rate:[{required:!0,message:"\u8BF7\u8F93\u5165\u63D0\u6210\u6BD4\u4F8B",trigger:["blur"]}]}),y=async a=>{for(const e in t)a[e]!=null&&a[e]!=null&&(t[e]=a[e]);t.create_time=F(t.create_time,"yyyy-mm-dd hh:MM:ss"),t.update_time=F(t.update_time,"yyyy-mm-dd hh:MM:ss")},V=async a=>{const e=await Y({id:a.id});y(e)},k=async()=>{var e,c;await((e=_.value)==null?void 0:e.validate());const a={...t};i.value=="edit"?await X(a):await W(a),(c=p.value)==null||c.close(),f("success")},x=(a="add")=>{var e;i.value=a,(e=p.value)==null||e.open()},M=()=>{f("close")},g=E([]);return(async()=>{const a=await N({});g.value=a})(),C({open:x,setFormData:y,getDetail:V}),(a,e)=>{const c=U,d=I,P=G,q=O,L=j,S=A;return m(),b("div",Z,[l(J,{ref_key:"popupRef",ref:p,title:r(R),async:!0,width:"550px",onConfirm:k,onClose:M},{default:s(()=>[l(S,{ref_key:"formRef",ref:_,model:r(t),"label-width":"90px",rules:r(w)},{default:s(()=>[l(d,{label:"\u5206\u7C7B\u96C6\u5408",prop:"goods_category_ids"},{default:s(()=>[l(c,{modelValue:r(t).goods_category_ids,"onUpdate:modelValue":e[0]||(e[0]=u=>r(t).goods_category_ids=u),options:r(g),width:"500",props:{expandTrigger:"hover",multiple:!0,checkStrictly:!0},clearable:"",filterable:"",with:"300"},null,8,["modelValue","options"])]),_:1}),l(d,{label:"\u7ED3\u7B97\u65B9\u5F0F",prop:"type"},{default:s(()=>[l(q,{class:"flex-1",modelValue:r(t).type,"onUpdate:modelValue":e[1]||(e[1]=u=>r(t).type=u),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u7ED3\u7B97\u65B9\u5F0F"},{default:s(()=>[(m(!0),b(H,null,K(o.dictData.performance_type,(u,T)=>(m(),Q(P,{key:T,label:u.name,value:parseInt(u.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(d,{label:"\u63D0\u6210\u6BD4\u4F8B",prop:"rate"},{default:s(()=>[l(L,{modelValue:r(t).rate,"onUpdate:modelValue":e[2]||(e[2]=u=>r(t).rate=u),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u63D0\u6210\u6BD4\u4F8B"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{ne as _,se as a,le as b};
