task-9fcd3c35.js 3.0 KB

12
  1. import{d as y,aC as T,f as C,n as s,bm as l,aQ as _,c as h,b6 as O,b_ as R,ba as b,cp as I,cq as S,Z as B,$ as j,a0 as z,T as g,bp as L,b4 as N,aB as K}from"./index-a8341fa1.js";import"./dayjs-919e6097.js";import{_ as V}from"./index.vue_vue_type_script_setup_true_lang-92c2842a.js";import{s as $}from"./tree-title-9b5dcfdd.js";function n(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Object]"&&!K(i)}const M=y({__name:"task",setup(i){const{t:e}=T(),w=C(()=>[{title:e("routes.task.所有者"),dataIndex:"owner"},{title:"ID",dataIndex:"id"},{field:"state",title:e("routes.task.状态"),width:"100px",customRender:({record:t})=>{let a,o,d,p;const r=[];switch(t.state){case 2:r.push(s(l,{color:"success"},{default:()=>[t.eventLoopRunning?e("routes.task.已激活"):e("routes.task.已启动")]}));break;case 3:r.push(s(l,{color:"processing"},n(a=e("routes.task.运行中"))?a:{default:()=>[a]}));break;case 4:r.push(s(l,{color:"processing"},n(o=e("routes.task.异步运行中"))?o:{default:()=>[o]}));break;case 5:r.push(s(l,{color:"warning"},n(d=e("routes.task.销毁中"))?d:{default:()=>[d]}));break;case 6:r.push(s(l,{color:"error"},n(p=e("routes.task.已销毁"))?p:{default:()=>[p]}));break;default:r.push(s(l,null,{default:()=>[$[t.state]]}));break}if(t.blocked){let u;r.push(s(l,{color:"warning"},n(u=e("routes.task.被阻塞"))?u:{default:()=>[u]}))}else if(t.blocking){let u;r.push(s(l,{color:"error"},n(u=e("routes.task.阻塞"))?u:{default:()=>[u]}))}return r}},{dataIndex:"startReason",title:e("routes.task.启动原因"),showOverflow:"tooltip"},{field:"startTime",title:e("routes.task.启动时间"),minWidth:"100px",customRender:({record:t})=>s(V,{value:t.startTime},null)},{field:"description",title:e("routes.task.描述"),showOverflow:"tooltip",customRender:({record:t})=>JSON.stringify(t.description)},{field:"operate",title:e("routes.task.操作"),width:"140px",slots:{default:"operate"},align:"center",fixed:"right",customRender:({record:t})=>{let a,o;return[s(_,{type:"link",onClick:()=>v(t),size:"small"},n(a=e("routes.task.重启"))?a:{default:()=>[a]}),s(_,{danger:!0,type:"link",onClick:()=>x(t),size:"small"},n(o=e("routes.task.关闭"))?o:{default:()=>[o]})]}}]),c=h([]),f=h([]);O(m),m();function k(t){return t.children&&t.children.length?(t.children=t.children.map(k).sort((a,o)=>a.id-o.id),f.value.push(t.id)):delete t.children,t}function m(){R().then(t=>{c.value=[t].map(k),c.value})}function v(t){b.confirm({title:e("routes.task.重启任务"),content:e("routes.task.确定重启任务",{id:t.id}),onOk:()=>I(t.pointer)})}function x(t){b.confirm({title:e("routes.task.关闭任务"),content:e("routes.task.确定关闭任务",{id:t.id}),onOk:()=>S(t.pointer)})}return(t,a)=>(B(),j(g(N),{class:"h-full overflow-scroll",bodyStyle:{height:"100%"}},{default:z(()=>[s(g(L),{rowKey:"id","indent-size":10,"data-source":c.value,columns:w.value,"expanded-row-keys":f.value},null,8,["data-source","columns","expanded-row-keys"])]),_:1}))}});export{M as default};
  2. //# sourceMappingURL=task-9fcd3c35.js.map