Merge branch 'v1.8' of github.com:metersphere/metersphere into v1.8

This commit is contained in:
chenjianxing 2021-03-31 10:53:14 +08:00
commit e04d82d117
10 changed files with 997 additions and 870 deletions

View File

@ -264,15 +264,7 @@ public class ApiDefinitionService {
test.setEnvironmentId(request.getEnvironmentId()); test.setEnvironmentId(request.getEnvironmentId());
test.setUserId(request.getUserId()); test.setUserId(request.getUserId());
test.setTags(request.getTags()); test.setTags(request.getTags());
if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) { this.setModule(test);
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(test.getProjectId()).andProtocolEqualTo(test.getProtocol()).andNameEqualTo("默认模块");
List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) {
test.setModuleId(modules.get(0).getId());
test.setModulePath(modules.get(0).getName());
}
}
apiDefinitionMapper.updateByPrimaryKeySelective(test); apiDefinitionMapper.updateByPrimaryKeySelective(test);
return test; return test;
} }
@ -591,6 +583,17 @@ public class ApiDefinitionService {
return apiTestCaseMapper.selectByPrimaryKey(apiCaseId); return apiTestCaseMapper.selectByPrimaryKey(apiCaseId);
} }
private void setModule(ApiDefinitionWithBLOBs item) {
if (item != null && StringUtils.isEmpty(item.getModuleId()) || "default-module".equals(item.getModuleId())) {
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo("默认模块");
List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) {
item.setModuleId(modules.get(0).getId());
item.setModulePath(modules.get(0).getName());
}
}
}
public ApiDefinitionImport apiTestImport(MultipartFile file, ApiTestImportRequest request) { public ApiDefinitionImport apiTestImport(MultipartFile file, ApiTestImportRequest request) {
ApiImportParser apiImportParser = ApiDefinitionImportParserFactory.getApiImportParser(request.getPlatform()); ApiImportParser apiImportParser = ApiDefinitionImportParserFactory.getApiImportParser(request.getPlatform());
@ -616,15 +619,7 @@ public class ApiDefinitionService {
} }
for (int i = 0; i < data.size(); i++) { for (int i = 0; i < data.size(); i++) {
ApiDefinitionWithBLOBs item = data.get(i); ApiDefinitionWithBLOBs item = data.get(i);
if (StringUtils.isEmpty(item.getModuleId()) || "default-module".equals(item.getModuleId())) { this.setModule(item);
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(item.getProjectId()).andProtocolEqualTo(item.getProtocol()).andNameEqualTo("默认模块");
List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) {
item.setModuleId(modules.get(0).getId());
item.setModulePath(modules.get(0).getName());
}
}
if (item.getName().length() > 255) { if (item.getName().length() > 255) {
item.setName(item.getName().substring(0, 255)); item.setName(item.getName().substring(0, 255));
} }

View File

@ -441,18 +441,14 @@ export default {
} }
}); });
if (this.$refs.scenarioTable) {
setTimeout(() => {
this.$refs.scenarioTable.doLayout();
this.result.loading = false;
}, 500)
}
if (!this.condition.selectAll) { if (!this.condition.selectAll) {
this.condition.unSelectIds = response.data.listObject.map(s => s.id); this.condition.unSelectIds = response.data.listObject.map(s => s.id);
} }
this.$nextTick(function () { this.$nextTick(function () {
if (this.$refs.scenarioTable) {
setTimeout(this.$refs.scenarioTable.doLayout, 200)
}
this.checkTableRowIsSelect(); this.checkTableRowIsSelect();
}) })
}); });
@ -732,8 +728,8 @@ export default {
// let ids = [row.id]; // let ids = [row.id];
let param = {}; let param = {};
this.buildBatchParam(param); this.buildBatchParam(param);
if(param.ids && param.ids.length <=0){ if (param.ids && param.ids.length <= 0) {
param.ids =[row.id]; param.ids = [row.id];
} }
this.$post('/api/automation/removeToGcByBatch/', param, () => { this.$post('/api/automation/removeToGcByBatch/', param, () => {
// this.$post('/api/automation/removeToGc/', ids, () => { // this.$post('/api/automation/removeToGc/', ids, () => {
@ -838,4 +834,8 @@ export default {
/deep/ .el-card__header { /deep/ .el-card__header {
padding: 10px; padding: 10px;
} }
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
}
</style> </style>

View File

@ -767,7 +767,7 @@
}, },
runDebug() { runDebug() {
/*触发执行操作*/ /*触发执行操作*/
let sign = this.$refs.envPopover.checkEnv(); let sign = this.$refs.envPopover.checkEnv(this.scenarioDefinition);
if (!sign) { if (!sign) {
return; return;
} }

View File

@ -44,8 +44,8 @@ export default {
setProjectEnvMap(map) { setProjectEnvMap(map) {
this.$emit("setProjectEnvMap", map); this.$emit("setProjectEnvMap", map);
}, },
checkEnv() { checkEnv(data) {
return this.$refs.envSelect.checkEnv(); return this.$refs.envSelect.checkEnv(data);
} }
} }

View File

@ -29,133 +29,257 @@
</template> </template>
<script> <script>
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel"; import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
import ApiEnvironmentConfig from "@/business/components/api/definition/components/environment/ApiEnvironmentConfig"; import ApiEnvironmentConfig from "@/business/components/api/definition/components/environment/ApiEnvironmentConfig";
import {ELEMENTS} from "./Setting";
export default { export default {
name: "EnvironmentSelect", name: "EnvironmentSelect",
components: {ApiEnvironmentConfig}, components: {ApiEnvironmentConfig},
props: { props: {
envMap: Map, envMap: Map,
projectIds: Set, projectIds: Set,
projectList: Array projectList: Array
}, },
data() { data() {
return { return {
data: [], data: [],
result: {}, result: {},
projects: [], projects: [],
environments: [], environments: [],
dialogVisible: false dialogVisible: false,
} isFullUrl: true,
}, }
methods: { },
init() { methods: {
this.projectIds.forEach(id => { init() {
let item = {id: id, envs: [], selectEnv: ""}; this.projectIds.forEach(id => {
this.data.push(item); let item = {id: id, envs: [], selectEnv: ""};
this.result = this.$get('/api/environment/list/' + id, res => { this.data.push(item);
let envs = res.data; this.result = this.$get('/api/environment/list/' + id, res => {
envs.forEach(environment => { let envs = res.data;
parseEnvironment(environment); envs.forEach(environment => {
}); parseEnvironment(environment);
// });
let temp = this.data.find(dt => dt.id === id); //
temp.envs = envs; let temp = this.data.find(dt => dt.id === id);
let envId = this.envMap.get(id); temp.envs = envs;
// let envId = this.envMap.get(id);
temp.selectEnv = envs.filter(e =>e.id === envId).length === 0 ? null : envId; //
temp.selectEnv = envs.filter(e => e.id === envId).length === 0 ? null : envId;
})
}) })
}) },
}, open() {
open() { this.data = [];
this.data = []; if (this.projectIds.size > 0) {
if (this.projectIds.size > 0) { this.init();
this.init(); }
} },
}, getProjectName(id) {
getProjectName(id) { const project = this.projectList.find(p => p.id === id);
const project = this.projectList.find(p => p.id === id); return project ? project.name : "";
return project ? project.name : ""; },
}, openEnvironmentConfig(projectId, envId) {
openEnvironmentConfig(projectId, envId) { if (!projectId) {
if (!projectId) { this.$error(this.$t('api_test.select_project'));
this.$error(this.$t('api_test.select_project'));
return;
}
this.$refs.environmentConfig.open(projectId, envId);
},
handleConfirm() {
let map = new Map();
let sign = true;
this.data.forEach(dt => {
if (!dt.selectEnv) {
sign = false;
return; return;
} }
map.set(dt.id, dt.selectEnv); this.$refs.environmentConfig.open(projectId, envId);
}) },
if (!sign) { handleConfirm() {
this.$warning("请为每个项目选择一个运行环境!"); let map = new Map();
return; let sign = true;
}
this.$emit('setProjectEnvMap', map);
this.$emit('close');
},
checkEnv() {
let sign = true;
if (this.data.length > 0) {
this.data.forEach(dt => { this.data.forEach(dt => {
if (!dt.selectEnv) { if (!dt.selectEnv) {
sign = false; sign = false;
return false; return;
}
map.set(dt.id, dt.selectEnv);
})
if (!sign) {
this.$warning("请为每个项目选择一个运行环境!");
return;
}
this.$emit('setProjectEnvMap', map);
this.$emit('close');
},
getApiInfo(request) {
if (request.id && request.referenced === 'REF') {
let requestResult = request.requestResult;
let url = request.refType && request.refType === 'CASE' ? "/api/testcase/get/" : "/api/definition/get/";
let enable = request.enable;
this.$get(url + request.id, response => {
if (response.data) {
Object.assign(request, JSON.parse(response.data.request));
request.name = response.data.name;
request.enable = enable;
if (response.data.path && response.data.path != null) {
request.path = response.data.path;
request.url = response.data.url;
this.setUrl(request.path);
}
if (response.data.method && response.data.method != null) {
request.method = response.data.method;
}
request.requestResult = requestResult;
request.id = response.data.id;
request.disabled = true;
request.root = true;
if (!request.projectId) {
request.projectId = response.data.projectId;
}
this.reload();
this.sort();
} else {
request.referenced = "Deleted";
}
})
}
},
getScenario(scenario) {
this.result = this.$get("/api/automation/getApiScenario/" + scenario.id, response => {
if (response.data) {
scenario.loaded = true;
let obj = {};
if (response.data.scenarioDefinition) {
obj = JSON.parse(response.data.scenarioDefinition);
scenario.hashTree = obj.hashTree;
}
//scenario.disabled = true;
scenario.name = response.data.name;
if (!scenario.projectId) {
scenario.projectId = response.data.projectId;
}
scenario.headers = obj.headers;
scenario.variables = obj.variables;
scenario.environmentMap = obj.environmentMap;
this.$emit('refReload');
} else {
scenario.referenced = "Deleted";
} }
}) })
} else { },
// recursiveSorting(arr) {
if (this.envMap && this.envMap.size > 0) { for (let i in arr) {
this.projectIds.forEach(id => { if (arr[i].referenced === 'REF') {
if (!this.envMap.get(id)) { //
if (arr[i].type === "HTTPSamplerProxy") {
//
this.getApiInfo(arr[i]);
//
if (!arr[i].url || (!arr[i].url.startsWith("http://") && !arr[i].url.startsWith("https://"))) {
this.isFullUrl = false;
}
} else if (arr[i].type === "scenario") {
this.getScenario(arr[i]);
}
} else {
if (arr[i].type === "HTTPSamplerProxy") {
//
if (arr[i].enable) {
if (!arr[i].url || (!arr[i].url.startsWith("http://") && !arr[i].url.startsWith("https://"))) {
this.isFullUrl = false;
}
}
}
}
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree);
}
}
},
checkFullUrl(scenarioDefinition) {
for (let i in scenarioDefinition) {
// ID
let request = scenarioDefinition[i];
if (request.referenced === 'REF') {
if (request.type === "HTTPSamplerProxy") {
this.getApiInfo(request);
//
if (!request.url || (!request.url.startsWith("http://") && !request.url.startsWith("https://"))) {
this.isFullUrl = false;
}
} else if (request.type === "scenario") {
this.getScenario(request);
}
} else {
if (request.type === "HTTPSamplerProxy") {
//
if (request.enable) {
if (!request.url || (!request.url.startsWith("http://") && !request.url.startsWith("https://"))) {
this.isFullUrl = false;
}
}
}
}
if (scenarioDefinition[i].hashTree != undefined && scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(scenarioDefinition[i].hashTree);
}
}
},
checkEnv(data) {
let sign = true;
this.isFullUrl = true;
if (this.data.length > 0) {
this.data.forEach(dt => {
if (!dt.selectEnv) {
sign = false; sign = false;
return false; return false;
} }
}) })
} else { } else {
sign = false; //
} if (this.envMap && this.envMap.size > 0) {
} this.projectIds.forEach(id => {
if (!this.envMap.get(id)) {
sign = false;
return false;
}
})
} else {
// this.checkFullUrl(data);
// sign = this.isFullUrl;
sign = false;
}
if (!sign) { //
this.$warning("请为每个项目选择一个运行环境!");
return false; }
if (!sign) {
this.$warning("请为每个项目选择一个运行环境!");
return false;
}
return true;
},
environmentConfigClose() {
// todo
} }
return true;
},
environmentConfigClose() {
// todo
} }
} }
}
</script> </script>
<style scoped> <style scoped>
.ms-scenario-button { .ms-scenario-button {
margin-left: 20px; margin-left: 20px;
} }
.env-confirm { .env-confirm {
margin-left: 20px; margin-left: 20px;
width: 360px; width: 360px;
margin-top: 10px; margin-top: 10px;
} }
.project-name { .project-name {
display:inline-block; display: inline-block;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
width: 150px; width: 150px;
margin-left: 8px; margin-left: 8px;
vertical-align:middle; vertical-align: middle;
} }
</style> </style>

View File

@ -313,7 +313,7 @@ export default {
this.condition.status = "Trash"; this.condition.status = "Trash";
this.condition.moduleIds = []; this.condition.moduleIds = [];
} }
if(!this.selectAll){ if (!this.selectAll) {
this.selectAll = false; this.selectAll = false;
this.unSelection = []; this.unSelection = [];
this.selectDataCounts = 0; this.selectDataCounts = 0;
@ -342,7 +342,7 @@ export default {
this.total = response.data.itemCount; this.total = response.data.itemCount;
this.tableData = response.data.listObject; this.tableData = response.data.listObject;
if(!this.selectAll){ if (!this.selectAll) {
this.unSelection = response.data.listObject.map(s => s.id); this.unSelection = response.data.listObject.map(s => s.id);
} }
@ -351,13 +351,11 @@ export default {
item.tags = JSON.parse(item.tags); item.tags = JSON.parse(item.tags);
} }
}) })
if (this.$refs.caseTable) {
setTimeout(() => { this.$nextTick(function () {
this.$refs.caseTable.doLayout(); if (this.$refs.caseTable) {
this.result.loading = false; setTimeout(this.$refs.caseTable.doLayout, 200)
}, 500) }
}
this.$nextTick(function(){
this.checkTableRowIsSelect(); this.checkTableRowIsSelect();
}) })
}); });
@ -365,20 +363,20 @@ export default {
getLabel(this, API_CASE_LIST); getLabel(this, API_CASE_LIST);
}, },
checkTableRowIsSelect(){ checkTableRowIsSelect() {
// //
if(this.selectAll){ if (this.selectAll) {
let unSelectIds = this.unSelection; let unSelectIds = this.unSelection;
this.tableData.forEach(row=>{ this.tableData.forEach(row => {
if(unSelectIds.indexOf(row.id)<0){ if (unSelectIds.indexOf(row.id) < 0) {
this.$refs.caseTable.toggleRowSelection(row,true); this.$refs.caseTable.toggleRowSelection(row, true);
//selectRows //selectRows
if (!this.selectRows.has(row)) { if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true); this.$set(row, "showMore", true);
this.selectRows.add(row); this.selectRows.add(row);
} }
}else{ } else {
//selectRow //selectRow
if (this.selectRows.has(row)) { if (this.selectRows.has(row)) {
this.$set(row, "showMore", false); this.$set(row, "showMore", false);
@ -694,4 +692,8 @@ export default {
/deep/ .el-table__fixed { /deep/ .el-table__fixed {
height: 100% !important; height: 100% !important;
} }
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
}
</style> </style>

View File

@ -2,128 +2,128 @@
<div class="card-container" v-loading="result.loading"> <div class="card-container" v-loading="result.loading">
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData" <ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:tip="$t('commons.search_by_name_or_id')" title="" :show-create="false"/> :tip="$t('commons.search_by_name_or_id')" title="" :show-create="false"/>
<el-table <el-table
border border
:data="tableData" :data="tableData"
@sort-change="sort" @sort-change="sort"
@filter-change="filter" @filter-change="filter"
@select-all="handleSelectAll" @select-all="handleSelectAll"
@select="handleSelect" @select="handleSelect"
@header-dragend="headerDragend" @header-dragend="headerDragend"
@cell-mouse-enter="showPopover" @cell-mouse-enter="showPopover"
row-key="id" row-key="id"
class="test-content adjust-table ms-select-all-fixed" class="test-content adjust-table ms-select-all-fixed"
ref="table" @row-click="handleEdit"> ref="table" @row-click="handleEdit">
<el-table-column
width="50"
type="selection"/>
<ms-table-header-select-popover v-show="total>0"
:page-size="pageSize > total ? total : pageSize"
:total="total"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column width="40" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<template v-for="(item, index) in tableLabel">
<el-table-column <el-table-column
width="50" v-if="item.id == 'num'"
type="selection"/> prop="num"
sortable="custom"
<ms-table-header-select-popover v-show="total>0" :label="$t('commons.id')"
:page-size="pageSize > total ? total : pageSize" :key="index"
:total="total" show-overflow-tooltip>
@selectPageAll="isSelectDataAll(false)" </el-table-column>
@selectAll="isSelectDataAll(true)"/> <el-table-column
v-if="item.id == 'name'"
<el-table-column width="40" :resizable="false" align="center"> prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.id == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="100px"
:label="$t('test_track.case.priority')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope"> <template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/> <priority-table-item :value="scope.row.priority"/>
</template> </template>
</el-table-column> </el-table-column>
<template v-for="(item, index) in tableLabel"> <el-table-column
v-if="item.id=='reviewStatus'"
<el-table-column column-key="reviewStatus"
v-if="item.id == 'num'" min-width="100px"
prop="num" :label="$t('test_track.case.status')"
sortable="custom" :key="index">
:label="$t('commons.id')" <template v-slot:default="scope">
:key="index"
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-if="item.id == 'name'"
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip
:key="index"
>
</el-table-column>
<el-table-column
v-if="item.id == 'priority'"
prop="priority"
:filters="priorityFilters"
column-key="priority"
min-width="100px"
:label="$t('test_track.case.priority')"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column
v-if="item.id=='reviewStatus'"
column-key="reviewStatus"
min-width="100px"
:label="$t('test_track.case.status')"
:key="index">
<template v-slot:default="scope">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<review-status :value="scope.row.reviewStatus"/> <review-status :value="scope.row.reviewStatus"/>
</span> </span>
</template>
</el-table-column>
<el-table-column v-if="item.id=='tags'" prop="tags" :label="$t('commons.tag')" :key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
<el-table-column
v-if="item.id=='nodePath'"
prop="nodePath"
:label="$t('test_track.case.module')"
min-width="150px"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.id=='updateTime'"
prop="updateTime"
sortable="custom"
:label="$t('commons.update_time')"
min-width="150px"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
<el-table-column fixed="right" min-width="150">
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)">
<template v-slot:middle>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')"
icon="el-icon-document-copy"
type="success" @exec="handleCopy(scope.row)"/>
</template>
</ms-table-operator>
</template> </template>
</el-table-column> </el-table-column>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems <el-table-column v-if="item.id=='tags'" prop="tags" :label="$t('commons.tag')" :key="index">
:type=type></header-custom> <template v-slot:default="scope">
</el-table> <ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize" <el-table-column
:total="total"/> v-if="item.id=='nodePath'"
prop="nodePath"
:label="$t('test_track.case.module')"
min-width="150px"
show-overflow-tooltip
:key="index">
</el-table-column>
<el-table-column
v-if="item.id=='updateTime'"
prop="updateTime"
sortable="custom"
:label="$t('commons.update_time')"
min-width="150px"
show-overflow-tooltip
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</template>
<el-table-column fixed="right" min-width="150">
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)">
<template v-slot:middle>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('commons.copy')"
icon="el-icon-document-copy"
type="success" @exec="handleCopy(scope.row)"/>
</template>
</ms-table-operator>
</template>
</el-table-column>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
:type=type></header-custom>
</el-table>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
<batch-edit ref="batchEdit" @batchEdit="batchEdit" <batch-edit ref="batchEdit" @batchEdit="batchEdit"
:typeArr="typeArr" :value-arr="valueArr" :dialog-title="$t('test_track.case.batch_edit_case')"/> :typeArr="typeArr" :value-arr="valueArr" :dialog-title="$t('test_track.case.batch_edit_case')"/>
@ -160,15 +160,17 @@ import {
_filter, _filter,
_handleSelect, _handleSelect,
_handleSelectAll, _handleSelectAll,
_sort, buildBatchParam, getLabel, _sort,
getSelectDataCounts, initCondition, buildBatchParam,
getLabel,
getSelectDataCounts,
initCondition,
setUnSelectIds, setUnSelectIds,
toggleAllSelection toggleAllSelection
} from "@/common/js/tableUtils"; } from "@/common/js/tableUtils";
import BatchMove from "./BatchMove"; import BatchMove from "./BatchMove";
import {Track_Test_Case} from "@/business/components/common/model/JsonData"; import {Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import i18n from "@/i18n/i18n";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import PlanStatusTableItem from "@/business/components/track/common/tableItems/plan/PlanStatusTableItem"; import PlanStatusTableItem from "@/business/components/track/common/tableItems/plan/PlanStatusTableItem";
@ -314,7 +316,7 @@ export default {
watch: { watch: {
selectNodeIds() { selectNodeIds() {
this.currentPage = 1; this.currentPage = 1;
initCondition(this.condition,false); initCondition(this.condition, false);
this.initTableData(); this.initTableData();
}, },
condition() { condition() {
@ -334,7 +336,7 @@ export default {
this.condition.planId = ""; this.condition.planId = "";
this.condition.nodeIds = []; this.condition.nodeIds = [];
//initCondition(this.condition); //initCondition(this.condition);
initCondition(this.condition,this.condition.selectAll); initCondition(this.condition, this.condition.selectAll);
this.selectDataCounts = 0; this.selectDataCounts = 0;
if (this.planId) { if (this.planId) {
// param.planId = this.planId; // param.planId = this.planId;
@ -392,33 +394,30 @@ export default {
this.tableData.forEach((item) => { this.tableData.forEach((item) => {
item.tags = JSON.parse(item.tags); item.tags = JSON.parse(item.tags);
}) })
if (this.$refs.table) {
setTimeout(() => {
this.$refs.table.doLayout();
this.result.loading = false;
}, 500)
}
this.$nextTick(function(){ this.$nextTick(() => {
if (this.$refs.table) {
setTimeout(this.$refs.table.doLayout, 200)
}
this.checkTableRowIsSelect(); this.checkTableRowIsSelect();
}) })
}); });
} }
}, },
checkTableRowIsSelect(){ checkTableRowIsSelect() {
// //
if(this.condition.selectAll){ if (this.condition.selectAll) {
let unSelectIds = this.condition.unSelectIds; let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row=>{ this.tableData.forEach(row => {
if(unSelectIds.indexOf(row.id)<0){ if (unSelectIds.indexOf(row.id) < 0) {
this.$refs.table.toggleRowSelection(row,true); this.$refs.table.toggleRowSelection(row, true);
//selectRows //selectRows
if (!this.selectRows.has(row)) { if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true); this.$set(row, "showMore", true);
this.selectRows.add(row); this.selectRows.add(row);
} }
}else{ } else {
//selectRow //selectRow
if (this.selectRows.has(row)) { if (this.selectRows.has(row)) {
this.$set(row, "showMore", false); this.$set(row, "showMore", false);
@ -446,7 +445,7 @@ export default {
handleCopy(testCase) { handleCopy(testCase) {
this.$get('test/case/get/' + testCase.id, response => { this.$get('test/case/get/' + testCase.id, response => {
let testCase = response.data; let testCase = response.data;
testCase.name='copy_'+testCase.name testCase.name = 'copy_' + testCase.name
this.$emit('testCaseCopy', testCase); this.$emit('testCaseCopy', testCase);
}); });
}, },
@ -662,4 +661,8 @@ export default {
.el-tag { .el-tag {
margin-left: 10px; margin-left: 10px;
} }
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
}
</style> </style>

View File

@ -473,10 +473,7 @@ export default {
} }
this.selectRows.clear(); this.selectRows.clear();
if (this.$refs.table) { if (this.$refs.table) {
setTimeout(() => { setTimeout(this.$refs.table.doLayout, 200)
this.$refs.table.doLayout();
this.result.loading = false;
}, 500)
} }
}); });
} }
@ -718,4 +715,8 @@ export default {
.ms-table-header >>> .table-title { .ms-table-header >>> .table-title {
height: 0px; height: 0px;
} }
/deep/ .el-table__fixed-body-wrapper {
top: 60px !important;
}
</style> </style>

@ -1 +1 @@
Subproject commit 07951ba17aef6f29e50cfd68e40de3266f9a60cd Subproject commit a37e6bb56ffaa7ecc4ee128640e9415304ad41b6