group-modal.cf21f82d.js 4.7 KB

1
  1. import{aN as E,aO as Z,_ as ee,d as ue,E as f,af as h,br as C,x as v,aA as te,o as _,N as V,K as i,O as le,u as e,aK as ae,y as p,c as L,M as R,L as q,b as se,W as x,bs as re}from"./index.743f0c80.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:be,VITE_PROXY_USER_REAL:ne}=Z(),b=ne+"/admin/",de=()=>E.request("post",`${b}userall`,{data:{}}),Be=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}),De=c=>E.request("post",`${b}statusDataGroup`,{data:c}),me={"w-full":"",flex:"","justify-end":""},fe=x("\u63D0\u4EA4"),ve=x("\u53D6\u6D88"),_e=ue({__name:"group-modal",emits:["reload"],setup(c,{expose:w,emit:O}){const D=f(""),F=f(!1),B=f(!1),t=Object.keys(g),G=f(null),A=f([]),k=h(()=>!D.value),P=h(()=>F.value?"\u67E5\u770B\u7528\u6237\u7EC4":k.value?"\u521B\u5EFA\u7528\u6237\u7EC4":"\u7F16\u8F91\u7528\u6237\u7EC4"),U=()=>{B.value=!1,O("reload")},{run:N,data:$,loading:M}=C({initalData:[]}),{run:T,data:j,loading:S}=C({initalData:{},success:()=>{const{type:r,title:u,remark:n,user_list:d}=j.value;A.value=d,s.value={type:r,title:u,remark:n,users:d.map(({uid:m})=>m)}}}),{run:I,loading:K}=C({success:()=>U()}),{run:X,loading:Y}=C({success:()=>U()}),s=f({});function z(){const{users:r,...u}=s.value;I(ie({...u,uids:r.map(n=>({uid:n}))}))}function W(){const{users:r,...u}=s.value,n=A.value.filter(({uid:a,id:o})=>!r.includes(a)).map(({uid:a,id:o})=>({uid:a,id:o,is_del:1})),d=A.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}));X(ce({id:D.value,...u,uids:[...n,...d,...m]}))}function H(){G.value.validate(r=>{if(!!r){if(k.value)return z();W()}})}return w({onDisplay(r="",u=!1){if(D.value=r,B.value=!0,F.value=u,N(de()),!D.value)return t.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"),J=v("el-dialog"),Q=te("loading");return _(),V(J,{modelValue:B.value,"onUpdate:modelValue":u[6]||(u[6]=l=>B.value=l),title:e(P),center:""},{default:i(()=>[le((_(),V(e(ae),{"label-width":"80px",rules:e(g),ref_key:"formRef",ref:G,model:s.value,disabled:F.value},{default:i(()=>[p(d,{label:"\u7EC4\u540D\u79F0",prop:e(t)[0]},{default:i(()=>[p(n,{placeholder:e(g)[e(t)[0]].message,modelValue:s.value[e(t)[0]],"onUpdate:modelValue":u[0]||(u[0]=l=>s.value[e(t)[0]]=l)},null,8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,{label:"\u7EC4\u6210\u5458",prop:e(t)[1]},{default:i(()=>[p(a,{placeholder:e(g)[e(t)[1]].message,modelValue:s.value[e(t)[1]],"onUpdate:modelValue":u[1]||(u[1]=l=>s.value[e(t)[1]]=l),multiple:"","w-full":""},{default:i(()=>[(_(!0),L(q,null,R(e($),l=>(_(),V(m,{key:l.id,value:l.id,label:l.nickname},null,8,["value","label"]))),128))]),_:1},8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,{label:"\u5171\u4EAB\u7C7B\u578B",prop:e(t)[2]},{default:i(()=>[p(a,{placeholder:e(g)[e(t)[2]].message,modelValue:s.value[e(t)[2]],"onUpdate:modelValue":u[2]||(u[2]=l=>s.value[e(t)[2]]=l),"w-full":""},{default:i(()=>[(_(!0),L(q,null,R(e(oe),l=>(_(),V(m,re({key:l.value},l),null,16))),128))]),_:1},8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,{label:"\u5907\u6CE8",prop:e(t)[3]},{default:i(()=>[p(n,{placeholder:e(g)[e(t)[3]].message,modelValue:s.value[e(t)[3]],"onUpdate:modelValue":u[3]||(u[3]=l=>s.value[e(t)[3]]=l)},null,8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,null,{default:i(()=>[se("div",me,[p(o,{type:"primary",onClick:u[4]||(u[4]=()=>H()),loading:e(K)||e(Y)},{default:i(()=>[fe]),_:1},8,["loading"]),p(o,{onClick:u[5]||(u[5]=()=>B.value=!1)},{default:i(()=>[ve]),_:1})])]),_:1})]),_:1},8,["rules","model","disabled"])),[[Q,e(M)||e(S)]])]),_:1},8,["modelValue","title"])}}});var ge=ee(_e,[["__file","D:/work/accout-vue3-ui/src/views/interest/userGroup/components/group-modal.vue"]]),Ce=Object.freeze(Object.defineProperty({__proto__:null,default:ge},Symbol.toStringTag,{value:"Module"}));export{ge as G,De as a,Ce as g,Be as h,oe as s,y as u};