style: 调整代码格式
This commit is contained in:
parent
339e1e243b
commit
1d5fb3f3ff
|
@ -330,16 +330,16 @@ public class TestCaseService {
|
|||
SessionUser user = SessionUtils.getUser();
|
||||
StringBuilder step = new StringBuilder("");
|
||||
StringBuilder result = new StringBuilder("");
|
||||
for (int i = 0; i < TestCaseList.size(); i++) {
|
||||
TestCaseList.forEach(t -> {
|
||||
TestCaseExcelData data = new TestCaseExcelData();
|
||||
data.setName(TestCaseList.get(i).getName());
|
||||
data.setNodePath(TestCaseList.get(i).getNodePath());
|
||||
data.setPriority(TestCaseList.get(i).getPriority());
|
||||
data.setType(TestCaseList.get(i).getType());
|
||||
data.setMethod(TestCaseList.get(i).getMethod());
|
||||
data.setPrerequisite(TestCaseList.get(i).getPrerequisite());
|
||||
if (TestCaseList.get(i).getMethod().equals("manual")) {
|
||||
String steps = TestCaseList.get(i).getSteps();
|
||||
data.setName(t.getName());
|
||||
data.setNodePath(t.getNodePath());
|
||||
data.setPriority(t.getPriority());
|
||||
data.setType(t.getType());
|
||||
data.setMethod(t.getMethod());
|
||||
data.setPrerequisite(t.getPrerequisite());
|
||||
if (t.getMethod().equals("manual")) {
|
||||
String steps = t.getSteps();
|
||||
JSONArray jsonArray = JSON.parseArray(steps);
|
||||
for (int j = 0; j < jsonArray.size(); j++) {
|
||||
int num = j + 1;
|
||||
|
@ -351,21 +351,21 @@ public class TestCaseService {
|
|||
data.setStepResult(result.toString());
|
||||
step.setLength(0);
|
||||
result.setLength(0);
|
||||
data.setRemark(TestCaseList.get(i).getRemark());
|
||||
data.setRemark(t.getRemark());
|
||||
|
||||
} else if (TestCaseList.get(i).getMethod().equals("auto") && TestCaseList.get(i).getType().equals("api")) {
|
||||
} else if (t.getMethod().equals("auto") && t.getType().equals("api")) {
|
||||
data.setStepDesc("");
|
||||
data.setStepResult("");
|
||||
data.setRemark(TestCaseList.get(i).getApiName());
|
||||
} else if (TestCaseList.get(i).getMethod().equals("auto") && TestCaseList.get(i).getType().equals("performance")) {
|
||||
data.setRemark(t.getApiName());
|
||||
} else if (t.getMethod().equals("auto") && t.getType().equals("performance")) {
|
||||
data.setStepDesc("");
|
||||
data.setStepResult("");
|
||||
data.setRemark(TestCaseList.get(i).getPerformName());
|
||||
data.setRemark(t.getPerformName());
|
||||
}
|
||||
data.setMaintainer(user.getId());
|
||||
list.add(data);
|
||||
}
|
||||
|
||||
});
|
||||
list.add(new TestCaseExcelData());
|
||||
TestCaseExcelData explain = new TestCaseExcelData();
|
||||
explain.setName(Translator.get("do_not_modify_header_order"));
|
||||
|
|
|
@ -10,18 +10,22 @@
|
|||
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/>
|
||||
</template>
|
||||
<template v-slot:button>
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2" :content="$t('test_track.case.import.import')" @click="importTestCase"/>
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-upload2"
|
||||
:content="$t('test_track.case.import.import')" @click="importTestCase"/>
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-download"
|
||||
:content="$t('test_track.case.export.export')" @click="handleBatch('export')"/>
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-right" :content="$t('test_track.case.move')" @click="handleBatch('move')"/>
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-delete" :content="$t('test_track.case.delete')" @click="handleBatch('delete')"/>
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-right" :content="$t('test_track.case.move')"
|
||||
@click="handleBatch('move')"/>
|
||||
<ms-table-button :is-tester-permission="true" icon="el-icon-delete" :content="$t('test_track.case.delete')"
|
||||
@click="handleBatch('delete')"/>
|
||||
<!--<test-case-export/>-->
|
||||
</template>
|
||||
</ms-table-header>
|
||||
|
||||
</template>
|
||||
|
||||
<test-case-import :projectId="currentProject == null? null : currentProject.id" @refresh="refresh" ref="testCaseImport"/>
|
||||
<test-case-import :projectId="currentProject == null? null : currentProject.id" @refresh="refresh"
|
||||
ref="testCaseImport"/>
|
||||
|
||||
<el-table
|
||||
:data="tableData"
|
||||
|
@ -87,9 +91,11 @@
|
|||
<el-table-column
|
||||
:label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
|
||||
@deleteClick="handleDelete(scope.row)">
|
||||
<template v-slot:middle>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')" icon="el-icon-document-copy"
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')"
|
||||
icon="el-icon-document-copy"
|
||||
type="success" @exec="handleCopy(scope.row)"/>
|
||||
</template>
|
||||
</ms-table-operator>
|
||||
|
@ -129,185 +135,186 @@
|
|||
MethodTableItem,
|
||||
TypeTableItem,
|
||||
PriorityTableItem,
|
||||
MsCreateBox, TestCaseImport, TestCaseExport, MsTablePagination, NodeBreadcrumb, MsTableHeader},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
deletePath: "/test/case/delete",
|
||||
condition: {},
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
selectIds: 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'}
|
||||
]
|
||||
}
|
||||
MsCreateBox, TestCaseImport, TestCaseExport, MsTablePagination, NodeBreadcrumb, MsTableHeader
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
deletePath: "/test/case/delete",
|
||||
condition: {},
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
selectIds: 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'}
|
||||
]
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProject: {
|
||||
type: Object
|
||||
},
|
||||
props: {
|
||||
currentProject: {
|
||||
type: Object
|
||||
},
|
||||
selectNodeIds: {
|
||||
type: Array
|
||||
},
|
||||
selectParentNodes: {
|
||||
type: Array
|
||||
}
|
||||
selectNodeIds: {
|
||||
type: Array
|
||||
},
|
||||
created: function () {
|
||||
selectParentNodes: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.initTableData();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.initTableData();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.initTableData();
|
||||
},
|
||||
selectNodeIds() {
|
||||
this.initTableData();
|
||||
selectNodeIds() {
|
||||
this.initTableData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
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();
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
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();
|
||||
});
|
||||
search() {
|
||||
this.initTableData();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testCaseCreate() {
|
||||
this.$emit('testCaseEdit');
|
||||
},
|
||||
handleEdit(testCase) {
|
||||
this.$emit('testCaseEdit', testCase);
|
||||
},
|
||||
handleCopy(testCase) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
search() {
|
||||
});
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.$post('/test/case/batch/delete', {ids: [...this.selectIds]}, () => {
|
||||
this.selectIds.clear();
|
||||
this.$emit("refresh");
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(testCase) {
|
||||
let testCaseId = testCase.id;
|
||||
this.$post('/test/case/delete/' + testCaseId, {}, () => {
|
||||
this.initTableData();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testCaseCreate() {
|
||||
this.$emit('testCaseEdit');
|
||||
},
|
||||
handleEdit(testCase) {
|
||||
this.$emit('testCaseEdit', testCase);
|
||||
},
|
||||
handleCopy(testCase) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.condition = {};
|
||||
this.selectIds.clear();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.$emit('testCaseDetail', row);
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
if (selection.length > 0) {
|
||||
this.tableData.forEach(item => {
|
||||
this.selectIds.add(item.id);
|
||||
});
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.$post('/test/case/batch/delete', {ids: [...this.selectIds]}, () => {
|
||||
this.selectIds.clear();
|
||||
this.$emit("refresh");
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(testCase) {
|
||||
let testCaseId = testCase.id;
|
||||
this.$post('/test/case/delete/' + testCaseId, {}, () => {
|
||||
this.initTableData();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.condition = {};
|
||||
} else {
|
||||
this.selectIds.clear();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.$emit('testCaseDetail', row);
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
if(selection.length > 0) {
|
||||
this.tableData.forEach(item => {
|
||||
this.selectIds.add(item.id);
|
||||
});
|
||||
} else {
|
||||
this.selectIds.clear();
|
||||
}
|
||||
},
|
||||
handleSelectionChange(selection, row) {
|
||||
if (this.selectIds.has(row.id)) {
|
||||
this.selectIds.delete(row.id);
|
||||
} else {
|
||||
this.selectIds.add(row.id);
|
||||
}
|
||||
},
|
||||
importTestCase() {
|
||||
this.$refs.testCaseImport.open();
|
||||
},
|
||||
exportTestCase() {
|
||||
let config = {
|
||||
url: '/test/case/export/testCase/' + [...this.selectIds],
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
};
|
||||
this.result = this.$request(config).then(response => {
|
||||
const filename = '测试用例.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) {
|
||||
if (this.selectIds.size < 1) {
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
return;
|
||||
}
|
||||
if (type === 'move') {
|
||||
this.$emit('moveToNode', this.selectIds);
|
||||
} else if (type === 'delete') {
|
||||
this.handleDeleteBatch();
|
||||
} else {
|
||||
this.exportTestCase();
|
||||
}
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
}
|
||||
},
|
||||
handleSelectionChange(selection, row) {
|
||||
if (this.selectIds.has(row.id)) {
|
||||
this.selectIds.delete(row.id);
|
||||
} else {
|
||||
this.selectIds.add(row.id);
|
||||
}
|
||||
},
|
||||
importTestCase() {
|
||||
this.$refs.testCaseImport.open();
|
||||
},
|
||||
exportTestCase() {
|
||||
let config = {
|
||||
url: '/test/case/export/testCase/' + [...this.selectIds],
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
};
|
||||
this.result = this.$request(config).then(response => {
|
||||
const filename = '测试用例.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) {
|
||||
if (this.selectIds.size < 1) {
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
return;
|
||||
}
|
||||
if (type === 'move') {
|
||||
this.$emit('moveToNode', this.selectIds);
|
||||
} else if (type === 'delete') {
|
||||
this.handleDeleteBatch();
|
||||
} else {
|
||||
this.exportTestCase();
|
||||
}
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -333,7 +340,7 @@
|
|||
}
|
||||
|
||||
.el-table {
|
||||
cursor:pointer;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue