From 22e453d476c388528552fa6309299a41dbd00fac Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 13 Jul 2021 18:23:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E7=A7=B0-=E9=A1=B9=E7=9B=AE=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=20#1005112?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automation/scenario/ApiScenarioList.vue | 93 ++++++++++--------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 9863854244..eea0caae10 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -50,7 +50,7 @@ {{ scope.row.customNum }} - + - + {{ scope.row.updateTime | timestampFormatDate }} - + {{ scope.row.createTime | timestampFormatDate }} - + - + { let project = response.data; - if(project){ + if (project) { this.projectName = project.name; } }); @@ -496,10 +496,10 @@ export default { this.search(); }, search(projectId) { - if(this.needRefreshModule()){ + if (this.needRefreshModule()) { this.$emit('refreshTree'); } - if(this.selectProjectId){ + if (this.selectProjectId) { projectId = this.selectProjectId; } this.selectRows = new Set(); @@ -810,17 +810,24 @@ export default { }, exportApi() { let param = {}; - this.buildBatchParam(param); - if (param.ids === undefined || param.ids.length < 1) { - this.$warning(this.$t("api_test.automation.scenario.check_case")); - return; - } - this.result.loading = true; - this.result = this.$post("/api/automation/export", param, response => { - this.result.loading = false; - let obj = response.data; - this.buildApiPath(obj.data); - downloadFile("Metersphere_Scenario_" + this.projectName + ".json", JSON.stringify(obj)); + this.projectId = getCurrentProjectID(); + this.$get('project/get/' + this.projectId, response => { + let project = response.data; + if (project) { + this.projectName = project.name; + this.buildBatchParam(param); + if (param.ids === undefined || param.ids.length < 1) { + this.$warning(this.$t("api_test.automation.scenario.check_case")); + return; + } + this.result.loading = true; + this.result = this.$post("/api/automation/export", param, response => { + this.result.loading = false; + let obj = response.data; + this.buildApiPath(obj.data); + downloadFile("Metersphere_Scenario_" + this.projectName + ".json", JSON.stringify(obj)); + }); + } }); }, exportJmx() { @@ -853,18 +860,18 @@ export default { getConditions() { return this.condition; }, - needRefreshModule(){ - if(this.initApiTableOpretion === '0'){ + needRefreshModule() { + if (this.initApiTableOpretion === '0') { return true; - }else { - this.$emit('updateInitApiTableOpretion','0'); + } else { + this.$emit('updateInitApiTableOpretion', '0'); return false; } }, - callBackSelectAll(selection){ + callBackSelectAll(selection) { this.$emit('selection', selection); }, - callBackSelect(selection){ + callBackSelect(selection) { this.$emit('selection', selection); }, batchCreatePerformance() { @@ -899,7 +906,7 @@ export default { } }); }, - batchCopy(){ + batchCopy() { this.$alert(this.$t('api_test.definition.request.batch_copy_confirm') + " ?", '', { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { @@ -915,16 +922,16 @@ export default { } }); }, - saveSortField(key,orders){ - saveLastTableSortField(key,JSON.stringify(orders)); + saveSortField(key, orders) { + saveLastTableSortField(key, JSON.stringify(orders)); }, - getSortField(){ + getSortField() { let orderJsonStr = getLastTableSortField(this.tableHeaderKey); let returnObj = null; - if(orderJsonStr){ + if (orderJsonStr) { try { returnObj = JSON.parse(orderJsonStr); - }catch (e){ + } catch (e) { return null; } }