group-modal.2f14ae6f.js 4.7 KB

1
  1. import{aH as E,aI as Z,_ as ee,d as ue,E as f,af as h,b3 as C,x as v,aA as te,o as _,N as y,K as i,O as le,u as e,aE as ae,y as p,c as L,M as R,L as q,b as se,W as x,b4 as oe}from"./index.1417328f.js";const V={name:"title",user:"users",type:"type",remark:"remark",status:"status"},re=[{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={[V.name]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u7EC4\u540D\u79F0"},[V.user]:{required:!0,trigger:"blur",message:"\u8BF7\u9009\u62E9\u7EC4\u6210\u5458"},[V.type]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u5171\u4EAB\u7C7B\u578B"},[V.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:P}){const D=f(""),F=f(!1),B=f(!1),t=Object.keys(g),G=f(null),A=f([]),U=h(()=>!D.value),O=h(()=>F.value?"\u67E5\u770B\u7528\u6237\u7EC4":U.value?"\u521B\u5EFA\u7528\u6237\u7EC4":"\u7F16\u8F91\u7528\u6237\u7EC4"),k=()=>{B.value=!1,P("reload")},{run:$,data:j,loading:M}=C({initalData:[]}),{run:N,data:T,loading:I}=C({initalData:{},success:()=>{const{type:o,title:u,remark:n,user_list:d}=T.value;A.value=d,s.value={type:o,title:u,remark:n,users:d.map(({uid:m})=>m)}}}),{run:S,loading:X}=C({success:()=>k()}),{run:Y,loading:z}=C({success:()=>k()}),s=f({});function H(){const{users:o,...u}=s.value;S(ie({...u,uids:o.map(n=>({uid:n}))}))}function K(){const{users:o,...u}=s.value,n=A.value.filter(({uid:a,id:r})=>!o.includes(a)).map(({uid:a,id:r})=>({uid:a,id:r,is_del:1})),d=A.value.filter(({uid:a,id:r})=>o.includes(a)).map(({uid:a,id:r})=>({uid:a,id:r,is_del:0})),m=o.filter(a=>!d.find(({uid:r})=>r===a)&&!n.find(({uid:r})=>r===a)).map(a=>({uid:a,id:null,is_del:0}));Y(ce({id:D.value,...u,uids:[...n,...d,...m]}))}function W(){G.value.validate(o=>{if(!!o){if(U.value)return H();K()}})}return w({onDisplay(o="",u=!1){if(D.value=o,B.value=!0,F.value=u,$(de()),!D.value)return t.forEach(n=>s.value[n]="");N(pe({id:o}))}}),(o,u)=>{const n=v("el-input"),d=v("el-form-item"),m=v("el-option"),a=v("el-select"),r=v("el-button"),J=v("el-dialog"),Q=te("loading");return _(),y(J,{modelValue:B.value,"onUpdate:modelValue":u[6]||(u[6]=l=>B.value=l),title:e(O),center:""},{default:i(()=>[le((_(),y(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(j),l=>(_(),y(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(re),l=>(_(),y(m,oe({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(r,{type:"primary",onClick:u[4]||(u[4]=()=>W()),loading:e(X)||e(z)},{default:i(()=>[fe]),_:1},8,["loading"]),p(r,{onClick:u[5]||(u[5]=()=>B.value=!1)},{default:i(()=>[ve]),_:1})])]),_:1})]),_:1},8,["rules","model","disabled"])),[[Q,e(M)||e(I)]])]),_:1},8,["modelValue","title"])}}});var ge=ee(_e,[["__file","/Users/apple/Desktop/Company Projects/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,re as s,V as u};