1 |
- import{d as k,k as i,ab as w,X as g,Y as x,Z as C,f as t,u as _,E as r}from"./vue-fae2b924.js";import{u as v,e as b,f as y,h as D}from"./global-d3aa2cdf.js";import{b3 as T,b5 as a,b6 as B,U as c,M as d}from"./radical-24ede98f.js";import{s as E}from"./tree-title-95ec8440.js";import"./index-bad227d6.js";const S=k({__name:"task",setup(F){const f=[{title:"ID",dataIndex:"id"},{title:"所有者",dataIndex:"owner"},{field:"state",title:"状态",width:"100",customRender:({record:e})=>{if(e.blocking)return t(a,{color:"error"},{default:()=>[r("阻塞")]});if(e.blocked)return t(a,{color:"warning"},{default:()=>[r("被阻塞")]});switch(e.state){case 2:return t(a,{color:"success"},{default:()=>[r("已启动")]});case 3:return t(a,{color:"processing"},{default:()=>[r("运行中")]});case 4:return t(a,{color:"processing"},{default:()=>[r("异步运行中")]});case 5:return t(a,{color:"warning"},{default:()=>[r("销毁中")]});case 6:return t(a,{color:"error"},{default:()=>[r("已销毁")]});default:return E[e.state]}}},{dataIndex:"startReason",title:"启动原因",showOverflow:"tooltip"},{field:"startTime",title:"启动时间",width:"100px",customRender:({record:e})=>t(B,{value:e.startTime},null)},{field:"description",title:"描述",showOverflow:"tooltip",customRender:({record:e})=>JSON.stringify(e.description)},{field:"operate",title:"操作",width:"140px",slots:{default:"operate"},align:"center",fixed:"right",customRender:({record:e})=>[t(c,{type:"link",onClick:()=>p(e),size:"small"},{default:()=>[r("重启")]}),t(c,{danger:!0,type:"link",onClick:()=>m(e),size:"small"},{default:()=>[r("关闭")]})]}],s=i([]),n=i([]);v(o),o();function l(e){return e.children&&e.children.length?(e.children=e.children.map(l),e.blocked&&(e.children.find(u=>u.id===e.blocked.id).blocking=!0),n.value.push(e.id)):delete e.children,e}function o(){b().then(e=>{s.value=[e].map(l),s.value})}function p(e){d.confirm({title:"重启任务",content:`确定重启任务 ${e.id} 吗?`,onOk:()=>y(e.pointer)})}function m(e){d.confirm({title:"关闭任务",content:`确定关闭任务 ${e.id} 吗?`,onOk:()=>D(e.pointer)})}return(e,u)=>{const h=w("Card");return g(),x(h,{class:"h-full overflow-scroll",bodyStyle:{height:"100%"}},{default:C(()=>[t(_(T),{rowKey:"id","indent-size":1,"data-source":s.value,columns:f,"expanded-row-keys":n.value},null,8,["data-source","expanded-row-keys"])]),_:1})}}});export{S as default};
|