index-RQm9NuHi.js 3.9 KB

1
  1. var m=(e,s,n)=>new Promise((i,l)=>{var d=t=>{try{c(n.next(t))}catch(a){l(a)}},r=t=>{try{c(n.throw(t))}catch(a){l(a)}},c=t=>t.done?i(t.value):Promise.resolve(t.value).then(d,r);c((n=n.apply(e,s)).next())});import{i as C}from"./index-oK_hln-O.js";import{B as x,u as y}from"./useTable-CDqjUv9a.js";import{T as _}from"./useForm-S2-4SPyv.js";import{b as B,aq as h,ao as S,v as D,_ as v}from"./entry/index-BFpON5wd-1719886843165.js";import{u as A,g as R,d as g}from"./token-DKGIVZme.js";import{l as U,d as $,f as k,k as T,a7 as u,_ as p,$ as P,a9 as f,a8 as w,G as M,a1 as N,ab as b}from"./vue-B3Yl1XMW.js";import{a9 as V,M as E}from"./antd-V2f1Ijkg.js";import"./ExclamationCircleOutlined-CvjJlgYP.js";import"./index-eZbZN8hc.js";import"./index-Cx3rMS0Q.js";import"./useWindowSizeFn-IiF7s4QS.js";import"./plugin-DHZ68pLH.js";import"./onMountedOrActivated-Cz7FEpZo.js";import"./sortable.esm-CnNXHMH-.js";import"./index-D--g-WIs.js";import"./tree-Dcz2GpQj.js";import"./copyTextToClipboard-TytJuPBe.js";import"./useSortable-Dipa7Xkv.js";import"./index-BN89L_L8.js";import"./index-DBtUZ0LU.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=k(),n=k(!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 g({ids:[t.id]})).code===0&&(yield l())})}function r(){return m(this,null,function*(){E.confirm({title:e("common.deleteConfirm"),icon:T(C.ExclamationCircleOutlined),onOk(){return m(this,null,function*(){(yield g({ids:s.value})).code===0&&(n.value=!1,yield l())})},onCancel(){}})})}function c(){return m(this,null,function*(){yield l()})}return{t:e,registerTable:i,handleDelete:d,handleSuccess:c,handleBatchDelete:r,showDeleteButton:n}}});function j(e,s,n,i,l,d){const r=u("Button"),c=u("TableAction"),t=u("BasicTable");return p(),P("div",null,[T(t,{onRegister:e.registerTable},{tableTitle:f(()=>[e.showDeleteButton?(p(),w(r,{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(c,{key:0,actions:[{icon:"ant-design:delete-outlined",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 me=v(O,[["render",j]]);export{me as default};