1 |
- var m=(e,s,n)=>new Promise((i,l)=>{var d=t=>{try{r(n.next(t))}catch(a){l(a)}},c=t=>{try{r(n.throw(t))}catch(a){l(a)}},r=t=>t.done?i(t.value):Promise.resolve(t.value).then(d,c);r((n=n.apply(e,s)).next())});import{i as C}from"./index-Ci2v5RRf.js";import{B as x,u as y}from"./useTable-CaBV0A9D.js";import{T as _}from"./index-BPgn07DB.js";import{b as B,aq as h,ao as S,v as D,_ as v}from"./entry/index-CP6zkLsN-1726190694502.js";import{u as A,g as R,d as k}from"./token-CZjT9vzr.js";import{l as U,d as $,f as g,k as T,a6 as u,_ as p,$ as P,a8 as f,a7 as w,G as M,a2 as N,a0 as b}from"./vue-CmlY4eyV.js";import{a9 as V,M as E}from"./antd-Bp5u6ujY.js";import"./ExclamationCircleOutlined-BR1Enpph.js";import"./useForm-DYTnyn58.js";import"./index-D5QnXKgB.js";import"./tree-Cz4SXb17.js";import"./copyTextToClipboard-o-L2h2rZ.js";import"./index-BAxfTGAN.js";import"./index-caYAhZot.js";import"./index-Ci1vkPDT.js";import"./index-B_Pz7KLI.js";import"./index-5JuY20kX.js";import"./useWindowSizeFn-c2oM7mG1.js";import"./plugin-BdCvh_fX.js";import"./uuid-BUBnBT7J.js";import"./onMountedOrActivated-C4hclMrd.js";import"./sortable.esm-CnNXHMH-.js";import"./useSortable-Dv9W1z21.js";const{t:o}=B(),F=[{title:"UUID",dataIndex:"id",width:80},{title:o("sys.login.username"),dataIndex:"username",width:50},{title:"Token",dataIndex:"token",width:50},{title:o("common.source"),dataIndex:"source",width:50},{title:o("common.status"),dataIndex:"status",width:40,customRender:({record:e})=>(Reflect.has(e,"pendingStatus")||(e.pendingStatus=!1),U(V,{checked:e.status===1,checkedChildren:o("common.on"),unCheckedChildren:o("common.off"),loading:e.pendingStatus,onChange(s,n){e.pendingStatus=!0;const i=s?1:2;A({id:e.id,status:i}).then(()=>{e.status=i}).finally(()=>{e.pendingStatus=!1})}}))},{title:o("common.createTime"),dataIndex:"createdAt",width:50,customRender:({record:e})=>h(e.createdAt)},{title:o("common.expiredAt"),dataIndex:"expiredAt",width:50,customRender:({record:e})=>h(e.expiredAt)}],L=[{field:"UUID",label:"UUID",component:"Input",colProps:{span:8},rules:[{max:30}]},{field:"username",label:o("sys.login.username"),component:"Input",colProps:{span:8},rules:[{max:30}]},{field:"email",label:o("sys.login.email"),component:"Input",colProps:{span:8},rules:[{max:50}]},{field:"nickname",label:o("sys.user.nickname"),component:"Input",colProps:{span:8},rules:[{max:20}]}],O=$({name:"TokenManagement",components:{BasicTable:x,TableAction:_,Button:S},setup(){const{t:e}=D.useI18n(),s=g(),n=g(!1),[i,{reload:l}]=y({title:e("sys.token.tokenList"),api:R,columns:F,formConfig:{labelWidth:120,schemas:L},useSearchForm:!0,showTableSetting:!0,bordered:!0,showIndexColumn:!1,clickToRowSelect:!1,actionColumn:{width:30,title:e("common.action"),dataIndex:"action",fixed:void 0},rowKey:"id",rowSelection:{type:"checkbox",onChange:(t,a)=>{s.value=t,n.value=t.length>0}}});function d(t){return m(this,null,function*(){(yield k({ids:[t.id]})).code===0&&(yield l())})}function c(){return m(this,null,function*(){E.confirm({title:e("common.deleteConfirm"),icon:T(C.ExclamationCircleOutlined),onOk(){return m(this,null,function*(){(yield k({ids:s.value})).code===0&&(n.value=!1,yield l())})},onCancel(){}})})}function r(){return m(this,null,function*(){yield l()})}return{t:e,registerTable:i,handleDelete:d,handleSuccess:r,handleBatchDelete:c,showDeleteButton:n}}});function j(e,s,n,i,l,d){const c=u("Button"),r=u("TableAction"),t=u("BasicTable");return p(),P("div",null,[T(t,{onRegister:e.registerTable},{tableTitle:f(()=>[e.showDeleteButton?(p(),w(c,{key:0,type:"primary",danger:"",preIcon:"ant-design:delete-outlined",onClick:e.handleBatchDelete},{default:f(()=>[M(N(e.t("common.delete")),1)]),_:1},8,["onClick"])):b("",!0)]),bodyCell:f(({column:a,record:I})=>[a.key==="action"?(p(),w(r,{key:0,actions:[{label:"删除",color:"error",popConfirm:{title:e.t("common.deleteConfirm"),placement:"left",confirm:e.handleDelete.bind(null,I)}}]},null,8,["actions"])):b("",!0)]),_:1},8,["onRegister"])])}const pe=v(O,[["render",j]]);export{pe as default};
|