import{_ as s,i as e,a as r,b as o,o as i,c as p,f as l,e as d,w as t,h as a,t as n,p as u,k as c}from"./index-4c6e30ca.js";const g={data:()=>({processPids:"",progress1:0,progress2:0,progress3:0,progress4:0,progress5:0,progress6:0,progress1_pid:0,progress2_pid:0,progress3_pid:0,progress4_pid:0,progress5_pid:0,progress6_pid:0}),mounted(){this.init()},methods:{init(){e.removeAllListeners(r.timerJobProgress),e.removeAllListeners(r.createPoolNotice),e.on(r.timerJobProgress,((s,e)=>{switch(e.jobId){case 1:this.progress1=e.number,this.progress1_pid=0==e.pid?e.pid:this.progress1_pid;break;case 2:this.progress2=e.number,this.progress2_pid=0==e.pid?e.pid:this.progress2_pid;break;case 3:this.progress3=e.number,this.progress3_pid=0==e.pid?e.pid:this.progress3_pid;break;case 4:this.progress4=e.number,this.progress4_pid=0==e.pid?e.pid:this.progress4_pid;break;case 5:this.progress5=e.number,this.progress5_pid=0==e.pid?e.pid:this.progress5_pid;break;case 6:this.progress6=e.number,this.progress6_pid=0==e.pid?e.pid:this.progress6_pid}})),e.on(r.createPoolNotice,((s,e)=>{let r=JSON.stringify(e);this.processPids=r}))},runJob(s,o){let i={id:s,type:"timer",action:o};e.invoke(r.someJob,i).then((s=>{if("close"!=o)switch(s.jobId){case 1:this.progress1_pid=s.result.pid;break;case 2:this.progress2_pid=s.result.pid}}))},createPool(){e.send(r.createPool,{number:3})},runJobByPool(s,o){let i={id:s,type:"timer",action:o};e.invoke(r.someJobByPool,i).then((s=>{switch(s.jobId){case 3:this.progress3_pid=s.result.pid;break;case 4:this.progress4_pid=s.result.pid;break;case 5:this.progress5_pid=s.result.pid;break;case 6:this.progress6_pid=s.result.pid}}))}}},_=s=>(u("data-v-71705fa7"),s=s(),c(),s),b={id:"app-base-jobs"},h=_((()=>l("div",{class:"one-block-1"},[l("span",null," 1. 任务 / 并发任务 ")],-1))),k={class:"one-block-2"},f=_((()=>l("p",null,null,-1))),m=_((()=>l("div",{class:"one-block-1"},[l("span",null," 2. 任务池 / 并发任务 ")],-1))),P={class:"one-block-2"},J=_((()=>l("p",null,null,-1))),v=_((()=>l("p",null,null,-1))),y=_((()=>l("p",null,null,-1))),C=_((()=>l("p",null,null,-1)));const B=s(g,[["render",function(s,e,r,u,c,g){const _=o("a-button"),B=o("a-space");return i(),p("div",b,[h,l("div",k,[d(B,null,{default:t((()=>[d(_,{onClick:e[0]||(e[0]=s=>g.runJob(1,"create"))},{default:t((()=>[a("执行任务1")])),_:1}),a(" 进度："+n(c.progress1)+" ， 进程pid："+n(c.progress1_pid)+" ",1),d(_,{onClick:e[1]||(e[1]=s=>g.runJob(1,"close"))},{default:t((()=>[a("关闭")])),_:1})])),_:1}),f,d(B,null,{default:t((()=>[d(_,{onClick:e[2]||(e[2]=s=>g.runJob(2,"create"))},{default:t((()=>[a("执行任务2")])),_:1}),a(" 进度："+n(c.progress2)+" ， 进程pid："+n(c.progress2_pid)+" ",1),d(_,{onClick:e[3]||(e[3]=s=>g.runJob(2,"close"))},{default:t((()=>[a("关闭")])),_:1})])),_:1})]),m,l("div",P,[d(B,null,{default:t((()=>[d(_,{onClick:e[4]||(e[4]=s=>g.createPool())},{default:t((()=>[a("创建进程池")])),_:1}),a(" 进程pids："+n(c.processPids),1)])),_:1}),J,d(B,null,{default:t((()=>[d(_,{onClick:e[5]||(e[5]=s=>g.runJobByPool(3,"run"))},{default:t((()=>[a("执行任务3")])),_:1}),a(" 进度："+n(c.progress3)+" ，进程pid："+n(c.progress3_pid),1)])),_:1}),v,d(B,null,{default:t((()=>[d(_,{onClick:e[6]||(e[6]=s=>g.runJobByPool(4,"run"))},{default:t((()=>[a("执行任务4")])),_:1}),a(" 进度："+n(c.progress4)+" ，进程pid："+n(c.progress4_pid),1)])),_:1}),y,d(B,null,{default:t((()=>[d(_,{onClick:e[7]||(e[7]=s=>g.runJobByPool(5,"run"))},{default:t((()=>[a("执行任务5")])),_:1}),a(" 进度："+n(c.progress5)+" ，进程pid："+n(c.progress5_pid),1)])),_:1}),C,d(B,null,{default:t((()=>[d(_,{onClick:e[8]||(e[8]=s=>g.runJobByPool(6,"run"))},{default:t((()=>[a("执行任务6")])),_:1}),a(" 进度："+n(c.progress6)+" ，进程pid："+n(c.progress6_pid),1)])),_:1})])])}],["__scopeId","data-v-71705fa7"]]);export{B as default};
