项目的点击事件

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"> <if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId} AND project.workspace_id = #{request.workspaceId}
</if> </if>
<if test="request.projectId != null">
AND project.id = #{request.projectId}
</if>
</where> </where>
<if test="request.recent"> <if test="request.recent">
order by load_test.update_time desc order by load_test.update_time desc

View File

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

View File

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

View File

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

View File

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