import{d as ta,J as ra,Q as na,u as ia,r as g,A as sa,b as pa,a1 as da,o as i,c as B,k as a,B as e,a as o,a2 as D,F as E,i as ua,a3 as ma,N as I,g as s,O as p,P as c,D as ca,h as R,a7 as fa,S as ba,$ as ya,R as _a,U as ga,V as wa,W as ha,X as ka,Y as va,Z as xa}from"./index-BP6bNRoi.js";import{_ as ja}from"./index.vue_vue_type_script_setup_true_lang-sJUY8qtC.js";import{E as Ca,a as Na,b as Sa}from"./el-dropdown-item-BW-wC9MJ.js";import{_ as Ra}from"./DictTag.vue_vue_type_script_lang-DwXPHgid.js";import{_ as Va}from"./ContentWrap.vue_vue_type_script_setup_true_lang-CR_2gECF.js";import{c as V}from"./permission-BEe7BIhI.js";import{_ as Oa}from"./JobForm.vue_vue_type_script_setup_true_lang-CoOEboRs.js";import{_ as Pa}from"./JobDetail.vue_vue_type_script_setup_true_lang-CdsDcxKW.js";import{d as Ta}from"./download-e0EdwhTv.js";import{b as Ua,e as Aa,d as Ja,f as qa,r as Fa}from"./index-BurMR7Th.js";import{a as h}from"./constants-CuOBQ73z.js";import"./index-BZESAUPP.js";import"./color-DXkOL5Tu.js";import"./el-card-bU92WWV4.js";import"./Dialog.vue_vue_type_style_index_0_lang-DFckl8Er.js";import"./el-descriptions-item-BuMEVwqR.js";import"./el-timeline-item-DBF-RmS6.js";import"./formatTime-DwR9f7DP.js";const za=ta({name:"InfraJob",__name:"index",setup(Ba){const{t:j}=ra(),f=na(),{push:K}=ia(),C=g(!0),O=g(0),P=g([]),n=sa({pageNo:1,pageSize:10,name:void 0,status:void 0,handlerName:void 0}),T=g(),N=g(!1),b=async()=>{C.value=!0;try{const t=await Ua(n);P.value=t.list,O.value=t.total}finally{C.value=!1}},k=()=>{n.pageNo=1,b()},L=()=>{T.value.resetFields(),k()},Q=async()=>{try{await f.exportConfirm(),N.value=!0;const t=await Aa(n);Ta.excel(t,"\u5B9A\u65F6\u4EFB\u52A1.xls")}catch{}finally{N.value=!1}},U=g(),A=(t,r)=>{U.value.open(t,r)},Y=async t=>{try{await f.confirm("\u786E\u8BA4\u8981\u7ACB\u5373\u6267\u884C\u4E00\u6B21"+t.name+"?",j("common.reminder")),await Fa(t.id),f.success("\u6267\u884C\u6210\u529F"),await b()}catch{}},J=g(),G=t=>{J.value.open(t)},q=t=>{K(t&&t>0?"/job/job-log?id="+t:"/job/job-log")};return pa(()=>{b()}),(t,r)=>{const F=fa,v=ba,M=ya,W=_a,w=ga,d=wa,X=ha,z=Va,y=ka,Z=Ra,S=Ca,$=Na,H=Sa,aa=va,ea=ja,_=da("hasPermi"),la=xa;return i(),B(E,null,[a(z,null,{default:e(()=>[a(X,{class:"-mb-15px",model:o(n),ref_key:"queryFormRef",ref:T,inline:!0,"label-width":"100px"},{default:e(()=>[a(v,{label:"\u4EFB\u52A1\u540D\u79F0",prop:"name"},{default:e(()=>[a(F,{modelValue:o(n).name,"onUpdate:modelValue":r[0]||(r[0]=l=>o(n).name=l),placeholder:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0",clearable:"",onKeyup:D(k,["enter"]),class:"!w-240px"},null,8,["modelValue"])]),_:1}),a(v,{label:"\u4EFB\u52A1\u72B6\u6001",prop:"status"},{default:e(()=>[a(W,{modelValue:o(n).status,"onUpdate:modelValue":r[1]||(r[1]=l=>o(n).status=l),placeholder:"\u8BF7\u9009\u62E9\u4EFB\u52A1\u72B6\u6001",clearable:"",class:"!w-240px"},{default:e(()=>[(i(!0),B(E,null,ua(o(ma)(o(I).INFRA_JOB_STATUS),l=>(i(),s(M,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(v,{label:"\u5904\u7406\u5668\u7684\u540D\u5B57",prop:"handlerName"},{default:e(()=>[a(F,{modelValue:o(n).handlerName,"onUpdate:modelValue":r[2]||(r[2]=l=>o(n).handlerName=l),placeholder:"\u8BF7\u8F93\u5165\u5904\u7406\u5668\u7684\u540D\u5B57",clearable:"",onKeyup:D(k,["enter"]),class:"!w-240px"},null,8,["modelValue"])]),_:1}),a(v,null,{default:e(()=>[a(d,{onClick:k},{default:e(()=>[a(w,{icon:"ep:search",class:"mr-5px"}),p(" \u641C\u7D22")]),_:1}),a(d,{onClick:L},{default:e(()=>[a(w,{icon:"ep:refresh",class:"mr-5px"}),p(" \u91CD\u7F6E")]),_:1}),c((i(),s(d,{type:"primary",plain:"",onClick:r[3]||(r[3]=l=>A("create"))},{default:e(()=>[a(w,{icon:"ep:plus",class:"mr-5px"}),p(" \u65B0\u589E ")]),_:1})),[[_,["infra:job:create"]]]),c((i(),s(d,{type:"success",plain:"",onClick:Q,loading:o(N)},{default:e(()=>[a(w,{icon:"ep:download",class:"mr-5px"}),p(" \u5BFC\u51FA ")]),_:1},8,["loading"])),[[_,["infra:job:export"]]]),c((i(),s(d,{type:"info",plain:"",onClick:r[4]||(r[4]=l=>q())},{default:e(()=>[a(w,{icon:"ep:zoom-in",class:"mr-5px"}),p(" \u6267\u884C\u65E5\u5FD7 ")]),_:1})),[[_,["infra:job:query"]]])]),_:1})]),_:1},8,["model"])]),_:1}),a(z,null,{default:e(()=>[c((i(),s(aa,{data:o(P)},{default:e(()=>[a(y,{label:"\u4EFB\u52A1\u7F16\u53F7",align:"center",prop:"id"}),a(y,{label:"\u4EFB\u52A1\u540D\u79F0",align:"center",prop:"name"}),a(y,{label:"\u4EFB\u52A1\u72B6\u6001",align:"center",prop:"status"},{default:e(l=>[a(Z,{type:o(I).INFRA_JOB_STATUS,value:l.row.status},null,8,["type","value"])]),_:1}),a(y,{label:"\u5904\u7406\u5668\u7684\u540D\u5B57",align:"center",prop:"handlerName"}),a(y,{label:"\u5904\u7406\u5668\u7684\u53C2\u6570",align:"center",prop:"handlerParam"}),a(y,{label:"CRON \u8868\u8FBE\u5F0F",align:"center",prop:"cronExpression"}),a(y,{label:"\u64CD\u4F5C",align:"center",width:"200"},{default:e(l=>[c((i(),s(d,{type:"primary",link:"",onClick:x=>A("update",l.row.id)},{default:e(()=>[p(" \u4FEE\u6539 ")]),_:2},1032,["onClick"])),[[_,["infra:job:update"]]]),c((i(),s(d,{type:"primary",link:"",onClick:x=>(async u=>{try{const m=u.status===h.STOP?"\u5F00\u542F":"\u5173\u95ED";await f.confirm("\u786E\u8BA4\u8981"+m+'\u5B9A\u65F6\u4EFB\u52A1\u7F16\u53F7\u4E3A"'+u.id+'"\u7684\u6570\u636E\u9879?',j("common.reminder"));const oa=u.status===h.STOP?h.NORMAL:h.STOP;await Ja(u.id,oa),f.success(m+"\u6210\u529F"),await b()}catch{}})(l.row)},{default:e(()=>[p(ca(l.row.status===o(h).STOP?"\u5F00\u542F":"\u6682\u505C"),1)]),_:2},1032,["onClick"])),[[_,["infra:job:update"]]]),c((i(),s(d,{type:"danger",link:"",onClick:x=>(async u=>{try{await f.delConfirm(),await qa(u),f.success(j("common.delSuccess")),await b()}catch{}})(l.row.id)},{default:e(()=>[p(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[_,["infra:job:delete"]]]),c((i(),s(H,{onCommand:x=>((u,m)=>{switch(u){case"handleRun":Y(m);break;case"openDetail":G(m.id);break;case"handleJobLog":q(m==null?void 0:m.id)}})(x,l.row)},{dropdown:e(()=>[a($,null,{default:e(()=>[o(V)(["infra:job:trigger"])?(i(),s(S,{key:0,command:"handleRun"},{default:e(()=>[p(" \u6267\u884C\u4E00\u6B21 ")]),_:1})):R("",!0),o(V)(["infra:job:query"])?(i(),s(S,{key:1,command:"openDetail"},{default:e(()=>[p(" \u4EFB\u52A1\u8BE6\u7EC6 ")]),_:1})):R("",!0),o(V)(["infra:job:query"])?(i(),s(S,{key:2,command:"handleJobLog"},{default:e(()=>[p(" \u8C03\u5EA6\u65E5\u5FD7 ")]),_:1})):R("",!0)]),_:1})]),default:e(()=>[a(d,{type:"primary",link:""},{default:e(()=>[a(w,{icon:"ep:d-arrow-right"}),p(" \u66F4\u591A")]),_:1})]),_:2},1032,["onCommand"])),[[_,["infra:job:trigger","infra:job:query"]]])]),_:1})]),_:1},8,["data"])),[[la,o(C)]]),a(ea,{total:o(O),page:o(n).pageNo,"onUpdate:page":r[5]||(r[5]=l=>o(n).pageNo=l),limit:o(n).pageSize,"onUpdate:limit":r[6]||(r[6]=l=>o(n).pageSize=l),onPagination:b},null,8,["total","page","limit"])]),_:1}),a(Oa,{ref_key:"formRef",ref:U,onSuccess:b},null,512),a(Pa,{ref_key:"detailRef",ref:J},null,512)],64)}}});export{za as default};