mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-12 13:05:13 +08:00
Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
8e4ada8e18
@ -25,7 +25,10 @@ import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.job.sechedule.ApiTestJob;
|
||||
import io.metersphere.notice.service.MailService;
|
||||
import io.metersphere.notice.service.NoticeService;
|
||||
import io.metersphere.service.*;
|
||||
import io.metersphere.service.FileService;
|
||||
import io.metersphere.service.QuotaService;
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import io.metersphere.service.UserService;
|
||||
import io.metersphere.track.service.TestCaseService;
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.constants.CommonConstants;
|
||||
@ -66,6 +69,7 @@ public class APITestService {
|
||||
@Resource
|
||||
private NoticeService noticeService;
|
||||
|
||||
|
||||
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
|
||||
|
||||
public List<APITestResult> list(QueryAPITestRequest request) {
|
||||
|
@ -258,7 +258,8 @@
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="io.metersphere.track.dto.TestCaseDTO">
|
||||
select test_case.* from test_case
|
||||
select <include refid="io.metersphere.base.mapper.TestCaseMapper.Base_Column_List"/>
|
||||
from test_case
|
||||
<where>
|
||||
<if test="request.combine != null">
|
||||
<include refid="combine">
|
||||
|
@ -53,13 +53,13 @@ public class TestResourcePoolController {
|
||||
|
||||
@GetMapping("list/all/valid")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
||||
public List<TestResourcePool> listValidResourcePools() {
|
||||
public List<TestResourcePoolDTO> listValidResourcePools() {
|
||||
return testResourcePoolService.listValidResourcePools();
|
||||
}
|
||||
|
||||
@GetMapping("list/quota/valid")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
||||
public List<TestResourcePool> listValidQuotaResourcePools() {
|
||||
public List<TestResourcePoolDTO> listValidQuotaResourcePools() {
|
||||
return testResourcePoolService.listValidQuotaResourcePools();
|
||||
}
|
||||
|
||||
|
@ -7,4 +7,5 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class QueryResourcePoolRequest {
|
||||
private String name;
|
||||
private String status;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
@ -57,7 +58,9 @@ public class DingTaskService {
|
||||
list.forEach(u -> {
|
||||
phoneList.add(u.getPhone());
|
||||
});
|
||||
at.setAtMobiles(phoneList);
|
||||
LogUtil.info("收件人地址" + phoneList);
|
||||
List<String> phoneLists = phoneList.stream().distinct().collect(Collectors.toList());
|
||||
at.setAtMobiles(phoneLists);
|
||||
request.setAt(at);
|
||||
OapiRobotSendResponse response = null;
|
||||
try {
|
||||
|
@ -37,6 +37,7 @@ import javax.mail.internet.MimeMessage;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
@ -111,8 +112,9 @@ public class MailService {
|
||||
list.forEach(u -> {
|
||||
emails.add(u.getEmail());
|
||||
});
|
||||
users = emails.toArray(new String[0]);
|
||||
LogUtil.info("收件人地址"+users);
|
||||
List<String> email = emails.stream().distinct().collect(Collectors.toList());
|
||||
users = email.toArray(new String[0]);
|
||||
LogUtil.info("收件人地址" + users);
|
||||
helper.setText(getContent(Template, context), true);
|
||||
helper.setTo(users);
|
||||
try {
|
||||
@ -144,9 +146,10 @@ public class MailService {
|
||||
}
|
||||
|
||||
public void sendCommentNotice(MessageDetail messageDetail, List<String> userIds, SaveCommentRequest request, TestCaseWithBLOBs testCaseWithBLOBs, String eventType) {
|
||||
User user = userMapper.selectByPrimaryKey(testCaseWithBLOBs.getMaintainer());
|
||||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
Map<String, String> context = new HashMap<>();
|
||||
context.put("maintainer", testCaseWithBLOBs.getMaintainer());
|
||||
context.put("maintainer", user.getName());
|
||||
context.put("testCaseName", testCaseWithBLOBs.getName());
|
||||
context.put("description", request.getDescription());
|
||||
context.put("url", baseSystemConfigDTO.getUrl());
|
||||
@ -184,7 +187,9 @@ public class MailService {
|
||||
list.forEach(u -> {
|
||||
emails.add(u.getEmail());
|
||||
});
|
||||
users = emails.toArray(new String[0]);
|
||||
List<String> email = emails.stream().distinct().collect(Collectors.toList());
|
||||
users = email.toArray(new String[0]);
|
||||
LogUtil.info("收件人地址" + users);
|
||||
helper.setText(getContent(Template, context), true);
|
||||
helper.setTo(users);
|
||||
if (users.length > 0) {
|
||||
@ -245,7 +250,9 @@ public class MailService {
|
||||
list.forEach(u -> {
|
||||
emails.add(u.getEmail());
|
||||
});
|
||||
users = emails.toArray(new String[0]);
|
||||
List<String> email = emails.stream().distinct().collect(Collectors.toList());
|
||||
users = email.toArray(new String[0]);
|
||||
LogUtil.info("收件人地址" + users);
|
||||
helper.setText(getContent(Template, context), true);
|
||||
helper.setTo(users);
|
||||
javaMailSender.send(mimeMessage);
|
||||
@ -280,7 +287,9 @@ public class MailService {
|
||||
list.forEach(u -> {
|
||||
emails.add(u.getEmail());
|
||||
});
|
||||
users = emails.toArray(new String[0]);
|
||||
List<String> email = emails.stream().distinct().collect(Collectors.toList());
|
||||
users = email.toArray(new String[0]);
|
||||
LogUtil.info("收件人地址" + users);
|
||||
helper.setText(getContent(Template, context), true);
|
||||
helper.setTo(users);
|
||||
javaMailSender.send(mimeMessage);
|
||||
@ -385,7 +394,7 @@ public class MailService {
|
||||
if (StringUtils.isNotBlank(context.get(k))) {
|
||||
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", context.get(k));
|
||||
} else {
|
||||
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", "");
|
||||
template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", "未设置");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,10 @@ import io.metersphere.base.domain.MessageTaskExample;
|
||||
import io.metersphere.base.mapper.MessageTaskMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtMessageMapper;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.notice.controller.request.MessageRequest;
|
||||
import io.metersphere.notice.domain.MessageDetail;
|
||||
import io.metersphere.notice.domain.MessageSettingDetail;
|
||||
@ -49,6 +51,7 @@ public class NoticeService {
|
||||
long time = System.currentTimeMillis();
|
||||
String identification = UUID.randomUUID().toString();
|
||||
list.getUserIds().forEach(m -> {
|
||||
checkUserIdExist(m, list);
|
||||
MessageTask message = new MessageTask();
|
||||
message.setId(UUID.randomUUID().toString());
|
||||
message.setEvent(list.getEvent());
|
||||
@ -57,7 +60,7 @@ public class NoticeService {
|
||||
message.setType(list.getType());
|
||||
message.setWebhook(list.getWebhook());
|
||||
message.setIdentification(identification);
|
||||
message.setIsSet(list.getIsSet());
|
||||
message.setIsSet(false);
|
||||
message.setOrganizationId(orgId);
|
||||
message.setTestId(list.getTestId());
|
||||
message.setCreateTime(time);
|
||||
@ -65,6 +68,14 @@ public class NoticeService {
|
||||
});
|
||||
}
|
||||
|
||||
private void checkUserIdExist(String userId, MessageDetail list) {
|
||||
MessageTaskExample example = new MessageTaskExample();
|
||||
example.createCriteria().andUserIdEqualTo(userId).andEventEqualTo(list.getEvent()).andTypeEqualTo(list.getType()).andTaskTypeEqualTo(list.getTaskType()).andWebhookEqualTo(list.getWebhook());
|
||||
if (messageTaskMapper.countByExample(example) > 0) {
|
||||
MSException.throwException(Translator.get("message_task_already_exists"));
|
||||
}
|
||||
}
|
||||
|
||||
public List<MessageDetail> searchMessageSchedule(String testId) {
|
||||
List<MessageTask> messageTaskLists = extMessageMapper.searchMessageByTestId(testId);
|
||||
List<MessageDetail> scheduleMessageTask = new ArrayList<>();
|
||||
@ -116,10 +127,14 @@ public class NoticeService {
|
||||
messageDetail.setUserIds(new ArrayList<String>(userIds));
|
||||
MessageDetailList.add(messageDetail);
|
||||
});
|
||||
List<MessageDetail> jenkinsTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.JENKINS_TASK)).sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList());
|
||||
List<MessageDetail> testCasePlanTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.TEST_PLAN_TASK)).sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList());
|
||||
List<MessageDetail> reviewTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.REVIEW_TASK)).sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList());
|
||||
List<MessageDetail> defectTask = MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.DEFECT_TASK)).sorted(Comparator.comparing(MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList());
|
||||
List<MessageDetail> jenkinsTask = (MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.JENKINS_TASK)).sorted(Comparator.comparing(
|
||||
MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList());
|
||||
List<MessageDetail> testCasePlanTask = (MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.TEST_PLAN_TASK)).sorted(Comparator.comparing(
|
||||
MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList());
|
||||
List<MessageDetail> reviewTask = (MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.REVIEW_TASK)).sorted(Comparator.comparing(
|
||||
MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList());
|
||||
List<MessageDetail> defectTask = (MessageDetailList.stream().filter(a -> a.getTaskType().equals(NoticeConstants.DEFECT_TASK)).sorted(Comparator.comparing(
|
||||
MessageDetail::getCreateTime, Comparator.nullsLast(Long::compareTo)).reversed()).collect(Collectors.toList())).stream().distinct().collect(Collectors.toList());
|
||||
messageSettingDetail.setJenkinsTask(jenkinsTask);
|
||||
messageSettingDetail.setTestCasePlanTask(testCasePlanTask);
|
||||
messageSettingDetail.setReviewTask(reviewTask);
|
||||
|
@ -18,6 +18,7 @@ import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
@ -50,7 +51,9 @@ public class WxChatTaskService {
|
||||
list.forEach(u -> {
|
||||
phoneList.add(u.getPhone());
|
||||
});
|
||||
mentionedMobileList.addAll(phoneList);
|
||||
LogUtil.info("收件人地址" + phoneList);
|
||||
List<String> phoneLists = phoneList.stream().distinct().collect(Collectors.toList());
|
||||
mentionedMobileList.addAll(phoneLists);
|
||||
message.setMentionedMobileList(mentionedMobileList);
|
||||
try {
|
||||
SendResult result = WxChatbotClient.send(Webhook, message);
|
||||
|
@ -145,6 +145,9 @@ public class TestResourcePoolService {
|
||||
if (StringUtils.isNotBlank(request.getName())) {
|
||||
criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getStatus())) {
|
||||
criteria.andStatusEqualTo(request.getStatus());
|
||||
}
|
||||
example.setOrderByClause("update_time desc");
|
||||
List<TestResourcePool> testResourcePools = testResourcePoolMapper.selectByExample(example);
|
||||
List<TestResourcePoolDTO> testResourcePoolDTOS = new ArrayList<>();
|
||||
@ -232,7 +235,7 @@ public class TestResourcePoolService {
|
||||
return testResourcePoolMapper.selectByPrimaryKey(resourcePoolId);
|
||||
}
|
||||
|
||||
public List<TestResourcePool> listValidResourcePools() {
|
||||
public List<TestResourcePoolDTO> listValidResourcePools() {
|
||||
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
|
||||
List<TestResourcePoolDTO> testResourcePools = listResourcePools(request);
|
||||
// 重新校验 pool
|
||||
@ -249,16 +252,15 @@ public class TestResourcePoolService {
|
||||
testResourcePoolMapper.updateByPrimaryKeySelective(pool);
|
||||
}
|
||||
}
|
||||
TestResourcePoolExample example = new TestResourcePoolExample();
|
||||
example.createCriteria().andStatusEqualTo(ResourceStatusEnum.VALID.name());
|
||||
return testResourcePoolMapper.selectByExample(example);
|
||||
request.setStatus(VALID.name());
|
||||
return listResourcePools(request);
|
||||
}
|
||||
|
||||
public List<TestResourcePool> listValidQuotaResourcePools() {
|
||||
public List<TestResourcePoolDTO> listValidQuotaResourcePools() {
|
||||
return filterQuota(listValidResourcePools());
|
||||
}
|
||||
|
||||
private List<TestResourcePool> filterQuota(List<TestResourcePool> list) {
|
||||
private List<TestResourcePoolDTO> filterQuota(List<TestResourcePoolDTO> list) {
|
||||
QuotaService quotaService = CommonBeanFactory.getBean(QuotaService.class);
|
||||
if (quotaService != null) {
|
||||
Set<String> pools = quotaService.getQuotaResourcePools();
|
||||
|
@ -3,8 +3,10 @@ package io.metersphere.track.service;
|
||||
import io.metersphere.base.domain.TestCaseComment;
|
||||
import io.metersphere.base.domain.TestCaseCommentExample;
|
||||
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||
import io.metersphere.base.domain.User;
|
||||
import io.metersphere.base.mapper.TestCaseCommentMapper;
|
||||
import io.metersphere.base.mapper.TestCaseMapper;
|
||||
import io.metersphere.base.mapper.UserMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestCaseCommentMapper;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
@ -48,7 +50,8 @@ public class TestCaseCommentService {
|
||||
private NoticeService noticeService;
|
||||
@Resource
|
||||
private ExtTestCaseCommentMapper extTestCaseCommentMapper;
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
public void saveComment(SaveCommentRequest request) {
|
||||
TestCaseComment testCaseComment = new TestCaseComment();
|
||||
@ -97,6 +100,7 @@ public class TestCaseCommentService {
|
||||
}
|
||||
|
||||
private String getReviewContext(TestCaseComment testCaseComment, TestCaseWithBLOBs testCaseWithBLOBs) {
|
||||
User user = userMapper.selectByPrimaryKey(testCaseComment.getAuthor());
|
||||
Long startTime = testCaseComment.getCreateTime();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String start = null;
|
||||
@ -105,7 +109,7 @@ public class TestCaseCommentService {
|
||||
start = sdf.format(new Date(Long.parseLong(sTime)));
|
||||
}
|
||||
String context = "";
|
||||
context = "测试评审任务通知:" + testCaseComment.getAuthor() + "在" + start + "为" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription();
|
||||
context = "测试评审任务通知:" + user.getName() + "在" + start + "为" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription();
|
||||
return context;
|
||||
}
|
||||
|
||||
|
@ -572,10 +572,14 @@ public class TestCaseReviewService {
|
||||
String eTime = String.valueOf(endTime);
|
||||
if (!sTime.equals("null")) {
|
||||
start = sdf.format(new Date(Long.parseLong(sTime)));
|
||||
} else {
|
||||
start = "未设置";
|
||||
}
|
||||
String end = null;
|
||||
if (!eTime.equals("null")) {
|
||||
end = sdf.format(new Date(Long.parseLong(eTime)));
|
||||
} else {
|
||||
start = "未设置";
|
||||
}
|
||||
String context = "";
|
||||
if (StringUtils.equals(NoticeConstants.CREATE, type)) {
|
||||
|
@ -547,13 +547,13 @@ public class TestPlanService {
|
||||
if (!sTime.equals("null")) {
|
||||
start = sdf.format(new Date(Long.parseLong(sTime)));
|
||||
} else {
|
||||
start = "";
|
||||
start = "未设置";
|
||||
}
|
||||
String end = null;
|
||||
if (!eTime.equals("null")) {
|
||||
end = sdf.format(new Date(Long.parseLong(eTime)));
|
||||
} else {
|
||||
end = "";
|
||||
end = "未设置";
|
||||
}
|
||||
String context = "";
|
||||
if (StringUtils.equals(NoticeConstants.CREATE, type)) {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 57d6f78efa4b0300be188e8b024511ceef0873ed
|
||||
Subproject commit 419c75bca64b7c5bfbd1194d7f0fd9919f0caa04
|
@ -170,6 +170,7 @@ test_plan_notification=Test plan notification
|
||||
task_defect_notification=Task defect notification
|
||||
task_notification_jenkins=Jenkins Task notification
|
||||
task_notification=Result notification
|
||||
message_task_already_exists=Task recipient already exists
|
||||
|
||||
|
||||
|
||||
|
@ -170,4 +170,5 @@ upload_content_is_null=导入内容为空
|
||||
test_plan_notification=测试计划通知
|
||||
task_defect_notification=缺陷任务通知
|
||||
task_notification_jenkins=jenkins任务通知
|
||||
task_notification=任务通知
|
||||
task_notification=任务通知
|
||||
message_task_already_exists=任务接收人已经存在
|
@ -172,4 +172,5 @@ test_plan_notification=測試計畫通知
|
||||
task_defect_notification=缺陷任務通知
|
||||
task_notification_jenkins=jenkins任務通知
|
||||
task_notification=任務通知
|
||||
message_task_already_exists=任務接收人已經存在
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
:placeholder="$t('load_test.input_thread_num')"
|
||||
v-model="threadGroup.threadNumber"
|
||||
@change="calculateChart(threadGroup)"
|
||||
:min="1"
|
||||
:min="resourcePoolResourceLength"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<br>
|
||||
@ -141,6 +141,7 @@ export default {
|
||||
activeNames: ["0"],
|
||||
threadGroups: [],
|
||||
serializeThreadgroups: false,
|
||||
resourcePoolResourceLength: 1
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -368,6 +369,11 @@ export default {
|
||||
if (handler.rampUpTime < handler.step) {
|
||||
handler.step = handler.rampUpTime;
|
||||
}
|
||||
// 线程数不能小于资源池节点的数量
|
||||
let resourcePool = this.resourcePools.filter(v => v.id === this.resourcePool)[0];
|
||||
if (resourcePool) {
|
||||
this.resourcePoolResourceLength = resourcePool.resources.length;
|
||||
}
|
||||
handler.options = {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
|
@ -145,14 +145,14 @@ export default {
|
||||
data.isReadOnly = true;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = !data.isReadOnly
|
||||
data.webhook = ''
|
||||
data.webhook = '';
|
||||
}
|
||||
},
|
||||
handleEditTask(index,data) {
|
||||
data.isSet = true
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = false;
|
||||
data.webhook = ''
|
||||
data.webhook = '';
|
||||
} else {
|
||||
data.isReadOnly = true;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ export default {
|
||||
data.isSet = true
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = false;
|
||||
data.webhook = ''
|
||||
data.webhook = '';
|
||||
} else {
|
||||
data.isReadOnly = true;
|
||||
}
|
||||
@ -203,7 +203,6 @@ export default {
|
||||
},
|
||||
addTask(data) {
|
||||
let list = [];
|
||||
data.isSet = false;
|
||||
list.push(data);
|
||||
let param = {};
|
||||
param.messageDetail = list;
|
||||
@ -216,7 +215,7 @@ export default {
|
||||
if (!data[index].identification) {
|
||||
data.splice(index, 1)
|
||||
} else {
|
||||
data[index].isSet = false;
|
||||
data[parseInt(index)].isSet = false;
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -148,21 +148,21 @@ export default {
|
||||
data.isReadOnly = true;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = !data.isReadOnly;
|
||||
data.webhook = ''
|
||||
data.webhook = '';
|
||||
}
|
||||
},
|
||||
handleAddTaskModel(type) {
|
||||
let Task = {};
|
||||
Task.event = [];
|
||||
Task.userIds = [];
|
||||
Task.type = "";
|
||||
Task.webhook = "";
|
||||
Task.type = '';
|
||||
Task.webhook = '';
|
||||
Task.isSet = true;
|
||||
Task.identification = "";
|
||||
Task.identification = '';
|
||||
if (type === 'scheduleTask') {
|
||||
Task.taskType = 'SCHEDULE_TASK'
|
||||
Task.testId=this.testId
|
||||
this.form.scheduleTask.push(Task)
|
||||
Task.taskType = 'SCHEDULE_TASK';
|
||||
Task.testId=this.testId;
|
||||
this.form.scheduleTask.push(Task);
|
||||
}
|
||||
},
|
||||
handleEditTask(index,data) {
|
||||
@ -170,7 +170,7 @@ export default {
|
||||
data.testId = this.testId;
|
||||
if (data.type === 'EMAIL') {
|
||||
data.isReadOnly = false;
|
||||
data.webhook = ''
|
||||
data.webhook = '';
|
||||
} else {
|
||||
data.isReadOnly = true;
|
||||
}
|
||||
@ -196,7 +196,7 @@ export default {
|
||||
data.isSet = false;
|
||||
list.push(data);
|
||||
let param = {};
|
||||
param.messageDetail = list
|
||||
param.messageDetail = list;
|
||||
this.result = this.$post("/notice/save/message/task", param, () => {
|
||||
this.initForm()
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
@ -206,7 +206,7 @@ export default {
|
||||
if (!data[index].identification) {
|
||||
data.splice(index, 1)
|
||||
} else {
|
||||
data[index].isSet = false
|
||||
data[index].isSet = false;
|
||||
}
|
||||
},
|
||||
deleteRowTask(index, data) { //删除
|
||||
|
@ -221,7 +221,7 @@ export default {
|
||||
if (!data[index].identification) {
|
||||
data.splice(index, 1)
|
||||
} else {
|
||||
data[index].isSet = false
|
||||
data[index].isSet = false;
|
||||
}
|
||||
},
|
||||
deleteRowTask(index, data) { //删除
|
||||
|
@ -55,204 +55,205 @@
|
||||
|
||||
<script>
|
||||
|
||||
import NodeTree from '../common/NodeTree';
|
||||
import TestCaseEdit from './components/TestCaseEdit';
|
||||
import {CURRENT_PROJECT, ROLE_TEST_MANAGER, ROLE_TEST_USER} from '../../../../common/js/constants';
|
||||
import TestCaseList from "./components/TestCaseList";
|
||||
import SelectMenu from "../common/SelectMenu";
|
||||
import TestCaseMove from "./components/TestCaseMove";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsAsideContainer from "../../common/components/MsAsideContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../common/js/utils";
|
||||
import BatchMove from "./components/BatchMove";
|
||||
import NodeTree from '../common/NodeTree';
|
||||
import TestCaseEdit from './components/TestCaseEdit';
|
||||
import {CURRENT_PROJECT, ROLE_TEST_MANAGER, ROLE_TEST_USER} from '../../../../common/js/constants';
|
||||
import TestCaseList from "./components/TestCaseList";
|
||||
import SelectMenu from "../common/SelectMenu";
|
||||
import TestCaseMove from "./components/TestCaseMove";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsAsideContainer from "../../common/components/MsAsideContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../common/js/utils";
|
||||
import BatchMove from "./components/BatchMove";
|
||||
|
||||
export default {
|
||||
name: "TestCase",
|
||||
components: {
|
||||
MsMainContainer,
|
||||
MsAsideContainer, MsContainer, TestCaseMove, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, BatchMove},
|
||||
comments: {},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
projects: [],
|
||||
currentProject: null,
|
||||
treeNodes: [],
|
||||
selectNodeIds: [],
|
||||
selectParentNodes: [],
|
||||
testCaseReadOnly: true,
|
||||
selectNode: {},
|
||||
nodeTreeDraggable: true,
|
||||
export default {
|
||||
name: "TestCase",
|
||||
components: {
|
||||
MsMainContainer,
|
||||
MsAsideContainer, MsContainer, TestCaseMove, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, BatchMove
|
||||
},
|
||||
comments: {},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
projects: [],
|
||||
currentProject: null,
|
||||
treeNodes: [],
|
||||
selectNodeIds: [],
|
||||
selectParentNodes: [],
|
||||
testCaseReadOnly: true,
|
||||
selectNode: {},
|
||||
nodeTreeDraggable: true,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init(this.$route);
|
||||
},
|
||||
watch: {
|
||||
'$route'(to, from) {
|
||||
this.init(to);
|
||||
},
|
||||
currentProject() {
|
||||
this.refresh();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(route) {
|
||||
let path = route.path;
|
||||
if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0) {
|
||||
this.getProjects();
|
||||
this.testCaseReadOnly = false;
|
||||
if (!checkoutTestManagerOrTestUser()) {
|
||||
this.testCaseReadOnly = true;
|
||||
}
|
||||
let caseId = this.$route.params.caseId;
|
||||
this.openRecentTestCaseEditDialog(caseId);
|
||||
this.$router.push('/track/case/all');
|
||||
} else if (route.params.projectId) {
|
||||
this.getProjects();
|
||||
this.getProjectById(route.params.projectId);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init(this.$route);
|
||||
},
|
||||
watch: {
|
||||
'$route'(to, from) {
|
||||
this.init(to);
|
||||
},
|
||||
currentProject() {
|
||||
this.refresh();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(route) {
|
||||
let path = route.path;
|
||||
if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0){
|
||||
this.getProjects();
|
||||
this.testCaseReadOnly = false;
|
||||
if (!checkoutTestManagerOrTestUser()) {
|
||||
this.testCaseReadOnly = true;
|
||||
getProjects() {
|
||||
this.$get("/project/listAll", (response) => {
|
||||
this.projects = response.data;
|
||||
let lastProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
|
||||
if (lastProject) {
|
||||
let hasCurrentProject = false;
|
||||
for (let i = 0; i < this.projects.length; i++) {
|
||||
if (this.projects[i].id == lastProject.id) {
|
||||
this.currentProject = lastProject;
|
||||
hasCurrentProject = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasCurrentProject) {
|
||||
this.setCurrentProject(this.projects[0]);
|
||||
}
|
||||
let caseId = this.$route.params.caseId;
|
||||
this.openRecentTestCaseEditDialog(caseId);
|
||||
this.$router.push('/track/case/all');
|
||||
} else if (route.params.projectId){
|
||||
this.getProjects();
|
||||
this.getProjectById(route.params.projectId);
|
||||
}
|
||||
},
|
||||
getProjects() {
|
||||
this.$get("/project/listAll", (response) => {
|
||||
this.projects = response.data;
|
||||
let lastProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
|
||||
if (lastProject) {
|
||||
let hasCurrentProject = false;
|
||||
for (let i = 0; i < this.projects.length; i++) {
|
||||
if (this.projects[i].id == lastProject.id) {
|
||||
this.currentProject = lastProject;
|
||||
hasCurrentProject = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasCurrentProject) {
|
||||
this.setCurrentProject(this.projects[0]);
|
||||
}
|
||||
} else {
|
||||
if(this.projects.length > 0){
|
||||
this.setCurrentProject(this.projects[0]);
|
||||
}
|
||||
}
|
||||
// this.checkProject();
|
||||
});
|
||||
},
|
||||
checkProject() {
|
||||
if(this.currentProject === null) {
|
||||
this.$alert(this.$t('test_track.case.no_project'), {
|
||||
confirmButtonText: this.$t('project.create'),
|
||||
callback: action => {
|
||||
this.$router.push("/track/project/create");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
changeProject(project) {
|
||||
this.setCurrentProject(project);
|
||||
},
|
||||
nodeChange(nodeIds, pNodes) {
|
||||
this.selectNodeIds = nodeIds;
|
||||
this.selectParentNodes = pNodes;
|
||||
},
|
||||
refreshTable() {
|
||||
this.$refs.testCaseList.initTableData();
|
||||
},
|
||||
editTestCase(testCase) {
|
||||
this.testCaseReadOnly = false;
|
||||
if (this.treeNodes.length < 1) {
|
||||
this.$warning(this.$t('test_track.case.create_module_first'));
|
||||
return;
|
||||
}
|
||||
this.$refs.testCaseEditDialog.open(testCase);
|
||||
},
|
||||
copyTestCase(testCase) {
|
||||
this.testCaseReadOnly = false;
|
||||
let item = {};
|
||||
Object.assign(item, testCase);
|
||||
item.name = '';
|
||||
item.isCopy = true;
|
||||
this.$refs.testCaseEditDialog.open(item);
|
||||
},
|
||||
showTestCaseDetail(testCase) {
|
||||
this.testCaseReadOnly = true;
|
||||
this.$refs.testCaseEditDialog.open(testCase);
|
||||
},
|
||||
getProjectByCaseId(caseId) {
|
||||
return this.$get('/test/case/project/' + caseId, async response => {
|
||||
this.setCurrentProject(response.data);
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.selectNodeIds = [];
|
||||
this.selectParentNodes = [];
|
||||
this.selectNode = {};
|
||||
this.$refs.testCaseList.initTableData();
|
||||
this.getNodeTree();
|
||||
},
|
||||
openRecentTestCaseEditDialog(caseId) {
|
||||
if (caseId) {
|
||||
this.getProjectByCaseId(caseId);
|
||||
this.$get('/test/case/get/' + caseId, response => {
|
||||
if (response.data) {
|
||||
this.$refs.testCaseEditDialog.open(response.data);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$refs.testCaseEditDialog.open();
|
||||
if (this.projects.length > 0) {
|
||||
this.setCurrentProject(this.projects[0]);
|
||||
}
|
||||
}
|
||||
},
|
||||
getProjectById(id) {
|
||||
if (id && id != 'all') {
|
||||
this.$get('/project/get/' + id, response => {
|
||||
let project = response.data;
|
||||
this.setCurrentProject(project);
|
||||
// this.$router.push('/track/case/all');
|
||||
});
|
||||
}
|
||||
if (id === 'all') {
|
||||
this.refresh();
|
||||
}
|
||||
},
|
||||
setCurrentProject(project) {
|
||||
if (project) {
|
||||
this.currentProject = project;
|
||||
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
|
||||
}
|
||||
this.refresh();
|
||||
},
|
||||
getNodeTree() {
|
||||
if (!hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
|
||||
this.nodeTreeDraggable = false;
|
||||
}
|
||||
if (this.currentProject) {
|
||||
this.result = this.$get("/case/node/list/" + this.currentProject.id, response => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
moveToNode(selectIds) {
|
||||
if (selectIds.size < 1) {
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
return;
|
||||
}
|
||||
this.$refs.testCaseEditDialog.getModuleOptions();
|
||||
this.$refs.testCaseMove.open(this.$refs.testCaseEditDialog.moduleOptions, selectIds);
|
||||
},
|
||||
batchMove(selectIds) {
|
||||
this.$refs.testBatchMove.open(this.treeNodes, selectIds,this.$refs.testCaseEditDialog.moduleOptions);
|
||||
// this.checkProject();
|
||||
});
|
||||
},
|
||||
checkProject() {
|
||||
if (this.currentProject === null) {
|
||||
this.$alert(this.$t('test_track.case.no_project'), {
|
||||
confirmButtonText: this.$t('project.create'),
|
||||
callback: action => {
|
||||
this.$router.push("/track/project/create");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
changeProject(project) {
|
||||
this.setCurrentProject(project);
|
||||
},
|
||||
nodeChange(nodeIds, pNodes) {
|
||||
this.selectNodeIds = nodeIds;
|
||||
this.selectParentNodes = pNodes;
|
||||
},
|
||||
refreshTable() {
|
||||
this.$refs.testCaseList.initTableData();
|
||||
},
|
||||
editTestCase(testCase) {
|
||||
this.testCaseReadOnly = false;
|
||||
if (this.treeNodes.length < 1) {
|
||||
this.$warning(this.$t('test_track.case.create_module_first'));
|
||||
return;
|
||||
}
|
||||
this.$refs.testCaseEditDialog.open(testCase);
|
||||
},
|
||||
copyTestCase(testCase) {
|
||||
this.testCaseReadOnly = false;
|
||||
let item = {};
|
||||
Object.assign(item, testCase);
|
||||
item.name = '';
|
||||
item.isCopy = true;
|
||||
this.$refs.testCaseEditDialog.open(item);
|
||||
},
|
||||
showTestCaseDetail(testCase) {
|
||||
this.testCaseReadOnly = true;
|
||||
this.$refs.testCaseEditDialog.open(testCase);
|
||||
},
|
||||
getProjectByCaseId(caseId) {
|
||||
return this.$get('/test/case/project/' + caseId, async response => {
|
||||
this.setCurrentProject(response.data);
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.selectNodeIds = [];
|
||||
this.selectParentNodes = [];
|
||||
this.selectNode = {};
|
||||
this.$refs.testCaseList.initTableData();
|
||||
this.getNodeTree();
|
||||
},
|
||||
openRecentTestCaseEditDialog(caseId) {
|
||||
if (caseId) {
|
||||
this.getProjectByCaseId(caseId);
|
||||
this.$get('/test/case/get/' + caseId, response => {
|
||||
if (response.data) {
|
||||
this.$refs.testCaseEditDialog.open(response.data);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$refs.testCaseEditDialog.open();
|
||||
}
|
||||
},
|
||||
getProjectById(id) {
|
||||
if (id && id != 'all') {
|
||||
this.$get('/project/get/' + id, response => {
|
||||
let project = response.data;
|
||||
this.setCurrentProject(project);
|
||||
// this.$router.push('/track/case/all');
|
||||
});
|
||||
}
|
||||
if (id === 'all') {
|
||||
this.refresh();
|
||||
}
|
||||
},
|
||||
setCurrentProject(project) {
|
||||
if (project) {
|
||||
this.currentProject = project;
|
||||
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
|
||||
}
|
||||
this.refresh();
|
||||
},
|
||||
getNodeTree() {
|
||||
if (!hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
|
||||
this.nodeTreeDraggable = false;
|
||||
}
|
||||
if (this.currentProject) {
|
||||
this.result = this.$get("/case/node/list/" + this.currentProject.id, response => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
moveToNode(selectIds) {
|
||||
if (selectIds.size < 1) {
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
return;
|
||||
}
|
||||
this.$refs.testCaseEditDialog.getModuleOptions();
|
||||
this.$refs.testCaseMove.open(this.$refs.testCaseEditDialog.moduleOptions, selectIds);
|
||||
},
|
||||
batchMove(selectIds) {
|
||||
this.$refs.testBatchMove.open(this.treeNodes, selectIds, this.$refs.testCaseEditDialog.moduleOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.el-main {
|
||||
padding: 15px;
|
||||
}
|
||||
.el-main {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -161,6 +161,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
testCase: {},
|
||||
dialogFormVisible: false,
|
||||
readOnly: true,
|
||||
form: {
|
||||
@ -190,9 +191,15 @@ export default {
|
||||
]
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$get('test/case/get/' + this.testCaseId, response => {
|
||||
this.testCase = response.data;
|
||||
});
|
||||
},
|
||||
methods: {},
|
||||
props: {
|
||||
testCase: {
|
||||
type: Object
|
||||
testCaseId: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -256,9 +256,9 @@
|
||||
|
||||
<script>
|
||||
|
||||
import {TokenKey, WORKSPACE_ID} from '../../../../../common/js/constants';
|
||||
import {TokenKey, WORKSPACE_ID} from '@/common/js/constants';
|
||||
import MsDialogFooter from '../../../common/components/MsDialogFooter'
|
||||
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||
import {Message} from "element-ui";
|
||||
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||
|
@ -35,6 +35,7 @@
|
||||
@filter-change="filter"
|
||||
@select-all="handleSelectAll"
|
||||
@select="handleSelectionChange"
|
||||
@cell-mouse-enter="showPopover"
|
||||
row-key="id"
|
||||
class="test-content adjust-table">
|
||||
<el-table-column
|
||||
@ -65,7 +66,7 @@
|
||||
width="60%"
|
||||
trigger="hover"
|
||||
>
|
||||
<test-case-detail :test-case="scope.row"/>
|
||||
<test-case-detail v-if="currentCaseId === scope.row.id" :test-case-id="currentCaseId"/>
|
||||
<span slot="reference">{{ scope.row.name }}</span>
|
||||
</el-popover>
|
||||
</template>
|
||||
@ -166,11 +167,11 @@ import MethodTableItem from "../../common/tableItems/planview/MethodTableItem";
|
||||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
import MsTableButton from "../../../common/components/MsTableButton";
|
||||
import {_filter, _sort} from "../../../../../common/js/utils";
|
||||
import {_filter, _sort} from "@/common/js/utils";
|
||||
import {TEST_CASE_CONFIGS} from "../../../common/components/search/search-components";
|
||||
import ShowMoreBtn from "./ShowMoreBtn";
|
||||
import BatchEdit from "./BatchEdit";
|
||||
import {WORKSPACE_ID} from "../../../../../common/js/constants";
|
||||
import {WORKSPACE_ID} from "@/common/js/constants";
|
||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
|
||||
import TestCaseDetail from "./TestCaseDetail";
|
||||
@ -187,336 +188,349 @@ export default {
|
||||
PriorityTableItem,
|
||||
MsCreateBox,
|
||||
TestCaseImport,
|
||||
TestCaseExport,
|
||||
MsTablePagination,
|
||||
NodeBreadcrumb,
|
||||
MsTableHeader,
|
||||
ShowMoreBtn,
|
||||
BatchEdit,
|
||||
StatusTableItem,
|
||||
TestCaseDetail,
|
||||
ReviewStatus
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
deletePath: "/test/case/delete",
|
||||
condition: {
|
||||
components: TEST_CASE_CONFIGS
|
||||
},
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
selectRows: new Set(),
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
],
|
||||
methodFilters: [
|
||||
{text: this.$t('test_track.case.manual'), value: 'manual'},
|
||||
{text: this.$t('test_track.case.auto'), value: 'auto'}
|
||||
],
|
||||
typeFilters: [
|
||||
{text: this.$t('commons.functional'), value: 'functional'},
|
||||
{text: this.$t('commons.performance'), value: 'performance'},
|
||||
{text: this.$t('commons.api'), value: 'api'}
|
||||
],
|
||||
statusFilters: [
|
||||
{text: this.$t('test_track.case.status_prepare'), value: 'Prepare'},
|
||||
{text: this.$t('test_track.case.status_pass'), value: 'Pass'},
|
||||
{text: this.$t('test_track.case.status_un_pass'), value: 'UnPass'},
|
||||
],
|
||||
showMore: false,
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit
|
||||
}, {
|
||||
name: this.$t('test_track.case.batch_move_case'), handleClick: this.handleBatchMove
|
||||
}, {
|
||||
name: this.$t('test_track.case.batch_delete_case'), handleClick: this.handleDeleteBatch
|
||||
}
|
||||
],
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'type', name: this.$t('test_track.case.type')},
|
||||
{id: 'method', name: this.$t('test_track.case.method')},
|
||||
{id: 'maintainer', name: this.$t('test_track.case.maintainer')},
|
||||
],
|
||||
valueArr: {
|
||||
priority: [
|
||||
{name: 'P0', id: 'P0'},
|
||||
{name: 'P1', id: 'P1'},
|
||||
{name: 'P2', id: 'P2'},
|
||||
{name: 'P3', id: 'P3'}
|
||||
],
|
||||
type: [
|
||||
{name: this.$t('commons.functional'), id: 'functional'},
|
||||
{name: this.$t('commons.performance'), id: 'performance'},
|
||||
{name: this.$t('commons.api'), id: 'api'}
|
||||
],
|
||||
method: [
|
||||
{name: this.$t('test_track.case.manual'), id: 'manual'},
|
||||
{name: this.$t('test_track.case.auto'), id: 'auto'}
|
||||
],
|
||||
maintainer: [],
|
||||
TestCaseExport,
|
||||
MsTablePagination,
|
||||
NodeBreadcrumb,
|
||||
MsTableHeader,
|
||||
ShowMoreBtn,
|
||||
BatchEdit,
|
||||
StatusTableItem,
|
||||
TestCaseDetail,
|
||||
ReviewStatus
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
deletePath: "/test/case/delete",
|
||||
condition: {
|
||||
components: TEST_CASE_CONFIGS
|
||||
},
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
selectRows: new Set(),
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
],
|
||||
methodFilters: [
|
||||
{text: this.$t('test_track.case.manual'), value: 'manual'},
|
||||
{text: this.$t('test_track.case.auto'), value: 'auto'}
|
||||
],
|
||||
typeFilters: [
|
||||
{text: this.$t('commons.functional'), value: 'functional'},
|
||||
{text: this.$t('commons.performance'), value: 'performance'},
|
||||
{text: this.$t('commons.api'), value: 'api'}
|
||||
],
|
||||
statusFilters: [
|
||||
{text: this.$t('test_track.case.status_prepare'), value: 'Prepare'},
|
||||
{text: this.$t('test_track.case.status_pass'), value: 'Pass'},
|
||||
{text: this.$t('test_track.case.status_un_pass'), value: 'UnPass'},
|
||||
],
|
||||
showMore: false,
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit
|
||||
}, {
|
||||
name: this.$t('test_track.case.batch_move_case'), handleClick: this.handleBatchMove
|
||||
}, {
|
||||
name: this.$t('test_track.case.batch_delete_case'), handleClick: this.handleDeleteBatch
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProject: {
|
||||
type: Object
|
||||
],
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'type', name: this.$t('test_track.case.type')},
|
||||
{id: 'method', name: this.$t('test_track.case.method')},
|
||||
{id: 'maintainer', name: this.$t('test_track.case.maintainer')},
|
||||
],
|
||||
valueArr: {
|
||||
priority: [
|
||||
{name: 'P0', id: 'P0'},
|
||||
{name: 'P1', id: 'P1'},
|
||||
{name: 'P2', id: 'P2'},
|
||||
{name: 'P3', id: 'P3'}
|
||||
],
|
||||
type: [
|
||||
{name: this.$t('commons.functional'), id: 'functional'},
|
||||
{name: this.$t('commons.performance'), id: 'performance'},
|
||||
{name: this.$t('commons.api'), id: 'api'}
|
||||
],
|
||||
method: [
|
||||
{name: this.$t('test_track.case.manual'), id: 'manual'},
|
||||
{name: this.$t('test_track.case.auto'), id: 'auto'}
|
||||
],
|
||||
maintainer: [],
|
||||
},
|
||||
selectNodeIds: {
|
||||
type: Array
|
||||
},
|
||||
selectParentNodes: {
|
||||
type: Array
|
||||
}
|
||||
currentCaseId: null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProject: {
|
||||
type: Object
|
||||
},
|
||||
created: function () {
|
||||
selectNodeIds: {
|
||||
type: Array
|
||||
},
|
||||
selectParentNodes: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.initTableData();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.initTableData();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.initTableData();
|
||||
},
|
||||
selectNodeIds() {
|
||||
this.currentPage = 1;
|
||||
this.initTableData();
|
||||
selectNodeIds() {
|
||||
this.currentPage = 1;
|
||||
this.initTableData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.planId) {
|
||||
// param.planId = this.planId;
|
||||
this.condition.planId = this.planId;
|
||||
}
|
||||
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||
// param.nodeIds = this.selectNodeIds;
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
}
|
||||
this.getData();
|
||||
},
|
||||
getData() {
|
||||
if (this.currentProject) {
|
||||
this.condition.projectId = this.currentProject.id;
|
||||
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
// this.selectIds.clear();
|
||||
this.selectRows.clear();
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.planId) {
|
||||
// param.planId = this.planId;
|
||||
this.condition.planId = this.planId;
|
||||
}
|
||||
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||
// param.nodeIds = this.selectNodeIds;
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
}
|
||||
this.getData();
|
||||
},
|
||||
getData() {
|
||||
if (this.currentProject) {
|
||||
this.condition.projectId = this.currentProject.id;
|
||||
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
// this.selectIds.clear();
|
||||
this.selectRows.clear();
|
||||
});
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.initTableData();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testCaseCreate() {
|
||||
this.$emit('testCaseEdit');
|
||||
},
|
||||
handleEdit(testCase) {
|
||||
search() {
|
||||
this.initTableData();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testCaseCreate() {
|
||||
this.$emit('testCaseEdit');
|
||||
},
|
||||
handleEdit(testCase) {
|
||||
this.$get('test/case/get/' + testCase.id, response => {
|
||||
let testCase = response.data;
|
||||
this.$emit('testCaseEdit', testCase);
|
||||
},
|
||||
handleCopy(testCase) {
|
||||
});
|
||||
},
|
||||
handleCopy(testCase) {
|
||||
this.$get('test/case/get/' + testCase.id, response => {
|
||||
let testCase = response.data;
|
||||
this.$emit('testCaseCopy', testCase);
|
||||
},
|
||||
handleDelete(testCase) {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(testCase);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDelete(testCase) {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(testCase);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$post('/test/case/batch/delete', {ids: ids}, () => {
|
||||
this.selectRows.clear();
|
||||
this.$emit("refresh");
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$post('/test/case/batch/delete', {ids: ids}, () => {
|
||||
this.selectRows.clear();
|
||||
this.$emit("refresh");
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(testCase) {
|
||||
let testCaseId = testCase.id;
|
||||
this.$post('/test/case/delete/' + testCaseId, {}, () => {
|
||||
this.initTableData();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.condition = {components: TEST_CASE_CONFIGS};
|
||||
// this.selectIds.clear();
|
||||
this.selectRows.clear();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
showAll() {
|
||||
this.condition = {components: TEST_CASE_CONFIGS};
|
||||
this.getData();
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.$emit('testCaseDetail', row);
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
if (selection.length > 0) {
|
||||
this.tableData.forEach(item => {
|
||||
this.$set(item, "showMore", true);
|
||||
this.selectRows.add(item);
|
||||
});
|
||||
},
|
||||
_handleDelete(testCase) {
|
||||
let testCaseId = testCase.id;
|
||||
this.$post('/test/case/delete/' + testCaseId, {}, () => {
|
||||
this.initTableData();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.condition = {components: TEST_CASE_CONFIGS};
|
||||
// this.selectIds.clear();
|
||||
} else {
|
||||
this.selectRows.clear();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
showAll() {
|
||||
this.condition = {components: TEST_CASE_CONFIGS};
|
||||
this.getData();
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.$emit('testCaseDetail', row);
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
if (selection.length > 0) {
|
||||
this.tableData.forEach(item => {
|
||||
this.$set(item, "showMore", true);
|
||||
this.selectRows.add(item);
|
||||
});
|
||||
} else {
|
||||
this.selectRows.clear();
|
||||
this.tableData.forEach(row => {
|
||||
this.$set(row, "showMore", false);
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSelectionChange(selection, row) {
|
||||
if (this.selectRows.has(row)) {
|
||||
this.tableData.forEach(row => {
|
||||
this.$set(row, "showMore", false);
|
||||
this.selectRows.delete(row);
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSelectionChange(selection, row) {
|
||||
if (this.selectRows.has(row)) {
|
||||
this.$set(row, "showMore", false);
|
||||
this.selectRows.delete(row);
|
||||
} else {
|
||||
this.$set(row, "showMore", true);
|
||||
this.selectRows.add(row);
|
||||
}
|
||||
},
|
||||
importTestCase() {
|
||||
this.$refs.testCaseImport.open();
|
||||
},
|
||||
exportTestCase() {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
let config = {
|
||||
url: '/test/case/export/testcase',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
// data: {ids: [...this.selectIds]}
|
||||
data: {ids: ids, projectId: this.currentProject.id}
|
||||
};
|
||||
this.result = this.$request(config).then(response => {
|
||||
const filename = this.$t('test_track.case.test_case') + ".xlsx";
|
||||
const blob = new Blob([response.data]);
|
||||
if ("download" in document.createElement("a")) {
|
||||
let aTag = document.createElement('a');
|
||||
aTag.download = filename;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(aTag.href)
|
||||
} else {
|
||||
this.$set(row, "showMore", true);
|
||||
this.selectRows.add(row);
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
}
|
||||
},
|
||||
importTestCase() {
|
||||
this.$refs.testCaseImport.open();
|
||||
},
|
||||
exportTestCase() {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
let config = {
|
||||
url: '/test/case/export/testcase',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
// data: {ids: [...this.selectIds]}
|
||||
data: {ids: ids, projectId: this.currentProject.id}
|
||||
};
|
||||
this.result = this.$request(config).then(response => {
|
||||
const filename = this.$t('test_track.case.test_case') + ".xlsx";
|
||||
const blob = new Blob([response.data]);
|
||||
if ("download" in document.createElement("a")) {
|
||||
let aTag = document.createElement('a');
|
||||
aTag.download = filename;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(aTag.href)
|
||||
} else {
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleBatch(type) {
|
||||
});
|
||||
},
|
||||
handleBatch(type) {
|
||||
|
||||
if (this.selectRows.size < 1) {
|
||||
if (type === 'export') {
|
||||
this.$alert(this.$t('test_track.case.export_all_cases'), '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.exportTestCase();
|
||||
}
|
||||
if (this.selectRows.size < 1) {
|
||||
if (type === 'export') {
|
||||
this.$alert(this.$t('test_track.case.export_all_cases'), '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.exportTestCase();
|
||||
}
|
||||
})
|
||||
return;
|
||||
} else {
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (type === 'move') {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$emit('moveToNode', ids);
|
||||
} else if (type === 'delete') {
|
||||
this.handleDeleteBatch();
|
||||
}
|
||||
})
|
||||
return;
|
||||
} else {
|
||||
this.exportTestCase();
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
return;
|
||||
}
|
||||
},
|
||||
batchEdit(form) {
|
||||
let arr = Array.from(this.selectRows);
|
||||
let ids = arr.map(row => row.id);
|
||||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
this.$post('/test/case/batch/edit', param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.refresh();
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
sort(column) {
|
||||
// 每次只对一个字段排序
|
||||
if (this.condition.orders) {
|
||||
this.condition.orders = [];
|
||||
}
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
handleBatchEdit() {
|
||||
this.getMaintainerOptions();
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
handleBatchMove() {
|
||||
this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id));
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
this.valueArr.maintainer = response.data;
|
||||
});
|
||||
}
|
||||
if (type === 'move') {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$emit('moveToNode', ids);
|
||||
} else if (type === 'delete') {
|
||||
this.handleDeleteBatch();
|
||||
} else {
|
||||
this.exportTestCase();
|
||||
}
|
||||
},
|
||||
batchEdit(form) {
|
||||
let arr = Array.from(this.selectRows);
|
||||
let ids = arr.map(row => row.id);
|
||||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
this.$post('/test/case/batch/edit', param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.refresh();
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
sort(column) {
|
||||
// 每次只对一个字段排序
|
||||
if (this.condition.orders) {
|
||||
this.condition.orders = [];
|
||||
}
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
handleBatchEdit() {
|
||||
this.getMaintainerOptions();
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
handleBatchMove() {
|
||||
this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id));
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
this.valueArr.maintainer = response.data;
|
||||
});
|
||||
},
|
||||
showPopover(row, column, cell) {
|
||||
if (column.property === 'name') {
|
||||
console.log(row, column);
|
||||
this.currentCaseId = row.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.table-page {
|
||||
padding-top: 20px;
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
.table-page {
|
||||
padding-top: 20px;
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.operate-button {
|
||||
float: right;
|
||||
}
|
||||
.operate-button {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.operate-button > div {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.operate-button > div {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.search {
|
||||
margin-left: 10px;
|
||||
width: 240px;
|
||||
}
|
||||
.search {
|
||||
margin-left: 10px;
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 71d57ae5d7f8bb5c93a29504ac6f2300dc189ce9
|
||||
Subproject commit 33bbdb3f528c914bf333b2c1839dd6d3bbd9b569
|
Loading…
Reference in New Issue
Block a user