提交 f64d7a21 编写于 作者: W wenyann

Merge remote-tracking branch 'origin/master'

...@@ -70,6 +70,6 @@ ...@@ -70,6 +70,6 @@
from project, test_case_review_project from project, test_case_review_project
where project.id = test_case_review_project.project_id where project.id = test_case_review_project.project_id
and project.workspace_id = #{workspaceId} and project.workspace_id = #{workspaceId}
and test_case_review_project.review_id = #{reviewId}; and test_case_review_project.review_id = #{reviewId}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
:request="selected" :scenario="currentScenario" v-if="isRequest"/> :request="selected" :scenario="currentScenario" v-if="isRequest"/>
</div> </div>
</el-main> </el-main>
<ms-api-scenario-select :exclude-id="test.id" @select="selectScenario" ref="selectDialog"/> <ms-api-scenario-select :exclude-id="test.id" :project-id="test.projectId" @select="selectScenario" ref="selectDialog"/>
</el-container> </el-container>
</template> </template>
......
...@@ -43,6 +43,7 @@ import MsTableSearchBar from "@/business/components/common/components/MsTableSea ...@@ -43,6 +43,7 @@ import MsTableSearchBar from "@/business/components/common/components/MsTableSea
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar"; import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
import MsApiScenarioSelectSubTable from "@/business/components/api/test/components/ApiScenarioSelectSubTable"; import MsApiScenarioSelectSubTable from "@/business/components/api/test/components/ApiScenarioSelectSubTable";
import {Scenario} from "@/business/components/api/test/model/ScenarioModel"; import {Scenario} from "@/business/components/api/test/model/ScenarioModel";
import {parseEnvironment} from "../model/EnvironmentModel";
export default { export default {
name: "MsApiScenarioSelect", name: "MsApiScenarioSelect",
...@@ -51,7 +52,8 @@ export default { ...@@ -51,7 +52,8 @@ export default {
MsTableAdvSearchBar, MsTableSearchBar, MsTablePagination, MsTableHeader MsTableAdvSearchBar, MsTableSearchBar, MsTablePagination, MsTableHeader
}, },
props: { props: {
excludeId: String excludeId: String,
projectId: String
}, },
data() { data() {
return { return {
...@@ -64,6 +66,7 @@ export default { ...@@ -64,6 +66,7 @@ export default {
pageSize: 5, pageSize: 5,
total: 0, total: 0,
selection: false, selection: false,
environmentMap: new Map()
} }
}, },
methods: { methods: {
...@@ -94,19 +97,50 @@ export default { ...@@ -94,19 +97,50 @@ export default {
} }
scenarios.push(scenario); scenarios.push(scenario);
} }
this.initScenarioEnvironment(scenarios);
this.$emit('select', scenarios); this.$emit('select', scenarios);
}, },
getEnvironment() {
if (this.projectId) {
this.result = this.$get('/api/environment/list/' + this.projectId, response => {
let environments = response.data;
this.environmentMap = new Map();
environments.forEach(environment => {
parseEnvironment(environment);
this.environmentMap.set(environment.id, environment);
});
});
}
},
initScenarioEnvironment(scenarios) {
scenarios.forEach(scenario => {
if (scenario.environmentId) {
let env = this.environmentMap.get(scenario.environmentId);
if (!env) {
scenario.environmentId = undefined;
scenario.environment = undefined;
} else {
scenario.environment = env;
}
} else {
scenario.environmentId = undefined;
scenario.environment = undefined;
}
});
},
clone(row) { clone(row) {
let scenarios = []; let scenarios = [];
row.selected.forEach(options => { row.selected.forEach(options => {
// 去掉ID,创建新的ID // 去掉ID,创建新的ID
options.id = undefined; options.id = undefined;
scenarios.push(new Scenario(options)); scenarios.push(new Scenario(options));
}) });
this.initScenarioEnvironment(scenarios);
this.$emit('select', scenarios); this.$emit('select', scenarios);
}, },
open() { open() {
this.search(); this.search();
this.getEnvironment();
this.visible = true; this.visible = true;
}, },
close() { close() {
......
Subproject commit 06d935cd1d22ab36f09763745c2aff8ad3fb08c1 Subproject commit cc38137a69a0f20fadece9c0f9f50a9468c4ace9
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册