fix: 解决冲突
This commit is contained in:
commit
fbed4ecda4
|
@ -149,9 +149,12 @@ public class JmeterDocumentParser {
|
|||
String path = ele.getTextContent();
|
||||
Map<String, String> parser = parserUrl(path);
|
||||
String url = parser.get("URL");
|
||||
String params = parser.keySet().stream().filter(k -> !"URL".equals(k)).reduce("", (u, k) -> {
|
||||
String params = parser.keySet().stream().filter(k -> !"URL".equals(k)).reduce("?", (u, k) -> {
|
||||
String v = parser.get(k);
|
||||
u += "&" + k + "=" + ScriptEngineUtils.calculate(v);
|
||||
if (!StringUtils.equals("?", u)) {
|
||||
u += "&";
|
||||
}
|
||||
u += k + "=" + ScriptEngineUtils.calculate(v);
|
||||
return u;
|
||||
});
|
||||
ele.setTextContent(url + params);
|
||||
|
|
|
@ -18,15 +18,13 @@ import io.metersphere.commons.constants.FileType;
|
|||
import io.metersphere.commons.constants.ScheduleGroup;
|
||||
import io.metersphere.commons.constants.ScheduleType;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||
import io.metersphere.dto.ScheduleDao;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.job.sechedule.ApiTestJob;
|
||||
import io.metersphere.service.FileService;
|
||||
import io.metersphere.service.QuotaService;
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import io.metersphere.track.service.TestCaseService;
|
||||
import org.apache.dubbo.common.URL;
|
||||
|
@ -37,6 +35,7 @@ import org.springframework.util.CollectionUtils;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -92,6 +91,7 @@ public class APITestService {
|
|||
}
|
||||
|
||||
public void copy(SaveAPITestRequest request) {
|
||||
checkQuota();
|
||||
request.setName(request.getName() + " Copy");
|
||||
try {
|
||||
checkNameExist(request);
|
||||
|
@ -355,4 +355,11 @@ public class APITestService {
|
|||
jMeterService.run(request.getId(), reportId, is);
|
||||
return reportId;
|
||||
}
|
||||
|
||||
private void checkQuota() {
|
||||
QuotaService quotaService = CommonBeanFactory.getBean(QuotaService.class);
|
||||
if (quotaService != null) {
|
||||
quotaService.checkAPIQuota();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
</select>
|
||||
|
||||
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||
select test_plan_test_case.*, test_case.*,test_case_node.name as model
|
||||
select test_case.*, test_plan_test_case.*,test_case_node.name as model
|
||||
from test_plan_test_case
|
||||
inner join test_case on test_plan_test_case.case_id = test_case.id left join test_case_node on
|
||||
test_case_node.id=test_case.node_id
|
||||
|
|
|
@ -16,11 +16,19 @@ public class CommonBeanFactory implements ApplicationContextAware {
|
|||
}
|
||||
|
||||
public static Object getBean(String beanName) {
|
||||
return context != null && !StringUtils.isBlank(beanName) ? context.getBean(beanName) : null;
|
||||
try {
|
||||
return context != null && !StringUtils.isBlank(beanName) ? context.getBean(beanName) : null;
|
||||
} catch (BeansException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> className) {
|
||||
return context != null && className != null ? context.getBean(className) : null;
|
||||
try {
|
||||
return context != null && className != null ? context.getBean(className) : null;
|
||||
} catch (BeansException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package io.metersphere.service;
|
||||
|
||||
public interface QuotaService {
|
||||
|
||||
void checkAPIQuota();
|
||||
}
|
|
@ -141,4 +141,6 @@ quota_workspace_excess_org_api=The total number of interface tests in the worksp
|
|||
quota_workspace_excess_org_performance=The total number of performance tests for the workspace cannot exceed the organization's quota
|
||||
quota_workspace_excess_org_max_threads=The maximum concurrent number of workspaces cannot exceed the quota of the organization
|
||||
quota_workspace_excess_org_max_duration=The stress test duration of the workspace cannot exceed the organization's quota
|
||||
quota_workspace_excess_org_resource_pool=The resource pool of the workspace cannot exceed the resource pool of the organization
|
||||
quota_workspace_excess_org_resource_pool=The resource pool of the workspace cannot exceed the resource pool of the organization
|
||||
quota_api_excess_workspace=The number of interface tests exceeds the workspace quota
|
||||
quota_api_excess_organization=The number of interface tests exceeds the organization quota
|
|
@ -142,6 +142,8 @@ quota_workspace_excess_org_performance=工作空间的性能测试数量总和
|
|||
quota_workspace_excess_org_max_threads=工作空间的最大并发数不能超过组织的配额
|
||||
quota_workspace_excess_org_max_duration=工作空间的压测时长不能超过组织的配额
|
||||
quota_workspace_excess_org_resource_pool=工作空间的资源池不能超过组织的资源池范围
|
||||
quota_api_excess_workspace=接口测试数量超过工作空间限额
|
||||
quota_api_excess_organization=接口测试数量超过组织限额
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -142,3 +142,5 @@ quota_workspace_excess_org_performance=工作空間的性能測試數量總和
|
|||
quota_workspace_excess_org_max_threads=工作空間的最大並發數不能超過組織的配額
|
||||
quota_workspace_excess_org_max_duration=工作空間的壓測時長不能超過組織的配額
|
||||
quota_workspace_excess_org_resource_pool=工作空間的資源池不能超過組織的資源池範圍
|
||||
quota_api_excess_workspace=接口測試數量超過工作空間限額
|
||||
quota_api_excess_organization=接口測試數量超過組織限額
|
|
@ -8,8 +8,8 @@
|
|||
</el-menu-item>
|
||||
|
||||
<el-submenu v-permission="['test_manager','test_user','test_viewer']" index="3">
|
||||
<template v-slot:title>{{$t('commons.project')}}</template>
|
||||
<ms-recent-list :options="projectRecent"/>
|
||||
<template v-slot:title>{{ $t('commons.project') }}</template>
|
||||
<ms-recent-list ref="projectRecent" :options="projectRecent"/>
|
||||
<el-divider class="menu-divider"/>
|
||||
<ms-show-all :index="'/api/project/all'"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/api/project/create'"
|
||||
|
@ -17,8 +17,8 @@
|
|||
</el-submenu>
|
||||
|
||||
<el-submenu v-permission="['test_manager','test_user','test_viewer']" index="4">
|
||||
<template v-slot:title>{{$t('commons.test')}}</template>
|
||||
<ms-recent-list :options="testRecent"/>
|
||||
<template v-slot:title>{{ $t('commons.test') }}</template>
|
||||
<ms-recent-list ref="testRecent" :options="testRecent"/>
|
||||
<el-divider class="menu-divider"/>
|
||||
<ms-show-all :index="'/api/test/list/all'"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/api/test/create'"
|
||||
|
@ -26,8 +26,8 @@
|
|||
</el-submenu>
|
||||
|
||||
<el-submenu v-permission="['test_manager','test_user','test_viewer']" index="5">
|
||||
<template v-slot:title>{{$t('commons.report')}}</template>
|
||||
<ms-recent-list :options="reportRecent"/>
|
||||
<template v-slot:title>{{ $t('commons.report') }}</template>
|
||||
<ms-recent-list ref="reportRecent" :options="reportRecent"/>
|
||||
<el-divider class="menu-divider"/>
|
||||
<ms-show-all :index="'/api/report/list/all'"/>
|
||||
</el-submenu>
|
||||
|
@ -46,57 +46,65 @@
|
|||
|
||||
<script>
|
||||
|
||||
import MsRecentList from "../../common/head/RecentList";
|
||||
import MsShowAll from "../../common/head/ShowAll";
|
||||
import MsCreateButton from "../../common/head/CreateButton";
|
||||
import MsCreateTest from "../../common/head/CreateTest";
|
||||
import MsRecentList from "../../common/head/RecentList";
|
||||
import MsShowAll from "../../common/head/ShowAll";
|
||||
import MsCreateButton from "../../common/head/CreateButton";
|
||||
import MsCreateTest from "../../common/head/CreateTest";
|
||||
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
name: "MsApiHeaderMenus",
|
||||
components: {MsCreateTest, MsCreateButton, MsShowAll, MsRecentList},
|
||||
data() {
|
||||
return {
|
||||
projectRecent: {
|
||||
title: this.$t('project.recent'),
|
||||
url: "/project/recent/5",
|
||||
index: function (item) {
|
||||
return '/api/test/list/' + item.id;
|
||||
},
|
||||
router: function (item) {
|
||||
return {name: 'ApiTestList', params: {projectId: item.id, projectName: item.name}}
|
||||
}
|
||||
export default {
|
||||
name: "MsApiHeaderMenus",
|
||||
components: {MsCreateTest, MsCreateButton, MsShowAll, MsRecentList},
|
||||
data() {
|
||||
return {
|
||||
projectRecent: {
|
||||
title: this.$t('project.recent'),
|
||||
url: "/project/recent/5",
|
||||
index: function (item) {
|
||||
return '/api/test/list/' + item.id;
|
||||
},
|
||||
testRecent: {
|
||||
title: this.$t('load_test.recent'),
|
||||
url: "/api/recent/5",
|
||||
index: function (item) {
|
||||
return '/api/test/edit/' + item.id;
|
||||
},
|
||||
router: function (item) {
|
||||
return {path: '/api/test/edit', query: {id: item.id}}
|
||||
}
|
||||
router: function (item) {
|
||||
return {name: 'ApiTestList', params: {projectId: item.id, projectName: item.name}}
|
||||
}
|
||||
},
|
||||
testRecent: {
|
||||
title: this.$t('load_test.recent'),
|
||||
url: "/api/recent/5",
|
||||
index: function (item) {
|
||||
return '/api/test/edit/' + item.id;
|
||||
},
|
||||
reportRecent: {
|
||||
title: this.$t('report.recent'),
|
||||
showTime: true,
|
||||
url: "/api/report/recent/5",
|
||||
index: function (item) {
|
||||
return '/api/report/view/' + item.id;
|
||||
}
|
||||
router: function (item) {
|
||||
return {path: '/api/test/edit', query: {id: item.id}}
|
||||
}
|
||||
},
|
||||
reportRecent: {
|
||||
title: this.$t('report.recent'),
|
||||
showTime: true,
|
||||
url: "/api/report/recent/5",
|
||||
index: function (item) {
|
||||
return '/api/report/view/' + item.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
ApiEvent.$on(LIST_CHANGE, () => {
|
||||
this.$refs.projectRecent.recent();
|
||||
this.$refs.testRecent.recent();
|
||||
this.$refs.reportRecent.recent();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#menu-bar {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
background-color: #FFF;
|
||||
}
|
||||
#menu-bar {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.menu-divider {
|
||||
margin: 0;
|
||||
}
|
||||
.menu-divider {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -49,112 +49,115 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsApiReportStatus from "./ApiReportStatus";
|
||||
import {_filter, _sort} from "@/common/js/utils";
|
||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||
import ReportTriggerModeItem from "../../common/tableItem/ReportTriggerModeItem";
|
||||
import {REPORT_CONFIGS} from "../../common/components/search/search-components";
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsApiReportStatus from "./ApiReportStatus";
|
||||
import {_filter, _sort} from "@/common/js/utils";
|
||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||
import ReportTriggerModeItem from "../../common/tableItem/ReportTriggerModeItem";
|
||||
import {REPORT_CONFIGS} from "../../common/components/search/search-components";
|
||||
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ReportTriggerModeItem,
|
||||
MsTableOperatorButton,
|
||||
MsApiReportStatus, MsMainContainer, MsContainer, MsTableHeader, MsTablePagination
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
condition: {
|
||||
components: REPORT_CONFIGS
|
||||
},
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
statusFilters: [
|
||||
{text: 'Saved', value: 'Saved'},
|
||||
{text: 'Starting', value: 'Starting'},
|
||||
{text: 'Running', value: 'Running'},
|
||||
{text: 'Reporting', value: 'Reporting'},
|
||||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'},
|
||||
{text: 'Success', value: 'Success'},
|
||||
],
|
||||
triggerFilters: [
|
||||
{text: this.$t('commons.trigger_mode.manual'), value: 'MANUAL'},
|
||||
{text: this.$t('commons.trigger_mode.schedule'), value: 'SCHEDULE'},
|
||||
{text: this.$t('commons.trigger_mode.api'), value: 'API'}
|
||||
],
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$route': 'init',
|
||||
},
|
||||
|
||||
methods: {
|
||||
search() {
|
||||
if (this.testId !== 'all') {
|
||||
this.condition.testId = this.testId;
|
||||
}
|
||||
|
||||
let url = "/api/report/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;
|
||||
});
|
||||
export default {
|
||||
components: {
|
||||
ReportTriggerModeItem,
|
||||
MsTableOperatorButton,
|
||||
MsApiReportStatus, MsMainContainer, MsContainer, MsTableHeader, MsTablePagination
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
condition: {
|
||||
components: REPORT_CONFIGS
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
handleView(report) {
|
||||
this.$router.push({
|
||||
path: '/api/report/view/' + report.id,
|
||||
})
|
||||
},
|
||||
handleDelete(report) {
|
||||
this.$alert(this.$t('api_report.delete_confirm') + report.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.result = this.$post("/api/report/delete", {id: report.id}, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.search();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
init() {
|
||||
this.testId = this.$route.params.testId;
|
||||
this.search();
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.init();
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.init();
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
created() {
|
||||
this.init();
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
statusFilters: [
|
||||
{text: 'Saved', value: 'Saved'},
|
||||
{text: 'Starting', value: 'Starting'},
|
||||
{text: 'Running', value: 'Running'},
|
||||
{text: 'Reporting', value: 'Reporting'},
|
||||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'},
|
||||
{text: 'Success', value: 'Success'},
|
||||
],
|
||||
triggerFilters: [
|
||||
{text: this.$t('commons.trigger_mode.manual'), value: 'MANUAL'},
|
||||
{text: this.$t('commons.trigger_mode.schedule'), value: 'SCHEDULE'},
|
||||
{text: this.$t('commons.trigger_mode.api'), value: 'API'}
|
||||
],
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$route': 'init',
|
||||
},
|
||||
|
||||
methods: {
|
||||
search() {
|
||||
if (this.testId !== 'all') {
|
||||
this.condition.testId = this.testId;
|
||||
}
|
||||
|
||||
let url = "/api/report/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;
|
||||
});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
handleView(report) {
|
||||
this.$router.push({
|
||||
path: '/api/report/view/' + report.id,
|
||||
})
|
||||
},
|
||||
handleDelete(report) {
|
||||
this.$alert(this.$t('api_report.delete_confirm') + report.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.result = this.$post("/api/report/delete", {id: report.id}, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.search();
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
ApiEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
init() {
|
||||
this.testId = this.$route.params.testId;
|
||||
this.search();
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.init();
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.init();
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
created() {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.table-content {
|
||||
width: 100%;
|
||||
}
|
||||
.table-content {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -56,173 +56,176 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import OneClickOperation from './OneClickOperation';
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsApiTestStatus from "./ApiTestStatus";
|
||||
import MsTableOperators from "../../common/components/MsTableOperators";
|
||||
import {_filter, _sort} from "@/common/js/utils";
|
||||
import {TEST_CONFIGS} from "../../common/components/search/search-components";
|
||||
import OneClickOperation from './OneClickOperation';
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsApiTestStatus from "./ApiTestStatus";
|
||||
import MsTableOperators from "../../common/components/MsTableOperators";
|
||||
import {_filter, _sort} from "@/common/js/utils";
|
||||
import {TEST_CONFIGS} from "../../common/components/search/search-components";
|
||||
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
OneClickOperation,
|
||||
MsTableOperators,
|
||||
MsApiTestStatus, MsMainContainer, MsContainer, MsTableHeader, MsTablePagination, MsTableOperator
|
||||
export default {
|
||||
components: {
|
||||
OneClickOperation,
|
||||
MsTableOperators,
|
||||
MsApiTestStatus, MsMainContainer, MsContainer, MsTableHeader, MsTablePagination, MsTableOperator
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
condition: {
|
||||
components: TEST_CONFIGS
|
||||
},
|
||||
projectId: null,
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
selectIds: new Set(),
|
||||
selectNames: new Set(),
|
||||
selectProjectNames: new Set(),
|
||||
buttons: [
|
||||
{
|
||||
tip: this.$t('commons.edit'), icon: "el-icon-edit",
|
||||
exec: this.handleEdit
|
||||
}, {
|
||||
tip: this.$t('commons.copy'), icon: "el-icon-copy-document", type: "success",
|
||||
exec: this.handleCopy
|
||||
}, {
|
||||
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
|
||||
exec: this.handleDelete
|
||||
}
|
||||
],
|
||||
statusFilters: [
|
||||
{text: 'Saved', value: 'Saved'},
|
||||
{text: 'Starting', value: 'Starting'},
|
||||
{text: 'Running', value: 'Running'},
|
||||
{text: 'Reporting', value: 'Reporting'},
|
||||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$route': 'init'
|
||||
},
|
||||
|
||||
methods: {
|
||||
create() {
|
||||
this.$router.push('/api/test/create');
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
condition: {
|
||||
components: TEST_CONFIGS
|
||||
},
|
||||
projectId: null,
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
selectIds: new Set(),
|
||||
selectNames: new Set(),
|
||||
selectProjectNames: new Set(),
|
||||
buttons: [
|
||||
{
|
||||
tip: this.$t('commons.edit'), icon: "el-icon-edit",
|
||||
exec: this.handleEdit
|
||||
}, {
|
||||
tip: this.$t('commons.copy'), icon: "el-icon-copy-document", type: "success",
|
||||
exec: this.handleCopy
|
||||
}, {
|
||||
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
|
||||
exec: this.handleDelete
|
||||
}
|
||||
],
|
||||
statusFilters: [
|
||||
{text: 'Saved', value: 'Saved'},
|
||||
{text: 'Starting', value: 'Starting'},
|
||||
{text: 'Running', value: 'Running'},
|
||||
{text: 'Reporting', value: 'Reporting'},
|
||||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'}
|
||||
]
|
||||
|
||||
handleSelectAll(selection) {
|
||||
if (selection.length > 0) {
|
||||
this.tableData.forEach(item => {
|
||||
this.selectIds.add(item.id);
|
||||
this.selectProjectNames.add(item.projectName)
|
||||
});
|
||||
} else {
|
||||
this.selectIds.clear()
|
||||
this.selectProjectNames.clear()
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$route': 'init'
|
||||
selectionChange(selection, row) {
|
||||
if (this.selectIds.has(row.id)) {
|
||||
this.selectIds.delete(row.id);
|
||||
this.selectProjectNames.delete(row.projectName)
|
||||
} else {
|
||||
this.selectIds.add(row.id);
|
||||
this.selectProjectNames.add(row.projectName)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
create() {
|
||||
this.$router.push('/api/test/create');
|
||||
},
|
||||
|
||||
handleSelectAll(selection) {
|
||||
if (selection.length > 0) {
|
||||
this.tableData.forEach(item => {
|
||||
this.selectIds.add(item.id);
|
||||
this.selectProjectNames.add(item.projectName)
|
||||
});
|
||||
} else {
|
||||
this.selectIds.clear()
|
||||
this.selectProjectNames.clear()
|
||||
}
|
||||
},
|
||||
selectionChange(selection, row) {
|
||||
if (this.selectIds.has(row.id)) {
|
||||
this.selectIds.delete(row.id);
|
||||
this.selectProjectNames.delete(row.projectName)
|
||||
} else {
|
||||
this.selectIds.add(row.id);
|
||||
this.selectProjectNames.add(row.projectName)
|
||||
}
|
||||
},
|
||||
runTest() {
|
||||
if (this.selectIds.size < 1) {
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
} else {
|
||||
this.$refs.OneClickOperation.openOneClickOperation();
|
||||
}
|
||||
},
|
||||
search() {
|
||||
if (this.projectId !== 'all') {
|
||||
this.condition.projectId = this.projectId;
|
||||
}
|
||||
let url = "/api/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 => {
|
||||
this.selectNames.add(item.name)
|
||||
})
|
||||
});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
handleEdit(test) {
|
||||
this.$router.push({
|
||||
path: '/api/test/edit?id=' + test.id,
|
||||
runTest() {
|
||||
if (this.selectIds.size < 1) {
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
} else {
|
||||
this.$refs.OneClickOperation.openOneClickOperation();
|
||||
}
|
||||
},
|
||||
search() {
|
||||
if (this.projectId !== 'all') {
|
||||
this.condition.projectId = this.projectId;
|
||||
}
|
||||
let url = "/api/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 => {
|
||||
this.selectNames.add(item.name)
|
||||
})
|
||||
},
|
||||
handleView(test) {
|
||||
this.$router.push({
|
||||
path: '/api/test/view?id=' + test.id,
|
||||
})
|
||||
},
|
||||
handleDelete(test) {
|
||||
this.$alert(this.$t('load_test.delete_confirm') + test.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.result = this.$post("/api/delete", {id: test.id}, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.search();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
handleEdit(test) {
|
||||
this.$router.push({
|
||||
path: '/api/test/edit?id=' + test.id,
|
||||
})
|
||||
},
|
||||
handleView(test) {
|
||||
this.$router.push({
|
||||
path: '/api/test/view?id=' + test.id,
|
||||
})
|
||||
},
|
||||
handleDelete(test) {
|
||||
this.$alert(this.$t('load_test.delete_confirm') + test.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.result = this.$post("/api/delete", {id: test.id}, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.search();
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
ApiEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCopy(test) {
|
||||
this.result = this.$post("/api/copy", {projectId: test.projectId, id: test.id, name: test.name}, () => {
|
||||
this.$success(this.$t('commons.copy_success'));
|
||||
this.search();
|
||||
});
|
||||
},
|
||||
init() {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
if (this.projectId && this.projectId !== "all") {
|
||||
this.$store.commit('setProjectId', this.projectId);
|
||||
}
|
||||
this.search();
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.init();
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.init();
|
||||
},
|
||||
});
|
||||
},
|
||||
created() {
|
||||
handleCopy(test) {
|
||||
this.result = this.$post("/api/copy", {projectId: test.projectId, id: test.id, name: test.name}, () => {
|
||||
this.$success(this.$t('commons.copy_success'));
|
||||
this.search();
|
||||
});
|
||||
},
|
||||
init() {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
if (this.projectId && this.projectId !== "all") {
|
||||
this.$store.commit('setProjectId', this.projectId);
|
||||
}
|
||||
this.search();
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.init();
|
||||
}
|
||||
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.init();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.table-content {
|
||||
width: 100%;
|
||||
}
|
||||
.table-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import Vue from 'vue'
|
||||
|
||||
export const LIST_CHANGE = 'LIST_CHANGE';
|
||||
|
||||
export let ApiEvent = new Vue();
|
||||
export let TrackEvent = new Vue();
|
||||
export let PerformanceEvent = new Vue();
|
|
@ -9,26 +9,28 @@
|
|||
|
||||
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
|
||||
index="3" popper-class="submenu">
|
||||
<template v-slot:title>{{$t('commons.project')}}</template>
|
||||
<ms-recent-list :options="projectRecent"/>
|
||||
<template v-slot:title>{{ $t('commons.project') }}</template>
|
||||
<ms-recent-list ref="projectRecent" :options="projectRecent"/>
|
||||
<el-divider/>
|
||||
<ms-show-all :index="'/performance/project/all'"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/performance/project/create'" :title="$t('project.create')"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/performance/project/create'"
|
||||
:title="$t('project.create')"/>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
|
||||
index="4" popper-class="submenu">
|
||||
<template v-slot:title>{{$t('commons.test')}}</template>
|
||||
<ms-recent-list :options="testRecent"/>
|
||||
<template v-slot:title>{{ $t('commons.test') }}</template>
|
||||
<ms-recent-list ref="testRecent" :options="testRecent"/>
|
||||
<el-divider/>
|
||||
<ms-show-all :index="'/performance/test/all'"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/performance/test/create'" :title="$t('load_test.create')"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/performance/test/create'"
|
||||
:title="$t('load_test.create')"/>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
|
||||
index="5" popper-class="submenu">
|
||||
<template v-slot:title>{{$t('commons.report')}}</template>
|
||||
<ms-recent-list :options="reportRecent"/>
|
||||
<template v-slot:title>{{ $t('commons.report') }}</template>
|
||||
<ms-recent-list ref="reportRecent" :options="reportRecent"/>
|
||||
<el-divider/>
|
||||
<ms-show-all :index="'/performance/report/all'"/>
|
||||
</el-submenu>
|
||||
|
@ -46,67 +48,75 @@
|
|||
|
||||
<script>
|
||||
|
||||
import MsCreateTest from "../../common/head/CreateTest";
|
||||
import MsRecentList from "../../common/head/RecentList";
|
||||
import MsCreateButton from "../../common/head/CreateButton";
|
||||
import MsShowAll from "../../common/head/ShowAll";
|
||||
import MsCreateTest from "../../common/head/CreateTest";
|
||||
import MsRecentList from "../../common/head/RecentList";
|
||||
import MsCreateButton from "../../common/head/CreateButton";
|
||||
import MsShowAll from "../../common/head/ShowAll";
|
||||
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
name: "PerformanceHeaderMenus",
|
||||
components: {
|
||||
MsCreateButton,
|
||||
MsShowAll,
|
||||
MsRecentList,
|
||||
MsCreateTest
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
projectRecent: {
|
||||
title: this.$t('project.recent'),
|
||||
url: "/project/recent/5",
|
||||
index(item) {
|
||||
return '/performance/test/' + item.id;
|
||||
},
|
||||
router(item) {
|
||||
return {name: 'perPlan', params: {projectId: item.id, projectName: item.name}}
|
||||
}
|
||||
export default {
|
||||
name: "PerformanceHeaderMenus",
|
||||
components: {
|
||||
MsCreateButton,
|
||||
MsShowAll,
|
||||
MsRecentList,
|
||||
MsCreateTest
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
projectRecent: {
|
||||
title: this.$t('project.recent'),
|
||||
url: "/project/recent/5",
|
||||
index(item) {
|
||||
return '/performance/test/' + item.id;
|
||||
},
|
||||
testRecent: {
|
||||
title: this.$t('load_test.recent'),
|
||||
url: "/performance/recent/5",
|
||||
index(item) {
|
||||
return '/performance/test/edit/' + item.id;
|
||||
},
|
||||
router(item) {
|
||||
}
|
||||
router(item) {
|
||||
return {name: 'perPlan', params: {projectId: item.id, projectName: item.name}}
|
||||
}
|
||||
},
|
||||
testRecent: {
|
||||
title: this.$t('load_test.recent'),
|
||||
url: "/performance/recent/5",
|
||||
index(item) {
|
||||
return '/performance/test/edit/' + item.id;
|
||||
},
|
||||
reportRecent: {
|
||||
title: this.$t('report.recent'),
|
||||
url: "/performance/report/recent/5",
|
||||
showTime: true,
|
||||
index(item) {
|
||||
return '/performance/report/view/' + item.id;
|
||||
},
|
||||
router(item) {
|
||||
}
|
||||
router(item) {
|
||||
}
|
||||
},
|
||||
reportRecent: {
|
||||
title: this.$t('report.recent'),
|
||||
url: "/performance/report/recent/5",
|
||||
showTime: true,
|
||||
index(item) {
|
||||
return '/performance/report/view/' + item.id;
|
||||
},
|
||||
router(item) {
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
PerformanceEvent.$on(LIST_CHANGE, () => {
|
||||
this.$refs.projectRecent.recent();
|
||||
this.$refs.testRecent.recent();
|
||||
this.$refs.reportRecent.recent();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-divider--horizontal {
|
||||
margin: 0;
|
||||
}
|
||||
.el-divider--horizontal {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.el-menu.el-menu--horizontal {
|
||||
border-bottom: none;
|
||||
}
|
||||
.el-menu.el-menu--horizontal {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#menu-bar {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
background-color: #FFF;
|
||||
}
|
||||
#menu-bar {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
background-color: #FFF;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -45,7 +45,8 @@
|
|||
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="triggerMode" width="150" :label="'触发方式'" column-key="triggerMode" :filters="triggerFilters">
|
||||
<el-table-column prop="triggerMode" width="150" :label="'触发方式'" column-key="triggerMode"
|
||||
:filters="triggerFilters">
|
||||
<template v-slot:default="scope">
|
||||
<report-trigger-mode-item :trigger-mode="scope.row.triggerMode"/>
|
||||
</template>
|
||||
|
@ -63,8 +64,10 @@
|
|||
width="150"
|
||||
:label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator-button :tip="$t('api_report.detail')" icon="el-icon-s-data" @exec="handleEdit(scope.row)" type="primary"/>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('api_report.delete')" icon="el-icon-delete" @exec="handleDelete(scope.row)" type="danger"/>
|
||||
<ms-table-operator-button :tip="$t('api_report.detail')" icon="el-icon-s-data"
|
||||
@exec="handleEdit(scope.row)" type="primary"/>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="$t('api_report.delete')"
|
||||
icon="el-icon-delete" @exec="handleDelete(scope.row)" type="danger"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -76,125 +79,129 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsPerformanceReportStatus from "./PerformanceReportStatus";
|
||||
import {_filter, _sort} from "../../../../common/js/utils";
|
||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||
import ReportTriggerModeItem from "../../common/tableItem/ReportTriggerModeItem";
|
||||
import {REPORT_CONFIGS} from "../../common/components/search/search-components";
|
||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsPerformanceReportStatus from "./PerformanceReportStatus";
|
||||
import {_filter, _sort} from "../../../../common/js/utils";
|
||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||
import ReportTriggerModeItem from "../../common/tableItem/ReportTriggerModeItem";
|
||||
import {REPORT_CONFIGS} from "../../common/components/search/search-components";
|
||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
name: "PerformanceTestReport",
|
||||
components: {
|
||||
MsTableHeader,
|
||||
ReportTriggerModeItem,
|
||||
MsTableOperatorButton, MsPerformanceReportStatus, MsTablePagination, MsContainer, MsMainContainer},
|
||||
created: function () {
|
||||
export default {
|
||||
name: "PerformanceTestReport",
|
||||
components: {
|
||||
MsTableHeader,
|
||||
ReportTriggerModeItem,
|
||||
MsTableOperatorButton, MsPerformanceReportStatus, MsTablePagination, MsContainer, MsMainContainer
|
||||
},
|
||||
created: function () {
|
||||
this.initTableData();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
queryPath: "/performance/report/list/all",
|
||||
deletePath: "/performance/report/delete/",
|
||||
condition: {
|
||||
components: REPORT_CONFIGS
|
||||
},
|
||||
projectId: null,
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
testId: null,
|
||||
statusFilters: [
|
||||
{text: 'Starting', value: 'Starting'},
|
||||
{text: 'Running', value: 'Running'},
|
||||
{text: 'Reporting', value: 'Reporting'},
|
||||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'}
|
||||
],
|
||||
triggerFilters: [
|
||||
{text: '手动', value: 'MANUAL'},
|
||||
{text: '定时任务', value: 'SCHEDULE'},
|
||||
{text: 'API', value: 'API'}
|
||||
],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
this.projectId = to.params.projectId;
|
||||
this.initTableData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.testId !== 'all') {
|
||||
this.condition.testId = this.testId;
|
||||
}
|
||||
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
});
|
||||
},
|
||||
search(combine) {
|
||||
this.initTableData(combine);
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
handleEdit(report) {
|
||||
if (report.status === "Error") {
|
||||
this.$warning(this.$t('report.generation_error'));
|
||||
return false
|
||||
} else if (report.status === "Starting") {
|
||||
this.$info(this.$t('report.being_generated'))
|
||||
return false
|
||||
}
|
||||
this.$router.push({
|
||||
path: '/performance/report/view/' + report.id
|
||||
})
|
||||
},
|
||||
handleDelete(report) {
|
||||
this.$alert(this.$t('report.delete_confirm') + report.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(report);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(report) {
|
||||
this.result = this.$post(this.deletePath + report.id, {}, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTableData();
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
PerformanceEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
queryPath: "/performance/report/list/all",
|
||||
deletePath: "/performance/report/delete/",
|
||||
condition: {
|
||||
components: REPORT_CONFIGS
|
||||
},
|
||||
projectId: null,
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
testId: null,
|
||||
statusFilters: [
|
||||
{text: 'Starting', value: 'Starting'},
|
||||
{text: 'Running', value: 'Running'},
|
||||
{text: 'Reporting', value: 'Reporting'},
|
||||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'}
|
||||
],
|
||||
triggerFilters: [
|
||||
{text: '手动', value: 'MANUAL'},
|
||||
{text: '定时任务', value: 'SCHEDULE'},
|
||||
{text: 'API', value: 'API'}
|
||||
],
|
||||
}
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
this.projectId = to.params.projectId;
|
||||
this.initTableData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.testId !== 'all') {
|
||||
this.condition.testId = this.testId;
|
||||
}
|
||||
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
});
|
||||
},
|
||||
search(combine) {
|
||||
this.initTableData(combine);
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
handleEdit(report) {
|
||||
if (report.status === "Error") {
|
||||
this.$warning(this.$t('report.generation_error'));
|
||||
return false
|
||||
} else if (report.status === "Starting") {
|
||||
this.$info(this.$t('report.being_generated'))
|
||||
return false
|
||||
}
|
||||
this.$router.push({
|
||||
path: '/performance/report/view/' + report.id
|
||||
})
|
||||
},
|
||||
handleDelete(report) {
|
||||
this.$alert(this.$t('report.delete_confirm') + report.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(report);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(report) {
|
||||
this.result = this.$post(this.deletePath + report.id, {}, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTableData();
|
||||
});
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.test-content {
|
||||
width: 100%;
|
||||
}
|
||||
.test-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -74,159 +74,162 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsPerformanceTestStatus from "./PerformanceTestStatus";
|
||||
import MsTableOperators from "../../common/components/MsTableOperators";
|
||||
import {_filter, _sort} from "../../../../common/js/utils";
|
||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||
import {TEST_CONFIGS} from "../../common/components/search/search-components";
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||
import MsContainer from "../../common/components/MsContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import MsPerformanceTestStatus from "./PerformanceTestStatus";
|
||||
import MsTableOperators from "../../common/components/MsTableOperators";
|
||||
import {_filter, _sort} from "../../../../common/js/utils";
|
||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||
import {TEST_CONFIGS} from "../../common/components/search/search-components";
|
||||
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
MsTableHeader,
|
||||
MsPerformanceTestStatus,
|
||||
MsTablePagination,
|
||||
MsTableOperator,
|
||||
MsContainer,
|
||||
MsMainContainer,
|
||||
MsTableOperators
|
||||
export default {
|
||||
components: {
|
||||
MsTableHeader,
|
||||
MsPerformanceTestStatus,
|
||||
MsTablePagination,
|
||||
MsTableOperator,
|
||||
MsContainer,
|
||||
MsMainContainer,
|
||||
MsTableOperators
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
queryPath: "/performance/list",
|
||||
deletePath: "/performance/delete",
|
||||
condition: {
|
||||
components: TEST_CONFIGS
|
||||
},
|
||||
projectId: null,
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
testId: null,
|
||||
buttons: [
|
||||
{
|
||||
tip: this.$t('commons.edit'), icon: "el-icon-edit",
|
||||
exec: this.handleEdit
|
||||
}, {
|
||||
tip: this.$t('commons.copy'), icon: "el-icon-copy-document", type: "success",
|
||||
exec: this.handleCopy
|
||||
}, {
|
||||
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
|
||||
exec: this.handleDelete
|
||||
}
|
||||
],
|
||||
statusFilters: [
|
||||
{text: 'Saved', value: 'Saved'},
|
||||
{text: 'Starting', value: 'Starting'},
|
||||
{text: 'Running', value: 'Running'},
|
||||
{text: 'Reporting', value: 'Reporting'},
|
||||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'}
|
||||
]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
this.projectId = to.params.projectId;
|
||||
this.initTableData();
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
this.initTableData();
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.projectId !== 'all') {
|
||||
this.condition.projectId = this.projectId;
|
||||
}
|
||||
|
||||
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
});
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
queryPath: "/performance/list",
|
||||
deletePath: "/performance/delete",
|
||||
condition: {
|
||||
components: TEST_CONFIGS
|
||||
},
|
||||
projectId: null,
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
loading: false,
|
||||
testId: null,
|
||||
buttons: [
|
||||
{
|
||||
tip: this.$t('commons.edit'), icon: "el-icon-edit",
|
||||
exec: this.handleEdit
|
||||
}, {
|
||||
tip: this.$t('commons.copy'), icon: "el-icon-copy-document", type: "success",
|
||||
exec: this.handleCopy
|
||||
}, {
|
||||
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
|
||||
exec: this.handleDelete
|
||||
search(combine) {
|
||||
this.initTableData(combine);
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
handleEdit(testPlan) {
|
||||
this.$router.push({
|
||||
path: '/performance/test/edit/' + testPlan.id,
|
||||
})
|
||||
},
|
||||
handleCopy(testPlan) {
|
||||
this.result = this.$post("/performance/copy", {id: testPlan.id}, () => {
|
||||
this.$success(this.$t('commons.copy_success'));
|
||||
this.search();
|
||||
});
|
||||
},
|
||||
handleDelete(testPlan) {
|
||||
this.$alert(this.$t('load_test.delete_confirm') + testPlan.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(testPlan);
|
||||
}
|
||||
],
|
||||
statusFilters: [
|
||||
{text: 'Saved', value: 'Saved'},
|
||||
{text: 'Starting', value: 'Starting'},
|
||||
{text: 'Running', value: 'Running'},
|
||||
{text: 'Reporting', value: 'Reporting'},
|
||||
{text: 'Completed', value: 'Completed'},
|
||||
{text: 'Error', value: 'Error'}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
this.projectId = to.params.projectId;
|
||||
_handleDelete(testPlan) {
|
||||
let data = {
|
||||
id: testPlan.id
|
||||
};
|
||||
|
||||
this.result = this.$post(this.deletePath, data, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTableData();
|
||||
}
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
PerformanceEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
},
|
||||
created: function () {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.projectId !== 'all') {
|
||||
this.condition.projectId = this.projectId;
|
||||
}
|
||||
|
||||
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
});
|
||||
},
|
||||
search(combine) {
|
||||
this.initTableData(combine);
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
handleEdit(testPlan) {
|
||||
this.$router.push({
|
||||
path: '/performance/test/edit/' + testPlan.id,
|
||||
})
|
||||
},
|
||||
handleCopy(testPlan) {
|
||||
this.result = this.$post("/performance/copy", {id: testPlan.id}, () => {
|
||||
this.$success(this.$t('commons.copy_success'));
|
||||
this.search();
|
||||
});
|
||||
},
|
||||
handleDelete(testPlan) {
|
||||
this.$alert(this.$t('load_test.delete_confirm') + testPlan.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(testPlan);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(testPlan) {
|
||||
let data = {
|
||||
id: testPlan.id
|
||||
};
|
||||
|
||||
this.result = this.$post(this.deletePath, data, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTableData();
|
||||
});
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
link(row) {
|
||||
this.$router.push({
|
||||
path: '/performance/test/edit/' + row.id,
|
||||
})
|
||||
},
|
||||
create() {
|
||||
this.$router.push('/performance/test/create');
|
||||
}
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
link(row) {
|
||||
this.$router.push({
|
||||
path: '/performance/test/edit/' + row.id,
|
||||
})
|
||||
},
|
||||
create() {
|
||||
this.$router.push('/performance/test/create');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.test-content {
|
||||
width: 100%;
|
||||
}
|
||||
.test-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.table-page {
|
||||
padding-top: 20px;
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
.table-page {
|
||||
padding-top: 20px;
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<el-table-column prop="name" :label="$t('commons.name')" width="250" show-overflow-tooltip/>
|
||||
<el-table-column prop="description" :label="$t('commons.description')" show-overflow-tooltip>
|
||||
<template v-slot:default="scope">
|
||||
<pre>{{scope.row.description}}</pre>
|
||||
<pre>{{ scope.row.description }}</pre>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--<el-table-column prop="workspaceName" :label="$t('project.owning_workspace')"/>-->
|
||||
|
@ -34,7 +34,8 @@
|
|||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="edit(scope.row)"
|
||||
@deleteClick="handleDelete(scope.row)">
|
||||
<template v-if="baseUrl == 'api'" v-slot:behind>
|
||||
<ms-table-operator-button :is-tester-permission="true" :tip="'环境配置'" icon="el-icon-setting"
|
||||
type="info" @exec="openEnvironmentConfig(scope.row)"/>
|
||||
|
@ -56,10 +57,10 @@
|
|||
<el-form-item :label="$t('commons.description')" prop="description">
|
||||
<el-input :autosize="{ minRows: 2, maxRows: 4}" type="textarea" v-model="form.description"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="TAPD项目ID" v-if="tapd">
|
||||
<el-form-item :label="$t('project.tapd_id')" v-if="tapd">
|
||||
<el-input v-model="form.tapdId" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="JIRA项目key" v-if="jira">
|
||||
<el-form-item :label="$t('project.jira_key')" v-if="jira">
|
||||
<el-input v-model="form.jiraKey" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -80,203 +81,209 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsCreateBox from "../settings/CreateBox";
|
||||
import {Message} from "element-ui";
|
||||
import MsTablePagination from "../common/pagination/TablePagination";
|
||||
import MsTableHeader from "../common/components/MsTableHeader";
|
||||
import MsTableOperator from "../common/components/MsTableOperator";
|
||||
import MsDialogFooter from "../common/components/MsDialogFooter";
|
||||
import {_sort, getCurrentUser, listenGoBack, removeGoBackListener} from "../../../common/js/utils";
|
||||
import MsContainer from "../common/components/MsContainer";
|
||||
import MsMainContainer from "../common/components/MsMainContainer";
|
||||
import MsDeleteConfirm from "../common/components/MsDeleteConfirm";
|
||||
import MsTableOperatorButton from "../common/components/MsTableOperatorButton";
|
||||
import ApiEnvironmentConfig from "../api/test/components/ApiEnvironmentConfig";
|
||||
import TemplateComponent from "../track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
|
||||
import MsCreateBox from "../settings/CreateBox";
|
||||
import {Message} from "element-ui";
|
||||
import MsTablePagination from "../common/pagination/TablePagination";
|
||||
import MsTableHeader from "../common/components/MsTableHeader";
|
||||
import MsTableOperator from "../common/components/MsTableOperator";
|
||||
import MsDialogFooter from "../common/components/MsDialogFooter";
|
||||
import {_sort, getCurrentUser, listenGoBack, removeGoBackListener} from "../../../common/js/utils";
|
||||
import MsContainer from "../common/components/MsContainer";
|
||||
import MsMainContainer from "../common/components/MsMainContainer";
|
||||
import MsDeleteConfirm from "../common/components/MsDeleteConfirm";
|
||||
import MsTableOperatorButton from "../common/components/MsTableOperatorButton";
|
||||
import ApiEnvironmentConfig from "../api/test/components/ApiEnvironmentConfig";
|
||||
import TemplateComponent from "../track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
|
||||
import {ApiEvent, LIST_CHANGE, PerformanceEvent, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
name: "MsProject",
|
||||
components: {
|
||||
TemplateComponent,
|
||||
ApiEnvironmentConfig,
|
||||
MsTableOperatorButton,
|
||||
MsDeleteConfirm,
|
||||
MsMainContainer,
|
||||
MsContainer, MsTableOperator, MsCreateBox, MsTablePagination, MsTableHeader, MsDialogFooter},
|
||||
data() {
|
||||
return {
|
||||
createVisible: false,
|
||||
result: {},
|
||||
btnTips: this.$t('project.create'),
|
||||
title: this.$t('project.create'),
|
||||
condition: {},
|
||||
items: [],
|
||||
tapd: false,
|
||||
jira: false,
|
||||
form: {},
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
rules: {
|
||||
name: [
|
||||
{required: true, message: this.$t('project.input_name'), trigger: 'blur'},
|
||||
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}
|
||||
],
|
||||
description: [
|
||||
{max: 500, message: this.$t('commons.input_limit', [0, 500]), trigger: 'blur'}
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
props: {
|
||||
baseUrl: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
export default {
|
||||
name: "MsProject",
|
||||
components: {
|
||||
TemplateComponent,
|
||||
ApiEnvironmentConfig,
|
||||
MsTableOperatorButton,
|
||||
MsDeleteConfirm,
|
||||
MsMainContainer,
|
||||
MsContainer, MsTableOperator, MsCreateBox, MsTablePagination, MsTableHeader, MsDialogFooter
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
createVisible: false,
|
||||
result: {},
|
||||
btnTips: this.$t('project.create'),
|
||||
title: this.$t('project.create'),
|
||||
condition: {},
|
||||
items: [],
|
||||
tapd: false,
|
||||
jira: false,
|
||||
form: {},
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
rules: {
|
||||
name: [
|
||||
{required: true, message: this.$t('project.input_name'), trigger: 'blur'},
|
||||
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}
|
||||
],
|
||||
description: [
|
||||
{max: 500, message: this.$t('commons.input_limit', [0, 500]), trigger: 'blur'}
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
props: {
|
||||
baseUrl: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.$route.path.split('/')[2] === 'project' &&
|
||||
this.$route.path.split('/')[3] === 'create') {
|
||||
this.create();
|
||||
this.$router.push('/' + this.baseUrl + '/project/all');
|
||||
}
|
||||
this.list();
|
||||
},
|
||||
activated() {
|
||||
this.list();
|
||||
},
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
if (this.$route.path.split('/')[2] === 'project' &&
|
||||
this.$route.path.split('/')[3] === 'create') {
|
||||
to.path.split('/')[3] === 'create') {
|
||||
this.create();
|
||||
this.$router.push('/' + this.baseUrl + '/project/all');
|
||||
}
|
||||
this.list();
|
||||
},
|
||||
activated() {
|
||||
this.list();
|
||||
},
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
if (this.$route.path.split('/')[2] === 'project' &&
|
||||
to.path.split('/')[3] === 'create') {
|
||||
this.create();
|
||||
this.$router.push('/' + this.baseUrl + '/project/all');
|
||||
} else if (this.$route.path.split('/')[2] === 'project' &&
|
||||
to.path.split('/')[3] === 'all') {
|
||||
this.list();
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentUser: () => {
|
||||
return getCurrentUser();
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
this.createVisible = false;
|
||||
},
|
||||
methods: {
|
||||
create() {
|
||||
let workspaceId = this.currentUser.lastWorkspaceId;
|
||||
if (!workspaceId) {
|
||||
this.$warning(this.$t('project.please_choose_workspace'));
|
||||
return false;
|
||||
}
|
||||
this.title = this.$t('project.create');
|
||||
listenGoBack(this.handleClose);
|
||||
this.createVisible = true;
|
||||
this.form = {};
|
||||
},
|
||||
edit(row) {
|
||||
this.title = this.$t('project.edit');
|
||||
this.createVisible = true;
|
||||
listenGoBack(this.handleClose);
|
||||
this.form = Object.assign({}, row);
|
||||
if (this.baseUrl === 'track') {
|
||||
this.$get("/service/integration/all/" + getCurrentUser().lastOrganizationId, response => {
|
||||
let data = response.data;
|
||||
let platforms = data.map(d => d.platform);
|
||||
if (platforms.indexOf("Tapd") !== -1) {
|
||||
this.tapd = true;
|
||||
}
|
||||
if (platforms.indexOf("Jira") !== -1) {
|
||||
this.jira = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
submit(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
let saveType = "add";
|
||||
if (this.form.id) {
|
||||
saveType = "update"
|
||||
}
|
||||
this.result = this.$post("/project/" + saveType, this.form, () => {
|
||||
this.createVisible = false;
|
||||
this.list();
|
||||
Message.success(this.$t('commons.save_success'));
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDelete(project) {
|
||||
this.$refs.deleteConfirm.open(project);
|
||||
},
|
||||
_handleDelete(project) {
|
||||
this.$confirm(this.$t('project.delete_tip'), '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$get('/project/delete/' + project.id, () => {
|
||||
Message.success(this.$t('commons.delete_success'));
|
||||
this.list();
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancelled')
|
||||
});
|
||||
});
|
||||
},
|
||||
handleClose() {
|
||||
removeGoBackListener(this.handleClose);
|
||||
this.createVisible = false;
|
||||
},
|
||||
search() {
|
||||
} else if (this.$route.path.split('/')[2] === 'project' &&
|
||||
to.path.split('/')[3] === 'all') {
|
||||
this.list();
|
||||
},
|
||||
list() {
|
||||
let url = "/project/list/" + this.currentPage + '/' + this.pageSize;
|
||||
this.result = this.$post(url, this.condition, (response) => {
|
||||
let data = response.data;
|
||||
this.items = data.listObject;
|
||||
this.total = data.itemCount;
|
||||
})
|
||||
},
|
||||
link(row) {
|
||||
// performance_test project link
|
||||
if (this.$route.name === 'perProject') {
|
||||
this.$router.push({
|
||||
path: '/performance/test/' + row.id,
|
||||
})
|
||||
} else if (this.$route.name === 'fucProject') {
|
||||
this.$router.push({
|
||||
path: '/api/test/list/' + row.id
|
||||
})
|
||||
} else if (this.$route.name ==='trackProject') {
|
||||
this.$router.push({
|
||||
path: '/track/case/' + row.id
|
||||
})
|
||||
}
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.list();
|
||||
},
|
||||
openEnvironmentConfig(project) {
|
||||
this.$refs.environmentConfig.open(project.id);
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentUser: () => {
|
||||
return getCurrentUser();
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
this.createVisible = false;
|
||||
},
|
||||
methods: {
|
||||
create() {
|
||||
let workspaceId = this.currentUser.lastWorkspaceId;
|
||||
if (!workspaceId) {
|
||||
this.$warning(this.$t('project.please_choose_workspace'));
|
||||
return false;
|
||||
}
|
||||
this.title = this.$t('project.create');
|
||||
listenGoBack(this.handleClose);
|
||||
this.createVisible = true;
|
||||
this.form = {};
|
||||
},
|
||||
edit(row) {
|
||||
this.title = this.$t('project.edit');
|
||||
this.createVisible = true;
|
||||
listenGoBack(this.handleClose);
|
||||
this.form = Object.assign({}, row);
|
||||
if (this.baseUrl === 'track') {
|
||||
this.$get("/service/integration/all/" + getCurrentUser().lastOrganizationId, response => {
|
||||
let data = response.data;
|
||||
let platforms = data.map(d => d.platform);
|
||||
if (platforms.indexOf("Tapd") !== -1) {
|
||||
this.tapd = true;
|
||||
}
|
||||
if (platforms.indexOf("Jira") !== -1) {
|
||||
this.jira = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
submit(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
let saveType = "add";
|
||||
if (this.form.id) {
|
||||
saveType = "update"
|
||||
}
|
||||
this.result = this.$post("/project/" + saveType, this.form, () => {
|
||||
this.createVisible = false;
|
||||
this.list();
|
||||
Message.success(this.$t('commons.save_success'));
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDelete(project) {
|
||||
this.$refs.deleteConfirm.open(project);
|
||||
},
|
||||
_handleDelete(project) {
|
||||
this.$confirm(this.$t('project.delete_tip'), '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$get('/project/delete/' + project.id, () => {
|
||||
Message.success(this.$t('commons.delete_success'));
|
||||
this.list();
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
ApiEvent.$emit(LIST_CHANGE);
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
PerformanceEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancelled')
|
||||
});
|
||||
});
|
||||
},
|
||||
handleClose() {
|
||||
removeGoBackListener(this.handleClose);
|
||||
this.createVisible = false;
|
||||
},
|
||||
search() {
|
||||
this.list();
|
||||
},
|
||||
list() {
|
||||
let url = "/project/list/" + this.currentPage + '/' + this.pageSize;
|
||||
this.result = this.$post(url, this.condition, (response) => {
|
||||
let data = response.data;
|
||||
this.items = data.listObject;
|
||||
this.total = data.itemCount;
|
||||
})
|
||||
},
|
||||
link(row) {
|
||||
// performance_test project link
|
||||
if (this.$route.name === 'perProject') {
|
||||
this.$router.push({
|
||||
path: '/performance/test/' + row.id,
|
||||
})
|
||||
} else if (this.$route.name === 'fucProject') {
|
||||
this.$router.push({
|
||||
path: '/api/test/list/' + row.id
|
||||
})
|
||||
} else if (this.$route.name === 'trackProject') {
|
||||
this.$router.push({
|
||||
path: '/track/case/' + row.id
|
||||
})
|
||||
}
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.list();
|
||||
},
|
||||
openEnvironmentConfig(project) {
|
||||
this.$refs.environmentConfig.open(project.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.el-table {
|
||||
cursor:pointer;
|
||||
}
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-card class="header-title" v-loading="result.loading">
|
||||
<div class="header-title" v-loading="result.loading">
|
||||
<div>
|
||||
<div>{{$t('organization.integration.select_defect_platform')}}</div>
|
||||
<el-radio-group v-model="platform" style="margin-top: 10px" @change="change">
|
||||
|
@ -33,7 +33,8 @@
|
|||
</el-button>
|
||||
<el-button v-if="showEdit" size="mini" @click="edit">{{$t('commons.edit')}}</el-button>
|
||||
<el-button type="primary" v-if="showSave" size="mini" @click="save('form')">{{$t('commons.save')}}</el-button>
|
||||
<el-button v-if="showCancel" size="mini" @click="cancelEdit">{{$t('organization.integration.cancel_edit')}}</el-button>
|
||||
<el-button v-if="showCancel" size="mini" @click="cancelEdit">{{$t('organization.integration.cancel_edit')}}
|
||||
</el-button>
|
||||
<el-button type="info" size="mini" @click="cancelIntegration('form')" :disabled="!show">
|
||||
{{$t('organization.integration.cancel_integration')}}
|
||||
</el-button>
|
||||
|
@ -46,11 +47,12 @@
|
|||
</div>
|
||||
<div>
|
||||
2. {{$t('organization.integration.use_tip_two')}}
|
||||
<router-link to="/track/project/all" style="margin-left: 5px">{{$t('organization.integration.link_the_project_now')}}
|
||||
<router-link to="/track/project/all" style="margin-left: 5px">
|
||||
{{$t('organization.integration.link_the_project_now')}}
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -69,9 +71,21 @@
|
|||
showSave: false,
|
||||
showCancel: false,
|
||||
rules: {
|
||||
account: {required: true, message: this.$t('organization.integration.input_api_account'), trigger: ['change', 'blur']},
|
||||
password: {required: true, message: this.$t('organization.integration.input_api_password'), trigger: ['change', 'blur']},
|
||||
url: {required: true, message: this.$t('organization.integration.input_jira_url'), trigger: ['change', 'blur']}
|
||||
account: {
|
||||
required: true,
|
||||
message: this.$t('organization.integration.input_api_account'),
|
||||
trigger: ['change', 'blur']
|
||||
},
|
||||
password: {
|
||||
required: true,
|
||||
message: this.$t('organization.integration.input_api_password'),
|
||||
trigger: ['change', 'blur']
|
||||
},
|
||||
url: {
|
||||
required: true,
|
||||
message: this.$t('organization.integration.input_jira_url'),
|
||||
trigger: ['change', 'blur']
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -126,7 +140,7 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
} else {
|
||||
this.$warning(this.$t('organization.integration.not_integrated'));
|
||||
}
|
||||
},
|
||||
|
@ -188,9 +202,14 @@
|
|||
});
|
||||
},
|
||||
testConnection() {
|
||||
this.result = this.$get("issues/auth/" + this.platform, () => {
|
||||
this.$success(this.$t('organization.integration.verified'));
|
||||
});
|
||||
if (this.form.account && this.form.password && this.platform) {
|
||||
this.result = this.$get("issues/auth/" + this.platform, () => {
|
||||
this.$success(this.$t('organization.integration.verified'));
|
||||
});
|
||||
} else {
|
||||
this.$warning(this.$t('organization.integration.not_integrated'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-tabs class="system-setting" v-model="activeName">
|
||||
<el-tab-pane :label="$t('organization.defect_manage')" name="defect">
|
||||
<defect-management/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -127,374 +127,379 @@
|
|||
|
||||
<script>
|
||||
|
||||
import MsCreateBox from '../../../settings/CreateBox';
|
||||
import TestCaseImport from '../components/TestCaseImport';
|
||||
import TestCaseExport from '../components/TestCaseExport';
|
||||
import MsTablePagination from '../../../../components/common/pagination/TablePagination';
|
||||
import NodeBreadcrumb from '../../common/NodeBreadcrumb';
|
||||
import MsTableHeader from '../../../../components/common/components/MsTableHeader';
|
||||
import PriorityTableItem from "../../common/tableItems/planview/PriorityTableItem";
|
||||
import TypeTableItem from "../../common/tableItems/planview/TypeTableItem";
|
||||
import MethodTableItem from "../../common/tableItems/planview/MethodTableItem";
|
||||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
import MsTableButton from "../../../common/components/MsTableButton";
|
||||
import {_filter, _sort} from "../../../../../common/js/utils";
|
||||
import {TEST_CASE_CONFIGS} from "../../../common/components/search/search-components";
|
||||
import ShowMoreBtn from "./ShowMoreBtn";
|
||||
import BatchEdit from "./BatchEdit";
|
||||
import {WORKSPACE_ID} from "../../../../../common/js/constants";
|
||||
import MsCreateBox from '../../../settings/CreateBox';
|
||||
import TestCaseImport from '../components/TestCaseImport';
|
||||
import TestCaseExport from '../components/TestCaseExport';
|
||||
import MsTablePagination from '../../../../components/common/pagination/TablePagination';
|
||||
import NodeBreadcrumb from '../../common/NodeBreadcrumb';
|
||||
import MsTableHeader from '../../../../components/common/components/MsTableHeader';
|
||||
import PriorityTableItem from "../../common/tableItems/planview/PriorityTableItem";
|
||||
import TypeTableItem from "../../common/tableItems/planview/TypeTableItem";
|
||||
import MethodTableItem from "../../common/tableItems/planview/MethodTableItem";
|
||||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
import MsTableButton from "../../../common/components/MsTableButton";
|
||||
import {_filter, _sort} from "../../../../../common/js/utils";
|
||||
import {TEST_CASE_CONFIGS} from "../../../common/components/search/search-components";
|
||||
import ShowMoreBtn from "./ShowMoreBtn";
|
||||
import BatchEdit from "./BatchEdit";
|
||||
import {WORKSPACE_ID} from "../../../../../common/js/constants";
|
||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
name: "TestCaseList",
|
||||
components: {
|
||||
MsTableButton,
|
||||
MsTableOperatorButton,
|
||||
MsTableOperator,
|
||||
MethodTableItem,
|
||||
TypeTableItem,
|
||||
PriorityTableItem,
|
||||
MsCreateBox,
|
||||
TestCaseImport,
|
||||
TestCaseExport,
|
||||
MsTablePagination,
|
||||
NodeBreadcrumb,
|
||||
MsTableHeader,
|
||||
ShowMoreBtn,
|
||||
BatchEdit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
deletePath: "/test/case/delete",
|
||||
condition: {
|
||||
components: TEST_CASE_CONFIGS
|
||||
},
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
selectRows: new Set(),
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
export default {
|
||||
name: "TestCaseList",
|
||||
components: {
|
||||
MsTableButton,
|
||||
MsTableOperatorButton,
|
||||
MsTableOperator,
|
||||
MethodTableItem,
|
||||
TypeTableItem,
|
||||
PriorityTableItem,
|
||||
MsCreateBox,
|
||||
TestCaseImport,
|
||||
TestCaseExport,
|
||||
MsTablePagination,
|
||||
NodeBreadcrumb,
|
||||
MsTableHeader,
|
||||
ShowMoreBtn,
|
||||
BatchEdit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
deletePath: "/test/case/delete",
|
||||
condition: {
|
||||
components: TEST_CASE_CONFIGS
|
||||
},
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
selectRows: new Set(),
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
],
|
||||
methodFilters: [
|
||||
{text: this.$t('test_track.case.manual'), value: 'manual'},
|
||||
{text: this.$t('test_track.case.auto'), value: 'auto'}
|
||||
],
|
||||
typeFilters: [
|
||||
{text: this.$t('commons.functional'), value: 'functional'},
|
||||
{text: this.$t('commons.performance'), value: 'performance'},
|
||||
{text: this.$t('commons.api'), value: 'api'}
|
||||
],
|
||||
showMore: false,
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit
|
||||
}, {
|
||||
name: this.$t('test_track.case.batch_move_case'), handleClick: this.handleBatchMove
|
||||
}, {
|
||||
name: this.$t('test_track.case.batch_delete_case'), handleClick: this.handleDeleteBatch
|
||||
}
|
||||
],
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'type', name: this.$t('test_track.case.type')},
|
||||
{id: 'method', name: this.$t('test_track.case.method')},
|
||||
{id: 'maintainer', name: this.$t('test_track.case.maintainer')},
|
||||
],
|
||||
valueArr: {
|
||||
priority: [
|
||||
{name: 'P0', id: 'P0'},
|
||||
{name: 'P1', id: 'P1'},
|
||||
{name: 'P2', id: 'P2'},
|
||||
{name: 'P3', id: 'P3'}
|
||||
],
|
||||
methodFilters: [
|
||||
{text: this.$t('test_track.case.manual'), value: 'manual'},
|
||||
{text: this.$t('test_track.case.auto'), value: 'auto'}
|
||||
type: [
|
||||
{name: this.$t('commons.functional'), id: 'functional'},
|
||||
{name: this.$t('commons.performance'), id: 'performance'},
|
||||
{name: this.$t('commons.api'), id: 'api'}
|
||||
],
|
||||
typeFilters: [
|
||||
{text: this.$t('commons.functional'), value: 'functional'},
|
||||
{text: this.$t('commons.performance'), value: 'performance'},
|
||||
{text: this.$t('commons.api'), value: 'api'}
|
||||
method: [
|
||||
{name: this.$t('test_track.case.manual'), id: 'manual'},
|
||||
{name: this.$t('test_track.case.auto'), id: 'auto'}
|
||||
],
|
||||
showMore: false,
|
||||
buttons: [
|
||||
{
|
||||
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit
|
||||
}, {
|
||||
name: this.$t('test_track.case.batch_move_case'), handleClick: this.handleBatchMove
|
||||
}, {
|
||||
name: this.$t('test_track.case.batch_delete_case'), handleClick: this.handleDeleteBatch
|
||||
}
|
||||
],
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'type', name: this.$t('test_track.case.type')},
|
||||
{id: 'method', name: this.$t('test_track.case.method')},
|
||||
{id: 'maintainer', name: this.$t('test_track.case.maintainer')},
|
||||
],
|
||||
valueArr: {
|
||||
priority: [
|
||||
{name: 'P0', id: 'P0'},
|
||||
{name: 'P1', id: 'P1'},
|
||||
{name: 'P2', id: 'P2'},
|
||||
{name: 'P3', id: 'P3'}
|
||||
],
|
||||
type: [
|
||||
{name: this.$t('commons.functional'), id: 'functional'},
|
||||
{name: this.$t('commons.performance'), id: 'performance'},
|
||||
{name: this.$t('commons.api'), id: 'api'}
|
||||
],
|
||||
method: [
|
||||
{name: this.$t('test_track.case.manual'), id: 'manual'},
|
||||
{name: this.$t('test_track.case.auto'), id: 'auto'}
|
||||
],
|
||||
maintainer: [],
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProject: {
|
||||
type: Object
|
||||
},
|
||||
selectNodeIds: {
|
||||
type: Array
|
||||
},
|
||||
selectParentNodes: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.initTableData();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.initTableData();
|
||||
},
|
||||
selectNodeIds() {
|
||||
this.initTableData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.planId) {
|
||||
// param.planId = this.planId;
|
||||
this.condition.planId = this.planId;
|
||||
}
|
||||
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||
// param.nodeIds = this.selectNodeIds;
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
}
|
||||
if (this.currentProject) {
|
||||
this.condition.projectId = this.currentProject.id;
|
||||
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
// this.selectIds.clear();
|
||||
this.selectRows.clear();
|
||||
});
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.initTableData();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testCaseCreate() {
|
||||
this.$emit('testCaseEdit');
|
||||
},
|
||||
handleEdit(testCase) {
|
||||
this.$emit('testCaseEdit', testCase);
|
||||
},
|
||||
handleCopy(testCase) {
|
||||
this.$emit('testCaseCopy', testCase);
|
||||
},
|
||||
handleDelete(testCase) {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(testCase);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$post('/test/case/batch/delete', {ids: ids}, () => {
|
||||
this.selectRows.clear();
|
||||
this.$emit("refresh");
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(testCase) {
|
||||
let testCaseId = testCase.id;
|
||||
this.$post('/test/case/delete/' + testCaseId, {}, () => {
|
||||
this.initTableData();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.condition = {components: TEST_CASE_CONFIGS};
|
||||
// this.selectIds.clear();
|
||||
this.selectRows.clear();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.$emit('testCaseDetail', row);
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
if (selection.length > 0) {
|
||||
if (selection.length === 1) {
|
||||
this.selectRows.add(selection[0]);
|
||||
} else {
|
||||
this.tableData.forEach(item => {
|
||||
this.$set(item, "showMore", true);
|
||||
this.selectRows.add(item);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.selectRows.clear();
|
||||
this.tableData.forEach(row => {
|
||||
this.$set(row, "showMore", false);
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSelectionChange(selection, row) {
|
||||
// if (this.selectIds.has(row.id)) {
|
||||
// this.selectIds.delete(row.id);
|
||||
// } else {
|
||||
// this.selectIds.add(row.id);
|
||||
// }
|
||||
if (this.selectRows.has(row)) {
|
||||
this.$set(row, "showMore", false);
|
||||
this.selectRows.delete(row);
|
||||
} else {
|
||||
this.$set(row, "showMore", true);
|
||||
this.selectRows.add(row);
|
||||
}
|
||||
|
||||
let arr = Array.from(this.selectRows);
|
||||
|
||||
// 选中1个以上的用例时显示更多操作
|
||||
if (this.selectRows.size === 1) {
|
||||
this.$set(arr[0], "showMore", false);
|
||||
} else if (this.selectRows.size === 2) {
|
||||
arr.forEach(row => {
|
||||
this.$set(row, "showMore", true);
|
||||
})
|
||||
}
|
||||
},
|
||||
importTestCase() {
|
||||
this.$refs.testCaseImport.open();
|
||||
},
|
||||
exportTestCase() {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
let config = {
|
||||
url: '/test/case/export/testcase',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
// data: {ids: [...this.selectIds]}
|
||||
data: {ids: ids}
|
||||
};
|
||||
this.result = this.$request(config).then(response => {
|
||||
const filename = this.$t('test_track.case.test_case') + ".xlsx";
|
||||
const blob = new Blob([response.data]);
|
||||
if ("download" in document.createElement("a")) {
|
||||
let aTag = document.createElement('a');
|
||||
aTag.download = filename;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(aTag.href)
|
||||
} else {
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleBatch(type) {
|
||||
if (this.selectRows.size < 1) {
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
return;
|
||||
}
|
||||
if (type === 'move') {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$emit('moveToNode', ids);
|
||||
} else if (type === 'delete') {
|
||||
this.handleDeleteBatch();
|
||||
} else {
|
||||
this.exportTestCase();
|
||||
}
|
||||
},
|
||||
batchEdit(form) {
|
||||
let sign = false;
|
||||
let arr = Array.from(this.selectRows);
|
||||
// 功能测试的测试方式不能设置为自动
|
||||
if (form.type === 'method' && form.value === 'auto') {
|
||||
arr.forEach(row => {
|
||||
if (row.type === 'functional') {
|
||||
sign = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (form.type === 'type' && form.value === 'functional') {
|
||||
arr.forEach(row => {
|
||||
if (row.method === 'auto') {
|
||||
sign = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let ids = arr.map(row => row.id);
|
||||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
if (!sign) {
|
||||
this.$post('/test/case/batch/edit' , param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.refresh();
|
||||
});
|
||||
} else {
|
||||
this.$warning("功能测试的测试方式不能设置为自动!");
|
||||
}
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
sort(column) {
|
||||
// 每次只对一个字段排序
|
||||
if (this.condition.orders) {
|
||||
this.condition.orders = [];
|
||||
}
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
handleBatchEdit() {
|
||||
this.getMaintainerOptions();
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
handleBatchMove() {
|
||||
this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id));
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
this.valueArr.maintainer = response.data;
|
||||
});
|
||||
maintainer: [],
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProject: {
|
||||
type: Object
|
||||
},
|
||||
selectNodeIds: {
|
||||
type: Array
|
||||
},
|
||||
selectParentNodes: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.initTableData();
|
||||
},
|
||||
watch: {
|
||||
currentProject() {
|
||||
this.initTableData();
|
||||
},
|
||||
selectNodeIds() {
|
||||
this.initTableData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.planId) {
|
||||
// param.planId = this.planId;
|
||||
this.condition.planId = this.planId;
|
||||
}
|
||||
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||
// param.nodeIds = this.selectNodeIds;
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
}
|
||||
if (this.currentProject) {
|
||||
this.condition.projectId = this.currentProject.id;
|
||||
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
// this.selectIds.clear();
|
||||
this.selectRows.clear();
|
||||
});
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.initTableData();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testCaseCreate() {
|
||||
this.$emit('testCaseEdit');
|
||||
},
|
||||
handleEdit(testCase) {
|
||||
this.$emit('testCaseEdit', testCase);
|
||||
},
|
||||
handleCopy(testCase) {
|
||||
this.$emit('testCaseCopy', testCase);
|
||||
},
|
||||
handleDelete(testCase) {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + '\'' + testCase.name + '\'' + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this._handleDelete(testCase);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$post('/test/case/batch/delete', {ids: ids}, () => {
|
||||
this.selectRows.clear();
|
||||
this.$emit("refresh");
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_handleDelete(testCase) {
|
||||
let testCaseId = testCase.id;
|
||||
this.$post('/test/case/delete/' + testCaseId, {}, () => {
|
||||
this.initTableData();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.condition = {components: TEST_CASE_CONFIGS};
|
||||
// this.selectIds.clear();
|
||||
this.selectRows.clear();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.$emit('testCaseDetail', row);
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
if (selection.length > 0) {
|
||||
if (selection.length === 1) {
|
||||
this.selectRows.add(selection[0]);
|
||||
} else {
|
||||
this.tableData.forEach(item => {
|
||||
this.$set(item, "showMore", true);
|
||||
this.selectRows.add(item);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.selectRows.clear();
|
||||
this.tableData.forEach(row => {
|
||||
this.$set(row, "showMore", false);
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSelectionChange(selection, row) {
|
||||
// if (this.selectIds.has(row.id)) {
|
||||
// this.selectIds.delete(row.id);
|
||||
// } else {
|
||||
// this.selectIds.add(row.id);
|
||||
// }
|
||||
if (this.selectRows.has(row)) {
|
||||
this.$set(row, "showMore", false);
|
||||
this.selectRows.delete(row);
|
||||
} else {
|
||||
this.$set(row, "showMore", true);
|
||||
this.selectRows.add(row);
|
||||
}
|
||||
|
||||
let arr = Array.from(this.selectRows);
|
||||
|
||||
// 选中1个以上的用例时显示更多操作
|
||||
if (this.selectRows.size === 1) {
|
||||
this.$set(arr[0], "showMore", false);
|
||||
} else if (this.selectRows.size === 2) {
|
||||
arr.forEach(row => {
|
||||
this.$set(row, "showMore", true);
|
||||
})
|
||||
}
|
||||
},
|
||||
importTestCase() {
|
||||
this.$refs.testCaseImport.open();
|
||||
},
|
||||
exportTestCase() {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
let config = {
|
||||
url: '/test/case/export/testcase',
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
// data: {ids: [...this.selectIds]}
|
||||
data: {ids: ids}
|
||||
};
|
||||
this.result = this.$request(config).then(response => {
|
||||
const filename = this.$t('test_track.case.test_case') + ".xlsx";
|
||||
const blob = new Blob([response.data]);
|
||||
if ("download" in document.createElement("a")) {
|
||||
let aTag = document.createElement('a');
|
||||
aTag.download = filename;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(aTag.href)
|
||||
} else {
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleBatch(type) {
|
||||
if (this.selectRows.size < 1) {
|
||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||
return;
|
||||
}
|
||||
if (type === 'move') {
|
||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$emit('moveToNode', ids);
|
||||
} else if (type === 'delete') {
|
||||
this.handleDeleteBatch();
|
||||
} else {
|
||||
this.exportTestCase();
|
||||
}
|
||||
},
|
||||
batchEdit(form) {
|
||||
let sign = false;
|
||||
let arr = Array.from(this.selectRows);
|
||||
// 功能测试的测试方式不能设置为自动
|
||||
if (form.type === 'method' && form.value === 'auto') {
|
||||
arr.forEach(row => {
|
||||
if (row.type === 'functional') {
|
||||
sign = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (form.type === 'type' && form.value === 'functional') {
|
||||
arr.forEach(row => {
|
||||
if (row.method === 'auto') {
|
||||
sign = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let ids = arr.map(row => row.id);
|
||||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
if (!sign) {
|
||||
this.$post('/test/case/batch/edit', param, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.refresh();
|
||||
});
|
||||
} else {
|
||||
this.$warning("功能测试的测试方式不能设置为自动!");
|
||||
}
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
sort(column) {
|
||||
// 每次只对一个字段排序
|
||||
if (this.condition.orders) {
|
||||
this.condition.orders = [];
|
||||
}
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
handleBatchEdit() {
|
||||
this.getMaintainerOptions();
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
handleBatchMove() {
|
||||
this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id));
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
this.valueArr.maintainer = response.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.table-page {
|
||||
padding-top: 20px;
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
.table-page {
|
||||
padding-top: 20px;
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.operate-button {
|
||||
float: right;
|
||||
}
|
||||
.operate-button {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.operate-button > div {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.operate-button > div {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.search {
|
||||
margin-left: 10px;
|
||||
width: 240px;
|
||||
}
|
||||
.search {
|
||||
margin-left: 10px;
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -10,31 +10,34 @@
|
|||
</el-menu-item>
|
||||
<el-submenu :class="{'deactivation':!isProjectActivation}"
|
||||
v-permission="['test_manager','test_user','test_viewer']" index="3" popper-class="submenu">
|
||||
<template v-slot:title>{{$t('commons.project')}}</template>
|
||||
<ms-recent-list :options="projectRecent"/>
|
||||
<template v-slot:title>{{ $t('commons.project') }}</template>
|
||||
<ms-recent-list ref="projectRecent" :options="projectRecent"/>
|
||||
<el-divider/>
|
||||
<ms-show-all :index="'/track/project/all'"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/track/project/create'" :title="$t('project.create')"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/track/project/create'"
|
||||
:title="$t('project.create')"/>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
|
||||
index="6" popper-class="submenu">
|
||||
<template v-slot:title>{{$t('test_track.case.test_case')}}</template>
|
||||
<ms-recent-list :options="caseRecent"/>
|
||||
<template v-slot:title>{{ $t('test_track.case.test_case') }}</template>
|
||||
<ms-recent-list ref="caseRecent" :options="caseRecent"/>
|
||||
<el-divider/>
|
||||
<ms-show-all :index="'/track/case/all'"/>
|
||||
<el-menu-item :index="testCaseEditPath" class="blank_item"></el-menu-item>
|
||||
<el-menu-item :index="testCaseProjectPath" class="blank_item"></el-menu-item>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/track/case/create'" :title="$t('test_track.case.create_case')"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/track/case/create'"
|
||||
:title="$t('test_track.case.create_case')"/>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu v-permission="['test_manager','test_user','test_viewer']" index="7" popper-class="submenu">
|
||||
<template v-slot:title>{{$t('test_track.plan.test_plan')}}</template>
|
||||
<ms-recent-list :options="planRecent"/>
|
||||
<template v-slot:title>{{ $t('test_track.plan.test_plan') }}</template>
|
||||
<ms-recent-list ref="planRecent" :options="planRecent"/>
|
||||
<el-divider/>
|
||||
<ms-show-all :index="'/track/plan/all'"/>
|
||||
<el-menu-item :index="testPlanViewPath" class="blank_item"></el-menu-item>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/track/plan/create'" :title="$t('test_track.plan.create_plan')"/>
|
||||
<ms-create-button v-permission="['test_manager','test_user']" :index="'/track/plan/create'"
|
||||
:title="$t('test_track.plan.create_plan')"/>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</el-col>
|
||||
|
@ -45,107 +48,115 @@
|
|||
</template>
|
||||
<script>
|
||||
|
||||
import MsShowAll from "../../common/head/ShowAll";
|
||||
import MsRecentList from "../../common/head/RecentList";
|
||||
import MsCreateButton from "../../common/head/CreateButton";
|
||||
import MsShowAll from "../../common/head/ShowAll";
|
||||
import MsRecentList from "../../common/head/RecentList";
|
||||
import MsCreateButton from "../../common/head/CreateButton";
|
||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
name: "TrackHeaderMenus",
|
||||
components: {MsShowAll, MsRecentList, MsCreateButton},
|
||||
data() {
|
||||
return {
|
||||
testPlanViewPath: '',
|
||||
isRouterAlive: true,
|
||||
testCaseEditPath: '',
|
||||
testCaseProjectPath: '',
|
||||
isProjectActivation: true,
|
||||
projectRecent: {
|
||||
title: this.$t('project.recent'),
|
||||
url: "/project/recent/5",
|
||||
index: function (item) {
|
||||
return '/track/case/' + item.id;
|
||||
},
|
||||
router: function (item) {
|
||||
return {name: 'testCase', params: {projectId: item.id, projectName: item.name}}
|
||||
}
|
||||
export default {
|
||||
name: "TrackHeaderMenus",
|
||||
components: {MsShowAll, MsRecentList, MsCreateButton},
|
||||
data() {
|
||||
return {
|
||||
testPlanViewPath: '',
|
||||
isRouterAlive: true,
|
||||
testCaseEditPath: '',
|
||||
testCaseProjectPath: '',
|
||||
isProjectActivation: true,
|
||||
projectRecent: {
|
||||
title: this.$t('project.recent'),
|
||||
url: "/project/recent/5",
|
||||
index: function (item) {
|
||||
return '/track/case/' + item.id;
|
||||
},
|
||||
caseRecent: {
|
||||
title: this.$t('test_track.recent_case'),
|
||||
url: "/test/case/recent/5",
|
||||
index: function (item) {
|
||||
return '/track/case/edit/' + item.id;
|
||||
},
|
||||
router: function (item) {}
|
||||
},
|
||||
planRecent: {
|
||||
title: this.$t('test_track.recent_plan'),
|
||||
url: "/test/plan/recent/5",
|
||||
index: function (item) {
|
||||
return '/track/plan/view/' + item.id;
|
||||
},
|
||||
router: function (item) {}
|
||||
router: function (item) {
|
||||
return {name: 'testCase', params: {projectId: item.id, projectName: item.name}}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
reload() {
|
||||
this.isRouterAlive = false;
|
||||
this.$nextTick(function () {
|
||||
this.isRouterAlive = true;
|
||||
});
|
||||
},
|
||||
init() {
|
||||
let path = this.$route.path;
|
||||
if (path.indexOf("/track/case") >= 0 && !!this.$route.params.projectId) {
|
||||
this.testCaseProjectPath = path;
|
||||
//不激活项目菜单栏
|
||||
this.isProjectActivation = false;
|
||||
this.reload();
|
||||
} else {
|
||||
this.isProjectActivation = true;
|
||||
caseRecent: {
|
||||
title: this.$t('test_track.recent_case'),
|
||||
url: "/test/case/recent/5",
|
||||
index: function (item) {
|
||||
return '/track/case/edit/' + item.id;
|
||||
},
|
||||
router: function (item) {
|
||||
}
|
||||
if (path.indexOf("/track/plan/view") >= 0) {
|
||||
this.testPlanViewPath = path;
|
||||
this.reload();
|
||||
}
|
||||
if (path.indexOf("/track/case/edit") >= 0) {
|
||||
this.testCaseEditPath = path;
|
||||
this.reload();
|
||||
},
|
||||
planRecent: {
|
||||
title: this.$t('test_track.recent_plan'),
|
||||
url: "/test/plan/recent/5",
|
||||
index: function (item) {
|
||||
return '/track/plan/view/' + item.id;
|
||||
},
|
||||
router: function (item) {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
TrackEvent.$on(LIST_CHANGE, () => {
|
||||
this.$refs.projectRecent.recent();
|
||||
this.$refs.planRecent.recent();
|
||||
this.$refs.caseRecent.recent();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
reload() {
|
||||
this.isRouterAlive = false;
|
||||
this.$nextTick(function () {
|
||||
this.isRouterAlive = true;
|
||||
});
|
||||
},
|
||||
init() {
|
||||
let path = this.$route.path;
|
||||
if (path.indexOf("/track/case") >= 0 && !!this.$route.params.projectId) {
|
||||
this.testCaseProjectPath = path;
|
||||
//不激活项目菜单栏
|
||||
this.isProjectActivation = false;
|
||||
this.reload();
|
||||
} else {
|
||||
this.isProjectActivation = true;
|
||||
}
|
||||
if (path.indexOf("/track/plan/view") >= 0) {
|
||||
this.testPlanViewPath = path;
|
||||
this.reload();
|
||||
}
|
||||
if (path.indexOf("/track/case/edit") >= 0) {
|
||||
this.testCaseEditPath = path;
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-divider--horizontal {
|
||||
margin: 0;
|
||||
}
|
||||
.el-divider--horizontal {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#menu-bar {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
background-color: #FFF;
|
||||
}
|
||||
#menu-bar {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.blank_item {
|
||||
display: none;
|
||||
}
|
||||
.blank_item {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.el-divider--horizontal {
|
||||
margin: 0;
|
||||
}
|
||||
.el-divider--horizontal {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.deactivation >>> .el-submenu__title {
|
||||
border-bottom: white !important;
|
||||
}
|
||||
.deactivation >>> .el-submenu__title {
|
||||
border-bottom: white !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -38,13 +38,15 @@
|
|||
</span>
|
||||
<el-dropdown-menu slot="dropdown" chang>
|
||||
<el-dropdown-item :disabled="!isTestManagerOrTestUser" :command="{id: scope.row.id, status: 'Prepare'}">
|
||||
{{$t('test_track.plan.plan_status_prepare')}}
|
||||
{{ $t('test_track.plan.plan_status_prepare') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :disabled="!isTestManagerOrTestUser" :command="{id: scope.row.id, status: 'Underway'}">
|
||||
{{$t('test_track.plan.plan_status_running')}}
|
||||
<el-dropdown-item :disabled="!isTestManagerOrTestUser"
|
||||
:command="{id: scope.row.id, status: 'Underway'}">
|
||||
{{ $t('test_track.plan.plan_status_running') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :disabled="!isTestManagerOrTestUser" :command="{id: scope.row.id, status: 'Completed'}">
|
||||
{{$t('test_track.plan.plan_status_completed')}}
|
||||
<el-dropdown-item :disabled="!isTestManagerOrTestUser"
|
||||
:command="{id: scope.row.id, status: 'Completed'}">
|
||||
{{ $t('test_track.plan.plan_status_completed') }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
@ -87,10 +89,15 @@
|
|||
<el-table-column
|
||||
:label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)">
|
||||
<ms-table-operator :is-tester-permission="true" @editClick="handleEdit(scope.row)"
|
||||
@deleteClick="handleDelete(scope.row)">
|
||||
<template v-slot:middle>
|
||||
<ms-table-operator-button type="success" v-if="!scope.row.reportId" :tip="$t('test_track.plan_view.create_report')" icon="el-icon-document" @exec="openTestReportTemplate(scope.row)"/>
|
||||
<ms-table-operator-button type="success" v-if="scope.row.reportId" :tip="$t('test_track.plan_view.view_report')" icon="el-icon-document" @exec="openReport(scope.row.id, scope.row.reportId)"/>
|
||||
<ms-table-operator-button type="success" v-if="!scope.row.reportId"
|
||||
:tip="$t('test_track.plan_view.create_report')" icon="el-icon-document"
|
||||
@exec="openTestReportTemplate(scope.row)"/>
|
||||
<ms-table-operator-button type="success" v-if="scope.row.reportId"
|
||||
:tip="$t('test_track.plan_view.view_report')" icon="el-icon-document"
|
||||
@exec="openReport(scope.row.id, scope.row.reportId)"/>
|
||||
</template>
|
||||
</ms-table-operator>
|
||||
</template>
|
||||
|
@ -108,143 +115,147 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsCreateBox from '../../../settings/CreateBox';
|
||||
import MsTablePagination from '../../../../components/common/pagination/TablePagination';
|
||||
import MsTableHeader from "../../../common/components/MsTableHeader";
|
||||
import MsDialogFooter from "../../../common/components/MsDialogFooter";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
|
||||
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
|
||||
import {_filter, _sort, checkoutTestManagerOrTestUser} from "../../../../../common/js/utils";
|
||||
import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
|
||||
import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
|
||||
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
|
||||
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
|
||||
import MsCreateBox from '../../../settings/CreateBox';
|
||||
import MsTablePagination from '../../../../components/common/pagination/TablePagination';
|
||||
import MsTableHeader from "../../../common/components/MsTableHeader";
|
||||
import MsDialogFooter from "../../../common/components/MsDialogFooter";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
|
||||
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
|
||||
import {_filter, _sort, checkoutTestManagerOrTestUser} from "../../../../../common/js/utils";
|
||||
import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
|
||||
import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
|
||||
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
|
||||
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
|
||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||
|
||||
export default {
|
||||
name: "TestPlanList",
|
||||
components: {
|
||||
MsDeleteConfirm,
|
||||
TestCaseReportView,
|
||||
TestReportTemplateList,
|
||||
PlanStageTableItem,
|
||||
PlanStatusTableItem,
|
||||
MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
queryPath: "/test/plan/list",
|
||||
deletePath: "/test/plan/delete",
|
||||
condition: {
|
||||
components: TEST_PLAN_CONFIGS
|
||||
},
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
isTestManagerOrTestUser: false,
|
||||
total: 0,
|
||||
tableData: [],
|
||||
statusFilters: [
|
||||
{text: this.$t('test_track.plan.plan_status_prepare'), value: 'Prepare'},
|
||||
{text: this.$t('test_track.plan.plan_status_running'), value: 'Underway'},
|
||||
{text: this.$t('test_track.plan.plan_status_completed'), value: 'Completed'}
|
||||
],
|
||||
stageFilters: [
|
||||
{text: this.$t('test_track.plan.smoke_test'), value: 'smoke'},
|
||||
{text: this.$t('test_track.plan.system_test'), value: 'system'},
|
||||
{text: this.$t('test_track.plan.regression_test'), value: 'regression'},
|
||||
],
|
||||
}
|
||||
export default {
|
||||
name: "TestPlanList",
|
||||
components: {
|
||||
MsDeleteConfirm,
|
||||
TestCaseReportView,
|
||||
TestReportTemplateList,
|
||||
PlanStageTableItem,
|
||||
PlanStatusTableItem,
|
||||
MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
queryPath: "/test/plan/list",
|
||||
deletePath: "/test/plan/delete",
|
||||
condition: {
|
||||
components: TEST_PLAN_CONFIGS
|
||||
},
|
||||
watch: {
|
||||
'$route'(to, from) {
|
||||
if (to.path.indexOf("/track/plan/all") >= 0){
|
||||
this.initTableData();
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
isTestManagerOrTestUser: false,
|
||||
total: 0,
|
||||
tableData: [],
|
||||
statusFilters: [
|
||||
{text: this.$t('test_track.plan.plan_status_prepare'), value: 'Prepare'},
|
||||
{text: this.$t('test_track.plan.plan_status_running'), value: 'Underway'},
|
||||
{text: this.$t('test_track.plan.plan_status_completed'), value: 'Completed'}
|
||||
],
|
||||
stageFilters: [
|
||||
{text: this.$t('test_track.plan.smoke_test'), value: 'smoke'},
|
||||
{text: this.$t('test_track.plan.system_test'), value: 'system'},
|
||||
{text: this.$t('test_track.plan.regression_test'), value: 'regression'},
|
||||
],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route'(to, from) {
|
||||
if (to.path.indexOf("/track/plan/all") >= 0) {
|
||||
this.initTableData();
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.planId) {
|
||||
// param.planId = this.planId;
|
||||
this.condition.planId = this.planId;
|
||||
}
|
||||
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||
// param.nodeIds = this.selectNodeIds;
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
}
|
||||
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
});
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testPlanCreate() {
|
||||
this.$emit('openTestPlanEditDialog');
|
||||
},
|
||||
handleEdit(testPlan) {
|
||||
this.$emit('testPlanEdit', testPlan);
|
||||
},
|
||||
statusChange(param) {
|
||||
this.$post('/test/plan/edit' , param, () => {
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
if (this.tableData[i].id == param.id) {
|
||||
this.tableData[i].status = param.status;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDelete(testPlan) {
|
||||
this.$refs.deleteConfirm.open(testPlan);
|
||||
},
|
||||
_handleDelete(testPlan) {
|
||||
let testPlanId = testPlan.id;
|
||||
this.$post('/test/plan/delete/' + testPlanId, {}, () => {
|
||||
this.initTableData();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
},
|
||||
intoPlan(row, event, column) {
|
||||
this.$router.push('/track/plan/view/' + row.id);
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
openTestReportTemplate(data) {
|
||||
this.$refs.testReportTemplateList.open(data.id);
|
||||
},
|
||||
openReport(planId, reportId) {
|
||||
if (reportId) {
|
||||
this.$refs.testCaseReportView.open(planId, reportId);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.projectId = this.$route.params.projectId;
|
||||
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
|
||||
this.initTableData();
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
if (this.planId) {
|
||||
// param.planId = this.planId;
|
||||
this.condition.planId = this.planId;
|
||||
}
|
||||
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
|
||||
// param.nodeIds = this.selectNodeIds;
|
||||
this.condition.nodeIds = this.selectNodeIds;
|
||||
}
|
||||
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
||||
let data = response.data;
|
||||
this.total = data.itemCount;
|
||||
this.tableData = data.listObject;
|
||||
});
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testPlanCreate() {
|
||||
this.$emit('openTestPlanEditDialog');
|
||||
},
|
||||
handleEdit(testPlan) {
|
||||
this.$emit('testPlanEdit', testPlan);
|
||||
},
|
||||
statusChange(param) {
|
||||
this.$post('/test/plan/edit', param, () => {
|
||||
for (let i = 0; i < this.tableData.length; i++) {
|
||||
if (this.tableData[i].id == param.id) {
|
||||
this.tableData[i].status = param.status;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDelete(testPlan) {
|
||||
this.$refs.deleteConfirm.open(testPlan);
|
||||
},
|
||||
_handleDelete(testPlan) {
|
||||
let testPlanId = testPlan.id;
|
||||
this.$post('/test/plan/delete/' + testPlanId, {}, () => {
|
||||
this.initTableData();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
// 发送广播,刷新 head 上的最新列表
|
||||
TrackEvent.$emit(LIST_CHANGE);
|
||||
});
|
||||
},
|
||||
intoPlan(row, event, column) {
|
||||
this.$router.push('/track/plan/view/' + row.id);
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
sort(column) {
|
||||
_sort(column, this.condition);
|
||||
this.initTableData();
|
||||
},
|
||||
openTestReportTemplate(data) {
|
||||
this.$refs.testReportTemplateList.open(data.id);
|
||||
},
|
||||
openReport(planId, reportId) {
|
||||
if (reportId) {
|
||||
this.$refs.testCaseReportView.open(planId, reportId);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.table-page {
|
||||
padding-top: 20px;
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
.table-page {
|
||||
padding-top: 20px;
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
cursor:pointer;
|
||||
}
|
||||
.el-table {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -213,6 +213,8 @@ export default {
|
|||
owning_workspace: 'Owning Workspace',
|
||||
please_choose_workspace: 'Please select Workspace',
|
||||
special_characters_are_not_supported: 'Incorrect format (special characters are not supported and cannot end with \'-\')',
|
||||
tapd_id: 'TAPD Project ID',
|
||||
jira_key: 'JIRA Project key',
|
||||
},
|
||||
member: {
|
||||
create: 'Create',
|
||||
|
|
|
@ -213,6 +213,8 @@ export default {
|
|||
owning_workspace: '所属工作空间',
|
||||
please_choose_workspace: '请选择工作空间',
|
||||
special_characters_are_not_supported: '格式错误(不支持特殊字符,且不能以\'-\'开头结尾)',
|
||||
tapd_id: 'TAPD项目ID',
|
||||
jira_key: 'JIRA项目key',
|
||||
},
|
||||
member: {
|
||||
create: '添加成员',
|
||||
|
|
|
@ -211,6 +211,8 @@ export default {
|
|||
owning_workspace: '所屬工作空間',
|
||||
please_choose_workspace: '請選擇工作空間',
|
||||
special_characters_are_not_supported: '格式錯誤(不支持特殊字符,且不能以\'-\'開頭結尾)',
|
||||
tapd_id: 'TAPD項目ID',
|
||||
jira_key: 'JIRA項目key',
|
||||
},
|
||||
member: {
|
||||
create: '添加成員',
|
||||
|
|
Loading…
Reference in New Issue