refactor(测试跟踪): 删除前端不用的组件

This commit is contained in:
CaptainB 2022-04-12 10:54:17 +08:00 committed by 刘瑞斌
parent 19c53e94b0
commit eb03477e9e
12 changed files with 159 additions and 1252 deletions

View File

@ -112,7 +112,6 @@ import MsBottomContainer from "../../../definition/components/BottomContainer";
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn"; import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
import MsBatchEdit from "../../../definition/components/basis/BatchEdit"; import MsBatchEdit from "../../../definition/components/basis/BatchEdit";
import {API_METHOD_COLOUR} from "../../../definition/model/JsonData"; import {API_METHOD_COLOUR} from "../../../definition/model/JsonData";
import ApiListContainer from "../../../definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "../../../../track/common/tableItems/planview/PriorityTableItem";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect"; import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar"; import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
@ -127,7 +126,6 @@ export default {
TableSelectCountBar, TableSelectCountBar,
MsEnvironmentSelect, MsEnvironmentSelect,
PriorityTableItem, PriorityTableItem,
ApiListContainer,
MsTableOperatorButton, MsTableOperatorButton,
MsTableOperator, MsTableOperator,
MsTablePagination, MsTablePagination,

View File

@ -1,5 +1,5 @@
<template> <template>
<el-card class="card-content" v-if="isShow"> <div v-if="isShow">
<el-button-group v-if="isShowChangeButton"> <el-button-group v-if="isShowChangeButton">
@ -19,11 +19,8 @@
<slot name="version"></slot> <slot name="version"></slot>
<template v-slot:header>
<slot name="header"></slot>
</template>
<slot></slot> <slot></slot>
</el-card> </div>
</template> </template>
<script> <script>

View File

@ -1,6 +1,5 @@
<template> <template>
<div> <div v-loading="result.loading">
<el-card v-loading="result.loading">
<env-popover :env-map="projectEnvMap" <env-popover :env-map="projectEnvMap"
:project-ids="projectIds" :project-ids="projectIds"
@setProjectEnvMap="setProjectEnvMap" @setProjectEnvMap="setProjectEnvMap"
@ -89,8 +88,6 @@
</ms-table> </ms-table>
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize" <ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
</el-card>
</div> </div>
</template> </template>

View File

@ -186,7 +186,6 @@ import MsBottomContainer from "../../../../../api/definition/components/BottomCo
import BatchEdit from "@/business/components/track/case/components/BatchEdit"; import BatchEdit from "@/business/components/track/case/components/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData"; import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData";
import {getCurrentProjectID, hasLicense, strMapToObj} from "@/common/js/utils"; import {getCurrentProjectID, hasLicense, strMapToObj} from "@/common/js/utils";
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import {getUUID} from "../../../../../../../common/js/utils"; import {getUUID} from "../../../../../../../common/js/utils";
import TestPlanCaseListHeader from "./TestPlanCaseListHeader"; import TestPlanCaseListHeader from "./TestPlanCaseListHeader";
@ -223,7 +222,6 @@ export default {
TestPlanCaseListHeader, TestPlanCaseListHeader,
ApiCaseList, ApiCaseList,
PriorityTableItem, PriorityTableItem,
ApiListContainer,
MsTablePagination, MsTablePagination,
MsTag, MsTag,
MsApiCaseList, MsApiCaseList,

View File

@ -13,13 +13,13 @@
ref="nodeTree"/> ref="nodeTree"/>
</template> </template>
<el-card>
<el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="getTestCases" <el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="getTestCases"
@keyup.enter.native="getTestCases" class="search-input" size="small" v-model="condition.name"/> @keyup.enter.native="getTestCases" class="search-input" size="small" v-model="condition.name"/>
<ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar" <ms-table-adv-search-bar :condition.sync="condition" class="adv-search-bar"
v-if="condition.components !== undefined && condition.components.length > 0" v-if="condition.components !== undefined && condition.components.length > 0"
@search="getTestCases"/> @search="getTestCases"/>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" margin-right="20" <version-select v-xpack :project-id="projectId" @changeVersion="changeVersion" style="float: left;"
class="search-input"/> class="search-input"/>
<ms-table <ms-table
@ -53,8 +53,7 @@
prop="versionId" prop="versionId"
:column-key="'versionId'" :column-key="'versionId'"
:filters="versionFilters" :filters="versionFilters"
:label="$t('commons.version')" :label="$t('commons.version')">
min-width="120px">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span> <span>{{ scope.row.versionName }}</span>
</template> </template>
@ -72,7 +71,8 @@
<el-table-column <el-table-column
sortable sortable
prop="createTime" prop="createTime"
:label="$t('commons.create_time')"> :label="$t('commons.create_time')"
show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
@ -80,7 +80,8 @@
<el-table-column <el-table-column
sortable sortable
prop="updateTime" prop="updateTime"
:label="$t('commons.update_time')"> :label="$t('commons.update_time')"
show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span> <span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template> </template>
@ -88,7 +89,7 @@
</ms-table> </ms-table>
<ms-table-pagination :change="getTestCases" :current-page.sync="currentPage" :page-size.sync="pageSize" <ms-table-pagination :change="getTestCases" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/> :total="total"/>
</el-card>
</test-case-relevance-base> </test-case-relevance-base>
</template> </template>

View File

@ -34,15 +34,11 @@ import SelectMenu from "../../common/SelectMenu";
import TestReviewRelevance from "./components/TestReviewRelevance"; import TestReviewRelevance from "./components/TestReviewRelevance";
import MsTestPlanHeaderBar from "@/business/components/track/plan/view/comonents/head/TestPlanHeaderBar"; import MsTestPlanHeaderBar from "@/business/components/track/plan/view/comonents/head/TestPlanHeaderBar";
import TestReviewFunction from "@/business/components/track/review/view/components/TestReviewFunction"; import TestReviewFunction from "@/business/components/track/review/view/components/TestReviewFunction";
import TestReviewApi from "@/business/components/track/review/view/components/TestReviewApi";
import TestReviewLoad from "@/business/components/track/review/view/components/TestReviewLoad";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
export default { export default {
name: "TestCaseReviewView", name: "TestCaseReviewView",
components: { components: {
TestReviewLoad,
TestReviewApi,
TestReviewFunction, TestReviewFunction,
MsTestPlanHeaderBar, MsTestPlanHeaderBar,
MsMainContainer, MsMainContainer,

View File

@ -1,258 +0,0 @@
<template>
<div>
<api-list-container
:is-api-list-enable="isApiListEnable"
@isApiListEnableChange="isApiListEnableChange">
<ms-environment-select :project-id="projectId" v-if="isTestPlan" :is-read-only="isReadOnly"
@setEnvironment="setEnvironment"/>
<el-input :placeholder="$t('api_monitor.please_search')" @blur="initTable" class="search-input" size="small"
@keyup.enter.native="initTable" v-model="condition.name"/>
<el-table v-loading="result.loading"
border
:data="tableData" row-key="id" class="test-content adjust-table"
@select-all="handleSelectAll"
@select="handleSelect" ref="table">
<el-table-column reserve-selection type="selection"/>
<el-table-column prop="name" :label="$t('api_test.definition.api_name')" show-overflow-tooltip/>
<el-table-column
prop="status"
column-key="api_status"
:label="$t('api_test.definition.api_status')"
show-overflow-tooltip>
<template v-slot:default="scope">
<ms-tag v-if="scope.row.status == 'Prepare'" type="info" effect="plain"
:content="$t('test_track.plan.plan_status_prepare')"/>
<ms-tag v-if="scope.row.status == 'Underway'" type="warning" effect="plain"
:content="$t('test_track.plan.plan_status_running')"/>
<ms-tag v-if="scope.row.status == 'Completed'" type="success" effect="plain"
:content="$t('test_track.plan.plan_status_completed')"/>
<ms-tag v-if="scope.row.status == 'Trash'" type="danger" effect="plain"
:content="$t('test_track.plan.plan_status_trash')"/>
</template>
</el-table-column>
<el-table-column
prop="method"
:label="$t('api_test.definition.api_type')"
show-overflow-tooltip>
<template v-slot:default="scope" class="request-method">
<el-tag size="mini"
:style="{'background-color': getColor(scope.row.method), border: getColor(true, scope.row.method)}"
class="api-el-tag">
{{ scope.row.method }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="path"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip/>
<el-table-column width="160" :label="$t('api_test.definition.api_last_time')" prop="updateTime">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
prop="caseTotal"
:label="$t('api_test.definition.api_case_number')"
show-overflow-tooltip/>
<el-table-column
prop="caseStatus"
:label="$t('api_test.definition.api_case_status')"
show-overflow-tooltip/>
<el-table-column
prop="casePassingRate"
:label="$t('api_test.definition.api_case_passing_rate')"
show-overflow-tooltip/>
</el-table>
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</api-list-container>
<table-select-count-bar :count="selectRows.size"/>
</div>
</template>
<script>
import MsTag from "../../../../common/components/MsTag";
import ApiListContainer from "@/business/components/api/definition/components/list/ApiListContainer";
import MsEnvironmentSelect from "@/business/components/api/definition/components/case/MsEnvironmentSelect";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import TableSelectCountBar from "@/business/components/api/automation/scenario/api/TableSelectCountBar";
import {API_METHOD_COLOUR, CASE_PRIORITY} from "@/business/components/api/definition/model/JsonData";
import {_filter, _handleSelect, _handleSelectAll, _sort} from "@/common/js/tableUtils";
export default {
name: "ReviewRelevanceApiList",
components: {TableSelectCountBar, MsTablePagination, MsEnvironmentSelect, ApiListContainer, MsTag},
data() {
return {
condition: {},
selectCase: {},
result: {},
moduleId: "",
deletePath: "/test/case/delete",
selectRows: new Set(),
typeArr: [
{id: 'priority', name: this.$t('test_track.case.priority')},
],
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
],
valueArr: {
priority: CASE_PRIORITY,
},
methodColorMap: new Map(API_METHOD_COLOUR),
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
environmentId: ""
}
},
props: {
currentProtocol: String,
selectNodeIds: Array,
visible: {
type: Boolean,
default: false,
},
isApiListEnable: {
type: Boolean,
default: false,
},
isReadOnly: {
type: Boolean,
default: false
},
isCaseRelevance: {
type: Boolean,
default: false,
},
projectId: String,
reviewId: String,
isTestPlan: Boolean
},
created: function () {
this.selectRows = new Set();
this.initTable();
},
watch: {
selectNodeIds() {
this.initTable();
},
currentProtocol() {
this.initTable();
},
projectId() {
this.initTable();
}
},
computed: {},
methods: {
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},
initTable(projectId) {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
this.condition.moduleIds = [];
}
if (projectId != null && typeof projectId === 'string') {
this.condition.projectId = projectId;
} else if (this.projectId != null) {
this.condition.projectId = this.projectId;
}
if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol;
} else {
this.condition.protocol = "HTTP";
}
let url = '/api/definition/list/';
if (this.isTestPlan) {
url = '/api/definition/list/relevance/review/';
this.condition.reviewId = this.reviewId;
}
this.result = this.$post(url + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
});
},
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
},
showExecResult(row) {
this.visible = false;
this.$emit('showExecResult', row);
},
filter(filters) {
_filter(filters, this.condition);
this.initTable();
},
sort(column) {
//
if (this.condition.orders) {
this.condition.orders = [];
}
_sort(column, this.condition);
this.initTable();
},
handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows);
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
getColor(method) {
return this.methodColorMap.get(method);
},
setEnvironment(data) {
this.environmentId = data.id;
},
clearSelection() {
this.selectRows = new Set();
if (this.$refs.table) {
this.$refs.table.clearSelection();
}
}
},
}
</script>
<style scoped>
.operate-button > div {
display: inline-block;
margin-left: 10px;
}
.request-method {
padding: 0 5px;
color: #1E90FF;
}
.api-el-tag {
color: white;
}
.search-input {
float: right;
width: 30%;
margin-bottom: 20px;
margin-right: 20px;
}
</style>

