var c=(e,l,o)=>new Promise((u,s)=>{var d=t=>{try{i(o.next(t))}catch(r){s(r)}},n=t=>{try{i(o.throw(t))}catch(r){s(r)}},i=t=>t.done?u(t.value):Promise.resolve(t.value).then(d,n);i((o=o.apply(e,l)).next())});import{i as T}from"./index-B8miXP3d.js";import{B as A,u as S}from"./useTable-Ol_P-TxG.js";import{T as v}from"./index-BEZBHtc2.js";import{ao as I,v as R,_ as $}from"./entry/index-BOVpYCVt-1731915664217.js";import{u as E}from"./index-CwBw3p8r.js";import{A as F,g as M,c as N,s as V,d as g}from"./ApiDrawer-ByjIlLso.js";import{M as L}from"./antd-DXvsKA0x.js";import{d as O,f as y,k as f,a9 as m,_ as w,$ as U,a7 as p,a6 as k,G as _,a2 as B,a0 as D}from"./vue-B5pbXMv7.js";import"./ExclamationCircleOutlined-BaVgfZo1.js";import"./useForm-B-PbqzOc.js";import"./index-x2bUusKH.js";import"./tree-Nv0Zt4Ov.js";import"./copyTextToClipboard-7uPthhEV.js";import"./index-DKfaJplO.js";import"./index-EdNvCi60.js";import"./index-DTfAZuwl.js";import"./index-BcSUkfeU.js";import"./index-DaqRmjER.js";import"./useWindowSizeFn-CzjmevD7.js";import"./plugin-CRRssOeV.js";import"./uuid-BUBnBT7J.js";import"./onMountedOrActivated-C3HH8-CK.js";import"./sortable.esm-BEDva30o.js";import"./useSortable-CRwDSVfI.js";const j=O({name:"ApiManagement",components:{BasicTable:A,ApiDrawer:F,TableAction:v,Button:I},setup(){const{t:e}=R.useI18n(),l=y(),o=y(!1),[u,{openDrawer:s}]=E(),[d,{reload:n}]=S({title:e("sys.apis.apiList"),api:M,columns:N,formConfig:{schemas:V},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:(a,C)=>{l.value=a,o.value=a.length>0}}});function i(){s(!0,{isUpdate:!1})}function t(a){s(!0,{record:a,isUpdate:!0})}function r(a){return c(this,null,function*(){(yield g({ids:[a.id]})).code===0&&(yield n())})}function h(){return c(this,null,function*(){L.confirm({title:e("common.deleteConfirm"),icon:f(T.ExclamationCircleOutlined),onOk(){return c(this,null,function*(){(yield g({ids:l.value})).code===0&&(o.value=!1,yield n())})},onCancel(){}})})}function b(){return c(this,null,function*(){yield n()})}return{t:e,registerTable:d,registerDrawer:u,handleCreate:i,handleEdit:t,handleDelete:r,handleSuccess:b,handleBatchDelete:h,showDeleteButton:o}}});function G(e,l,o,u,s,d){const n=m("Button"),i=m("a-button"),t=m("TableAction"),r=m("BasicTable"),h=m("ApiDrawer");return w(),U("div",null,[f(r,{onRegister:e.registerTable},{tableTitle:p(()=>[e.showDeleteButton?(w(),k(n,{key:0,type:"primary",danger:"",preIcon:"ant-design:delete-outlined",onClick:e.handleBatchDelete},{default:p(()=>[_(B(e.t("common.delete")),1)]),_:1},8,["onClick"])):D("",!0)]),toolbar:p(()=>[f(i,{type:"primary",onClick:e.handleCreate},{default:p(()=>[_(B(e.t("sys.apis.addApi")),1)]),_:1},8,["onClick"])]),bodyCell:p(({column:b,record:a})=>[b.key==="action"?(w(),k(t,{key:0,actions:[{label:"编辑",onClick:e.handleEdit.bind(null,a)},{label:"删除",color:"error",popConfirm:{title:e.t("common.deleteConfirm"),placement:"left",confirm:e.handleDelete.bind(null,a)}}]},null,8,["actions"])):D("",!0)]),_:1},8,["onRegister"]),f(h,{onRegister:e.registerDrawer,onSuccess:e.handleSuccess},null,8,["onRegister","onSuccess"])])}const de=$(j,[["render",G]]);export{de as default};