import{C as I,D as O,Q as U,R as L,F as S}from"./element-plus.fcb5dc91.js";import{P as j}from"./index.94abbaf6.js";import{r as c,t as F}from"./index.fbf661f7.js";import{d as D,s as B,r as A,b as N,a0 as g,o as i,c as E,W as l,O as s,u as o,V as Q,a7 as T,M as W}from"./@vue.a7a54728.js";function ee(u){return c.get({url:"/performance.performance_rules/lists",params:u})}function z(u){return c.post({url:"/performance.performance_rules/add",params:u})}function G(u){return c.post({url:"/performance.performance_rules/edit",params:u})}function te(u){return c.post({url:"/performance.performance_rules/delete",params:u})}function H(u){return c.get({url:"/performance.performance_rules/detail",params:u})}const J={class:"edit-popup"},K=D({name:"performanceRulesEdit"}),ue=D({...K,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(u,{expose:b,emit:C}){const f=C,_=B(),p=B(),d=A("add"),v=N(()=>d.value=="edit"?"\u7F16\u8F91\u7EE9\u6548\u89C4\u5219":"\u65B0\u589E\u7EE9\u6548\u89C4\u5219"),t=g({id:"",goods_category_ids:"",type:"",rate:""}),R=g({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 H({id:a.id});y(e)},h=async()=>{var e,n;await((e=_.value)==null?void 0:e.validate());const a={...t};d.value=="edit"?await G(a):await z(a),(n=p.value)==null||n.close(),f("success")},w=(a="add")=>{var e;d.value=a,(e=p.value)==null||e.open()},k=()=>{f("close")};return b({open:w,setFormData:y,getDetail:V}),(a,e)=>{const n=I,m=O,x=U,P=L,M=S;return i(),E("div",J,[l(j,{ref_key:"popupRef",ref:p,title:o(v),async:!0,width:"550px",onConfirm:h,onClose:k},{default:s(()=>[l(M,{ref_key:"formRef",ref:_,model:o(t),"label-width":"90px",rules:o(R)},{default:s(()=>[l(m,{label:"\u5206\u7C7B\u96C6\u5408",prop:"goods_category_ids"},{default:s(()=>[l(n,{modelValue:o(t).goods_category_ids,"onUpdate:modelValue":e[0]||(e[0]=r=>o(t).goods_category_ids=r),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5206\u7C7B\u96C6\u5408"},null,8,["modelValue"])]),_:1}),l(m,{label:"\u7ED3\u7B97\u65B9\u5F0F",prop:"type"},{default:s(()=>[l(P,{class:"flex-1",modelValue:o(t).type,"onUpdate:modelValue":e[1]||(e[1]=r=>o(t).type=r),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u7ED3\u7B97\u65B9\u5F0F"},{default:s(()=>[(i(!0),E(Q,null,T(u.dictData.performance_type,(r,q)=>(i(),W(x,{key:q,label:r.name,value:parseInt(r.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(m,{label:"\u63D0\u6210\u6BD4\u4F8B",prop:"rate"},{default:s(()=>[l(n,{modelValue:o(t).rate,"onUpdate:modelValue":e[2]||(e[2]=r=>o(t).rate=r),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u63D0\u6210\u6BD4\u4F8B"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{ue as _,te as a,ee as b};
