group-modal.ecf5a4.js 4.7 KB

1
  1. import{aU as E,ac as Z,_ as ee,d as ue,x as f,ah as h,bG as C,r as v,aD as le,o as _,G as V,D as i,H as te,m as e,aQ as ae,l as p,c as L,F as R,E as q,bJ as se,h as re,M as x}from"./index.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:w,emit:P}){const B=f(""),y=f(!1),D=f(!1),l=Object.keys(g),U=f(null),G=f([]),k=h(()=>!B.value),O=h(()=>y.value?"\u67E5\u770B\u7528\u6237\u7EC4":k.value?"\u521B\u5EFA\u7528\u6237\u7EC4":"\u7F16\u8F91\u7528\u6237\u7EC4"),A=()=>{D.value=!1,P("reload")},{run:$,data:j,loading:M}=C({initalData:[]}),{run:T,data:N,loading:S}=C({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}=C({success:()=>A()}),{run:Y,loading:z}=C({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:B.value,...u,uids:[...n,...d,...m]}))}function Q(){U.value.validate(r=>{if(!!r){if(k.value)return H();J()}})}return w({onDisplay(r="",u=!1){if(B.value=r,D.value=!0,y.value=u,$(de()),!B.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"),K=v("el-dialog"),W=le("loading");return _(),V(K,{modelValue:D.value,"onUpdate:modelValue":u[6]||(u[6]=t=>D.value=t),title:e(O),"close-on-click-modal":!1,"close-on-press-escape":!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),L(R,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),L(R,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]=()=>Q()),loading:e(X)||e(z)},{default:i(()=>[x("\u63D0\u4EA4")]),_:1},8,["loading"]),p(o,{onClick:u[5]||(u[5]=()=>D.value=!1)},{default:i(()=>[x("\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/89793/Desktop/projects/settle-vue3/src/views/interest/userGroup/components/group-modal.vue"]]),De=Object.freeze(Object.defineProperty({__proto__:null,default:ve},Symbol.toStringTag,{value:"Module"}));export{ve as G,be as a,De as g,Ee as h,oe as s,F as u};