import{d as Q,O as Z,n as O,r as f,f as ee,q as te,N as l,h as u,c as h,e as i,w as o,a as p,t as m,u as n,i as c,y as $,I as _,F as T,G as D,B as b,a8 as ae,E as le,ar as oe,ah as ne,aj as ie,at as se,$ as re,as as me,aF as de,X as ue,W as pe,az as ce,aA as _e,Y as fe,aa as ye,a0 as ge,_ as ve}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-form-item-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css */import{a4 as we,a5 as ke,a6 as he,S as be,a7 as xe,a8 as Ve,a9 as Ce}from"./sys-8ead7f22.js";import{_ as Ee}from"./cron-info.vue_vue_type_script_setup_true_lang-13e7b8d6.js";const Te={class:"main-container"},De={class:"flex justify-between items-center mb-[20px]"},Ue={class:"text-[20px]"},Be={class:"flex items-center"},ze={class:"mt-2"},Fe={class:"mt-[20px]"},Le={class:"mt-[16px] flex justify-end"},Re={class:"flex"},Ne={class:"input-width flex items-center text-sm"},Oe={class:"dialog-footer"},$e=Q({__name:"schedule",setup(Pe){const P=Z().meta.title,s=O({page:1,limit:10,total:0,loading:!0,data:[],searchParam:{title:"",type:"",last_time:""}}),U=f([]),B=f([]),z=f([]);f(),(async()=>{U.value=await(await we()).data,B.value=await(await ke()).data,z.value=await(await he()).data})();const g=(r=1)=>{s.loading=!0,s.page=r,be({page:s.page,limit:s.limit,...s.searchParam}).then(a=>{s.loading=!1,s.data=a.data.data,s.total=a.data.total}).catch(()=>{s.loading=!1})};g(),ee();const w=f(!1),e=O({...{id:0,key:"",status:2,time:{type:"min",week:"",day:"",hour:"",min:""}}}),F=f(),S=()=>{e.id=0,e.key="",e.status=2,e.time.type="min",e.time.week="",e.time.day="",e.time.hour="",e.time.min="",w.value=!0},j=te(()=>({key:[{required:!0,message:l("titlePlaceholder"),trigger:"blur"}],timeDate:[{required:!0,validator:I,trigger:"blur"}]})),I=(r,a,d)=>e.time.type=="min"&&e.time.min!=""||e.time.type=="week"&&e.time.week!=""&&e.time.hour!=""&&e.time.min!=""||e.time.type=="month"&&e.time.day!=""&&e.time.hour!=""&&e.time.min!=""||e.time.type=="day"&&e.time.day!=""&&e.time.hour!=""&&e.time.min!=""||e.time.type=="hour"&&e.time.hour!=""&&e.time.min!=""?d():d(new Error(l("cronTimeTips"))),k=f(!1),q=async r=>{k.value||!r||await r.validate(async a=>{if(a){k.value=!0;const d=e;(e.id>0?xe:Ve)(d).then(v=>{k.value=!1,w.value=!1,g()}).catch(()=>{k.value=!1})}})},A=r=>{e.id=r.id,e.key=r.key,e.status=r.status,e.time=r.time,w.value=!0},G=r=>{ae.confirm(l("cronDeleteTips"),l("warning"),{confirmButtonText:l("confirm"),cancelButtonText:l("cancel"),type:"warning"}).then(()=>{Ce(r).then(()=>{g()}).catch(()=>{})})},W=f(null);return(r,a)=>{const d=le,L=oe,v=ne,M=ie,X=se,Y=re,x=me,V=de,C=ue,E=pe,R=ce,H=_e,J=fe,K=ye,N=ge;return u(),h("div",Te,[i(Y,{class:"box-card !border-none",shadow:"never"},{default:o(()=>[p("div",De,[p("span",Ue,m(n(P)),1),i(d,{type:"primary",onClick:S},{default:o(()=>[c(m(n(l)("addCron")),1)]),_:1})]),i(L,{class:"warm-prompt",type:"info"},{default:o(()=>[p("div",Be,[p("div",null,[p("p",null,m(n(l)("cronTipsOne")),1),p("p",ze,m(n(l)("cronTipsTwo")),1)])])]),_:1}),p("div",Fe,[$((u(),_(M,{data:s.data,size:"large"},{empty:o(()=>[p("span",null,m(s.loading?"":n(l)("emptyData")),1)]),default:o(()=>[i(v,{prop:"name",label:n(l)("title"),"min-width":"150"},null,8,["label"]),i(v,{prop:"key",label:n(l)("key"),"min-width":"150"},null,8,["label"]),i(v,{label:n(l)("crondType"),"min-width":"150"},{default:o(({row:t})=>[c(m(t.crontab_content),1)]),_:1},8,["label"]),i(v,{prop:"status_name",label:n(l)("openStatus"),"min-width":"100"},null,8,["label"]),i(v,{label:n(l)("operation"),align:"right",fixed:"right",width:"130"},{default:o(({row:t})=>[i(d,{type:"primary",link:"",onClick:y=>A(t)},{default:o(()=>[c(m(n(l)("edit")),1)]),_:2},1032,["onClick"]),i(d,{type:"primary",link:"",onClick:y=>G(t.id)},{default:o(()=>[c(m(n(l)("delete")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"])]),_:1},8,["data"])),[[N,s.loading]]),p("div",Le,[i(X,{"current-page":s.page,"onUpdate:current-page":a[0]||(a[0]=t=>s.page=t),"page-size":s.limit,"onUpdate:page-size":a[1]||(a[1]=t=>s.limit=t),layout:"total, sizes, prev, pager, next, jumper",total:s.total,onSizeChange:a[2]||(a[2]=t=>g()),onCurrentChange:g},null,8,["current-page","page-size","total"])])])]),_:1}),i(Ee,{ref_key:"cronDialog",ref:W,onComplete:g},null,512),i(K,{modelValue:w.value,"onUpdate:modelValue":a[11]||(a[11]=t=>w.value=t),title:n(l)("editCron"),width:"750px","destroy-on-close":!0},{footer:o(()=>[p("span",Oe,[i(d,{type:"primary",onClick:a[10]||(a[10]=t=>q(F.value))},{default:o(()=>[c(m(n(l)("confirm")),1)]),_:1})])]),default:o(()=>[$((u(),_(J,{model:e,"label-width":"110px",ref_key:"formRef",ref:F,rules:n(j),class:"page-form"},{default:o(()=>[i(C,{label:n(l)("cronTemplate"),class:"items-center",prop:"key"},{default:o(()=>[i(V,{modelValue:e.key,"onUpdate:modelValue":a[3]||(a[3]=t=>e.key=t)},{default:o(()=>[(u(!0),h(T,null,D(U.value,t=>(u(),_(x,{key:t.key,label:t.name,value:t.key},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),i(C,{label:n(l)("cronTime"),prop:"timeDate"},{default:o(()=>[i(V,{modelValue:e.time.type,"onUpdate:modelValue":a[4]||(a[4]=t=>e.time.type=t),class:"w-[150px]"},{default:o(()=>[(u(!0),h(T,null,D(B.value,(t,y)=>(u(),_(x,{key:y,label:t,value:y},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),p("div",Re,[e.time.type=="week"?(u(),_(V,{key:0,modelValue:e.time.week,"onUpdate:modelValue":a[5]||(a[5]=t=>e.time.week=t),class:"ml-2 w-[120px]"},{default:o(()=>[(u(!0),h(T,null,D(z.value,(t,y)=>(u(),_(x,{key:y,label:t,value:y},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):b("",!0),["month","day"].indexOf(e.time.type)!=-1?(u(),_(E,{key:1,modelValue:e.time.day,"onUpdate:modelValue":a[6]||(a[6]=t=>e.time.day=t),class:"ml-2 w-[120px]"},{append:o(()=>[c(m(n(l)("day")),1)]),_:1},8,["modelValue"])):b("",!0),["month","day","hour","week"].indexOf(e.time.type)!=-1?(u(),_(E,{key:2,modelValue:e.time.hour,"onUpdate:modelValue":a[7]||(a[7]=t=>e.time.hour=t),class:"ml-2 w-[120px]"},{append:o(()=>[c(m(n(l)("hour")),1)]),_:1},8,["modelValue"])):b("",!0),["month","day","hour","week","min"].indexOf(e.time.type)!=-1?(u(),_(E,{key:3,modelValue:e.time.min,"onUpdate:modelValue":a[8]||(a[8]=t=>e.time.min=t),class:"ml-2 w-[120px]"},{append:o(()=>[c(m(n(l)("min")),1)]),_:1},8,["modelValue"])):b("",!0)])]),_:1},8,["label"]),i(C,{label:n(l)("isopen")},{default:o(()=>[p("div",Ne,[i(H,{modelValue:e.status,"onUpdate:modelValue":a[9]||(a[9]=t=>e.status=t)},{default:o(()=>[i(R,{label:1},{default:o(()=>[c(m(n(l)("yes")),1)]),_:1}),i(R,{label:2},{default:o(()=>[c(m(n(l)("no")),1)]),_:1})]),_:1},8,["modelValue"])])]),_:1},8,["label"])]),_:1},8,["model","rules"])),[[N,r.loading]])]),_:1},8,["modelValue","title"])])}}});const mt=ve($e,[["__scopeId","data-v-ef253c4a"]]);export{mt as default};