import{aU as E,ac as Z,_ as ee,d as ue,w as f,ag as h,bv as D,r as v,aC as le,o as _,G as V,C as i,H as te,u as e,aR as ae,l as p,c as R,F as L,D as q,bw as se,b as re,M as w}from"./index.1d1a5ecb.js";const F={name:"title",user:"users",type:"type",remark:"remark",status:"status"},oe=[{value:"1",label:"\u7EC4\u5185\u5171\u4EAB\xB7\u53EF\u7F16\u8F91"},{value:"2",label:"\u7EC4\u5185\u5171\u4EAB\xB7\u53EA\u8BFB"},{value:"3",label:"\u7EC4\u5185\u4E0D\u5171\u4EAB"}],g={[F.name]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u7EC4\u540D\u79F0"},[F.user]:{required:!0,trigger:"blur",message:"\u8BF7\u9009\u62E9\u7EC4\u6210\u5458"},[F.type]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u5171\u4EAB\u7C7B\u578B"},[F.remark]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u5907\u6CE8"}},{VITE_PROXY_DOMAIN_REAL:ge,VITE_PROXY_USER_REAL:ne}=Z(),b=ne+"/admin/",de=()=>E.request("post",`${b}userall`,{data:{}}),Ee=c=>E.request("post",`${b}getDataGroupList`,{data:c}),ie=c=>E.request("post",`${b}addDataGroup`,{data:c}),pe=c=>E.request("post",`${b}getDataGroupDetail`,{data:c}),ce=c=>E.request("post",`${b}editDataGroup`,{data:c}),be=c=>E.request("post",`${b}statusDataGroup`,{data:c}),me={"w-full":"",flex:"","justify-end":""},fe=ue({__name:"group-modal",emits:["reload"],setup(c,{expose:x,emit:P}){const C=f(""),y=f(!1),B=f(!1),l=Object.keys(g),U=f(null),G=f([]),k=h(()=>!C.value),O=h(()=>y.value?"\u67E5\u770B\u7528\u6237\u7EC4":k.value?"\u521B\u5EFA\u7528\u6237\u7EC4":"\u7F16\u8F91\u7528\u6237\u7EC4"),A=()=>{B.value=!1,P("reload")},{run:$,data:j,loading:M}=D({initalData:[]}),{run:T,data:N,loading:S}=D({initalData:{},success:()=>{const{type:r,title:u,remark:n,user_list:d}=N.value;G.value=d,s.value={type:r,title:u,remark:n,users:d.map(({uid:m})=>m)}}}),{run:I,loading:X}=D({success:()=>A()}),{run:Y,loading:z}=D({success:()=>A()}),s=f({});function H(){const{users:r,...u}=s.value;I(ie({...u,uids:r.map(n=>({uid:n}))}))}function J(){const{users:r,...u}=s.value,n=G.value.filter(({uid:a,id:o})=>!r.includes(a)).map(({uid:a,id:o})=>({uid:a,id:o,is_del:1})),d=G.value.filter(({uid:a,id:o})=>r.includes(a)).map(({uid:a,id:o})=>({uid:a,id:o,is_del:0})),m=r.filter(a=>!d.find(({uid:o})=>o===a)&&!n.find(({uid:o})=>o===a)).map(a=>({uid:a,id:null,is_del:0}));Y(ce({id:C.value,...u,uids:[...n,...d,...m]}))}function K(){U.value.validate(r=>{if(!!r){if(k.value)return H();J()}})}return x({onDisplay(r="",u=!1){if(C.value=r,B.value=!0,y.value=u,$(de()),!C.value)return l.forEach(n=>s.value[n]="");T(pe({id:r}))}}),(r,u)=>{const n=v("el-input"),d=v("el-form-item"),m=v("el-option"),a=v("el-select"),o=v("el-button"),Q=v("el-dialog"),W=le("loading");return _(),V(Q,{modelValue:B.value,"onUpdate:modelValue":u[6]||(u[6]=t=>B.value=t),title:e(O),"close-on-click-modal":!1,center:""},{default:i(()=>[te((_(),V(e(ae),{"label-width":"80px",rules:e(g),ref_key:"formRef",ref:U,model:s.value,disabled:y.value},{default:i(()=>[p(d,{label:"\u7EC4\u540D\u79F0",prop:e(l)[0]},{default:i(()=>[p(n,{placeholder:e(g)[e(l)[0]].message,modelValue:s.value[e(l)[0]],"onUpdate:modelValue":u[0]||(u[0]=t=>s.value[e(l)[0]]=t)},null,8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,{label:"\u7EC4\u6210\u5458",prop:e(l)[1]},{default:i(()=>[p(a,{placeholder:e(g)[e(l)[1]].message,modelValue:s.value[e(l)[1]],"onUpdate:modelValue":u[1]||(u[1]=t=>s.value[e(l)[1]]=t),multiple:"","w-full":""},{default:i(()=>[(_(!0),R(L,null,q(e(j),t=>(_(),V(m,{key:t.id,value:t.id,label:t.nickname},null,8,["value","label"]))),128))]),_:1},8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,{label:"\u5171\u4EAB\u7C7B\u578B",prop:e(l)[2]},{default:i(()=>[p(a,{placeholder:e(g)[e(l)[2]].message,modelValue:s.value[e(l)[2]],"onUpdate:modelValue":u[2]||(u[2]=t=>s.value[e(l)[2]]=t),"w-full":""},{default:i(()=>[(_(!0),R(L,null,q(e(oe),t=>(_(),V(m,se({key:t.value},t),null,16))),128))]),_:1},8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,{label:"\u5907\u6CE8",prop:e(l)[3]},{default:i(()=>[p(n,{placeholder:e(g)[e(l)[3]].message,modelValue:s.value[e(l)[3]],"onUpdate:modelValue":u[3]||(u[3]=t=>s.value[e(l)[3]]=t)},null,8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,null,{default:i(()=>[re("div",me,[p(o,{type:"primary",onClick:u[4]||(u[4]=()=>K()),loading:e(X)||e(z)},{default:i(()=>[w("\u63D0\u4EA4")]),_:1},8,["loading"]),p(o,{onClick:u[5]||(u[5]=()=>B.value=!1)},{default:i(()=>[w("\u53D6\u6D88")]),_:1})])]),_:1})]),_:1},8,["rules","model","disabled"])),[[W,e(M)||e(S)]])]),_:1},8,["modelValue","title"])}}});var ve=ee(fe,[["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/interest/userGroup/components/group-modal.vue"]]),Be=Object.freeze(Object.defineProperty({__proto__:null,default:ve},Symbol.toStringTag,{value:"Module"}));export{ve as G,be as a,Be as g,Ee as h,oe as s,F as u};
