提交 e3ce7c0d 编写于 作者: C Captain.B

fix: 修复删除测试和报告的时候没有及时刷新 recent 列表的问题

上级 0c2f7e27
......@@ -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'}
],
}
},
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',
},
watch: {
'$route': 'init',
},
methods: {
search() {
if (this.testId !== 'all') {
this.condition.testId = this.testId;
}
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();
});
}
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() {
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
},
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'}
]
}
},
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'
},
watch: {
'$route': 'init'
},
methods: {
create() {
this.$router.push('/api/test/create');
},
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)
})
handleSelectAll(selection) {
if (selection.length > 0) {
this.tableData.forEach(item => {
this.selectIds.add(item.id);
this.selectProjectNames.add(item.projectName)
});
},
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,
} 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)
})
},
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);
}
});
},
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();
},
sort(column) {
_sort(column, this.condition);
this.init();
},
filter(filters) {
_filter(filters, this.condition);
this.init();
},
});
},
init() {
this.projectId = this.$route.params.projectId;
if (this.projectId && this.projectId !== "all") {
this.$store.commit('setProjectId', this.projectId);
}
this.search();
},
created() {
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>
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;
},
router(item) {
}
},
reportRecent: {
title: this.$t('report.recent'),
url: "/performance/report/recent/5",
showTime: true,
index(item) {
return '/performance/report/view/' + 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) {
}
}
},
}
},
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();
},
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'}
],
}
},
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;
});
},
watch: {
'$route'(to) {
this.projectId = to.params.projectId;
this.initTableData();
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
})
},
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.$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);
}
});
},
_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();
},
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
},
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'}
]
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;
});
},
watch: {
'$route'(to) {
this.projectId = to.params.projectId;
this.initTableData();
}
search(combine) {
this.initTableData(combine);
},
created: function () {
this.projectId = this.$route.params.projectId;
this.initTableData();
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
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);
}
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
};
}
});
},
_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.result = this.$post(this.deletePath, data, () => {
this.$success(this.$t('commons.delete_success'));
this.initTableData();
},
link(row) {
this.$router.push({
path: '/performance/test/edit/' + row.id,
})
},
create() {
this.$router.push('/performance/test/create');
}
// 发送广播,刷新 head 上的最新列表
PerformanceEvent.$emit(LIST_CHANGE);
});
},
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');
}
}
}
</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)"/>
......@@ -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');
} else if (this.$route.path.split('/')[2] === 'project' &&
to.path.split('/')[3] === 'all') {
this.list();
}
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 = {};
},
computed: {
currentUser: () => {
return getCurrentUser();
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;
}
});
}
},
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;
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
let saveType = "add";
if (this.form.id) {
saveType = "update"
}
});
},
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.result = this.$post("/project/" + saveType, this.form, () => {
this.createVisible = false;
this.list();
Message.success(this.$t('commons.save_success'));
});
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('commons.delete_cancelled')
});
} 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);
});
},
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;
}).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
})
},
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);
}
},
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>
......@@ -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) {}
router: function (item) {
return {name: 'testCase', params: {projectId: item.id, projectName: item.name}}
}
},
caseRecent: {
title: this.$t('test_track.recent_case'),
url: "/test/case/recent/5",
index: function (item) {
return '/track/case/edit/' + item.id;
},
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) {
}
},
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() {
}
},
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;
});
},
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();
}
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();
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();
}
}
},
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;
}
}
},
created() {
this.projectId = this.$route.params.projectId;
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
});
},
handleDelete(testPlan) {
this.$refs.deleteConfirm.open(testPlan);
},
_handleDelete(testPlan) {
let testPlanId = testPlan.id;
this.$post('/test/plan/delete/' + testPlanId, {}, () => {
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);
}
},
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>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册