|
@@ -3,11 +3,12 @@ import { Component, OnInit, ViewChild } from '@angular/core';
|
|
import { _HttpClient, ModalHelper } from '@delon/theme';
|
|
import { _HttpClient, ModalHelper } from '@delon/theme';
|
|
import { STColumn, STComponent } from '@delon/abc';
|
|
import { STColumn, STComponent } from '@delon/abc';
|
|
import { SFSchema } from '@delon/form';
|
|
import { SFSchema } from '@delon/form';
|
|
-import { NzDrawerService, NzNotificationService } from 'ng-zorro-antd';
|
|
|
|
|
|
+import { NzDrawerService, NzNotificationService, NzModalService } from 'ng-zorro-antd';
|
|
import { TimedTaskService } from 'app/services/timed-task.service';
|
|
import { TimedTaskService } from 'app/services/timed-task.service';
|
|
import { TimedTask } from 'app/entity/timed-task';
|
|
import { TimedTask } from 'app/entity/timed-task';
|
|
import { SystemTimedTaskAddComponent } from './add/add.component';
|
|
import { SystemTimedTaskAddComponent } from './add/add.component';
|
|
import { EventManager } from '@angular/platform-browser';
|
|
import { EventManager } from '@angular/platform-browser';
|
|
|
|
+import { SystemTimedTaskUpdateModelComponent } from './update-model/update-model.component';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-system-timed-task',
|
|
selector: 'app-system-timed-task',
|
|
@@ -21,15 +22,13 @@ import { EventManager } from '@angular/platform-browser';
|
|
* Copyright 2019 上海翠颠信息科技有限公司. All Rights Reserved.
|
|
* Copyright 2019 上海翠颠信息科技有限公司. All Rights Reserved.
|
|
*/
|
|
*/
|
|
export class SystemTimedTaskComponent implements OnInit {
|
|
export class SystemTimedTaskComponent implements OnInit {
|
|
-
|
|
|
|
- listOfData = [];//任务列表
|
|
|
|
|
|
+ listOfData = []; //任务列表
|
|
page = {
|
|
page = {
|
|
total: 0,
|
|
total: 0,
|
|
- current: 0
|
|
|
|
|
|
+ current: 0,
|
|
};
|
|
};
|
|
|
|
|
|
-
|
|
|
|
- timedTask: TimedTask;//查询条件
|
|
|
|
|
|
+ timedTask: TimedTask; //查询条件
|
|
isSpinning = false;
|
|
isSpinning = false;
|
|
|
|
|
|
constructor(
|
|
constructor(
|
|
@@ -37,34 +36,33 @@ export class SystemTimedTaskComponent implements OnInit {
|
|
private drawerService: NzDrawerService,
|
|
private drawerService: NzDrawerService,
|
|
private notification: NzNotificationService,
|
|
private notification: NzNotificationService,
|
|
private i18NService: I18NService,
|
|
private i18NService: I18NService,
|
|
- private eventManager: EventManager
|
|
|
|
- ) { }
|
|
|
|
|
|
+ private eventManager: EventManager,
|
|
|
|
+ private modalService: NzModalService,
|
|
|
|
+ ) {}
|
|
|
|
|
|
ngOnInit() {
|
|
ngOnInit() {
|
|
- this.timedTask = {//初始化查询条件
|
|
|
|
- jobClassName: "",
|
|
|
|
- cronExpression: "",
|
|
|
|
- parameter: "",
|
|
|
|
- description: "",
|
|
|
|
- pageNo: 0
|
|
|
|
- }
|
|
|
|
|
|
+ this.timedTask = {
|
|
|
|
+ //初始化查询条件
|
|
|
|
+ jobClassName: '',
|
|
|
|
+ cronExpression: '',
|
|
|
|
+ parameter: '',
|
|
|
|
+ description: '',
|
|
|
|
+ pageNo: 0,
|
|
|
|
+ };
|
|
this.list(1);
|
|
this.list(1);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
// 获取分页编号模式列表
|
|
// 获取分页编号模式列表
|
|
list(pageNo) {
|
|
list(pageNo) {
|
|
this.isSpinning = true;
|
|
this.isSpinning = true;
|
|
- this.timedTask.pageNo = pageNo;//当前页码
|
|
|
|
- this.timedTaskService.list(this.timedTask).then((response) => {
|
|
|
|
|
|
+ this.timedTask.pageNo = pageNo; //当前页码
|
|
|
|
+ this.timedTaskService.list(this.timedTask).then(response => {
|
|
this.listOfData = response.result.records;
|
|
this.listOfData = response.result.records;
|
|
this.page = response.result;
|
|
this.page = response.result;
|
|
this.isSpinning = false;
|
|
this.isSpinning = false;
|
|
- })
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
// 翻页事件
|
|
// 翻页事件
|
|
pageIndexChange(event) {
|
|
pageIndexChange(event) {
|
|
this.list(event);
|
|
this.list(event);
|
|
@@ -74,8 +72,8 @@ export class SystemTimedTaskComponent implements OnInit {
|
|
add() {
|
|
add() {
|
|
const drawerRef = this.drawerService.create<SystemTimedTaskAddComponent, { value: string }, string>({
|
|
const drawerRef = this.drawerService.create<SystemTimedTaskAddComponent, { value: string }, string>({
|
|
nzTitle: this.i18NService.fanyi('TimedTask.Pages.Add.title'),
|
|
nzTitle: this.i18NService.fanyi('TimedTask.Pages.Add.title'),
|
|
- nzWidth: "600px",
|
|
|
|
- nzContent: SystemTimedTaskAddComponent
|
|
|
|
|
|
+ nzWidth: '600px',
|
|
|
|
+ nzContent: SystemTimedTaskAddComponent,
|
|
});
|
|
});
|
|
//关闭的回调函数
|
|
//关闭的回调函数
|
|
drawerRef.afterClose.subscribe(() => {
|
|
drawerRef.afterClose.subscribe(() => {
|
|
@@ -85,21 +83,22 @@ export class SystemTimedTaskComponent implements OnInit {
|
|
|
|
|
|
//修改
|
|
//修改
|
|
edit(id) {
|
|
edit(id) {
|
|
- this.timedTaskService.queryById(id).then((respon) => {
|
|
|
|
- if (respon.success) {//判断是否返回数据
|
|
|
|
|
|
+ this.timedTaskService.queryById(id).then(respon => {
|
|
|
|
+ if (respon.success) {
|
|
|
|
+ //判断是否返回数据
|
|
console.log(respon);
|
|
console.log(respon);
|
|
const drawerRef = this.drawerService.create<SystemTimedTaskAddComponent, { timedTask: TimedTask }, string>({
|
|
const drawerRef = this.drawerService.create<SystemTimedTaskAddComponent, { timedTask: TimedTask }, string>({
|
|
nzTitle: this.i18NService.fanyi('TimedTask.Pages.Edit.title'),
|
|
nzTitle: this.i18NService.fanyi('TimedTask.Pages.Edit.title'),
|
|
- nzWidth: "600px",
|
|
|
|
|
|
+ nzWidth: '600px',
|
|
nzContent: SystemTimedTaskAddComponent,
|
|
nzContent: SystemTimedTaskAddComponent,
|
|
nzContentParams: {
|
|
nzContentParams: {
|
|
//params
|
|
//params
|
|
- timedTask: respon.result
|
|
|
|
- }
|
|
|
|
|
|
+ timedTask: respon.result,
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
|
|
//关闭的回调函数
|
|
//关闭的回调函数
|
|
- drawerRef.afterClose.subscribe((isload) => {
|
|
|
|
|
|
+ drawerRef.afterClose.subscribe(isload => {
|
|
if (isload) {
|
|
if (isload) {
|
|
//刷新表中的数据
|
|
//刷新表中的数据
|
|
this.list(this.page.current);
|
|
this.list(this.page.current);
|
|
@@ -111,18 +110,54 @@ export class SystemTimedTaskComponent implements OnInit {
|
|
|
|
|
|
//删除
|
|
//删除
|
|
delete(id) {
|
|
delete(id) {
|
|
- this.timedTaskService.delete(id).then((response) => {
|
|
|
|
|
|
+ this.timedTaskService.delete(id).then(response => {
|
|
if (response.success) {
|
|
if (response.success) {
|
|
- this.notification.success(this.i18NService.fanyi("successful.deletion"), "");
|
|
|
|
|
|
+ this.notification.success(this.i18NService.fanyi('successful.deletion'), '');
|
|
this.list(this.page.current);
|
|
this.list(this.page.current);
|
|
} else {
|
|
} else {
|
|
- this.notification.success(this.i18NService.fanyi("delete.failed"), response.message);
|
|
|
|
|
|
+ this.notification.success(this.i18NService.fanyi('delete.failed'), response.message);
|
|
}
|
|
}
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- cancelDel() {
|
|
|
|
-
|
|
|
|
|
|
+ cancelDel() {}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 直接修改定时规则
|
|
|
|
+ */
|
|
|
|
+ editDirect(data) {
|
|
|
|
+ const modalRef = this.modalService.create({
|
|
|
|
+ nzTitle: '修改定时规则',
|
|
|
|
+ nzContent: SystemTimedTaskUpdateModelComponent,
|
|
|
|
+ nzWidth: 900,
|
|
|
|
+ nzFooter: [
|
|
|
|
+ {
|
|
|
|
+ label: this.i18NService.fanyi('button.cancel'),
|
|
|
|
+ type: 'default',
|
|
|
|
+ onClick: addModel => {
|
|
|
|
+ addModel.close();
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: this.i18NService.fanyi('determine'),
|
|
|
|
+ type: 'primary',
|
|
|
|
+ onClick: addModel => {
|
|
|
|
+
|
|
|
|
+ addModel.submitForm().then(() => {
|
|
|
|
+ data.cronExpression = addModel.cronExpression; //获取定时规则
|
|
|
|
+ //修改
|
|
|
|
+ this.timedTaskService.edit(data).then(response => {
|
|
|
|
+ if (response.success === true) {
|
|
|
|
+ addModel.close();
|
|
|
|
+ alert(this.i18NService.fanyi('successful.revision'));
|
|
|
|
+ this.list(this.page.current)
|
|
|
|
+ } else {
|
|
|
|
+ alert(this.i18NService.fanyi('modification.failed'));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ });
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|