This commit is contained in:
fit2-zhao 2021-03-25 10:38:19 +08:00
commit 0a0bd2bec2
5 changed files with 18 additions and 10 deletions

View File

@ -239,10 +239,7 @@ insert into system_header (type, props)
values ('test_case_list', values ('test_case_list',
'[{"id":"tags","label":"标签"},{"id":"nodePath","label":"所属模块"},{"id":"updateTime","label":"更新时间"},{"id":"num","label":"ID"},{"id":"name","label":"名称"},{"id":"priority","label":"用例等级"},{"id":"reviewStatus","label":"评审状态"}]'); '[{"id":"tags","label":"标签"},{"id":"nodePath","label":"所属模块"},{"id":"updateTime","label":"更新时间"},{"id":"num","label":"ID"},{"id":"name","label":"名称"},{"id":"priority","label":"用例等级"},{"id":"reviewStatus","label":"评审状态"}]');
insert into system_header (type, props) insert into system_header (type, props)
values ('test_case_list',
'[{"id":"tags","label":"标签"},{"id":"nodePath","label":"所属模块"},{"id":"updateTime","label":"更新时间"},{"id":"num","label":"ID"},{"id":"name","label":"名称"},{"id":"priority","label":"用例等级"},{"id":"reviewStatus","label":"评审状态"}]');
insert into system_header (type, props)
values ('test_plan_scenario_case', values ('test_plan_scenario_case',
'[{"id":"num","label":"ID"},{"id":"name","label":"名称"},{"id":"level","label":"用例等级"},{"id":"tagNames","label":"标签"},{"id":"userId","label":"创建人"},{"id":"updateTime","label":"最后更新时间"},{"id":"stepTotal","label":"通过"},{"id":"lastResult","label":"失败"},{"id":"passRate","label":"通过率"}]'); '[{"id":"num","label":"ID"},{"id":"name","label":"名称"},{"id":"level","label":"用例等级"},{"id":"tagNames","label":"标签"},{"id":"userId","label":"创建人"},{"id":"updateTime","label":"最后更新时间"},{"id":"stepTotal","label":"通过"},{"id":"lastResult","label":"失败"},{"id":"passRate","label":"通过率"}]');
alter table system_header add primary key(type);

View File

@ -127,7 +127,9 @@ export default {
if (apiTest && apiTest.name) { if (apiTest && apiTest.name) {
this.$set(this.test, "name", apiTest.name); this.$set(this.test, "name", apiTest.name);
let blob = new Blob([apiTest.jmx.xml], {type: "application/octet-stream"}); let blob = new Blob([apiTest.jmx.xml], {type: "application/octet-stream"});
let file = new File([blob], apiTest.jmx.name); let suffixIndex = apiTest.jmx.name.lastIndexOf(".jmx");
let jmxName = apiTest.jmx.name.substring(0, suffixIndex) + "_" + new Date().getTime() + ".jmx";
let file = new File([blob], jmxName); //
this.$refs.basicConfig.beforeUploadJmx(file); this.$refs.basicConfig.beforeUploadJmx(file);
this.$refs.basicConfig.handleUpload({file: file}); this.$refs.basicConfig.handleUpload({file: file});
if (JSON.stringify(apiTest.jmx.attachFiles) != "{}") { if (JSON.stringify(apiTest.jmx.attachFiles) != "{}") {

View File

@ -132,12 +132,13 @@ export default {
this.projectLoadingResult = this.$post('api/automation/export/jmx', condition, response => { this.projectLoadingResult = this.$post('api/automation/export/jmx', condition, response => {
let data = response.data; let data = response.data;
data.forEach(d => { data.forEach(d => {
let threadGroups = findThreadGroup(d.jmx, d.name + ".jmx") let jmxName = d.name + "_" + new Date().getTime() + ".jmx";
let threadGroups = findThreadGroup(d.jmx, jmxName)
threadGroups.forEach(tg => { threadGroups.forEach(tg => {
tg.options = {}; tg.options = {};
this.scenarios.push(tg); this.scenarios.push(tg);
}); });
let file = new File([d.jmx], d.name + ".jmx"); let file = new File([d.jmx], jmxName);
this.uploadList.push(file); this.uploadList.push(file);
this.tableData.push({ this.tableData.push({
name: file.name, name: file.name,

View File

@ -34,6 +34,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="type" prop="type"
width="100"
:label="$t('load_test.file_type')"> :label="$t('load_test.file_type')">
</el-table-column> </el-table-column>
<el-table-column <el-table-column

View File

@ -313,10 +313,17 @@ export default {
this.$post("/test/case/review/projects", {reviewId: this.reviewId}, res => { this.$post("/test/case/review/projects", {reviewId: this.reviewId}, res => {
let data = res.data; let data = res.data;
if (data) { if (data) {
this.currentProject = data[0];
this.projects = data; this.projects = data;
const index = data.findIndex(d => d.id === this.$store.state.projectId);
if (index !== -1) {
this.projectId = data[index].id;
this.projectName = data[index].name;
this.currentProject = data[index];
} else {
this.projectId = data[0].id; this.projectId = data[0].id;
this.projectName = data[0].name; this.projectName = data[0].name;
this.currentProject = data[0];
}
} }
}) })
} }