项目的点击事件

This commit is contained in:
Captain.B 2020-02-26 17:33:59 +08:00
parent a77ba70aa7
commit 1ab4b75e79
5 changed files with 27 additions and 18 deletions

View File

@ -18,6 +18,9 @@
<if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId}
</if>
<if test="request.projectId != null">
AND project.id = #{request.projectId}
</if>
</where>
<if test="request.recent">
order by load_test.update_time desc

View File

@ -18,7 +18,7 @@
<template slot="title">测试</template>
<ms-recent-test-plan/>
<el-divider/>
<el-menu-item index="/allTest">
<el-menu-item index="/allTest/all">
<font-awesome-icon :icon="['fa', 'list-ul']"/>
<span style="padding-left: 5px;">所有测试</span>
</el-menu-item>

View File

@ -1,11 +1,13 @@
<template>
<el-menu>
<el-menu router menu-trigger="click" :default-active="$route.path">
<div class="recent-text">
<i class="el-icon-time"/>
{{$t('project.recent')}}
</div>
<el-menu-item :key="recentProject.id" v-for="recentProject in recentProjects" @click="goTest(recentProject)">
{{ recentProject.name }}
<el-menu-item :key="p.id" v-for="p in recentProjects"
:index="'/allTest/' + p.id" :route="{name:'allTest', params:{projectId:p.id, projectName:p.name}}">
{{ p.name }}
</el-menu-item>
</el-menu>
</template>
@ -18,12 +20,7 @@
this.recentProjects = response.data;
});
},
methods: {
goTest(project) {
window.console.log(project);
// this.$router.push({path: '/allTest', params: {projectId: project.id, projectName: project.name}});
}
},
methods: {},
data() {
return {
recentProjects: [],

View File

@ -85,11 +85,11 @@ const router = new VueRouter({
}
},
{
path: "/allTest",
path: "/allTest/:projectId",
name: "allTest",
components: {
content: AllTestPlan
},
props: true,
},
{
path: "/project",

View File

@ -80,16 +80,13 @@
<script>
export default {
props: {
projectId: String,
projectName: String
},
data() {
return {
result: {},
queryPath: "/testplan/list",
deletePath: "/testplan/delete",
condition: "",
projectId: null,
tableData: [],
multipleSelection: [],
currentPage: 1,
@ -98,20 +95,32 @@
loading: false,
}
},
watch: {
'$route'(to, from) {
window.console.log(to, from);
this.projectId = to.params.projectId;
this.initTableData();
}
},
created: function () {
this.projectId = this.$route.params.projectId;
this.initTableData();
},
methods: {
initTableData() {
let param = {
name: this.condition
name: this.condition,
};
if (this.projectId !== 'all') {
param.projectId = this.projectId;
}
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
})
});
},
search() {
this.initTableData();