refactor: 自定义ID显示问题

This commit is contained in:
shiziyuan9527 2021-05-13 12:16:28 +08:00 committed by 刘瑞斌
parent 621c98b792
commit 52143b1894
2 changed files with 32 additions and 5 deletions

View File

@ -20,6 +20,7 @@
:referenced="true"
:trash-enable="false"
@selection="setData"
:custom-num="customNum"
ref="apiScenarioList"/>
<template v-slot:footer>
@ -57,13 +58,22 @@
isApiListEnable: true,
currentScenario: [],
currentScenarioIds: [],
projectId: ''
projectId: '',
customNum: false
}
},
watch: {
projectId() {
this.$refs.apiScenarioList.search(this.projectId);
projectId(val) {
this.$refs.nodeTree.list(this.projectId);
if (val) {
this.$get("/project/get/" + val, result => {
let data = result.data;
if (data) {
this.customNum = data.scenarioCustomNum;
}
});
}
this.$refs.apiScenarioList.search(this.projectId);
}
},
methods: {

View File

@ -16,7 +16,12 @@
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll" @select="handleSelect">
<el-table-column type="selection"/>
<el-table-column v-if="!customNum" prop="num" label="ID"
show-overflow-tooltip>
</el-table-column>
<el-table-column v-if="customNum" prop="customNum" label="ID"
show-overflow-tooltip>
</el-table-column>
<el-table-column prop="name" :label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip/>
<el-table-column prop="level" :label="$t('api_test.automation.case_level')"
@ -102,7 +107,8 @@
projectEnvMap: new Map(),
projectList: [],
projectIds: new Set(),
map: new Map()
map: new Map(),
customNum: false
}
},
watch: {
@ -123,6 +129,7 @@
if (!this.projectId) {
return;
}
this.getProject(this.projectId);
this.selectRows = new Set();
this.loading = true;
@ -166,6 +173,16 @@
this.projectList = res.data;
})
},
getProject(projectId) {
if (projectId) {
this.$get("/project/get/" + projectId, result => {
let data = result.data;
if (data) {
this.customNum = data.scenarioCustomNum;
}
});
}
},
initProjectIds() {
this.projectIds.clear();
this.map.clear();