1 |
- var s=(e,c,n)=>new Promise((p,i)=>{var f=o=>{try{a(n.next(o))}catch(r){i(r)}},m=o=>{try{a(n.throw(o))}catch(r){i(r)}},a=o=>o.done?p(o.value):Promise.resolve(o.value).then(f,m);a((n=n.apply(e,c)).next())});import{i as R}from"./index-BQgPd3bX.js";import{B as F,u as $}from"./useTable-B6PunZL5.js";import{T as A}from"./index-BIj58_Cj.js";import{ao as N,v as V,bl as L,_ as O}from"./entry/index-DJx93RYF-1731481145019.js";import{u as S}from"./index-CzIUqxsa.js";import U from"./TokenDrawer-4Z_Vw3wM.js";import W from"./ModeDrawer-EKgNhWT8.js";import{g as j,b as G,s as P,d as B}from"./token-DAX88hZA.js";import{M,am as q,bp as z,aa as H}from"./antd-CBeLo_oO.js";import{d as J,f as T,o as K,k as w,a9 as l,_ as h,$ as Q,a7 as u,a6 as g,G as _,a2 as v,a0 as D}from"./vue-B5pbXMv7.js";import"./ExclamationCircleOutlined-Ca0mYuiu.js";import"./useForm-pwHPrILC.js";import"./index-D_SNX-7K.js";import"./tree-BtJaOqz0.js";import"./copyTextToClipboard-Dngb1Nn3.js";import"./index-BDsRYE32.js";import"./index-wDJjh9Os.js";import"./index-BzfGKMh3.js";import"./index-DkGmfgEA.js";import"./index-Cuu0w1HY.js";import"./useWindowSizeFn-BxA6-zLj.js";import"./plugin-C2XGVjF6.js";import"./uuid-BUBnBT7J.js";import"./onMountedOrActivated-C3HH8-CK.js";import"./sortable.esm-BEDva30o.js";import"./useSortable-lvT7rWOs.js";import"./agent-DQqRa36i.js";import"./department-DVahU7fr.js";let I=T("");const X=J({name:"TokenManagement",components:{Modal:M,Select:q,FormItem:z,Form:H,BasicTable:F,TokenDrawer:U,ModeDrawer:W,TableAction:A,Button:N},setup(){const{t:e}=V.useI18n(),c=T(),n=T(!1),[p,{openDrawer:i}]=S(),[f,{openDrawer:m}]=S(),[a,{reload:o}]=$({title:e("wechat.token.tokenList"),api:j,columns:G,formConfig:{labelWidth:120,schemas:P},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",columnWidth:20,onChange:(t,y)=>{c.value=t,n.value=t.length>0}}});K(()=>s(this,null,function*(){let t=yield L();I.value=t.data[0]}));function r(){i(!0,{isUpdate:!1})}function b(t){i(!0,{record:t,isUpdate:!0})}function k(t){m(!0,{record:t})}function C(t){return s(this,null,function*(){(yield B({ids:[t.id]})).code===0&&(yield o())})}function d(){return s(this,null,function*(){M.confirm({title:e("common.deleteConfirm"),icon:w(R.ExclamationCircleOutlined),onOk(){return s(this,null,function*(){(yield B({ids:c.value})).code===0&&(n.value=!1,yield o())})},onCancel(){}})})}function E(){return s(this,null,function*(){yield o()})}return{t:e,registerTable:a,registerDrawer:p,registerModeDrawer:f,handleCreate:r,handleEdit:b,handleEditMode:k,handleDelete:C,handleSuccess:E,handleBatchDelete:d,showDeleteButton:n,permCode:I}}});function Y(e,c,n,p,i,f){const m=l("Button"),a=l("a-button"),o=l("TableAction"),r=l("BasicTable"),b=l("TokenDrawer"),k=l("ModeDrawer");return h(),Q("div",null,[w(r,{onRegister:e.registerTable},{tableTitle:u(()=>[e.showDeleteButton?(h(),g(m,{key:0,type:"primary",danger:"",preIcon:"ant-design:delete-outlined",onClick:e.handleBatchDelete},{default:u(()=>[_(v(e.t("common.delete")),1)]),_:1},8,["onClick"])):D("",!0)]),toolbar:u(()=>[e.permCode==="001"?(h(),g(a,{key:0,type:"primary",onClick:e.handleCreate},{default:u(()=>[_(v(e.t("wechat.token.addToken")),1)]),_:1},8,["onClick"])):D("",!0)]),bodyCell:u(({column:C,record:d})=>[C.key==="action"?(h(),g(o,{key:0,actions:[{label:"选择 AI 角色",onClick:e.handleEditMode.bind(null,d)},{label:"编辑",onClick:e.handleEdit.bind(null,d),ifShow:e.permCode==="001"},{label:"删除",color:"error",popConfirm:{title:e.t("common.deleteConfirm"),placement:"left",confirm:e.handleDelete.bind(null,d)},ifShow:e.permCode==="001"}]},null,8,["actions"])):D("",!0)]),_:1},8,["onRegister"]),w(b,{onRegister:e.registerDrawer,onSuccess:e.handleSuccess},null,8,["onRegister","onSuccess"]),w(k,{onRegister:e.registerModeDrawer,onSuccess:e.handleSuccess},null,8,["onRegister","onSuccess"])])}const _e=O(X,[["render",Y]]);export{_e as default};
|