fix(测试计划): 鼠标悬停在开关上未展示下次执行时间和运行规则

--bug=1010303 --user=李敏 鼠标悬停在开关上未展示下次执行时间和运行规则 https://www.tapd.cn/55049933/s/1105634
This commit is contained in:
limin-fit2 2022-02-18 11:53:34 +08:00 committed by jianxing
parent 3547abdbdb
commit 12c1b616ad
4 changed files with 34 additions and 1 deletions

View File

@ -287,4 +287,9 @@ public class TestPlanController {
public long countByScheduleEnableTotal(@RequestBody QueryTestPlanRequest request) { public long countByScheduleEnableTotal(@RequestBody QueryTestPlanRequest request) {
return testPlanService.countScheduleEnableTotal(request); return testPlanService.countScheduleEnableTotal(request);
} }
@PostMapping(value = "/update/scheduleByEnable")
public ScheduleDTO updateTestPlanBySchedule(@RequestBody ScheduleInfoRequest request) {
return testPlanService.updateTestPlanBySchedule(request);
}
} }

View File

@ -0,0 +1,14 @@
package io.metersphere.track.dto;
import io.metersphere.base.domain.Schedule;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ScheduleDTO extends Schedule {
/**
* 定时任务下一次执行时间
*/
private Long scheduleExecuteTime;
}

View File

@ -2039,4 +2039,16 @@ public class TestPlanService {
Date time1 = trigger.getFireTimeAfter(time0); Date time1 = trigger.getFireTimeAfter(time0);
return time1.getTime(); return time1.getTime();
} }
public ScheduleDTO updateTestPlanBySchedule(ScheduleInfoRequest request) {
ScheduleDTO scheduleDTO = new ScheduleDTO();
Schedule schedule = scheduleService.getSchedule(request.getTaskID());
schedule.setEnable(request.isEnable());
apiAutomationService.updateSchedule(schedule);
BeanUtils.copyBean(scheduleDTO, schedule);
if (schedule.getEnable() != null && schedule.getEnable()) {
scheduleDTO.setScheduleExecuteTime(getNextTriggerTime(schedule.getValue()));
}
return scheduleDTO;
}
} }

View File

@ -628,9 +628,11 @@ export default {
cancelButtonText: this.$t('commons.cancel'), cancelButtonText: this.$t('commons.cancel'),
type: 'warning', type: 'warning',
}).then(() => { }).then(() => {
this.result = this.$post('/test/plan/schedule/updateEnableByPrimyKey', param, () => { this.result = this.$post('/test/plan/update/scheduleByEnable', param, response => {
if (row.scheduleOpen) { if (row.scheduleOpen) {
row.scheduleStatus = 'OPEN' row.scheduleStatus = 'OPEN'
row.scheduleCorn = response.data.value;
row.scheduleExecuteTime = response.data.scheduleExecuteTime;
} else { } else {
row.scheduleStatus = 'SHUT' row.scheduleStatus = 'SHUT'
} }