diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index ebe3dc5fb4..9ffd26fd3d 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -109,7 +109,7 @@ {{$t('api_test.automation.scenario_total')}} - :{{this.currentScenario.variables!=undefined?this.currentScenario.variables.length-1: 0}} + :{{this.currentScenario.variables!=undefined?this.currentScenario.variables.length: 0}} 共享cookie @@ -220,7 +220,7 @@ - + @@ -247,7 +247,7 @@ import MsLoopController from "./LoopController"; import MsApiScenarioComponent from "./ApiScenarioComponent"; import MsApiReportDetail from "../report/ApiReportDetail"; - import MsScenarioParameters from "./ScenarioParameters"; + import MsVariableList from "./variable/VariableList"; import ApiImport from "../../definition/components/import/ApiImport"; import InputTag from 'vue-input-tag' import "@/common/css/material-icons.css" @@ -262,10 +262,10 @@ currentScenario: {}, }, components: { + MsVariableList, ScenarioRelevance, ScenarioApiRelevance, ApiEnvironmentConfig, - MsScenarioParameters, MsApiReportDetail, MsInputTag, MsRun, MsApiScenarioComponent, @@ -333,10 +333,7 @@ this.operatingElements = ELEMENTS.get("ALL"); this.getMaintainerOptions(); this.getApiScenario(); - } - , - watch: {} - , + }, directives: {OutsideClick}, computed: { buttons() { @@ -457,6 +454,9 @@ getIdx(index) { return index - 0.33 }, + setVariables(v) { + this.currentScenario.variables = v; + }, showButton(...names) { for (const name of names) { if (this.operatingElements.includes(name)) { @@ -836,7 +836,20 @@ let obj = JSON.parse(response.data.scenarioDefinition); if (obj) { this.currentEnvironmentId = obj.environmentId; - this.currentScenario.variables = obj.variables; + this.currentScenario.variables = []; + let index = 1; + obj.variables.forEach(item => { + // 兼容历史数据 + if (item.name) { + if (!item.type) { + item.type = "VARIABLE"; + item.id = getUUID(); + } + item.num = index; + this.currentScenario.variables.push(item); + index++; + } + }) this.enableCookieShare = obj.enableCookieShare; this.scenarioDefinition = obj.hashTree; } @@ -848,8 +861,7 @@ this.getEnvironments(); }) } - } - , + }, setParameter() { this.currentScenario.stepTotal = this.scenarioDefinition.length; this.currentScenario.projectId = getCurrentProjectID(); @@ -873,17 +885,10 @@ runRefresh() { this.debugVisible = true; this.loading = false; - } - , + }, showScenarioParameters() { this.$refs.scenarioParameters.open(this.currentScenario.variables); - } - , - addParameters(data) { - this.currentScenario.variables = data; - this.reload(); - } - , + }, apiImport(importData) { if (importData && importData.data) { importData.data.forEach(item => { diff --git a/frontend/src/business/components/api/automation/scenario/ScenarioParameters.vue b/frontend/src/business/components/api/automation/scenario/ScenarioParameters.vue deleted file mode 100644 index b250fbd08d..0000000000 --- a/frontend/src/business/components/api/automation/scenario/ScenarioParameters.vue +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue b/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue new file mode 100644 index 0000000000..cc1876beda --- /dev/null +++ b/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/frontend/src/business/components/api/automation/scenario/variable/EditConstant.vue b/frontend/src/business/components/api/automation/scenario/variable/EditConstant.vue new file mode 100644 index 0000000000..3dcc73dd4a --- /dev/null +++ b/frontend/src/business/components/api/automation/scenario/variable/EditConstant.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/frontend/src/business/components/api/automation/scenario/variable/EditCounter.vue b/frontend/src/business/components/api/automation/scenario/variable/EditCounter.vue new file mode 100644 index 0000000000..2ba19cf61b --- /dev/null +++ b/frontend/src/business/components/api/automation/scenario/variable/EditCounter.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/frontend/src/business/components/api/automation/scenario/variable/EditCsv.vue b/frontend/src/business/components/api/automation/scenario/variable/EditCsv.vue new file mode 100644 index 0000000000..5a755b76d2 --- /dev/null +++ b/frontend/src/business/components/api/automation/scenario/variable/EditCsv.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/frontend/src/business/components/api/automation/scenario/variable/EditListValue.vue b/frontend/src/business/components/api/automation/scenario/variable/EditListValue.vue new file mode 100644 index 0000000000..a1123e53b8 --- /dev/null +++ b/frontend/src/business/components/api/automation/scenario/variable/EditListValue.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/frontend/src/business/components/api/automation/scenario/variable/EditRandom.vue b/frontend/src/business/components/api/automation/scenario/variable/EditRandom.vue new file mode 100644 index 0000000000..d55c8e6c0a --- /dev/null +++ b/frontend/src/business/components/api/automation/scenario/variable/EditRandom.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue new file mode 100644 index 0000000000..d5c587a91a --- /dev/null +++ b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 4629e2c072..083abdfe28 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -570,7 +570,7 @@ export default { create_tag: "Create tag", scenario_step: "Ccenario step", step_total: "Step total", - scenario_total: "Scenario total", + scenario_total: "Scenario variable", api_list_import: "Api list import", external_import: "External import", wait_controller: "Wait controller", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index b91cd2e0c4..d586380f8f 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -569,7 +569,7 @@ export default { create_tag: "创建Tag", scenario_step: "场景步骤", step_total: "步骤总数", - scenario_total: "场景公共参数", + scenario_total: "场景变量", api_list_import: "接口列表导入", external_import: "外部导入", wait_controller: "等待控制器", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 3007e1de51..5c077d4ca1 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -569,7 +569,7 @@ export default { create_tag: "創建Tag", scenario_step: "場景步驟", step_total: "步驟總數", - scenario_total: "場景公共參數", + scenario_total: "場景變量", api_list_import: "接口列表導入", external_import: "外部導入", wait_controller: "等待控制器",