var s=(e,d,o)=>new Promise((u,i)=>{var p=t=>{try{n(o.next(t))}catch(r){i(r)}},a=t=>{try{n(o.throw(t))}catch(r){i(r)}},n=t=>t.done?u(t.value):Promise.resolve(t.value).then(p,a);n((o=o.apply(e,d)).next())});import{i as _}from"./index-Ci2v5RRf.js";import{B as L,u as S}from"./useTable-CaBV0A9D.js";import{T as v}from"./index-BPgn07DB.js";import{ao as I,v as R,_ as $}from"./entry/index-CP6zkLsN-1726190694502.js";import{u as E}from"./index-Bh1SitHa.js";import{L as F,c as A,s as M}from"./LabelDrawer-DMkzz5X2.js";import{a as N,d as C}from"./label-BQDFJo32.js";import{M as V}from"./antd-Bp5u6ujY.js";import{d as O,f as g,k as f,a6 as c,_ as w,$ as U,a8 as m,a7 as k,G as y,a2 as B,a0 as D}from"./vue-CmlY4eyV.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 j=O({name:"LabelManagement",components:{BasicTable:L,LabelDrawer:F,TableAction:v,Button:I},setup(){const{t:e}=R.useI18n(),d=g(),o=g(!1),[u,{openDrawer:i}]=E(),[p,{reload:a}]=S({title:e("wechat.label.labelList"),api:N,columns:A,formConfig:{labelWidth:120,schemas:M},useSearchForm:!0,showTableSetting:!0,bordered:!1,showIndexColumn:!1,clickToRowSelect:!1,actionColumn:{width:80,title:e("common.action"),dataIndex:"action",fixed:void 0},rowKey:"id"});function n(){i(!0,{isUpdate:!1})}function t(l){i(!0,{record:l,isUpdate:!0})}function r(l){return s(this,null,function*(){(yield C({ids:[l.id]})).code===0&&(yield a())})}function b(){return s(this,null,function*(){V.confirm({title:e("common.deleteConfirm"),icon:f(_.ExclamationCircleOutlined),onOk(){return s(this,null,function*(){(yield C({ids:d.value})).code===0&&(o.value=!1,yield a())})},onCancel(){}})})}function h(){return s(this,null,function*(){yield a()})}return{t:e,registerTable:p,registerDrawer:u,handleCreate:n,handleEdit:t,handleDelete:r,handleSuccess:h,handleBatchDelete:b,showDeleteButton:o}}});function G(e,d,o,u,i,p){const a=c("Button"),n=c("a-button"),t=c("TableAction"),r=c("BasicTable"),b=c("LabelDrawer");return w(),U("div",null,[f(r,{onRegister:e.registerTable},{tableTitle:m(()=>[e.showDeleteButton?(w(),k(a,{key:0,type:"primary",danger:"",preIcon:"ant-design:delete-outlined",onClick:e.handleBatchDelete},{default:m(()=>[y(B(e.t("common.delete")),1)]),_:1},8,["onClick"])):D("",!0)]),toolbar:m(()=>[f(n,{type:"primary",onClick:e.handleCreate},{default:m(()=>[y(B(e.t("wechat.label.addLabel")),1)]),_:1},8,["onClick"])]),bodyCell:m(({column:h,record:l})=>[h.key==="action"?(w(),k(t,{key:0,actions:[{label:"编辑",onClick:e.handleEdit.bind(null,l)},{label:"删除",color:"error",popConfirm:{title:e.t("common.deleteConfirm"),placement:"left",confirm:e.handleDelete.bind(null,l)}}]},null,8,["actions"])):D("",!0)]),_:1},8,["onRegister"]),f(b,{onRegister:e.registerDrawer,onSuccess:e.handleSuccess},null,8,["onRegister","onSuccess"])])}const fe=$(j,[["render",G]]);export{fe as default};