This commit is contained in:
fit2-zhao 2021-01-19 13:12:58 +08:00
commit e2356c1849
7 changed files with 124 additions and 67 deletions

View File

@ -86,6 +86,12 @@
this.$refs.relevanceDialog.close();
},
open() {
if (this.$refs.apiList) {
this.$refs.apiList.clearSelection();
}
if (this.$refs.apiCaseList) {
this.$refs.apiCaseList.clearSelection();
}
this.$refs.relevanceDialog.open();
},
isApiListEnableChange(data) {

View File

@ -1,4 +1,5 @@
<template>
<div>
<api-list-container
:is-api-list-enable="isApiListEnable"
@isApiListEnableChange="isApiListEnableChange">
@ -7,13 +8,12 @@
<el-input placeholder="搜索" @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">
<el-table-column type="selection"/>
@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/>
@ -70,6 +70,9 @@
<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>
@ -88,10 +91,12 @@ import PriorityTableItem from "../../../../track/common/tableItems/planview/Prio
import {_filter, _sort} from "../../../../../../common/js/utils";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
export default {
name: "RelevanceApiList",
components: {
TableSelectCountBar,
MsEnvironmentSelect,
PriorityTableItem,
ApiListContainer,
@ -155,6 +160,7 @@ export default {
isTestPlan: Boolean
},
created: function () {
this.selectRows = new Set();
this.initTable();
},
watch: {
@ -174,7 +180,6 @@ export default {
this.$emit('isApiListEnableChange', data);
},
initTable() {
this.selectRows = new Set();
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
@ -230,6 +235,12 @@ export default {
},
setEnvironment(data) {
this.environmentId = data.id;
},
clearSelection() {
this.selectRows = new Set();
if (this.$refs.table) {
this.$refs.table.clearSelection();
}
}
},
}

View File

@ -10,12 +10,14 @@
<el-table v-loading="result.loading"
border
:data="tableData" row-key="id" class="test-content adjust-table"
:data="tableData"
row-key="id"
class="test-content adjust-table"
@select-all="handleSelectAll"
@filter-change="filter"
@sort-change="sort"
@select="handleSelect">
<el-table-column type="selection"/>
@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/>
@ -55,6 +57,8 @@
:total="total"/>
</api-list-container>
<table-select-count-bar :count="selectRows.size"/>
</div>
</template>
@ -76,10 +80,12 @@
import {_filter, _sort} from "../../../../../../common/js/utils";
import {_handleSelect, _handleSelectAll} from "../../../../../../common/js/tableUtils";
import MsEnvironmentSelect from "../../../definition/components/case/MsEnvironmentSelect";
import TableSelectCountBar from "./TableSelectCountBar";
export default {
name: "RelevanceCaseList",
components: {
TableSelectCountBar,
MsEnvironmentSelect,
PriorityTableItem,
ApiListContainer,
@ -154,16 +160,12 @@
projectId() {
this.initTable();
}
},
computed: {
},
methods: {
isApiListEnableChange(data) {
this.$emit('isApiListEnableChange', data);
},
initTable() {
this.selectRows = new Set();
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
if (this.projectId != null) {
@ -231,6 +233,12 @@
},
setEnvironment(data) {
this.environmentId = data.id;
},
clearSelection() {
this.selectRows = new Set();
if (this.$refs.table) {
this.$refs.table.clearSelection();
}
}
},
}

View File

@ -0,0 +1,23 @@
<template>
<div v-if="count && count > 0" class="content">
{{$t('commons.table.select_tip', [this.count])}}
</div>
</template>
<script>
export default {
name: "TableSelectCountBar",
props: ['count']
}
</script>
<style scoped>
.content {
text-align: center;
height: 20px;
line-height: 20px;
margin-top: 10px;
}
</style>

View File

@ -127,6 +127,9 @@ export default {
validate: "Validate",
batch_add: "Batch add",
check_project_tip: "Create or select the project first",
table: {
select_tip: "Item {0} data is selected"
},
date: {
select_date: 'Select date',
start_date: 'Start date',

View File

@ -127,6 +127,9 @@ export default {
validate: "校验",
batch_add: "批量添加",
check_project_tip: "请先创建或选择项目",
table: {
select_tip: "已选中 {0} 条数据"
},
date: {
select_date: '选择日期',
start_date: '开始日期',

View File

@ -127,6 +127,9 @@ export default {
validate: "校驗",
batch_add: "批量添加",
check_project_tip: "請先創建或選擇項目",
table: {
select_tip: "已选中 {0} 条数据"
},
date: {
select_date: '選擇日期',
start_date: '開始日期',