加入定时任务

This commit is contained in:
java110 2020-06-01 19:10:54 +08:00
parent b698028a26
commit 613a383134
2 changed files with 202 additions and 0 deletions

View File

@ -0,0 +1,129 @@
<div>
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>查询条件</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="请输入任务ID" v-model="jobManageInfo.conditions.taskId"
class=" form-control">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="请输入任务名称" v-model="jobManageInfo.conditions.taskName"
class=" form-control">
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<input type="text" placeholder="请选择定时器类型" v-model="jobManageInfo.conditions.taskType"
class=" form-control">
</div>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryJobMethod()">
<i class="fa fa-search"></i> 查询
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>映射信息</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddJobModal()">
<i class="fa fa-plus"></i>
添加
</button>
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center">任务ID</th>
<th class="text-center">任务名称</th>
<th class="text-center">运行时间</th>
<th class="text-center">任务类型</th>
<th class="text-center">创建时间</th>
<th class="text-center">运行状态</th>
<th class="text-center">启停状态</th>
<th class="text-center">线程数</th>
<th class="text-right">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="job in jobManageInfo.Jobs">
<td class="text-center">{{job.taskId}}</td>
<td class="text-center">{{job.taskName}}</td>
<td class="text-center">{{job.taskTaskcron}}</td>
<td class="text-center">{{job.taskUOrDName}}</td>
<td class="text-center">{{job.taskCreateDate}}</td>
<td class="text-center">{{job.taskRunState}}</td>
<td class="text-center">{{job.taskRunState}}</td>
<td class="text-center">{{job.taskTnum}}</td>
<td class="text-right">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openEditJobModel(job)">
启动
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDeleteJobModel(job)">
停止
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openEditJobModel(job)">
修改
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDeleteJobModel(job)">
删除
</button>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
<vc:create path="dev/addJob"></vc:create>
<vc:create path="dev/editJob"></vc:create>
<vc:create path="dev/deleteJob"></vc:create>
</div>

View File

@ -0,0 +1,73 @@
/**
入驻小区
**/
(function(vc){
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data:{
jobManageInfo:{
jobs:[],
name:'',
total:0,
records:1,
conditions:{
taskId:'',
taskName:'',
taskType:''
}
}
},
_initMethod:function(){
vc.component._listJobs(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent:function(){
vc.on('jobManage','listJob',function(_param){
vc.component._listJobs(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination','page_event',function(_currentPage){
vc.component._listJobs(_currentPage,DEFAULT_ROWS);
});
},
methods:{
_listJobs:function(_page, _rows){
vc.component.jobManageInfo.conditions.page = _page;
vc.component.jobManageInfo.conditions.row = _rows;
var param = {
params:vc.component.jobManageInfo.conditions
};
//发送get请求
vc.http.get('jobManage',
'list',
param,
function(json,res){
var _jobManageInfo=JSON.parse(json);
vc.component.jobManageInfo.total = _jobManageInfo.total;
vc.component.jobManageInfo.records = _jobManageInfo.records;
vc.component.jobManageInfo.jobs = _jobManageInfo.jobs;
vc.emit('pagination','init',{
total:vc.component.jobManageInfo.records,
currentPage:_page
});
},function(errInfo,error){
console.log('请求失败处理');
}
);
},
_openAddJobModal:function(){
vc.emit('addJob','openAddJobModal',{});
},
_openEditJobModel:function(_job){
vc.emit('editJob','openEditJobModal',_job);
},
_openDeleteJobModel:function(_job){
vc.emit('deleteJob','openDeleteJobModal',_job);
},
_queryJobMethod:function(){
vc.component._listJobs(DEFAULT_PAGE, DEFAULT_ROWS);
}
}
});
})(window.vc);