1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
| /**
| * 任务管理初始化
| */
| var Job = {
| id: "JobTable", //表格id
| seItem: null, //选中的条目
| table: null,
| layerIndex: -1
| };
|
| /**
| * 表格按钮
| */
| Job.operateFormatter = function (value, row, index) {
| return [
| '<button type="button" class="pause btn btn-warning btn-sm" style="margin-right:5px;">暂停</button>',
| '<button type="button" class="resume btn btn-info btn-sm" style="margin-right:5px;">恢复</button>',
| '<button type="button" class="delete btn btn-danger btn-sm" style="margin-right:5px;">删除</button>',
| '<button type="button" class="edit btn btn-primary btn-sm">修改</button>'
|
| ].join('');
| }
| window.operateEvents = {
| 'click .pause': function (e, value, row, index) {
| var ajax = new $ax(Feng.ctxPath + "/job/pauseJob", function (data) {
| Feng.success("暂停成功!");
| Job.table.refresh();
| }, function (data) {
| Feng.error("暂停失败!");
| });
| ajax.set("jobClassName", row.jobClassName);
| ajax.set("jobGroupName", row.jobGroup);
| ajax.start();
| },
| 'click .resume': function (e, value, row, index) {
| var ajax = new $ax(Feng.ctxPath + "/job/resumeJob", function (data) {
| Feng.success("继续成功!");
| Job.table.refresh();
| }, function (data) {
| Feng.error("继续失败!");
| });
| ajax.set("jobClassName", row.jobClassName);
| ajax.set("jobGroupName", row.jobGroup);
| ajax.start();
| },
| 'click .delete': function (e, value, row, index) {
| var operation = function () {
| var ajax = new $ax(Feng.ctxPath + "/job/deleteJob", function (data) {
| Feng.success("删除成功!");
| Job.table.refresh();
| }, function (data) {
| Feng.error("删除失败!");
| });
| ajax.set("jobClassName", row.jobClassName);
| ajax.set("jobGroupName", row.jobGroup);
| ajax.start();
| };
| Feng.confirm("是否删除该任务?", operation);
| },
| 'click .edit': function (e, value, row, index) {
| Job.openEditJob(row.desCription,row.jobClassName, row.jobGroup, row.cronExpression);
| }
| };
|
|
| /**
| * 初始化表格的列
| */
| Job.initColumn = function () {
| return [
| {field: 'selectItem', radio: true},
| {title: '任务名称', field: 'desCription', visible: true, align: 'left', valign: 'middle'},
| {title: '上次执行时间', field: 'prevFireTimeFormat', visible: true, align: 'center', valign: 'middle'},
| {title: '下次执行时间', field: 'nextFireTimeFormat', visible: true, align: 'left', valign: 'middle'},
| {title: 'cron表达式', field: 'cronExpression', visible: true, align: 'center', valign: 'middle'},
| {title: '时区', field: 'timeZoneId', visible: true, align: 'center', valign: 'middle'},
| {title: '状态', field: 'statusName', visible: true, align: 'center', valign: 'middle'},
| {
| title: '操作',
| field: 'operate',
| align: 'center',
| width: 240,
| events: operateEvents,
| formatter: Job.operateFormatter
| }
| ];
| };
|
| /**
| * 打开新增任务界面
| */
| Job.openAddJob = function () {
| var index = layer.open({
| type: 2,
| title: '添加任务',
| area: ['800px', '500px'], //宽高
| fix: false, //不固定
| maxmin: true,
| content: Feng.ctxPath + '/job/job_add'
| });
| this.layerIndex = index;
| };
|
| /**
| * 打开修改任务界面
| */
| Job.openEditJob = function (description,jobClassName, jobGroup, cronExpression) {
| var index = layer.open({
| type: 2,
| title: '编辑任务',
| area: ['800px', '500px'], //宽高
| fix: false, //不固定
| maxmin: true,
| content: Feng.ctxPath + '/job/job_edit?description='+description+'&jobClassName=' + jobClassName + '&jobGroupName=' + jobGroup + '&cronExpression=' + cronExpression
| });
| this.layerIndex = index;
| };
|
|
| $(function () {
| var defaultColunms = Job.initColumn();
| var table = new BSTable(Job.id, "/job/list", defaultColunms);
| table.setPaginationType("client");
| Job.table = table.init();
| });
|
|