import{aC as E,a2 as Z,_ as ee,d as ue,w as f,W as h,bc as C,r as v,al as le,o as _,G as V,C as i,H as te,u as e,aG as ae,l as p,c as L,F as R,D as q,be as re,b as se,M as w}from"./index.1d5f2f42.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 D=f(""),y=f(!1),B=f(!1),l=Object.keys(g),k=f(null),G=f([]),A=h(()=>!D.value),O=h(()=>y.value?"\u67E5\u770B\u7528\u6237\u7EC4":A.value?"\u521B\u5EFA\u7528\u6237\u7EC4":"\u7F16\u8F91\u7528\u6237\u7EC4"),U=()=>{B.value=!1,P("reload")},{run:$,data:M,loading:T}=C({initalData:[]}),{run:j,data:N,loading:S}=C({initalData:{},success:()=>{const{type:s,title:u,remark:n,user_list:d}=N.value;G.value=d,r.value={type:s,title:u,remark:n,users:d.map(({uid:m})=>m)}}}),{run:I,loading:X}=C({success:()=>U()}),{run:Y,loading:z}=C({success:()=>U()}),r=f({});function H(){const{users:s,...u}=r.value;I(ie({...u,uids:s.map(n=>({uid:n}))}))}function W(){const{users:s,...u}=r.value,n=G.value.filter(({uid:a,id:o})=>!s.includes(a)).map(({uid:a,id:o})=>({uid:a,id:o,is_del:1})),d=G.value.filter(({uid:a,id:o})=>s.includes(a)).map(({uid:a,id:o})=>({uid:a,id:o,is_del:0})),m=s.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:D.value,...u,uids:[...n,...d,...m]}))}function J(){k.value.validate(s=>{if(!!s){if(A.value)return H();W()}})}return x({onDisplay(s="",u=!1){if(D.value=s,B.value=!0,y.value=u,$(de()),!D.value)return l.forEach(n=>r.value[n]="");j(pe({id:s}))}}),(s,u)=>{const n=v("el-input"),d=v("el-form-item"),m=v("el-option"),a=v("el-select"),o=v("el-button"),K=v("el-dialog"),Q=le("loading");return _(),V(K,{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:k,model:r.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:r.value[e(l)[0]],"onUpdate:modelValue":u[0]||(u[0]=t=>r.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:r.value[e(l)[1]],"onUpdate:modelValue":u[1]||(u[1]=t=>r.value[e(l)[1]]=t),multiple:"","w-full":""},{default:i(()=>[(_(!0),L(R,null,q(e(M),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:r.value[e(l)[2]],"onUpdate:modelValue":u[2]||(u[2]=t=>r.value[e(l)[2]]=t),"w-full":""},{default:i(()=>[(_(!0),L(R,null,q(e(oe),t=>(_(),V(m,re({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:r.value[e(l)[3]],"onUpdate:modelValue":u[3]||(u[3]=t=>r.value[e(l)[3]]=t)},null,8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,null,{default:i(()=>[se("div",me,[p(o,{type:"primary",onClick:u[4]||(u[4]=()=>J()),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"])),[[Q,e(T)||e(S)]])]),_:1},8,["modelValue","title"])}}});var ve=ee(fe,[["__file","D:/work/rep-v3/report-v3/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};