Merge branch 'v1.8' of github.com:metersphere/metersphere into v1.8
This commit is contained in:
commit
e04d82d117
|
@ -264,15 +264,7 @@ public class ApiDefinitionService {
|
|||
test.setEnvironmentId(request.getEnvironmentId());
|
||||
test.setUserId(request.getUserId());
|
||||
test.setTags(request.getTags());
|
||||
if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
this.setModule(test);
|
||||
apiDefinitionMapper.updateByPrimaryKeySelective(test);
|
||||
return test;
|
||||
}
|
||||
|
@ -591,6 +583,17 @@ public class ApiDefinitionService {
|
|||
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) {
|
||||
ApiImportParser apiImportParser = ApiDefinitionImportParserFactory.getApiImportParser(request.getPlatform());
|
||||
|
@ -616,15 +619,7 @@ public class ApiDefinitionService {
|
|||
}
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
ApiDefinitionWithBLOBs item = data.get(i);
|
||||
if (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());
|
||||
}
|
||||
}
|
||||
this.setModule(item);
|
||||
if (item.getName().length() > 255) {
|
||||
item.setName(item.getName().substring(0, 255));
|
||||
}
|
||||
|
|
|
@ -441,18 +441,14 @@ export default {
|
|||
}
|
||||
});
|
||||
|
||||
if (this.$refs.scenarioTable) {
|
||||
setTimeout(() => {
|
||||
this.$refs.scenarioTable.doLayout();
|
||||
this.result.loading = false;
|
||||
}, 500)
|
||||
}
|
||||
|
||||
if (!this.condition.selectAll) {
|
||||
this.condition.unSelectIds = response.data.listObject.map(s => s.id);
|
||||
}
|
||||
|
||||
this.$nextTick(function () {
|
||||
if (this.$refs.scenarioTable) {
|
||||
setTimeout(this.$refs.scenarioTable.doLayout, 200)
|
||||
}
|
||||
this.checkTableRowIsSelect();
|
||||
})
|
||||
});
|
||||
|
@ -732,8 +728,8 @@ export default {
|
|||
// let ids = [row.id];
|
||||
let param = {};
|
||||
this.buildBatchParam(param);
|
||||
if(param.ids && param.ids.length <=0){
|
||||
param.ids =[row.id];
|
||||
if (param.ids && param.ids.length <= 0) {
|
||||
param.ids = [row.id];
|
||||
}
|
||||
this.$post('/api/automation/removeToGcByBatch/', param, () => {
|
||||
// this.$post('/api/automation/removeToGc/', ids, () => {
|
||||
|
@ -838,4 +834,8 @@ export default {
|
|||
/deep/ .el-card__header {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/deep/ .el-table__fixed-body-wrapper {
|
||||
top: 60px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -767,7 +767,7 @@
|
|||
},
|
||||
runDebug() {
|
||||
/*触发执行操作*/
|
||||
let sign = this.$refs.envPopover.checkEnv();
|
||||
let sign = this.$refs.envPopover.checkEnv(this.scenarioDefinition);
|
||||
if (!sign) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ export default {
|
|||
setProjectEnvMap(map) {
|
||||
this.$emit("setProjectEnvMap", map);
|
||||
},
|
||||
checkEnv() {
|
||||
return this.$refs.envSelect.checkEnv();
|
||||
checkEnv(data) {
|
||||
return this.$refs.envSelect.checkEnv(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,10 +29,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
|
||||
import ApiEnvironmentConfig from "@/business/components/api/definition/components/environment/ApiEnvironmentConfig";
|
||||
import {parseEnvironment} from "@/business/components/api/test/model/EnvironmentModel";
|
||||
import ApiEnvironmentConfig from "@/business/components/api/definition/components/environment/ApiEnvironmentConfig";
|
||||
import {ELEMENTS} from "./Setting";
|
||||
|
||||
export default {
|
||||
export default {
|
||||
name: "EnvironmentSelect",
|
||||
components: {ApiEnvironmentConfig},
|
||||
props: {
|
||||
|
@ -46,7 +47,8 @@ export default {
|
|||
result: {},
|
||||
projects: [],
|
||||
environments: [],
|
||||
dialogVisible: false
|
||||
dialogVisible: false,
|
||||
isFullUrl: true,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -64,7 +66,7 @@ export default {
|
|||
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;
|
||||
})
|
||||
})
|
||||
},
|
||||
|
@ -102,8 +104,125 @@ export default {
|
|||
this.$emit('setProjectEnvMap', map);
|
||||
this.$emit('close');
|
||||
},
|
||||
checkEnv() {
|
||||
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";
|
||||
}
|
||||
})
|
||||
},
|
||||
recursiveSorting(arr) {
|
||||
for (let i in arr) {
|
||||
if (arr[i].referenced === 'REF') {
|
||||
// 分场景和接口
|
||||
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) {
|
||||
|
@ -121,8 +240,13 @@ export default {
|
|||
}
|
||||
})
|
||||
} else {
|
||||
// this.checkFullUrl(data);
|
||||
// sign = this.isFullUrl;
|
||||
sign = false;
|
||||
}
|
||||
|
||||
// 校验是否全是全路径
|
||||
|
||||
}
|
||||
|
||||
if (!sign) {
|
||||
|
@ -135,27 +259,27 @@ export default {
|
|||
// todo 关闭处理
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ms-scenario-button {
|
||||
.ms-scenario-button {
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.env-confirm {
|
||||
.env-confirm {
|
||||
margin-left: 20px;
|
||||
width: 360px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.project-name {
|
||||
display:inline-block;
|
||||
.project-name {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 150px;
|
||||
margin-left: 8px;
|
||||
vertical-align:middle;
|
||||
}
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -313,7 +313,7 @@ export default {
|
|||
this.condition.status = "Trash";
|
||||
this.condition.moduleIds = [];
|
||||
}
|
||||
if(!this.selectAll){
|
||||
if (!this.selectAll) {
|
||||
this.selectAll = false;
|
||||
this.unSelection = [];
|
||||
this.selectDataCounts = 0;
|
||||
|
@ -342,7 +342,7 @@ export default {
|
|||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
|
||||
if(!this.selectAll){
|
||||
if (!this.selectAll) {
|
||||
this.unSelection = response.data.listObject.map(s => s.id);
|
||||
}
|
||||
|
||||
|
@ -351,13 +351,11 @@ export default {
|
|||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
})
|
||||
|
||||
this.$nextTick(function () {
|
||||
if (this.$refs.caseTable) {
|
||||
setTimeout(() => {
|
||||
this.$refs.caseTable.doLayout();
|
||||
this.result.loading = false;
|
||||
}, 500)
|
||||
setTimeout(this.$refs.caseTable.doLayout, 200)
|
||||
}
|
||||
this.$nextTick(function(){
|
||||
this.checkTableRowIsSelect();
|
||||
})
|
||||
});
|
||||
|
@ -365,20 +363,20 @@ export default {
|
|||
getLabel(this, API_CASE_LIST);
|
||||
|
||||
},
|
||||
checkTableRowIsSelect(){
|
||||
checkTableRowIsSelect() {
|
||||
//如果默认全选的话,则选中应该选中的行
|
||||
if(this.selectAll){
|
||||
if (this.selectAll) {
|
||||
let unSelectIds = this.unSelection;
|
||||
this.tableData.forEach(row=>{
|
||||
if(unSelectIds.indexOf(row.id)<0){
|
||||
this.$refs.caseTable.toggleRowSelection(row,true);
|
||||
this.tableData.forEach(row => {
|
||||
if (unSelectIds.indexOf(row.id) < 0) {
|
||||
this.$refs.caseTable.toggleRowSelection(row, true);
|
||||
|
||||
//默认全选,需要把选中对行添加到selectRows中。不然会影响到勾选函数统计
|
||||
if (!this.selectRows.has(row)) {
|
||||
this.$set(row, "showMore", true);
|
||||
this.selectRows.add(row);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
//不勾选的行,也要判断是否被加入了selectRow中。加入了的话就去除。
|
||||
if (this.selectRows.has(row)) {
|
||||
this.$set(row, "showMore", false);
|
||||
|
@ -694,4 +692,8 @@ export default {
|
|||
/deep/ .el-table__fixed {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
/deep/ .el-table__fixed-body-wrapper {
|
||||
top: 60px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -116,7 +116,8 @@
|
|||
min-width="120px"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :show-tooltip="true" :content="itemName" style="margin-left: 0px; margin-right: 2px"/>
|
||||
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :show-tooltip="true" :content="itemName"
|
||||
style="margin-left: 0px; margin-right: 2px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -211,41 +212,45 @@
|
|||
|
||||
<script>
|
||||
|
||||
import MsTableHeader from '../../../../common/components/MsTableHeader';
|
||||
import MsTableOperator from "../../../../common/components/MsTableOperator";
|
||||
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
|
||||
import MsTableButton from "../../../../common/components/MsTableButton";
|
||||
import MsTablePagination from "../../../../common/pagination/TablePagination";
|
||||
import MsTag from "../../../../common/components/MsTag";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "../BottomContainer";
|
||||
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
||||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
|
||||
import {checkoutTestManagerOrTestUser, downloadFile, getUUID} from "@/common/js/utils";
|
||||
import {PROJECT_NAME} from '@/common/js/constants';
|
||||
import {API_LIST, TEST_CASE_LIST, WORKSPACE_ID} from '@/common/js/constants';
|
||||
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
|
||||
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
|
||||
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
|
||||
import {API_DEFINITION_CONFIGS} from "@/business/components/common/components/search/search-components";
|
||||
import MsTipButton from "@/business/components/common/components/MsTipButton";
|
||||
import CaseBatchMove from "@/business/components/api/definition/components/basis/BatchMove";
|
||||
import {
|
||||
import MsTableHeader from '../../../../common/components/MsTableHeader';
|
||||
import MsTableOperator from "../../../../common/components/MsTableOperator";
|
||||
import MsTableOperatorButton from "../../../../common/components/MsTableOperatorButton";
|
||||
import MsTableButton from "../../../../common/components/MsTableButton";
|
||||
import MsTablePagination from "../../../../common/pagination/TablePagination";
|
||||
import MsTag from "../../../../common/components/MsTag";
|
||||
import MsApiCaseList from "../case/ApiCaseList";
|
||||
import MsContainer from "../../../../common/components/MsContainer";
|
||||
import MsBottomContainer from "../BottomContainer";
|
||||
import ShowMoreBtn from "../../../../track/case/components/ShowMoreBtn";
|
||||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
|
||||
import {downloadFile} from "@/common/js/utils";
|
||||
import {API_LIST, PROJECT_NAME, WORKSPACE_ID} from '@/common/js/constants';
|
||||
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
|
||||
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
|
||||
import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar";
|
||||
import {API_DEFINITION_CONFIGS} from "@/business/components/common/components/search/search-components";
|
||||
import MsTipButton from "@/business/components/common/components/MsTipButton";
|
||||
import CaseBatchMove from "@/business/components/api/definition/components/basis/BatchMove";
|
||||
import {
|
||||
_filter,
|
||||
_handleSelect,
|
||||
_handleSelectAll, buildBatchParam, getLabel,
|
||||
getSelectDataCounts, initCondition,
|
||||
setUnSelectIds, toggleAllSelection
|
||||
} from "@/common/js/tableUtils";
|
||||
import {_filter, _sort} from "@/common/js/tableUtils";
|
||||
import {Api_List} from "@/business/components/common/model/JsonData";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||
import {Body} from "@/business/components/api/definition/model/ApiTestModel";
|
||||
_handleSelectAll,
|
||||
_sort,
|
||||
buildBatchParam,
|
||||
getLabel,
|
||||
getSelectDataCounts,
|
||||
initCondition,
|
||||
setUnSelectIds,
|
||||
toggleAllSelection
|
||||
} from "@/common/js/tableUtils";
|
||||
import {Api_List} from "@/business/components/common/model/JsonData";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||
import {Body} from "@/business/components/api/definition/model/ApiTestModel";
|
||||
|
||||
|
||||
export default {
|
||||
export default {
|
||||
name: "ApiList",
|
||||
components: {
|
||||
HeaderLabelOperate,
|
||||
|
@ -385,11 +390,11 @@
|
|||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
initCondition(this.condition,false);
|
||||
initCondition(this.condition, false);
|
||||
this.initTable();
|
||||
},
|
||||
currentProtocol() {
|
||||
initCondition(this.condition,false);
|
||||
initCondition(this.condition, false);
|
||||
this.initTable();
|
||||
},
|
||||
trashEnable() {
|
||||
|
@ -399,7 +404,7 @@
|
|||
} else {
|
||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||
}
|
||||
initCondition(this.condition,false);
|
||||
initCondition(this.condition, false);
|
||||
this.initTable();
|
||||
}
|
||||
},
|
||||
|
@ -412,7 +417,7 @@
|
|||
},
|
||||
initTable() {
|
||||
this.selectRows = new Set();
|
||||
initCondition(this.condition,this.condition.selectAll);
|
||||
initCondition(this.condition, this.condition.selectAll);
|
||||
this.selectDataCounts = 0;
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
this.condition.projectId = this.projectId;
|
||||
|
@ -454,38 +459,32 @@
|
|||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
})
|
||||
if (this.$refs.apiDefinitionTable) {
|
||||
setTimeout(() => {
|
||||
this.$refs.apiDefinitionTable.doLayout();
|
||||
this.result.loading = false;
|
||||
}, 500)
|
||||
}
|
||||
|
||||
// nexttick:表格加载完成之后触发。判断是否需要勾选行
|
||||
this.$nextTick(function(){
|
||||
// if (this.$refs.apiDefinitionTable) {
|
||||
// this.$refs.apiDefinitionTable.doLayout();
|
||||
// this.result.loading = false;
|
||||
// }
|
||||
this.$nextTick(function () {
|
||||
if (this.$refs.apiDefinitionTable) {
|
||||
setTimeout(this.$refs.apiDefinitionTable.doLayout, 200)
|
||||
}
|
||||
this.checkTableRowIsSelect();
|
||||
})
|
||||
});
|
||||
}
|
||||
getLabel(this, API_LIST);
|
||||
},
|
||||
checkTableRowIsSelect(){
|
||||
checkTableRowIsSelect() {
|
||||
//如果默认全选的话,则选中应该选中的行
|
||||
if(this.condition.selectAll){
|
||||
if (this.condition.selectAll) {
|
||||
let unSelectIds = this.condition.unSelectIds;
|
||||
this.tableData.forEach(row=>{
|
||||
if(unSelectIds.indexOf(row.id)<0){
|
||||
this.$refs.apiDefinitionTable.toggleRowSelection(row,true);
|
||||
this.tableData.forEach(row => {
|
||||
if (unSelectIds.indexOf(row.id) < 0) {
|
||||
this.$refs.apiDefinitionTable.toggleRowSelection(row, true);
|
||||
|
||||
//默认全选,需要把选中对行添加到selectRows中。不然会影响到勾选函数统计
|
||||
if (!this.selectRows.has(row)) {
|
||||
this.$set(row, "showMore", true);
|
||||
this.selectRows.add(row);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
//不勾选的行,也要判断是否被加入了selectRow中。加入了的话就去除。
|
||||
if (this.selectRows.has(row)) {
|
||||
this.$set(row, "showMore", false);
|
||||
|
@ -763,8 +762,7 @@
|
|||
obj.protocol = this.currentProtocol;
|
||||
this.buildApiPath(obj.data);
|
||||
downloadFile("Metersphere_Api_" + localStorage.getItem(PROJECT_NAME) + ".json", JSON.stringify(obj));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
downloadFile("Swagger_Api_" + localStorage.getItem(PROJECT_NAME) + ".json", JSON.stringify(obj));
|
||||
}
|
||||
});
|
||||
|
@ -802,40 +800,44 @@
|
|||
this.$refs.searchBar.open();
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.operate-button > div {
|
||||
.operate-button > div {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.request-method {
|
||||
.request-method {
|
||||
padding: 0 5px;
|
||||
color: #1E90FF;
|
||||
}
|
||||
}
|
||||
|
||||
.api-el-tag {
|
||||
.api-el-tag {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
.search-input {
|
||||
.search-input {
|
||||
float: right;
|
||||
width: 300px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
.el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-select-all >>> th:first-child {
|
||||
.ms-select-all >>> th:first-child {
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-select-all >>> th:nth-child(2) .el-icon-arrow-down {
|
||||
.ms-select-all >>> th:nth-child(2) .el-icon-arrow-down {
|
||||
top: -2px;
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .el-table__fixed-body-wrapper {
|
||||
top: 60px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -160,15 +160,17 @@ import {
|
|||
_filter,
|
||||
_handleSelect,
|
||||
_handleSelectAll,
|
||||
_sort, buildBatchParam, getLabel,
|
||||
getSelectDataCounts, initCondition,
|
||||
_sort,
|
||||
buildBatchParam,
|
||||
getLabel,
|
||||
getSelectDataCounts,
|
||||
initCondition,
|
||||
setUnSelectIds,
|
||||
toggleAllSelection
|
||||
} from "@/common/js/tableUtils";
|
||||
import BatchMove from "./BatchMove";
|
||||
import {Track_Test_Case} from "@/business/components/common/model/JsonData";
|
||||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import i18n from "@/i18n/i18n";
|
||||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||
import PlanStatusTableItem from "@/business/components/track/common/tableItems/plan/PlanStatusTableItem";
|
||||
|
||||
|
@ -314,7 +316,7 @@ export default {
|
|||
watch: {
|
||||
selectNodeIds() {
|
||||
this.currentPage = 1;
|
||||
initCondition(this.condition,false);
|
||||
initCondition(this.condition, false);
|
||||
this.initTableData();
|
||||
},
|
||||
condition() {
|
||||
|
@ -334,7 +336,7 @@ export default {
|
|||
this.condition.planId = "";
|
||||
this.condition.nodeIds = [];
|
||||
//initCondition(this.condition);
|
||||
initCondition(this.condition,this.condition.selectAll);
|
||||
initCondition(this.condition, this.condition.selectAll);
|
||||
this.selectDataCounts = 0;
|
||||
if (this.planId) {
|
||||
// param.planId = this.planId;
|
||||
|
@ -392,33 +394,30 @@ export default {
|
|||
this.tableData.forEach((item) => {
|
||||
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();
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
checkTableRowIsSelect(){
|
||||
checkTableRowIsSelect() {
|
||||
//如果默认全选的话,则选中应该选中的行
|
||||
if(this.condition.selectAll){
|
||||
if (this.condition.selectAll) {
|
||||
let unSelectIds = this.condition.unSelectIds;
|
||||
this.tableData.forEach(row=>{
|
||||
if(unSelectIds.indexOf(row.id)<0){
|
||||
this.$refs.table.toggleRowSelection(row,true);
|
||||
this.tableData.forEach(row => {
|
||||
if (unSelectIds.indexOf(row.id) < 0) {
|
||||
this.$refs.table.toggleRowSelection(row, true);
|
||||
|
||||
//默认全选,需要把选中对行添加到selectRows中。不然会影响到勾选函数统计
|
||||
if (!this.selectRows.has(row)) {
|
||||
this.$set(row, "showMore", true);
|
||||
this.selectRows.add(row);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
//不勾选的行,也要判断是否被加入了selectRow中。加入了的话就去除。
|
||||
if (this.selectRows.has(row)) {
|
||||
this.$set(row, "showMore", false);
|
||||
|
@ -446,7 +445,7 @@ export default {
|
|||
handleCopy(testCase) {
|
||||
this.$get('test/case/get/' + testCase.id, response => {
|
||||
let testCase = response.data;
|
||||
testCase.name='copy_'+testCase.name
|
||||
testCase.name = 'copy_' + testCase.name
|
||||
this.$emit('testCaseCopy', testCase);
|
||||
});
|
||||
},
|
||||
|
@ -662,4 +661,8 @@ export default {
|
|||
.el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
/deep/ .el-table__fixed-body-wrapper {
|
||||
top: 60px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -473,10 +473,7 @@ export default {
|
|||
}
|
||||
this.selectRows.clear();
|
||||
if (this.$refs.table) {
|
||||
setTimeout(() => {
|
||||
this.$refs.table.doLayout();
|
||||
this.result.loading = false;
|
||||
}, 500)
|
||||
setTimeout(this.$refs.table.doLayout, 200)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -718,4 +715,8 @@ export default {
|
|||
.ms-table-header >>> .table-title {
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
/deep/ .el-table__fixed-body-wrapper {
|
||||
top: 60px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 07951ba17aef6f29e50cfd68e40de3266f9a60cd
|
||||
Subproject commit a37e6bb56ffaa7ecc4ee128640e9415304ad41b6
|
Loading…
Reference in New Issue