import{aT as c,ac as M,_ as N,d as S,ag as F,bs as C,w as D,r as i,o as v,G as E,C as d,j as y,l as u,M as b,L as $,h as j,aq as U,aN as g}from"./index.js";const{VITE_PROXY_DOMAIN_REAL:G,VITE_PROXY_USER_REAL:O}=M(),p=O+"/admin/",H=(e={})=>c.request("post",`${p}exclulist`,{data:e}),T=(e={})=>c.request("post",`${p}excluadd`,{data:e}),L=(e={})=>c.request("post",`${p}excluedit`,{data:e}),J=(e={})=>c.request("post",`${p}excludel`,{data:e}),K=(e={})=>c.request("post",`${p}exclustatus`,{data:e}),P={class:"w-full flex justify-end"},z=S({__name:"modal",props:{data:{type:null,required:!0,default:{companyNo:"",name:"",pid:"",id:""}},pid:{type:String,required:!0},visible:{type:Boolean,required:!0},breadcrumb:{type:Array,required:!0}},emits:["refresh"],setup(e,{emit:V}){const l=e,x={companyNo:"",name:"",pid:"",id:""},h=F(()=>{const{breadcrumb:o=[]}=l;return o.slice(0).map(({name:t})=>t).join("/")}),q=F(()=>a.value.id?"\u7F16\u8F91\u4E13\u5C5E\u7C7B\u578B":"\u6DFB\u52A0\u4E13\u5C5E\u7C7B\u578B"),n=C(l,"visible"),a=C(l,"data"),m=D(!1),B=D(null),w={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E13\u5C5E\u7C7B\u578B\u540D\u79F0",trigger:"blur"}]};function A(){a.value={...x},n.value=!1}async function R(){try{await B.value.validate();const{id:o}=l.data,t={pid:l.pid||"0",name:a.value.name},s=o===void 0||!o;s||(t.id=o);const f=s?T:L;m.value=!0;const _=await f(t);m.value=!1,_.code===0?(n.value=!1,g.success(`${s?"\u6DFB\u52A0":"\u66F4\u65B0"}\u6210\u529F`),V("refresh")):g.warning(`${s?"\u6DFB\u52A0":"\u66F4\u65B0"}\u5931\u8D25`)}catch{}}return(o,t)=>{const s=i("ElInput"),f=i("ElFormItem"),_=i("ElButton"),k=i("ElForm"),I=i("ElDialog");return v(),E(I,{modelValue:u(n),"onUpdate:modelValue":t[2]||(t[2]=r=>U(n)?n.value=r:null),title:u(q),center:"",onClose:A},{default:d(()=>[y(k,{model:u(a),rules:w,size:"small",ref_key:"formRef",ref:B},{default:d(()=>[y(f,{label:"\u540D\u79F0",prop:"name"},{default:d(()=>[e.pid==="0"||e.pid===""?(v(),E(s,{key:0,modelValue:u(a).name,"onUpdate:modelValue":t[0]||(t[0]=r=>u(a).name=r),style:{width:"100%"},placeholder:"\u540D\u79F0"},null,8,["modelValue"])):(v(),E(s,{key:1,modelValue:u(a).name,"onUpdate:modelValue":t[1]||(t[1]=r=>u(a).name=r)},{prepend:d(()=>[b($(u(h)),1)]),_:1},8,["modelValue"]))]),_:1}),j("div",P,[y(_,{type:"primary",loading:m.value,onClick:R},{default:d(()=>[b("\u4FDD\u5B58")]),_:1},8,["loading"])])]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});var X=N(z,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/serviceParam/exclusive/cpns/modal.vue"]]),Q=Object.freeze(Object.defineProperty({__proto__:null,default:X},Symbol.toStringTag,{value:"Module"}));export{X as M,J as a,K as b,H as h,Q as m};
