import{a as R,b as $,c as A}from"./log-drawer-DaQyKcwN.js";import{d as E,k as z,r as s,i as U,bB as W,o as d,c as f,w as o,e as B,f as a,x as q,g as _,t as L,h as M,_ as O,B as j,a9 as F,aS as G,av as H,l as J}from"./index-BlU6DPnP.js";import{u as K,_ as P}from"./workflow.vue_vue_type_style_index_0_lang-3sh8K__j.js";import{g as Q}from"./workflow-D85MYEv3.js";import"./CollapseItem-nfFVmwOd.js";import"./job-task-list-table.vue_vue_type_script_setup_true_lang-CaM06I1u.js";import"./table-u42G8C7W.js";import"./Grid-Cpsk88_v.js";import"./job-B63-MVN3.js";import"./detail-drawer-C_9uz2U2.js";import"./DescriptionsItem-gspY_Hjg.js";import"./dynamic-input.vue_vue_type_script_setup_true_lang-DwXVKZT0.js";import"./DynamicInput-DvfAGTT6.js";import"./code-mirror-1zmFi0Qb.js";import"./cron-input.vue_vue_type_style_index_0_lang-BHP-tMGB.js";import"./notify-BkZnHT3U.js";import"./group-XM1tp95e.js";const X={class:"flex-center"},Y={class:"flex-center gap-8px"},Z=E({name:"workflow_form_batch",__name:"index",setup(ee){const c=K(),S=z(),v=s(!1),g=String(S.query.id),u=s({}),l=s(0),p=s(),k=new AbortController,t=s(!0),y=()=>{t.value=!0,k.abort(),clearTimeout(p.value),p.value=void 0},x=()=>{t.value||k.abort(),y(),u.value={},c.clear()},r=async()=>{v.value=!0;const{data:n,error:e}=await Q(g);e?(e==null?void 0:e.code)!=="ERR_CANCELED"&&x():(u.value=n,t.value=!(n.workflowBatchStatus&&[1,2].includes(n.workflowBatchStatus))||l.value===0,!t.value&&l.value!==0&&(clearTimeout(p.value),p.value=setTimeout(r,l.value*1e3))),v.value=!1},b=async n=>{if(n===-1){t.value&&(t.value=!1,await r());return}if(l.value=n,n===0){y();return}t.value=!1,await r()};U(()=>{c.clear(),c.setType(2),c.setId(g),r()}),W(()=>{x()});const w=s([{label:"Auto(off)",key:0},{label:"1s",key:1},{label:"5s",key:5},{label:"10s",key:10},{label:"30s",key:30},{label:"1m",key:60},{label:"5m",key:300}]);return(n,e)=>{const h=R,N=O,C=j,m=F,T=G,V=$,D=A,I=H;return d(),f(M(P),{modelValue:u.value,"onUpdate:modelValue":e[1]||(e[1]=i=>u.value=i),spinning:!1,disabled:"",onRefresh:e[2]||(e[2]=i=>r())},{buttons:o(()=>[B("div",X,[a(T,{trigger:"hover",width:"trigger",options:w.value,onSelect:b},{default:o(()=>[a(m,{placement:"left"},{trigger:o(()=>[a(C,{dashed:"",class:q(["w-136px",t.value?"mr-16px":"mr-42px"]),onClick:e[0]||(e[0]=i=>b(-1))},{icon:o(()=>[B("div",Y,[a(h,{class:"text-18px"}),_(" "+L(w.value.filter(i=>i.key===l.value)[0].label)+" ",1),a(N,{icon:"material-symbols:expand-more-rounded"})])]),_:1},8,["class"])]),default:o(()=>[e[3]||(e[3]=_(" 自动刷新频率 "))]),_:1})]),_:1},8,["options"]),t.value?(d(),f(m,{key:0,placement:"top"},{trigger:o(()=>[a(V,{class:"text-26px color-success"})]),default:o(()=>[e[4]||(e[4]=_(" 流程批次加载完成 "))]),_:1})):(d(),f(m,{key:1},{trigger:o(()=>[a(I,{size:"small"},{icon:o(()=>[a(D)]),_:1})]),default:o(()=>[e[5]||(e[5]=_(" 流程批次正在加载 "))]),_:1}))])]),_:1},8,["modelValue"])}}}),ke=J(Z,[["__scopeId","data-v-dfdd102d"]]);export{ke as default};
