fix(接口测试): 修复场景报告页面link进入场景模块信息缺失的缺陷

--bug=1013398 --user=王孝刚 【接口测试】github#13809.
切换项目后,从报告中点击场景用例link进入场景用例页面,页面显示模块信息丢失
https://www.tapd.cn/55049933/s/1172963
This commit is contained in:
wxg0103 2022-06-02 18:31:52 +08:00 committed by f2c-ci-robot[bot]
parent 3ef1982aad
commit 08e6bb223d
2 changed files with 19 additions and 16 deletions

View File

@ -219,12 +219,12 @@ export default {
let scenarioId = selectParamArr[1]; let scenarioId = selectParamArr[1];
// //
let url = "/api/automation/list/" + 1 + "/" + 1; let url = "/api/automation/list/" + 1 + "/" + 1;
this.$post(url, {id: scenarioId}, response => { this.$post(url, {id: scenarioId}, async response => {
let data = response.data; let data = response.data;
if (data != null) { if (data != null) {
// //
if (this.moduleOptions && JSON.stringify(this.moduleOptions) === '{}') { if (this.moduleOptions && this.moduleOptions.length === 0) {
this.$refs.nodeTree.list(); await this.$refs.nodeTree.list();
} }
if (data.listObject && data.listObject.length > 0) { if (data.listObject && data.listObject.length > 0) {
let row = data.listObject[0]; let row = data.listObject[0];

View File

@ -182,20 +182,23 @@
return; return;
} }
} }
this.result = this.$get(url, response => { return new Promise((resolve) => {
if (response.data != undefined && response.data != null) { this.result = this.$get(url, response => {
this.data = response.data; if (response.data != undefined && response.data != null) {
this.data.forEach(node => { this.data = response.data;
node.name = node.name === '未规划场景' ? this.$t('api_test.automation.unplanned_scenario') : node.name this.data.forEach(node => {
buildTree(node, {path: ''}); node.name = node.name === '未规划场景' ? this.$t('api_test.automation.unplanned_scenario') : node.name
}); buildTree(node, {path: ''});
this.$emit('setModuleOptions', this.data); });
this.$emit('setNodeTree', this.data); this.$emit('setModuleOptions', this.data);
if (this.$refs.nodeTree) { this.$emit('setNodeTree', this.data);
this.$refs.nodeTree.filter(this.condition.filterText); if (this.$refs.nodeTree) {
this.$refs.nodeTree.filter(this.condition.filterText);
}
} }
} });
}); resolve();
})
}, },
edit(param) { edit(param) {
param.projectId = this.projectId; param.projectId = this.projectId;