import{J as A,D as I,C as M,S as G,T as N,F as O}from"./element-plus.55d71530.js";import{P}from"./index.8e3b20a1.js";import{r as i}from"./index.75e08341.js";import{a as j}from"./goods.2ecc1535.js";import"./lodash.d6737109.js";import"./dayjs.37feae28.js";import{d as B,s as g,r as D,b as J,_ as y,o as p,c as b,V as s,M as r,u as o,U as z,aa as H,L as K,a as Q}from"./@vue.96c135a1.js";function ne(a){return i.get({url:"/effective.effective_rules/lists",params:a})}function W(a){return i.post({url:"/effective.effective_rules/add",params:a})}function X(a){return i.post({url:"/effective.effective_rules/edit",params:a})}function ce(a){return i.post({url:"/effective.effective_rules/delete",params:a})}function Y(a){return i.get({url:"/effective.effective_rules/detail",params:a})}const Z={class:"edit-popup"},$=Q("div",{class:"form-tips"}," \u8BF7\u9009\u62E9\u6700\u540E\u4E00\u7EA7\u7C7B\u76EE ",-1),ee=B({name:"effectiveRulesEdit"}),fe=B({...ee,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(a,{expose:C,emit:V}){const m=V,_=g(),f=g(),d=D("add"),k=J(()=>d.value=="edit"?"\u7F16\u8F91\u4FDD\u4FEE\u5361\u89C4\u5219":"\u65B0\u589E\u4FDD\u4FEE\u5361\u89C4\u5219"),u=y({id:"",goods_category_ids:[],effective_num:"",effective_unit:"",remark:""}),w=y({goods_category_ids:[{required:!0,message:"\u8BF7\u9009\u62E9\u7C7B\u76EE",trigger:["change"]}],effective_num:[{required:!0,message:"\u8BF7\u8F93\u5165\u4FDD\u4FEE\u503C",trigger:["blur"]}],effective_unit:[{required:!0,message:"\u8BF7\u8F93\u5165\u5355\u4F4D",trigger:["blur"]}]}),E=async t=>{for(const e in u)t[e]!=null&&t[e]!=null&&(u[e]=t[e])},R=async t=>{const e=await Y({id:t.id});E(e)},x=async()=>{var e,n;await((e=_.value)==null?void 0:e.validate());const t={...u};d.value=="edit"?await X(t):await W(t),(n=f.value)==null||n.close(),m("success")},h=(t="add")=>{var e;d.value=t,(e=f.value)==null||e.open()},U=()=>{m("close")},v=D([]);return(async()=>{const t=await j({});v.value=t})(),C({open:h,setFormData:E,getDetail:R}),(t,e)=>{const n=A,c=I,F=M,q=G,L=N,S=O;return p(),b("div",Z,[s(P,{ref_key:"popupRef",ref:f,title:o(k),async:!0,width:"800px",onConfirm:x,onClose:U},{default:r(()=>[s(S,{ref_key:"formRef",ref:_,model:o(u),"label-width":"90px",rules:o(w)},{default:r(()=>[s(c,{label:"\u670D\u52A1\u7C7B\u76EE",prop:"goods_category_ids"},{default:r(()=>[s(n,{modelValue:o(u).goods_category_ids,"onUpdate:modelValue":e[0]||(e[0]=l=>o(u).goods_category_ids=l),options:o(v),props:{expandTrigger:"hover",multiple:!0,checkStrictly:!0},clearable:"",filterable:"",with:"300"},null,8,["modelValue","options"])]),_:1}),$,s(c,{label:"\u4FDD\u4FEE\u503C",prop:"effective_num"},{default:r(()=>[s(F,{modelValue:o(u).effective_num,"onUpdate:modelValue":e[1]||(e[1]=l=>o(u).effective_num=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4FDD\u4FEE\u503C"},null,8,["modelValue"])]),_:1}),s(c,{label:"\u5355\u4F4D",prop:"goods_payment_type"},{default:r(()=>[s(L,{class:"w-[280px]",modelValue:o(u).effective_unit,"onUpdate:modelValue":e[2]||(e[2]=l=>o(u).effective_unit=l),clearable:"",placeholder:"\u652F\u4ED8\u7C7B\u522B"},{default:r(()=>[(p(!0),b(z,null,H(a.dictData.effective_unit,(l,T)=>(p(),K(q,{key:T,label:l.name,value:parseInt(l.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(c,{label:"\u4FDD\u4FEE\u8BF4\u660E",prop:"remark"},{default:r(()=>[s(F,{type:"textarea",rows:5,modelValue:o(u).remark,"onUpdate:modelValue":e[3]||(e[3]=l=>o(u).remark=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4FDD\u4FEE\u8BF4\u660E"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{fe as _,ce as a,ne as b};
