This commit is contained in:
fit2-zhao 2021-03-19 18:41:39 +08:00
commit a34274b414
11 changed files with 38 additions and 12 deletions

View File

@ -0,0 +1,9 @@
package io.metersphere.excel.annotation;
import java.lang.annotation.*;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface NotRequired {
}

View File

@ -2,6 +2,7 @@ package io.metersphere.excel.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.metersphere.excel.annotation.NotRequired;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
@ -40,6 +41,7 @@ public class TestCaseExcelDataCn extends TestCaseExcelData {
@ColumnWidth(50)
@ExcelProperty("标签")
@NotRequired
@Length(min = 0, max = 1000)
private String tags;

View File

@ -2,6 +2,7 @@ package io.metersphere.excel.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.metersphere.excel.annotation.NotRequired;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
@ -38,6 +39,12 @@ public class TestCaseExcelDataTw extends TestCaseExcelData {
@Pattern(regexp = "(^P0$)|(^P1$)|(^P2$)|(^P3$)", message = "{test_case_priority_validate}")
private String priority;
@ColumnWidth(50)
@ExcelProperty("標簽")
@NotRequired
@Length(min = 0, max = 1000)
private String tags;
@NotBlank(message = "{cannot_be_null}")
@ExcelProperty("測試方式")
@Pattern(regexp = "(^manual$)|(^auto$)", message = "{test_case_method_validate}")

View File

@ -2,6 +2,7 @@ package io.metersphere.excel.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.metersphere.excel.annotation.NotRequired;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
@ -39,6 +40,12 @@ public class TestCaseExcelDataUs extends TestCaseExcelData {
@Pattern(regexp = "(^P0$)|(^P1$)|(^P2$)|(^P3$)", message = "{test_case_priority_validate}")
private String priority;
@ColumnWidth(50)
@ExcelProperty("Tag")
@NotRequired
@Length(min = 0, max = 1000)
private String tags;
@NotBlank(message = "{cannot_be_null}")
@ExcelProperty("Method")
@Pattern(regexp = "(^manual$)|(^auto$)", message = "{test_case_method_validate}")

View File

@ -6,15 +6,13 @@ import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.exception.ExcelAnalysisException;
import com.alibaba.excel.util.StringUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.excel.annotation.NotRequired;
import io.metersphere.excel.domain.ExcelErrData;
import io.metersphere.excel.domain.TestCaseExcelData;
import io.metersphere.excel.domain.UserExcelData;
import io.metersphere.excel.utils.ExcelValidateHelper;
import io.metersphere.i18n.Translator;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.*;
public abstract class EasyExcelListener<T> extends AnalysisEventListener<T> {
@ -131,9 +129,12 @@ public abstract class EasyExcelListener<T> extends AnalysisEventListener<T> {
for (String v : excelProperty.value()) {
value.append(v);
}
// 检查是否必有的头部信息
if (field.getAnnotation(NotRequired.class) == null) {
result.add(value.toString());
}
}
}
return result;
}

View File

@ -144,12 +144,12 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
String[] stepRes = new String[1];
if (data.getStepDesc() != null) {
stepDesc = data.getStepDesc().split("\n");
stepDesc = data.getStepDesc().split("\r\n");
} else {
stepDesc[0] = "";
}
if (data.getStepResult() != null) {
stepRes = data.getStepResult().split("\n");
stepRes = data.getStepResult().split("\r\n");
} else {
stepRes[0] = "";
}

View File

@ -520,8 +520,8 @@ public class TestCaseService {
for (int j = 0; j < jsonArray.size(); j++) {
int num = j + 1;
step.append(num + "." + jsonArray.getJSONObject(j).getString("desc") + "\n");
result.append(num + "." + jsonArray.getJSONObject(j).getString("result") + "\n");
step.append(num + "." + jsonArray.getJSONObject(j).getString("desc") + "\r\n");
result.append(num + "." + jsonArray.getJSONObject(j).getString("result") + "\r\n");
}
data.setStepDesc(step.toString());

View File

@ -159,7 +159,7 @@ export default {
data() {
return {
timeout: 60000,
responseTimeout: null,
responseTimeout: 60000,
statusCode: [],
domains: [],
params: [],

View File

@ -8,6 +8,7 @@
@setTreeNodes="setTreeNodes"
@exportTestCase="exportTestCase"
@saveAsEdit="editTestCase"
@refreshAll="refreshAll"
:type="'edit'"
ref="nodeTree"
/>

View File

@ -101,7 +101,6 @@ export default {
this.$emit("refreshTable");
},
refreshAll() {
this.selectRows.clear();
this.$emit('refreshAll');
},
handleCommand(e) {

View File

@ -2,7 +2,7 @@
<el-card class="table-card" v-loading="result.loading" body-style="padding:10px;">
<div slot="header">
<span class="title">
遗留缺陷统计
用例评审
</span>
<ms-table-button :is-tester-permission="true" v-if="!showMyCreator" icon="el-icon-view"
:content="$t('test_track.review.my_create')" @click="searchMyCreator" style="float: right"/>