import{ch as E,a5 as ee,_ as ue,d as le,n as f,aa as L,d3 as C,r as v,aw as te,o as _,A as V,y as i,B as ae,i as e,cd as se,h as p,c as R,F as h,z as q,d6 as re,e as oe,H as w}from"./index.js";const y={name:"title",user:"users",type:"type",remark:"remark",status:"status"},ne=[{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:Ee,VITE_PROXY_USER_REAL:de}=ee(),B=de+"/admin/",ie=()=>E.request("post",`${B}userall`,{data:{}}),Be=c=>E.request("post",`${B}getDataGroupList`,{data:c}),pe=c=>E.request("post",`${B}addDataGroup`,{data:c}),ce=c=>E.request("post",`${B}getDataGroupDetail`,{data:c}),me=c=>E.request("post",`${B}editDataGroup`,{data:c}),be=c=>E.request("post",`${B}statusDataGroup`,{data:c}),fe={"w-full":"",flex:"","justify-end":""},ve=le({__name:"group-modal",emits:["reload"],setup(c,{expose:x,emit:P}){const O=P,D=f(""),F=f(!1),b=f(!1),l=Object.keys(g),A=f(null),k=f([]),G=L(()=>!D.value),$=L(()=>F.value?"\u67E5\u770B\u7528\u6237\u7EC4":G.value?"\u521B\u5EFA\u7528\u6237\u7EC4":"\u7F16\u8F91\u7528\u6237\u7EC4"),U=()=>{b.value=!1,O("reload")},{run:j,data:T,loading:M}=C({initalData:[]}),{run:N,data:S,loading:I}=C({initalData:{},success:()=>{const{type:r,title:u,remark:n,user_list:d}=S.value;k.value=d,s.value={type:r,title:u,remark:n,users:d.map(({uid:m})=>m)}}}),{run:z,loading:X}=C({success:()=>U()}),{run:Y,loading:H}=C({success:()=>U()}),s=f({});function J(){const{users:r,...u}=s.value;z(pe({...u,uids:r.map(n=>({uid:n}))}))}function K(){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(me({id:D.value,...u,uids:[...n,...d,...m]}))}function Q(){A.value.validate(r=>{if(!!r){if(G.value)return J();K()}})}return x({onDisplay(r="",u=!1){if(D.value=r,b.value=!0,F.value=u,j(ie()),!D.value)return l.forEach(n=>s.value[n]="");N(ce({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"),W=v("el-dialog"),Z=te("loading");return _(),V(W,{modelValue:b.value,"onUpdate:modelValue":u[6]||(u[6]=t=>b.value=t),title:$.value,"close-on-click-modal":!1,"close-on-press-escape":!1,center:""},{default:i(()=>[ae((_(),V(e(se),{"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),R(h,null,q(e(T),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(h,null,q(e(ne),t=>(_(),V(m,re({key:t.value,ref_for:!0},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(()=>[oe("div",fe,[p(o,{type:"primary",onClick:u[4]||(u[4]=()=>Q()),loading:e(X)||e(H)},{default:i(()=>u[7]||(u[7]=[w("\u63D0\u4EA4")])),_:1},8,["loading"]),p(o,{onClick:u[5]||(u[5]=()=>b.value=!1)},{default:i(()=>u[8]||(u[8]=[w("\u53D6\u6D88")])),_:1})])]),_:1})]),_:1},8,["rules","model","disabled"])),[[Z,e(M)||e(I)]])]),_:1},8,["modelValue","title"])}}});var _e=ue(ve,[["__file","D:/work/jiesuan/settle-vue3/src/views/interest/userGroup/components/group-modal.vue"]]),De=Object.freeze(Object.defineProperty({__proto__:null,default:_e},Symbol.toStringTag,{value:"Module"}));export{_e as G,be as a,De as g,Be as h,ne as s,y as u};
