1 line
4.8 KiB
JavaScript
1 line
4.8 KiB
JavaScript
"use strict";(self["webpackChunkx_php_admin"]=self["webpackChunkx_php_admin"]||[]).push([[732],{3732:function(e,t,l){l.r(t),l.d(t,{default:function(){return _}});var i=l(6252),s=l(3577);const a=e=>((0,i.dD)("data-v-116ca45f"),e=e(),(0,i.Cn)(),e),o=a((()=>(0,i._)("p",null,"添加计划任务",-1))),n=a((()=>(0,i._)("h4",null,"执行类",-1))),d=a((()=>(0,i._)("h4",null,"定时规则",-1))),u={class:"bottom"},r={class:"state"},c={class:"handler"};function m(e,t,l,a,m,p){const h=(0,i.up)("el-icon-plus"),g=(0,i.up)("el-icon"),f=(0,i.up)("el-card"),w=(0,i.up)("el-col"),_=(0,i.up)("el-tag"),k=(0,i.up)("el-button"),v=(0,i.up)("el-popconfirm"),b=(0,i.up)("el-dropdown-item"),$=(0,i.up)("el-dropdown-menu"),W=(0,i.up)("el-dropdown"),y=(0,i.up)("el-row"),C=(0,i.up)("el-main"),x=(0,i.up)("save-dialog"),D=(0,i.up)("logs"),z=(0,i.up)("el-drawer");return(0,i.wg)(),(0,i.iD)(i.HY,null,[(0,i.Wm)(C,null,{default:(0,i.w5)((()=>[(0,i.Wm)(y,{gutter:15},{default:(0,i.w5)((()=>[(0,i.Wm)(w,{xl:6,lg:6,md:8,sm:12,xs:24},{default:(0,i.w5)((()=>[(0,i.Wm)(f,{class:"task task-add",shadow:"never",onClick:p.add},{default:(0,i.w5)((()=>[(0,i.Wm)(g,null,{default:(0,i.w5)((()=>[(0,i.Wm)(h)])),_:1}),o])),_:1},8,["onClick"])])),_:1}),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(m.list,(e=>((0,i.wg)(),(0,i.j4)(w,{xl:6,lg:6,md:8,sm:12,xs:24,key:e.id},{default:(0,i.w5)((()=>[(0,i.Wm)(f,{class:"task task-item",shadow:"hover"},{default:(0,i.w5)((()=>[(0,i._)("h2",null,(0,s.zw)(e.title),1),(0,i._)("ul",null,[(0,i._)("li",null,[n,(0,i._)("p",null,(0,s.zw)(e.type),1)]),(0,i._)("li",null,[d,(0,i._)("p",null,[(0,i.Uk)((0,s.zw)(e.schedule)+" ",1),(0,i._)("code",null,"("+(0,s.zw)(e.executetime)+")",1)])])]),(0,i._)("div",u,[(0,i._)("div",r,["1"==e.status?((0,i.wg)(),(0,i.j4)(_,{key:0,size:"small"},{default:(0,i.w5)((()=>[(0,i.Uk)("准备就绪")])),_:1})):(0,i.kq)("",!0),"0"==e.status?((0,i.wg)(),(0,i.j4)(_,{key:1,size:"small",type:"info"},{default:(0,i.w5)((()=>[(0,i.Uk)("停用")])),_:1})):(0,i.kq)("",!0)]),(0,i._)("div",c,[(0,i.Wm)(v,{title:"立即执行吗?",onConfirm:t=>p.run(e)},{reference:(0,i.w5)((()=>[(0,i.Wm)(k,{type:"primary",icon:"el-icon-caret-right",circle:""})])),_:2},1032,["onConfirm"]),(0,i.Wm)(W,{trigger:"click"},{dropdown:(0,i.w5)((()=>[(0,i.Wm)($,null,{default:(0,i.w5)((()=>[(0,i.Wm)(b,{onClick:t=>p.edit(e)},{default:(0,i.w5)((()=>[(0,i.Uk)("编辑")])),_:2},1032,["onClick"]),(0,i.Wm)(b,{onClick:t=>p.logs(e)},{default:(0,i.w5)((()=>[(0,i.Uk)("日志")])),_:2},1032,["onClick"]),(0,i.Wm)(b,{onClick:t=>p.crontabdelete(e),divided:""},{default:(0,i.w5)((()=>[(0,i.Uk)("删除")])),_:2},1032,["onClick"])])),_:2},1024)])),default:(0,i.w5)((()=>[(0,i.Wm)(k,{type:"primary",icon:"el-icon-more",circle:"",plain:""})])),_:2},1024)])])])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1}),m.dialog.save?((0,i.wg)(),(0,i.j4)(x,{key:0,ref:"saveDialog",onSuccess:p.handleSuccess,onClosed:t[0]||(t[0]=e=>m.dialog.save=!1)},null,8,["onSuccess"])):(0,i.kq)("",!0),(0,i.Wm)(z,{title:m.loginfo.title+"计划任务日志",modelValue:m.dialog.logsVisible,"onUpdate:modelValue":t[1]||(t[1]=e=>m.dialog.logsVisible=e),size:600,direction:"rtl","destroy-on-close":""},{default:(0,i.w5)((()=>[(0,i.Wm)(D,{ref:"logs"},null,512)])),_:1},8,["title","modelValue"])],64)}l(7658);var p=l(1005),h=l(2953),g={name:"crontab",components:{saveDialog:p["default"],logs:h["default"]},provide(){return{list:this.list}},data(){return{dialog:{save:!1,logsVisible:!1},list:[],loginfo:{},logslist:[]}},mounted(){this.loaddata()},methods:{loaddata(){this.$http.get("crontab/admin/lists").then((e=>{200!=e.code?this.$alert(e.message,"提示",{type:"error"}):this.list=e.data}))},add(){this.dialog.save=!0,this.$nextTick((()=>{this.$refs.saveDialog.open()}))},edit(e){this.dialog.save=!0,this.$nextTick((()=>{this.$refs.saveDialog.open("edit").setData(e)}))},crontabdelete(e){this.$confirm(`确认删除 ${e.title} 计划任务吗?`,"提示",{type:"warning",confirmButtonText:"删除",confirmButtonClass:"el-button--danger"}).then((()=>{this.$http.get("crontab/admin/delete").then((t=>{200!=t.code?this.$alert(t.message,"提示",{type:"error"}):this.list.splice(this.list.findIndex((t=>t.id===e.id)),1)}))})).catch((()=>{}))},logs(e){this.loginfo=e,this.dialog.logsVisible=!0,this.$nextTick((()=>{this.$refs.logs.setApi("crontab/admin/logs?id="+e.id)}))},run(e){this.$message.success(`已成功执行计划任务:${e.title}`)},handleSuccess(e,t){this.$http.post("crontab/admin/submit",{type:t,info:e}).then((l=>{if(this.$refs.saveDialog.isSaveing=!1,200==l.code)return l.data&&l.data.id?"add"==t?this.list.push(e):"edit"==t&&this.list.filter((t=>t.id===e.id)).forEach((t=>{Object.assign(t,e)})):this.loaddata({}),this.$refs.saveDialog.visible=!1,void this.$message.success(l.message||"操作成功");this.$alert(l.message||"错误","提示",{type:"error"})}))}}},f=l(3744);const w=(0,f.Z)(g,[["render",m],["__scopeId","data-v-116ca45f"]]);var _=w}}]); |