import{a0 as S,D as T,Q as U,R as G,C as j,F as A}from"./element-plus.ae09c4a0.js";import{P as N}from"./index.e64ff1d1.js";import{r as n,t as F}from"./index.80696382.js";import{a as Q}from"./goods.f836f77e.js";import{d as v,s as B,r as E,b as W,a0 as D,o as m,c as b,W as l,O as s,u as r,V as z,a7 as H,M as J}from"./@vue.a7a54728.js";function le(o){return n.get({url:"/performance.performance_rules/lists",params:o})}function K(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:R}){const f=R,_=B(),p=B(),i=E("add"),h=W(()=>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 K(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 Q({});g.value=a})(),C({open:x,setFormData:y,getDetail:V}),(a,e)=>{const c=S,d=T,P=U,q=G,I=j,L=A;return m(),b("div",Z,[l(N,{ref_key:"popupRef",ref:p,title:r(h),async:!0,width:"550px",onConfirm:k,onClose:M},{default:s(()=>[l(L,{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(z,null,H(o.dictData.performance_type,(u,O)=>(m(),J(P,{key:O,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(I,{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};
