import{a0 as M,D as O,C as S,Q as T,R as G,F as N}from"./element-plus.fcb5dc91.js";import{P}from"./index.94abbaf6.js";import{r as i}from"./index.fbf661f7.js";import{a as j}from"./goods.af74a827.js";import"./lodash.dbfecd92.js";import{d as B,s as g,r as D,b as Q,a0 as y,o as p,c as b,W as s,O as r,u as o,V as W,a7 as z,M as H,a as J}from"./@vue.a7a54728.js";function ie(a){return i.get({url:"/effective.effective_rules/lists",params:a})}function K(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 ne(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"},$=J("div",{class:"form-tips"}," \u8BF7\u9009\u62E9\u6700\u540E\u4E00\u7EA7\u7C7B\u76EE ",-1),ee=B({name:"effectiveRulesEdit"}),ce=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"),R=Q(()=>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:""}),k=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])},w=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 K(t),(n=f.value)==null||n.close(),m("success")},h=(t="add")=>{var e;d.value=t,(e=f.value)==null||e.open()},q=()=>{m("close")},v=D([]);return(async()=>{const t=await j({});v.value=t})(),C({open:h,setFormData:E,getDetail:w}),(t,e)=>{const n=M,c=O,F=S,U=T,A=G,I=N;return p(),b("div",Z,[s(P,{ref_key:"popupRef",ref:f,title:o(R),async:!0,width:"800px",onConfirm:x,onClose:q},{default:r(()=>[s(I,{ref_key:"formRef",ref:_,model:o(u),"label-width":"90px",rules:o(k)},{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(A,{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(W,null,z(a.dictData.effective_unit,(l,L)=>(p(),H(U,{key:L,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{ce as _,ne as a,ie as b};
