import{a as A,b as G,N as O}from"./search-form-BsG63UYZ.js";import{d as U,a0 as T,a1 as I,c as M,o as C,ad as j,h as o,ae as q,av as K,$ as t,r as D,q as E,w as h,f as l,c1 as H,L as Z,bl as J,b as Q,ag as W,G as X,B as $,aw as Y,Z as P,ax as ee,a3 as ae,ah as te,ai as oe}from"./index-mUIrqFZO.js";import{f as le,a as ne,b as se,c as re,d as ce}from"./workflow-JuhkmNQA.js";import{_ as ue,u as ie,a as me}from"./table-CiARbIUu.js";import{_ as pe}from"./select-group.vue_vue_type_script_setup_true_lang-CX_ZxJlr.js";import{_ as de}from"./datetime-range.vue_vue_type_script_setup_true_lang-C9JNnLz-.js";import{_ as fe}from"./AutoComplete-CFzanfTN.js";import{b as he}from"./Grid-BaTVMcBE.js";import"./CollapseItem-Ylp0YizN.js";import"./group-Bi2fhdLF.js";const we=U({name:"TaskBatchStatus",__name:"task-batch-status",props:T({disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(c){const w=c,p=I(c,"modelValue");return(_,d)=>{const s=j;return C(),M(s,{value:p.value,"onUpdate:value":d[0]||(d[0]=u=>p.value=u),placeholder:o(t)("common.taskBatchStatus.form"),options:o(q)(o(K)),disabled:w.disabled,clearable:w.clearable},null,8,["value","placeholder","options","disabled","clearable"])}}}),ke=U({name:"WorkflowBatchSearch",__name:"workflow-batch-search",props:{model:{required:!0},modelModifiers:{}},emits:T(["reset","search"],["update:model"]),setup(c,{emit:w}){const p=D(!1),_=w,d=D([]),s=I(c,"model"),u=D(s.value.workflowName);function v(){u.value="",_("reset")}function B(){_("search")}async function k(){const r=await le({keywords:u.value,groupName:s.value.groupName});d.value=r.data}function y(r){s.value.workflowId=r}E(()=>u.value,r=>{r.length!==0?k():p.value=!1});function x(r){return r.map(n=>({value:n.id,label:n.workflowName}))}function b(r){return[r.label,`(${r.value})`]}return(r,n)=>{const g=ue,N=fe,R=A;return C(),M(R,{"btn-span":"12 s:24 m:10 l:12 xl:16",model:s.value,onSearch:B,onReset:v},{default:h(()=>[l(g,{span:"24 s:12 m:8",label:o(t)("page.workflowBatch.groupName"),path:"groupName",class:"pr-24px"},{default:h(()=>[l(pe,{value:s.value.groupName,"onUpdate:value":n[0]||(n[0]=i=>s.value.groupName=i),clearable:""},null,8,["value"])]),_:1},8,["label"]),l(g,{span:"24 s:12 m:8",label:o(t)("page.workflowBatch.workflowName"),"label-width":100,path:"workflowName",class:"pr-24px"},{default:h(()=>[l(N,{value:u.value,"onUpdate:value":n[1]||(n[1]=i=>u.value=i),placeholder:o(t)("page.workflowBatch.form.workflowName"),options:x(d.value),"empty-visible":p.value,clearable:"",filterable:"","render-label":b,onSelect:y},null,8,["value","placeholder","options","empty-visible"])]),_:1},8,["label"]),l(g,{span:"24 s:12 m:8",label:o(t)("page.workflowBatch.taskBatchStatus"),path:"taskBatchStatus",class:"pr-24px"},{default:h(()=>[l(we,{value:s.value.taskBatchStatus,"onUpdate:value":n[2]||(n[2]=i=>s.value.taskBatchStatus=i),clearable:""},null,8,["value"])]),_:1},8,["label"]),l(g,{span:"24 s:24 m:14 l:12 xl:8",label:o(t)("page.common.createTime"),path:"datetimeRange",class:"pr-24px"},{default:h(()=>[l(de,{value:s.value.datetimeRange,"onUpdate:value":n[3]||(n[3]=i=>s.value.datetimeRange=i)},null,8,["value"])]),_:1},8,["label"])]),_:1},8,["model"])}}}),ge={class:"min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto"};function S(c){return typeof c=="function"||Object.prototype.toString.call(c)==="[object Object]"&&!oe(c)}const We=U({name:"workflow_batch",__name:"index",setup(c){const w=H(),p=Z(),_=history.state.workflowId,d=history.state.workflowName,s=history.state.taskBatchStatus,{columns:u,columnChecks:v,data:B,getData:k,loading:y,mobilePagination:x,searchParams:b,resetSearchParams:r}=ie({apiFn:se,apiParams:{page:1,size:10,workflowId:null,workflowName:null,groupName:null,taskBatchStatus:null,datetimeRange:J()},searchParams:{workflowId:_,workflowName:d,taskBatchStatus:s},columns:()=>[{type:"selection"},{key:"id",title:t("common.index"),align:"center",width:120,render:e=>{function a(){F(e.id)}return l($,{text:!0,tag:"a",type:"primary",onClick:a,class:"ws-normal"},{default:()=>[e.id]})}},{key:"workflowName",title:t("page.workflowBatch.workflowName"),align:"left",minWidth:120},{key:"groupName",title:t("page.workflowBatch.groupName"),align:"left",minWidth:120},{key:"executionAt",title:t("page.workflowBatch.executionAt"),align:"left",minWidth:120},{key:"taskBatchStatus",title:t("page.workflowBatch.taskBatchStatus"),align:"left",minWidth:120,render:e=>{if(!e.taskBatchStatus)return null;const a={1:"info",2:"success",3:"success",4:"error",5:"warning",6:"warning"},m=t(Y[e.taskBatchStatus]);return l(P,{type:a[e.taskBatchStatus]},S(m)?m:{default:()=>[m]})}},{key:"operationReason",title:t("page.workflowBatch.operationReason"),align:"left",minWidth:120,render:e=>{if(!e.operationReason)return null;const a=t(ee[e.operationReason]);return l(P,{type:"warning"},S(a)?a:{default:()=>[a]})}},{key:"createDt",title:t("page.workflowBatch.createDt"),align:"left",minWidth:120},{key:"operate",title:t("common.operate"),align:"center",width:130,render:e=>l("div",{class:"flex-center gap-8px"},[(e==null?void 0:e.taskBatchStatus)===1||(e==null?void 0:e.taskBatchStatus)===2?l(ae,null,[l(O,{onPositiveClick:()=>V(e.id)},{default:()=>t("common.confirmStop"),trigger:()=>{let a;return l($,{type:"error",text:!0,ghost:!0,size:"small"},S(a=t("common.stop"))?a:{default:()=>[a]})}}),l(te,{vertical:!0},null)]):"",l(O,{onPositiveClick:()=>R(e.id)},{default:()=>t("common.confirmDelete"),trigger:()=>{let a;return l($,{type:"error",text:!0,ghost:!0,size:"small"},S(a=t("common.delete"))?a:{default:()=>[a]})}})])}]}),{checkedRowKeys:n,onDeleted:g,onBatchDeleted:N}=me(B,k);async function R(e){const{error:a}=await re(e);a||g()}async function i(){const{error:e}=await ne(n.value);e||N()}async function V(e){var m;const{error:a}=await ce(e);a||((m=window.$message)==null||m.success(t("common.executeSuccess")),k())}function F(e){w.push({path:"/workflow/form/batch",query:{id:e}})}return(e,a)=>{const m=G,L=he,z=X;return C(),Q("div",ge,[l(ke,{model:o(b),"onUpdate:model":a[0]||(a[0]=f=>W(b)?b.value=f:null),onReset:o(r),onSearch:o(k)},null,8,["model","onReset","onSearch"]),l(z,{title:o(t)("page.workflowBatch.title"),bordered:!1,size:"small",class:"sm:flex-1-hidden card-wrapper","header-class":"view-card-header"},{"header-extra":h(()=>[l(m,{columns:o(v),"onUpdate:columns":a[1]||(a[1]=f=>W(v)?v.value=f:null),"disabled-delete":o(n).length===0,loading:o(y),"show-add":!1,onDelete:i,onRefresh:o(k)},null,8,["columns","disabled-delete","loading","onRefresh"])]),default:h(()=>[l(L,{"checked-row-keys":o(n),"onUpdate:checkedRowKeys":a[2]||(a[2]=f=>W(n)?n.value=f:null),columns:o(u),data:o(B),"flex-height":!o(p).isMobile,"scroll-x":962,loading:o(y),remote:"","row-key":f=>f.id,pagination:o(x),class:"sm:h-full"},null,8,["checked-row-keys","columns","data","flex-height","loading","row-key","pagination"])]),_:1},8,["title"])])}}});export{We as default};