View File

@ -1,200 +0,0 @@
<template>
<div>
<el-card class="table-card" v-loading="result.loading">
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
:project-list="projectList" ref="envPopover" class="env-popover"/>
<el-table ref="scenarioTable" border :data="tableData" class="adjust-table" @select-all="handleSelectAll"
@select="handleSelect">
<el-table-column type="selection"/>
<el-table-column prop="name" :label="$t('api_test.automation.scenario_name')"
show-overflow-tooltip/>
<el-table-column
v-if="versionEnable"
prop="versionId"
:filters="versionFilters"
:label="$t('commons.version')"
min-width="120px">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</el-table-column>
<el-table-column prop="level" :label="$t('api_test.automation.case_level')"
show-overflow-tooltip>
<template v-slot:default="scope">
<priority-table-item :value="scope.row.level" ref="level"/>
</template>
</el-table-column>
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" min-width="120">
<template v-slot:default="scope">
<ms-tag v-for="itemName in scope.row.tags" :key="itemName" type="success" effect="plain" :content="itemName"
style="margin-left: 5px"/>
</template>
</el-table-column>
<el-table-column prop="userId" :label="$t('api_test.automation.creator')" show-overflow-tooltip/>
<el-table-column prop="updateTime" :label="$t('api_test.automation.update_time')" width="180">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="stepTotal" :label="$t('api_test.automation.step')" show-overflow-tooltip/>
<el-table-column prop="lastResult" :label="$t('api_test.automation.last_result')">
<template v-slot:default="{row}">
<el-link type="success" @click="showReport(row)" v-if="row.lastResult === 'Success'">
{{ $t('api_test.automation.success') }}
</el-link>
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
{{ $t('api_test.automation.fail') }}
</el-link>
</template>
</el-table-column>
<el-table-column prop="passRate" :label="$t('api_test.automation.passing_rate')"
show-overflow-tooltip/>
</el-table>
<ms-table-pagination :change="search" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
</div>
</template>
<script>
import {_handleSelect, _handleSelectAll} from "@/common/js/tableUtils";
import MsTag from "@/business/components/common/components/MsTag";
import EnvPopover from "@/business/components/track/common/EnvPopover";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem";
import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
export default {
name: "ReviewRelevanceScenarioList",
components: {PriorityTableItem, MsTablePagination, EnvPopover, MsTag},
props: {
referenced: {
type: Boolean,
default: false,
},
selectNodeIds: Array,
projectId: String,
reviewId: String,
versionEnable: Boolean,
},
data() {
return {
result: {},
condition: {},
currentScenario: {},
schedule: {},
selectAll: false,
tableData: [],
currentPage: 1,
pageSize: 10,
total: 0,
reportId: "",
infoDb: false,
selectRows: new Set(),
projectEnvMap: new Map(),
projectList: [],
projectIds: new Set(),
versionFilters: []
}
},
watch: {
selectNodeIds() {
this.search();
},
projectId() {
this.search();
},
},
created() {
this.getWsProjects();
this.getVersionOptions();
},
methods: {
search() {
this.projectEnvMap.clear();
this.projectIds.clear();
if (!this.projectId) {
return;
}
this.selectRows = new Set();
this.loading = true;
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.condition.moduleIds = this.selectNodeIds;
if (this.projectId != null) {
this.condition.projectId = this.projectId;
}
if (this.reviewId != null) {
this.condition.reviewId = this.reviewId;
}
let url = "/test/case/review/scenario/case/relevance/list/" + this.currentPage + "/" + this.pageSize;
this.result = this.$post(url, this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
});
});
},
handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows);
this.initProjectIds();
},
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
this.initProjectIds();
},
setProjectEnvMap(projectEnvMap) {
this.projectEnvMap = projectEnvMap;
},
getWsProjects() {
this.$get("/project/getOwnerProjects", res => {
this.projectList = res.data;
})
},
initProjectIds() {
this.projectIds.clear();
this.selectRows.forEach(row => {
row.projectIds.forEach(id => {
this.projectIds.add(id);
})
})
},
checkEnv() {
return this.$refs.envPopover.checkEnv();
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
}
}
</script>
<style scoped>
/deep/ .el-drawer__header {
margin-bottom: 0px;
}
.env-popover {
float: right;
margin-top: 4px;
}
</style>

