import{ck as E,X as W,_ as ee,d as ue,m as f,Q as h,cX as C,r as v,ag as le,o as _,A as V,x as i,B as te,u as e,cr as ae,h as p,c as x,F as L,y as R,cZ as se,b as re,H as q}from"./index.e80c366d.js";const y={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={[y.name]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u7EC4\u540D\u79F0"},[y.user]:{required:!0,trigger:"blur",message:"\u8BF7\u9009\u62E9\u7EC4\u6210\u5458"},[y.type]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u5171\u4EAB\u7C7B\u578B"},[y.remark]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u5907\u6CE8"}},{VITE_PROXY_DOMAIN_REAL:ge,VITE_PROXY_USER_REAL:ne}=W(),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:w,emit:P}){const D=f(""),F=f(!1),b=f(!1),l=Object.keys(g),A=f(null),k=f([]),G=h(()=>!D.value),O=h(()=>F.value?"\u67E5\u770B\u7528\u6237\u7EC4":G.value?"\u521B\u5EFA\u7528\u6237\u7EC4":"\u7F16\u8F91\u7528\u6237\u7EC4"),U=()=>{b.value=!1,P("reload")},{run:$,data:j,loading:T}=C({initalData:[]}),{run:M,data:N,loading:S}=C({initalData:{},success:()=>{const{type:r,title:u,remark:n,user_list:d}=N.value;k.value=d,s.value={type:r,title:u,remark:n,users:d.map(({uid:m})=>m)}}}),{run:X,loading:I}=C({success:()=>U()}),{run:Y,loading:z}=C({success:()=>U()}),s=f({});function H(){const{users:r,...u}=s.value;X(ie({...u,uids:r.map(n=>({uid:n}))}))}function Q(){const{users:r,...u}=s.value,n=k.value.filter(({uid:a,id:o})=>!r.includes(a)).map(({uid:a,id:o})=>({uid:a,id:o,is_del:1})),d=k.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:D.value,...u,uids:[...n,...d,...m]}))}function Z(){A.value.validate(r=>{if(!!r){if(G.value)return H();Q()}})}return w({onDisplay(r="",u=!1){if(D.value=r,b.value=!0,F.value=u,$(de()),!D.value)return l.forEach(n=>s.value[n]="");M(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"),J=v("el-dialog"),K=le("loading");return _(),V(J,{modelValue:b.value,"onUpdate:modelValue":u[6]||(u[6]=t=>b.value=t),title:O.value,"close-on-click-modal":!1,center:""},{default:i(()=>[te((_(),V(e(ae),{"label-width":"80px",rules:e(g),ref_key:"formRef",ref:A,model:s.value,disabled:F.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),x(L,null,R(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),x(L,null,R(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]=()=>Z()),loading:e(I)||e(z)},{default:i(()=>[q("\u63D0\u4EA4")]),_:1},8,["loading"]),p(o,{onClick:u[5]||(u[5]=()=>b.value=!1)},{default:i(()=>[q("\u53D6\u6D88")]),_:1})])]),_:1})]),_:1},8,["rules","model","disabled"])),[[K,e(T)||e(S)]])]),_:1},8,["modelValue","title"])}}});var ve=ee(fe,[["__file","C:/Users/63107/Desktop/projects/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,y as u};
