1 |
- import{_ as X,d as Y,w as c,ag as U,bq as E,r as f,aC as Z,o as v,G as B,C as i,H as $,l as e,b1 as ee,j as p,c as A,F as G,D as h,br as ue,h as le,M as x}from"./index.js";import{b as ae,c as te,d as re,e as oe}from"./index.a9cb0efc.js";const C={name:"title",user:"users",type:"type",remark:"remark",status:"status"},se=[{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={[C.name]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u7EC4\u540D\u79F0"},[C.user]:{required:!0,trigger:"blur",message:"\u8BF7\u9009\u62E9\u7EC4\u6210\u5458"},[C.type]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u5171\u4EAB\u7C7B\u578B"},[C.remark]:{required:!0,trigger:"blur",message:"\u8BF7\u8F93\u5165\u5907\u6CE8"}},ne={"w-full":"",flex:"","justify-end":""},de=Y({__name:"group-modal",emits:["reload"],setup(pe,{expose:w,emit:L}){const b=c(""),F=c(!1),_=c(!1),l=Object.keys(g),y=c(null),V=c([]),D=U(()=>!b.value),j=U(()=>F.value?"\u67E5\u770B\u7528\u6237\u7EC4":D.value?"\u521B\u5EFA\u7528\u6237\u7EC4":"\u7F16\u8F91\u7528\u6237\u7EC4"),k=()=>{_.value=!1,L("reload")},{run:R,data:q,loading:P}=E({initalData:[]}),{run:M,data:N,loading:O}=E({initalData:{},success:()=>{const{type:o,title:u,remark:n,user_list:d}=N.value;V.value=d,r.value={type:o,title:u,remark:n,users:d.map(({uid:m})=>m)}}}),{run:T,loading:S}=E({success:()=>k()}),{run:z,loading:H}=E({success:()=>k()}),r=c({});function I(){const{users:o,...u}=r.value;T(re({...u,uids:o.map(n=>({uid:n}))}))}function J(){const{users:o,...u}=r.value,n=V.value.filter(({uid:t,id:s})=>!o.includes(t)).map(({uid:t,id:s})=>({uid:t,id:s,is_del:1})),d=V.value.filter(({uid:t,id:s})=>o.includes(t)).map(({uid:t,id:s})=>({uid:t,id:s,is_del:0})),m=o.filter(t=>!d.find(({uid:s})=>s===t)&&!n.find(({uid:s})=>s===t)).map(t=>({uid:t,id:null,is_del:0}));z(oe({id:b.value,...u,uids:[...n,...d,...m]}))}function K(){y.value.validate(o=>{if(!!o){if(D.value)return I();J()}})}return w({onDisplay(o="",u=!1){if(b.value=o,_.value=!0,F.value=u,R(ae()),!b.value)return l.forEach(n=>r.value[n]="");M(te({id:o}))}}),(o,u)=>{const n=f("el-input"),d=f("el-form-item"),m=f("el-option"),t=f("el-select"),s=f("el-button"),Q=f("el-dialog"),W=Z("loading");return v(),B(Q,{modelValue:_.value,"onUpdate:modelValue":u[6]||(u[6]=a=>_.value=a),title:e(j),"close-on-click-modal":!1,center:""},{default:i(()=>[$((v(),B(e(ee),{"label-width":"80px",rules:e(g),ref_key:"formRef",ref:y,model:r.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:r.value[e(l)[0]],"onUpdate:modelValue":u[0]||(u[0]=a=>r.value[e(l)[0]]=a)},null,8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,{label:"\u7EC4\u6210\u5458",prop:e(l)[1]},{default:i(()=>[p(t,{placeholder:e(g)[e(l)[1]].message,modelValue:r.value[e(l)[1]],"onUpdate:modelValue":u[1]||(u[1]=a=>r.value[e(l)[1]]=a),multiple:"","w-full":""},{default:i(()=>[(v(!0),A(G,null,h(e(q),a=>(v(),B(m,{key:a.id,value:a.id,label:a.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(t,{placeholder:e(g)[e(l)[2]].message,modelValue:r.value[e(l)[2]],"onUpdate:modelValue":u[2]||(u[2]=a=>r.value[e(l)[2]]=a),"w-full":""},{default:i(()=>[(v(!0),A(G,null,h(e(se),a=>(v(),B(m,ue({key:a.value},a),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:r.value[e(l)[3]],"onUpdate:modelValue":u[3]||(u[3]=a=>r.value[e(l)[3]]=a)},null,8,["placeholder","modelValue"])]),_:1},8,["prop"]),p(d,null,{default:i(()=>[le("div",ne,[p(s,{type:"primary",onClick:u[4]||(u[4]=()=>K()),loading:e(S)||e(H)},{default:i(()=>[x("\u63D0\u4EA4")]),_:1},8,["loading"]),p(s,{onClick:u[5]||(u[5]=()=>_.value=!1)},{default:i(()=>[x("\u53D6\u6D88")]),_:1})])]),_:1})]),_:1},8,["rules","model","disabled"])),[[W,e(P)||e(O)]])]),_:1},8,["modelValue","title"])}}});var ie=X(de,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/interest/userGroup/components/group-modal.vue"]]),fe=Object.freeze(Object.defineProperty({__proto__:null,default:ie},Symbol.toStringTag,{value:"Module"}));export{ie as G,fe as g,se as s,C as u};
|