View File

@ -1,214 +0,0 @@
<template>
<ms-test-plan-common-component>
<template v-slot:aside>
<ms-api-module
v-if="model === 'api'"
@nodeSelectEvent="nodeChange"
@protocolChange="handleProtocolChange"
@refreshTable="refreshTable"
@setModuleOptions="setModuleOptions"
:review-id="reviewId"
:is-read-only="true"
:redirectCharType="redirectCharType"
ref="apiNodeTree"
>
<template v-slot:header>
<div class="model-change-radio">
<el-radio v-model="model" label="api">接口用例</el-radio>
<el-radio v-model="model" label="scenario">场景用例</el-radio>
</div>
</template>
</ms-api-module>
<ms-api-scenario-module
v-if="model === 'scenario'"
@nodeSelectEvent="nodeChange"
@refreshTable="refreshTable"
@setModuleOptions="setModuleOptions"
:version-enable="versionEnable"
:is-read-only="true"
:review-id="reviewId"
ref="scenarioNodeTree">
<template v-slot:header>
<div class="model-change-radio">
<el-radio v-model="model" label="api">接口用例</el-radio>
<el-radio v-model="model" label="scenario">场景用例</el-radio>
</div>
</template>
</ms-api-scenario-module>
</template>
<template v-slot:main>
<test-plan-api-case-list
v-if="model === 'api'"
:current-protocol="currentProtocol"
:currentRow="currentRow"
:version-enable="versionEnable"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:is-case-relevance="true"
:model="'plan'"
:review-id="reviewId"
:clickType="clickType"
@refresh="refreshTree"
@relevanceCase="openTestCaseRelevanceDialog"
ref="apiCaseList"/>
<ms-test-plan-api-scenario-list
v-if="model === 'scenario'"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:version-enable="versionEnable"
:review-id="reviewId"
:clickType="clickType"
@refresh="refreshTree"
@relevanceCase="openTestCaseRelevanceDialog"
ref="apiScenarioList"/>
</template>
<test-review-relevance-api
@refresh="refresh"
:review-id="reviewId"
:version-enable="versionEnable"
:model="model"
ref="apiCaseRelevance"
/>
<test-review-relevance-scenario
@refresh="refresh"
:review-id="reviewId"
:version-enable="versionEnable"
:model="model"
ref="scenarioCaseRelevance"
/>
</ms-test-plan-common-component>
</template>
<script>
import MsTestPlanCommonComponent from "@/business/components/track/plan/view/comonents/base/TestPlanCommonComponent";
import MsTestPlanApiScenarioList from "@/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList";
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
import ApiCaseSimpleList from "@/business/components/api/definition/components/list/ApiCaseSimpleList";
import TestPlanApiCaseList from "@/business/components/track/plan/view/comonents/api/TestPlanApiCaseList";
import NodeTree from "@/business/components/track/common/NodeTree";
import MsApiModule from "../../../../api/definition/components/module/ApiModule"
import TestReviewRelevanceApi from "@/business/components/track/review/view/components/TestReviewRelevanceApi";
import TestReviewRelevanceScenario
from "@/business/components/track/review/view/components/TestReviewRelevanceScenario";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
export default {
name: "TestReviewApi",
components: {
TestReviewRelevanceScenario,
TestReviewRelevanceApi,
MsTestPlanApiScenarioList,
MsApiScenarioModule,
ApiCaseSimpleList,
TestPlanApiCaseList,
MsTestPlanCommonComponent,
NodeTree,
MsApiModule,
},
data() {
return {
result: {},
treeNodes: [],
currentRow: "",
trashEnable: false,
currentProtocol: null,
currentModule: null,
selectNodeIds: [],
moduleOptions: {},
model: 'api',
versionEnable: false,
}
},
props: [
'reviewId',
'redirectCharType',
'clickType'
],
mounted() {
this.checkRedirectCharType();
this.checkVersionEnable();
},
watch: {
model() {
this.selectNodeIds = [];
this.moduleOptions = {};
},
redirectCharType(){
if(this.redirectCharType=='scenario'){
this.model = 'scenario';
}else{
this.model = 'api';
}
}
},
methods: {
checkRedirectCharType(){
if(this.redirectCharType=='scenario'){
this.model = 'scenario';
}else{
this.model = 'api';
}
},
refresh() {
this.refreshTree();
this.refreshTable();
},
refreshTable() {
if (this.$refs.apiCaseList) {
this.$refs.apiCaseList.initTable();
}
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.search();
}
},
refreshTree() {
if (this.$refs.apiNodeTree) {
this.$refs.apiNodeTree.list();
}
if (this.$refs.scenarioNodeTree) {
this.$refs.scenarioNodeTree.list();
}
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.currentProtocol = protocol;
},
setModuleOptions(data) {
this.moduleOptions = data;
},
openTestCaseRelevanceDialog(model) {
if (model === 'scenario') {
this.$refs.scenarioCaseRelevance.open();
} else {
this.$refs.apiCaseRelevance.open();
}
},
checkVersionEnable() {
if (!getCurrentProjectID()) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + getCurrentProjectID(), response => {
this.versionEnable = response.data;
});
}
},
}
}
</script>
<style scoped>
.model-change-radio {
height: 25px;
line-height: 25px;
margin: 5px 10px;
}
</style>

