import{d as X,u as Oe,q as Be,s as It,c as n,b as $,P as z,v as ot,x as Ta,y as ua,z as _a,_ as k,e as Ct,r as j,g as Rt,B as at,a as Q,K as ve,h as Ae,C as ct,D as G,o as rt,w as Fe,p as wa,f as ka,E as Pa,F as Gt,G as Qe,R as xt,H as Ea,A as Bt,i as ca,I as Ia,J as Ra,L as Ba,M as st,N as Aa,O as et,Q as Oa,S as qt,T as $a,U as Da,V as Na,W as St,X as La,Y as Ma,Z as Fa,$ as Ua,a0 as ja,a1 as ke,a2 as Ka,l as oe,a3 as tt,a4 as Ha,a5 as ce,a6 as xe,a7 as nt,a8 as Wa,a9 as za,aa as Tt,ab as gt,ac as Vt,ad as me,k as Ga,ae as qa}from"./index-c0ea9eee.js";import{D as Va,u as J,i as Xa,a as Xt,R as He,C as de,b as Ya,c as Za,T as Ja}from"./index-02a906e5.js";import{c as da,t as Qa,a as en,b as tn,h as an,f as nn,F as fe}from"./Form-e6eeda59.js";import{R as Yt}from"./Col-c05b789a.js";import{D as rn,M as _t,E as on,b as ln,c as sn}from"./index-97c28cb7.js";import{A as un,S as it}from"./index-84bc77be.js";import{i as cn}from"./useFlexGapSupport-20a12060.js";import"./useSize-7089b0c3.js";var dn=["class","style"],vn=function(){return{prefixCls:String,href:String,separator:z.any,overlay:z.any,onClick:Function}};const dt=X({compatConfig:{MODE:3},name:"ABreadcrumbItem",inheritAttrs:!1,__ANT_BREADCRUMB_ITEM:!0,props:vn(),slots:["separator","overlay"],setup:function(e,a){var r=a.slots,o=a.attrs,i=Oe("breadcrumb",e),l=i.prefixCls,d=function(u,s){var v=Be(r,e,"overlay");return v?n(rn,{overlay:v,placement:"bottom"},{default:function(){return[n("span",{class:"".concat(s,"-overlay-link")},[u,n(Va,null,null)])]}}):u};return function(){var f,u=(f=Be(r,e,"separator"))!==null&&f!==void 0?f:"/",s=Be(r,e),v=o.class,c=o.style,b=It(o,dn),p;return e.href!==void 0?p=n("a",$({class:"".concat(l.value,"-link"),onClick:e.onClick},b),[s]):p=n("span",$({class:"".concat(l.value,"-link"),onClick:e.onClick},b),[s]),p=d(p,l.value),s?n("span",{class:v,style:c},[p,u&&n("span",{class:"".concat(l.value,"-separator")},[u])]):null}}});var fn=function(){return{prefixCls:String,routes:{type:Array},params:z.any,separator:z.any,itemRender:{type:Function}}};function bn(t,e){if(!t.breadcrumbName)return null;var a=Object.keys(e).join("|"),r=t.breadcrumbName.replace(new RegExp(":(".concat(a,")"),"g"),function(o,i){return e[i]||o});return r}function Zt(t){var e=t.route,a=t.params,r=t.routes,o=t.paths,i=r.indexOf(e)===r.length-1,l=bn(e,a);return i?n("span",null,[l]):n("a",{href:"#/".concat(o.join("/"))},[l])}const We=X({compatConfig:{MODE:3},name:"ABreadcrumb",props:fn(),slots:["separator","itemRender"],setup:function(e,a){var r=a.slots,o=Oe("breadcrumb",e),i=o.prefixCls,l=o.direction,d=function(v,c){return v=(v||"").replace(/^\//,""),Object.keys(c).forEach(function(b){v=v.replace(":".concat(b),c[b])}),v},f=function(v,c,b){var p=Ct(v),C=d(c||"",b);return C&&p.push(C),p},u=function(v){var c=v.routes,b=c===void 0?[]:c,p=v.params,C=p===void 0?{}:p,w=v.separator,x=v.itemRender,S=x===void 0?Zt:x,y=[];return b.map(function(m){var g=d(m.path,C);g&&y.push(g);var T=[].concat(y),E=null;return m.children&&m.children.length&&(E=n(_t,null,{default:function(){return[m.children.map(function(D){return n(_t.Item,{key:D.path||D.breadcrumbName},{default:function(){return[S({route:D,params:C,routes:b,paths:f(T,D.path,C)})]}})})]}})),n(dt,{overlay:E,separator:w,key:g||m.breadcrumbName},{default:function(){return[S({route:m,params:C,routes:b,paths:T})]}})})};return function(){var s,v,c,b=e.routes,p=e.params,C=p===void 0?{}:p,w=ot(Be(r,e)),x=(s=Be(r,e,"separator"))!==null&&s!==void 0?s:"/",S=e.itemRender||r.itemRender||Zt;b&&b.length>0?c=u({routes:b,params:C,separator:x,itemRender:S}):w.length&&(c=w.map(function(m,g){return Ta(ua(m.type)==="object"&&(m.type.__ANT_BREADCRUMB_ITEM||m.type.__ANT_BREADCRUMB_SEPARATOR),"Breadcrumb","Only accepts Breadcrumb.Item and Breadcrumb.Separator as it's children"),_a(m,{separator:x,key:g})}));var y=(v={},k(v,i.value,!0),k(v,"".concat(i.value,"-rtl"),l.value==="rtl"),v);return n("div",{class:y},[c])}}});var mn=["separator","class"],pn=function(){return{prefixCls:String}};const wt=X({compatConfig:{MODE:3},name:"ABreadcrumbSeparator",__ANT_BREADCRUMB_SEPARATOR:!0,inheritAttrs:!1,props:pn(),setup:function(e,a){var r=a.slots,o=a.attrs,i=Oe("breadcrumb",e),l=i.prefixCls;return function(){var d;o.separator;var f=o.class,u=It(o,mn),s=ot((d=r.default)===null||d===void 0?void 0:d.call(r));return n("span",$({class:["".concat(l.value,"-separator"),f]},u),[s.length>0?s:"/"])}}});We.Item=dt;We.Separator=wt;We.install=function(t){return t.component(We.name,We),t.component(dt.name,dt),t.component(wt.name,wt),t};function yn(t){var e=j(),a=j(!1);function r(){for(var o=arguments.length,i=new Array(o),l=0;lN?(R=h,T.value="x"):(R=_,T.value="y"),e(-R,-R)&&P.preventDefault()}var I=j({onTouchStart:y,onTouchMove:m,onTouchEnd:g,onWheel:E});function D(P){I.value.onTouchStart(P)}function L(P){I.value.onTouchMove(P)}function M(P){I.value.onTouchEnd(P)}function te(P){I.value.onWheel(P)}rt(function(){var P,h;document.addEventListener("touchmove",L,{passive:!1}),document.addEventListener("touchend",M,{passive:!1}),(P=t.value)===null||P===void 0||P.addEventListener("touchstart",D,{passive:!1}),(h=t.value)===null||h===void 0||h.addEventListener("wheel",te,{passive:!1})}),Rt(function(){document.removeEventListener("touchmove",L),document.removeEventListener("touchend",M)})}function ta(t,e){var a=j(t);function r(o){var i=typeof o=="function"?o(a.value):o;i!==a.value&&e(i,a.value),a.value=i}return[a,r]}var kn=function(){var e=j(new Map),a=function(o){return function(i){e.value.set(o,i)}};return Pa(function(){e.value=new Map}),[a,e]};const Pn=kn;function En(t,e,a,r){if(!Gt(t))return t;e=da(e,t);for(var o=-1,i=e.length,l=i-1,d=t;d!=null&&++oU?"left":"right"})}),S=G(x,2),y=S[0],m=S[1],g=ta(0,function(A,U){!w.value&&e.onTabScroll&&e.onTabScroll({direction:A>U?"top":"bottom"})}),T=G(g,2),E=T[0],I=T[1],D=J(0),L=G(D,2),M=L[0],te=L[1],P=J(0),h=G(P,2),_=h[0],R=h[1],K=J(null),N=G(K,2),O=N[0],be=N[1],ie=J(null),F=G(ie,2),Y=F[0],se=F[1],pe=J(0),H=G(pe,2),$e=H[0],ye=H[1],ee=J(0),ae=G(ee,2),Ue=ae[0],je=ae[1],De=hn(new Map),Se=G(De,2),qe=Se[0],Ve=Se[1],Ke=Cn(l,qe),Ne=Q(function(){return"".concat(d.value,"-nav-operations-hidden")}),q=j(0),Ee=j(0);ct(function(){w.value?e.rtl?(q.value=0,Ee.value=Math.max(0,M.value-O.value)):(q.value=Math.min(0,O.value-M.value),Ee.value=0):(q.value=Math.min(0,Y.value-_.value),Ee.value=0)});var Ie=function(U){return UEe.value?Ee.value:U},Xe=j(),Ye=J(),Dt=G(Ye,2),vt=Dt[0],Nt=Dt[1],ft=function(){Nt(Date.now())},bt=function(){clearTimeout(Xe.value)},Lt=function(U,B){U(function(V){var W=Ie(V+B);return W})};wn(f,function(A,U){if(w.value){if(O.value>=M.value)return!1;Lt(m,A)}else{if(Y.value>=_.value)return!1;Lt(I,U)}return bt(),ft(),!0}),Fe(vt,function(){bt(),vt.value&&(Xe.value=setTimeout(function(){Nt(0)},100))});var Mt=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e.activeKey,B=Ke.value.get(U)||{width:0,height:0,left:0,right:0,top:0};if(w.value){var V=y.value;e.rtl?B.righty.value+O.value&&(V=B.right+B.width-O.value):B.left<-y.value?V=-B.left:B.left+B.width>-y.value+O.value&&(V=-(B.left+B.width-O.value)),I(0),m(Ie(V))}else{var W=E.value;B.top<-E.value?W=-B.top:B.top+B.height>-E.value+Y.value&&(W=-(B.top+B.height-Y.value)),m(0),I(Ie(W))}},mt=j(0),pt=j(0);ct(function(){var A,U,B,V,W,ne,re,Le=Ke.value;["top","bottom"].includes(e.tabPosition)?(U="width",W=O.value,ne=M.value,re=$e.value,B=e.rtl?"right":"left",V=Math.abs(y.value)):(U="height",W=Y.value,ne=M.value,re=Ue.value,B="top",V=-E.value);var ue=W;ne+re>W&&neV+ue){Z=he-1;break}}for(var we=0,le=Me-1;le>=0;le-=1){var Ce=Le.get(Te[le].key)||aa;if(Ce[B]0,we=y.value+O.value0&&arguments[0]!==void 0?arguments[0]:[],b;return c.forEach(function(p){p&&Da(p.type)&&p.type.__ANT_CARD_GRID&&(b=!0)}),b};return function(){var v,c,b,p,C,w,x,S,y=e.headStyle,m=y===void 0?{}:y,g=e.bodyStyle,T=g===void 0?{}:g,E=e.loading,I=e.bordered,D=I===void 0?!0:I,L=e.type,M=e.tabList,te=e.hoverable,P=e.activeTabKey,h=e.defaultActiveTabKey,_=e.tabBarExtraContent,R=_===void 0?et((v=r.tabBarExtraContent)===null||v===void 0?void 0:v.call(r)):_,K=e.title,N=K===void 0?et((c=r.title)===null||c===void 0?void 0:c.call(r)):K,O=e.extra,be=O===void 0?et((b=r.extra)===null||b===void 0?void 0:b.call(r)):O,ie=e.actions,F=ie===void 0?et((p=r.actions)===null||p===void 0?void 0:p.call(r)):ie,Y=e.cover,se=Y===void 0?et((C=r.cover)===null||C===void 0?void 0:C.call(r)):Y,pe=ot((w=r.default)===null||w===void 0?void 0:w.call(r)),H=i.value,$e=(x={},k(x,"".concat(H),!0),k(x,"".concat(H,"-loading"),E),k(x,"".concat(H,"-bordered"),D),k(x,"".concat(H,"-hoverable"),!!te),k(x,"".concat(H,"-contain-grid"),s(pe)),k(x,"".concat(H,"-contain-tabs"),M&&M.length),k(x,"".concat(H,"-").concat(d.value),d.value),k(x,"".concat(H,"-type-").concat(L),!!L),k(x,"".concat(H,"-rtl"),l.value==="rtl"),x),ye=T.padding===0||T.padding==="0px"?{padding:"24px"}:void 0,ee=n("div",{class:"".concat(H,"-loading-block")},null),ae=n("div",{class:"".concat(H,"-loading-content"),style:ye},[n(He,{gutter:8},{default:function(){return[n(de,{span:22},{default:function(){return[ee]}})]}}),n(He,{gutter:8},{default:function(){return[n(de,{span:8},{default:function(){return[ee]}}),n(de,{span:15},{default:function(){return[ee]}})]}}),n(He,{gutter:8},{default:function(){return[n(de,{span:6},{default:function(){return[ee]}}),n(de,{span:18},{default:function(){return[ee]}})]}}),n(He,{gutter:8},{default:function(){return[n(de,{span:13},{default:function(){return[ee]}}),n(de,{span:9},{default:function(){return[ee]}})]}}),n(He,{gutter:8},{default:function(){return[n(de,{span:4},{default:function(){return[ee]}}),n(de,{span:3},{default:function(){return[ee]}}),n(de,{span:16},{default:function(){return[ee]}})]}})]),Ue=P!==void 0,je=(S={size:"large"},k(S,Ue?"activeKey":"defaultActiveKey",Ue?P:h),k(S,"onChange",u),k(S,"class","".concat(H,"-head-tabs")),S),De,Se=M&&M.length?n(ze,je,{default:function(){return[M.map(function(q){var Ee=q.tab,Ie=q.slots,Xe=Ie==null?void 0:Ie.tab;st(!Ie,"Card","tabList slots is deprecated, Please use `customTab` instead.");var Ye=Ee!==void 0?Ee:r[Xe]?r[Xe](q):null;return Ye=Oa(r,"customTab",q,function(){return[Ye]}),n(jn,{tab:Ye,key:q.key,disabled:q.disabled},null)})]},rightExtra:R?function(){return R}:null}):null;(N||be||Se)&&(De=n("div",{class:"".concat(H,"-head"),style:m},[n("div",{class:"".concat(H,"-head-wrapper")},[N&&n("div",{class:"".concat(H,"-head-title")},[N]),be&&n("div",{class:"".concat(H,"-extra")},[be])]),Se]));var qe=se?n("div",{class:"".concat(H,"-cover")},[se]):null,Ve=n("div",{class:"".concat(H,"-body"),style:T},[E?ae:pe]),Ke=F&&F.length?n("ul",{class:"".concat(H,"-actions")},[f(F)]):null;return n("div",{class:$e,ref:"cardContainerRef"},[De,qe,pe&&pe.length?Ve:null,Ke])}}});const Ge=Hn;var Wn=function(){return{prefixCls:String,title:z.any,description:z.any,avatar:z.any}};const Pt=X({compatConfig:{MODE:3},name:"ACardMeta",props:Wn(),slots:["title","description","avatar"],setup:function(e,a){var r=a.slots,o=Oe("card",e),i=o.prefixCls;return function(){var l=k({},"".concat(i.value,"-meta"),!0),d=Be(r,e,"avatar"),f=Be(r,e,"title"),u=Be(r,e,"description"),s=d?n("div",{class:"".concat(i.value,"-meta-avatar")},[d]):null,v=f?n("div",{class:"".concat(i.value,"-meta-title")},[f]):null,c=u?n("div",{class:"".concat(i.value,"-meta-description")},[u]):null,b=v||c?n("div",{class:"".concat(i.value,"-meta-detail")},[v,c]):null;return n("div",{class:l},[s,b])}}});var zn=function(){return{prefixCls:String,hoverable:{type:Boolean,default:!0}}};const Et=X({compatConfig:{MODE:3},name:"ACardGrid",__ANT_CARD_GRID:!0,props:zn(),setup:function(e,a){var r=a.slots,o=Oe("card",e),i=o.prefixCls,l=Q(function(){var d;return d={},k(d,"".concat(i.value,"-grid"),!0),k(d,"".concat(i.value,"-grid-hoverable"),e.hoverable),d});return function(){var d;return n("div",{class:l.value},[(d=r.default)===null||d===void 0?void 0:d.call(r)])}}});Ge.Meta=Pt;Ge.Grid=Et;Ge.install=function(t){return t.component(Ge.name,Ge),t.component(Pt.name,Pt),t.component(Et.name,Et),t};fe.useInjectFormItemContext=Na;fe.ItemRest=St;fe.install=function(t){return t.component(fe.name,fe),t.component(fe.Item.name,fe.Item),t.component(St.name,St),t};var Gn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"arrow-left",theme:"outlined"};const qn=Gn;function la(t){for(var e=1;ea<=60?`${a}分钟`:`${Math.floor(a/60)}小时 ${a%60}分钟`;return()=>{const{data:a}=t;return n("div",null,[n(He,{gutter:[12,6]},{default:()=>[n(de,{span:12,class:"text-right"},{default:()=>[oe("总学习时长")]}),n(de,{span:12},{default:()=>[a.learnTime>0?e(a.learnTime):"0分钟"]})]})])}}});var ya={exports:{}};(function(t,e){(function(a,r){r()})(tt,function(){function a(u,s){return typeof s>"u"?s={autoBom:!1}:typeof s!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),s={autoBom:!s}),s.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(u.type)?new Blob(["\uFEFF",u],{type:u.type}):u}function r(u,s,v){var c=new XMLHttpRequest;c.open("GET",u),c.responseType="blob",c.onload=function(){f(c.response,s,v)},c.onerror=function(){console.error("could not download file")},c.send()}function o(u){var s=new XMLHttpRequest;s.open("HEAD",u,!1);try{s.send()}catch{}return 200<=s.status&&299>=s.status}function i(u){try{u.dispatchEvent(new MouseEvent("click"))}catch{var s=document.createEvent("MouseEvents");s.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),u.dispatchEvent(s)}}var l=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof tt=="object"&&tt.global===tt?tt:void 0,d=l.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),f=l.saveAs||(typeof window!="object"||window!==l?function(){}:"download"in HTMLAnchorElement.prototype&&!d?function(u,s,v){var c=l.URL||l.webkitURL,b=document.createElement("a");s=s||u.name||"download",b.download=s,b.rel="noopener",typeof u=="string"?(b.href=u,b.origin===location.origin?i(b):o(b.href)?r(u,s,v):i(b,b.target="_blank")):(b.href=c.createObjectURL(u),setTimeout(function(){c.revokeObjectURL(b.href)},4e4),setTimeout(function(){i(b)},0))}:"msSaveOrOpenBlob"in navigator?function(u,s,v){if(s=s||u.name||"download",typeof u!="string")navigator.msSaveOrOpenBlob(a(u,v),s);else if(o(u))r(u,s,v);else{var c=document.createElement("a");c.href=u,c.target="_blank",setTimeout(function(){i(c)})}}:function(u,s,v,c){if(c=c||open("","_blank"),c&&(c.document.title=c.document.body.innerText="downloading..."),typeof u=="string")return r(u,s,v);var b=u.type==="application/octet-stream",p=/constructor/i.test(l.HTMLElement)||l.safari,C=/CriOS\/[\d]+/.test(navigator.userAgent);if((C||b&&p||d)&&typeof FileReader<"u"){var w=new FileReader;w.onloadend=function(){var y=w.result;y=C?y:y.replace(/^data:[^;]*;/,"data:attachment/file;"),c?c.location.href=y:location=y,c=null},w.readAsDataURL(u)}else{var x=l.URL||l.webkitURL,S=x.createObjectURL(u);c?c.location=S:location.href=S,c=null,setTimeout(function(){x.revokeObjectURL(S)},4e4)}});l.saveAs=f.saveAs=f,t.exports=f})})(ya);var sa=ya.exports;const sr=Ha("users",{state:()=>({list:[],page:0,size:20,total:0}),getters:{canLoadNext:t=>{const{size:e,page:a,total:r}=t;return a*e1&&this.getUsersList(this.$state.page-1)},async loadNextPage(){await this.getUsersList(this.$state.page+1)},async addOrUpdateUser(t){ce.show("保存中");try{let e={};if(t._id?e=await Pe.updateUser(t):e=await Pe.createUser(t),e.errorNo!=200){xe.error("保存失败");return}xe.success("保存成功"),this.listRefresh()}catch(e){console.log(e)}finally{ce.hidden()}},async deleteUser(t){await nt.confirm({title:"删除确认",content:`删除后数据无法恢复,确认删除${t!=null&&t.loginName?`用户${t==null?void 0:t.loginName}`:"该用户"}?`,type:"danger"})&&(ce.show("删除中"),await Pe.deleteUser(t._id),ce.hidden(),xe.success("删除成功"),this.listRefresh())},async deleteAll(t){await nt.confirm({title:"删除确认",content:"删除后数据无法恢复,确认删除所选用户?",type:"danger"})&&(ce.show("删除中"),await Pe.deleteUsers(t),ce.hidden(),xe.success("删除成功"),this.listRefresh())},async getUsersList(t=1){ce.show("");const e=await Pe.getUsersList({page:t,size:this.$state.size});if(ce.hidden(),e.errorNo!=200)return xe.error(e.errorDesc),!1;this.$state.list=e.result.list,this.$state.page=t,this.$state.total=e.result.total},async userDtl(t){ce.show("");const e=await Pe.userDtl(t._id);if(ce.hidden(),e.errorNo!=200)return xe.error(e.errorDesc),!1;nt.show(n(ir,{data:e.result},null),{title:"用户详情",width:"500px"})},async downloadUser(){const t=await Pe.downloadUserTpl();sa.saveAs(t,"用户模板.xlsx")},async exportUser(){const t=await Pe.exportUser();sa.saveAs(t,"所有用户.xlsx")},async importUser(){var a;const[t]=await Wa.selectFile({accept:".xlsx"});if(((a=t.name.split(".").pop())==null?void 0:a.toLowerCase())!="xlsx")return xe.error("文件格式不支持!"),!1;ce.show("导入中");try{const r=await Pe.importUser({file:t});if(r.errorNo!==200)return xe.error("导入失败"),!1;r.result&&r.result.length>0?xe.error(r.result[0]):xe.success("导入成功"),this.listRefresh()}catch{}finally{ce.hidden()}}}});const ur=X({props:{data:za()},setup(t){var d;const e=nt.use(),a=Tt({formData:{loginName:"",password:"",roles:["student"],...t.data}}),r=Tt({loginName:[{required:!0,message:"登录名不能为空",trigger:"change"}],password:[{required:!((d=t.data)!=null&&d._id),message:"登录密码不能为空",trigger:"change"}],roles:[{required:!0,message:"用户角色不能为空",trigger:"change"}]}),{validate:o,validateInfos:i}=fe.useForm(a.formData,r),l=()=>{o().then(async()=>{e.submit(a.formData)})};return()=>n("div",null,[n("div",{class:cr},[n("div",{class:"form_box"},[n(fe,{labelCol:{span:6},wrapperCol:{span:18}},{default:()=>[n(fe.Item,gt({label:"登录名",name:"loginName"},i.loginName),{default:()=>[n(Vt,{value:a.formData.loginName,"onUpdate:value":f=>a.formData.loginName=f},null)]}),n(fe.Item,gt({label:"登录密码",name:"password"},i.password),{default:()=>[n(Vt.Password,{value:a.formData.password,"onUpdate:value":f=>a.formData.password=f},null)]}),n(fe.Item,gt({label:"用户角色",name:"roles"},i.roles),{default:()=>[n(Ya,{class:"flex w-full login_role",value:a.formData.roles[0],"onUpdate:value":f=>a.formData.roles[0]=f},{default:()=>[n(Yt,{value:"student"},{default:()=>[oe("学员")]}),n(Yt,{value:"admin"},{default:()=>[oe("管理员")]})]})]})]})]),n("div",{class:"footer"},[n(me,{type:"primary",block:!0,onClick:l},{default:()=>[oe("保存")]})])])])}}),cr="m9za2m9";const Cr=X({setup(){const t=sr(),e=Ga();t.getUsersList();const a=Za(),r=Tt({selectedRows:[]}),o=[{title:"账号",dataIndex:"loginName"},{title:"角色",dataIndex:"roles",customRender:({record:l})=>l.roles.includes("admin")?"管理员":"学员"},{title:"操作",customRender:({record:l})=>e.isAdmin?n(it,null,{default:()=>[n(me,{type:"link",onClick:()=>{i(l)}},{default:()=>[oe("编辑")]}),n(me,{type:"link",onClick:()=>{a.showHistory(l._id)}},{default:()=>[oe("考核历史")]}),!l.roles.includes("admin")&&n(me,{danger:!0,type:"link",onClick:()=>{t.deleteUser(l)}},{default:()=>[oe("删除")]})]}):n(it,null,{default:()=>[n(me,{type:"link",onClick:()=>{a.showHistory(l._id)}},{default:()=>[oe("考核历史")]})]})}],i=async l=>{const d=qa.cloneDeep(l),f=await nt.show(n(ur,{data:d},null),{title:l._id?"编辑用户":"添加用户"});t.addOrUpdateUser(f)};return()=>n(Ge,{class:dr},{default:()=>[n(lr,{title:"用户管理"},{extra:()=>{if(e.isAdmin)return n(it,null,{default:()=>[n(me,{type:"primary",onClick:()=>{i({})}},{default:()=>[oe("+ 新增用户")]}),n(me,{onClick:()=>{t.downloadUser()}},{default:()=>[oe("用户模板下载")]}),n(me,{onClick:()=>{t.importUser()}},{default:()=>[oe("导入用户")]}),n(me,{onClick:()=>{t.exportUser()}},{default:()=>[oe("导出用户")]})]})}}),r.selectedRows.length>0&&n("div",{class:"selected_view"},[n("div",null,["已选择",r.selectedRows.length,"项"]),n(it,null,{default:()=>[n(me,{onClick:async()=>{await t.deleteAll(r.selectedRows),r.selectedRows=[]}},{default:()=>[oe("批量删除")]}),n(me,{type:"link",onClick:()=>{r.selectedRows=[]}},{default:()=>[oe("取消选择")]})]})]),n(Ja,{class:"banner_table",bordered:!0,size:"small",rowKey:"_id",rowSelection:{selectedRowKeys:r.selectedRows,onChange:l=>{r.selectedRows=l},getCheckboxProps:l=>({disabled:l.roles.includes("admin")})},pagination:{size:"small",showSizeChanger:!1,hideOnSinglePage:!0,pageSize:t.$state.size,total:t.$state.total,onChange:l=>t.getUsersList(l)},columns:o,dataSource:t.$state.list},null)]})}}),dr="pwd2bxw";export{Cr as default};