View File

@ -1,116 +0,0 @@
<template>
<ms-test-plan-common-component>
<template v-slot:aside>
<node-tree
class="node-tree"
v-loading="result.loading"
@nodeSelectEvent="nodeChange"
:tree-nodes="treeNodes"
ref="nodeTree"/>
</template>
<template v-slot:main>
<test-plan-load-case-list
class="table-list"
@refresh="refresh"
:review-id="reviewId"
:clickType="clickType"
:select-project-id="selectProjectId"
:select-parent-nodes="selectParentNodes"
:version-enable="versionEnable"
@relevanceCase="openTestCaseRelevanceDialog"
ref="testPlanLoadCaseList"/>
</template>
<test-case-load-relevance
@refresh="refresh"
:review-id="reviewId"
:version-enable="versionEnable"
ref="testCaseLoadRelevance"/>
</ms-test-plan-common-component>
</template>
<script>
import MsTestPlanCommonComponent from "@/business/components/track/plan/view/comonents/base/TestPlanCommonComponent";
import NodeTree from "@/business/components/track/common/NodeTree";
import TestPlanLoadCaseList from "@/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList";
import TestCaseLoadRelevance from "@/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance";
import {hasLicense} from "@/common/js/utils";
export default {
name: "TestReviewLoad",
components: {
MsTestPlanCommonComponent,
NodeTree,
TestPlanLoadCaseList,
TestCaseLoadRelevance,
},
data() {
return {
result: {},
selectNodeIds: [],
selectParentNodes: [],
selectProjectId: "",
projectId: null,
treeNodes: [],
versionEnable: false,
}
},
props: [
'reviewId',
'redirectCharType',
'clickType'
],
watch: {
planId() {
this.initData();
}
},
mounted() {
this.initData();
this.checkVersionEnable();
},
methods: {
refresh() {
this.selectProjectId = '';
this.selectParentNodes = [];
this.$refs.testPlanLoadCaseList.initTable();
this.getNodeTreeByPlanId();
},
initData() {
this.getNodeTreeByPlanId();
},
openTestCaseRelevanceDialog() {
this.$refs.testCaseLoadRelevance.open();
},
nodeChange(node, nodeIds, pNodes) {
this.selectProjectId = node.key;
// node
this.$refs.testPlanLoadCaseList.currentPage = 1;
this.$refs.testPlanLoadCaseList.pageSize = 10;
},
getNodeTreeByPlanId() {
if (this.planId) {
this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
this.treeNodes = response.data;
//
this.treeNodes.map(node => node.children = null);
});
}
},
checkVersionEnable() {
if (!this.projectId) {
return;
}
if (hasLicense()) {
this.$get('/project/version/enable/' + this.projectId, response => {
this.versionEnable = response.data;
});
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -1,162 +0,0 @@
<template>
<test-case-relevance-base
@setProject="setProject"
@save="saveCaseRelevance"
ref="baseRelevance"
>
<template v-slot:aside>
<ms-api-module
:relevance-project-id="projectId"
@nodeSelectEvent="nodeChange"
@protocolChange="handleProtocolChange"
@refreshTable="refresh"
@setModuleOptions="setModuleOptions"
:is-read-only="true"
ref="nodeTree"
/>
</template>
<review-relevance-api-list
v-if="isApiListEnable"
:current-protocol="currentProtocol"
:select-node-ids="selectNodeIds"
:is-api-list-enable="isApiListEnable"
:project-id="projectId"
:is-test-plan="true"
:review_id="reviewId"
@isApiListEnableChange="isApiListEnableChange"
ref="apiList"/>
<review-relevance-case-list
v-if="!isApiListEnable"
:current-protocol="currentProtocol"
:select-node-ids="selectNodeIds"
:is-api-list-enable="isApiListEnable"
:project-id="projectId"
:is-test-plan="true"
:review-id="reviewId"
@isApiListEnableChange="isApiListEnableChange"
ref="apiCaseList"/>
</test-case-relevance-base>
</template>
<script>
import TestCaseRelevanceBase from "@/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase";
import MsApiModule from "@/business/components/api/definition/components/module/ApiModule";
import ReviewRelevanceApiList from "@/business/components/track/review/view/components/ReviewRelevanceApiList";
import ReviewRelevanceCaseList from "@/business/components/track/review/view/components/ReviewRelevanceCaseList";
export default {
name: "TestReviewRelevanceApi",
components: {ReviewRelevanceCaseList, ReviewRelevanceApiList, MsApiModule, TestCaseRelevanceBase},
data() {
return {
showCasePage: true,
currentProtocol: null,
currentModule: null,
selectNodeIds: [],
moduleOptions: {},
trashEnable: false,
isApiListEnable: true,
condition: {},
currentRow: {},
projectId: ""
};
},
props: {
reviewId: {
type: String
}
},
watch: {
reviewId() {
this.condition.reviewId = this.reviewId;
},
},
methods: {
open() {
this.init();
this.$refs.baseRelevance.open();
},
init() {
if (this.$refs.apiList) {
this.$refs.apiList.initTable();
}
if (this.$refs.apiCaseList) {
this.$refs.apiCaseList.initTable();
}
if (this.$refs.nodeTree) {
this.$refs.nodeTree.list();
}
},
setProject(projectId) {
this.projectId = projectId;
},
isApiListEnableChange(data) {
this.isApiListEnable = data;
},
refresh(data) {
if (this.isApiListEnable) {
this.$refs.apiList.initTable(data);
} else {
this.$refs.apiCaseList.initTable(data);
}
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.currentProtocol = protocol;
},
setModuleOptions(data) {
this.moduleOptions = data;
},
saveCaseRelevance() {
let param = {};
let url = '';
let environmentId = undefined;
let selectIds = [];
if (this.isApiListEnable) {
url = '/api/definition/relevance/review';
environmentId = this.$refs.apiList.environmentId;
selectIds = Array.from(this.$refs.apiList.selectRows).map(row => row.id);
} else {
url = '/api/testcase/relevance/review';
environmentId = this.$refs.apiCaseList.environmentId;
selectIds = Array.from(this.$refs.apiCaseList.selectRows).map(row => row.id);
}
if (!environmentId) {
this.$warning(this.$t('api_test.environment.select_environment'));
return;
}
param.reviewId = this.reviewId;
param.selectIds = selectIds;
param.environmentId = environmentId;
this.result = this.$post(url, param, () => {
this.$success(this.$t('commons.save_success'));
this.$emit('refresh');
this.refresh();
this.$refs.baseRelevance.close();
});
},
}
}
</script>
<style scoped>
/deep/ .select-menu {
margin-bottom: 15px;
}
/deep/ .environment-select {
float: right;
margin-right: 10px;
}
</style>

View File

@ -1,130 +0,0 @@
<template>
<test-case-relevance-base
@setProject="setProject"
@save="saveCaseRelevance"
ref="baseRelevance">
<template v-slot:aside>
<ms-api-scenario-module
@nodeSelectEvent="nodeChange"
@refreshTable="refresh"
@setModuleOptions="setModuleOptions"
:relevance-project-id="projectId"
:is-read-only="true"
ref="nodeTree"
/>
</template>
<review-relevance-scenario-list
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:review-id="reviewId"
:version-enable="versionEnable"
:project-id="projectId"
ref="apiScenarioList"/>
</test-case-relevance-base>
</template>
<script>
import TestCaseRelevanceBase from "@/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase";
import MsApiScenarioModule from "@/business/components/api/automation/scenario/ApiScenarioModule";
import ReviewRelevanceScenarioList
from "@/business/components/track/review/view/components/ReviewRelevanceScenarioList";
import {strMapToObj} from "@/common/js/utils";
export default {
name: "TestReviewRelevanceScenario",
components: {ReviewRelevanceScenarioList, MsApiScenarioModule, TestCaseRelevanceBase},
data() {
return {
showCasePage: true,
currentProtocol: null,
currentModule: null,
selectNodeIds: [],
moduleOptions: {},
trashEnable: false,
condition: {},
currentRow: {},
projectId: ""
};
},
props: {
reviewId: {
type: String
},
versionEnable: {
type: Boolean,
default: false
}
},
watch: {
reviewId() {
this.condition.reviewId = this.reviewId;
},
},
methods: {
open() {
this.$refs.baseRelevance.open();
if (this.$refs.apiScenarioList) {
this.$refs.apiScenarioList.search();
}
},
setProject(projectId) {
this.projectId = projectId;
},
refresh(data) {
this.$refs.apiScenarioList.search(data);
},
nodeChange(node, nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.currentProtocol = protocol;
},
setModuleOptions(data) {
this.moduleOptions = data;
},
saveCaseRelevance() {
const sign = this.$refs.apiScenarioList.checkEnv();
if (!sign) {
return false;
}
let param = {};
let url = '/api/automation/relevance/review';
let rows = this.$refs.apiScenarioList.selectRows;
const envMap = this.$refs.apiScenarioList.projectEnvMap;
let map = new Map();
rows.forEach(row => {
map.set(row.id, row.projectIds);
})
param.reviewId = this.reviewId;
param.mapping = strMapToObj(map);
param.envMap = strMapToObj(envMap);
this.result = this.$post(url, param, () => {
this.$success(this.$t('commons.save_success'));
this.$emit('refresh');
this.refresh();
this.$refs.baseRelevance.close();
});
},
}
}
</script>
<style scoped>
/deep/ .select-menu {
margin-bottom: 15px;
}
/deep/ .environment-select {
float: right;
margin-right: 10px;
}
/deep/ .module-input {
width: 243px;
}
</style>