提交 57d98a12 authored 作者: 黄志强's avatar 黄志强

修改跳转

上级 94bb9a4e
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<el-breadcrumb-item v-if="currentRouter === '/taskManage' || currentRouter === '/addTask' || currentRouter === '/viewTask' || currentRouter === '/departmentTask' || currentRouter === '/taskDetails'" :to="{ path: '/taskManage' }">任务管理</el-breadcrumb-item> <el-breadcrumb-item v-if="currentRouter === '/taskManage' || currentRouter === '/addTask' || currentRouter === '/viewTask' || currentRouter === '/departmentTask' || currentRouter === '/taskDetails'" :to="{ path: '/taskManage' }">任务管理</el-breadcrumb-item>
<el-breadcrumb-item v-if="currentRouter === '/addTask'" >新建任务</el-breadcrumb-item> <el-breadcrumb-item v-if="currentRouter === '/addTask'" >新建任务</el-breadcrumb-item>
<el-breadcrumb-item v-if="currentRouter === '/viewTask' || currentRouter === '/taskDetails' || currentRouter === '/unpublishedTask'" :to="{ path: '/viewTask' }">查看任务</el-breadcrumb-item> <el-breadcrumb-item v-if="isDepartment === false && (currentRouter === '/viewTask' || currentRouter === '/taskDetails' || currentRouter === '/unpublishedTask')" :to="{ path: '/viewTask' }">查看任务</el-breadcrumb-item>
<el-breadcrumb-item v-if="currentRouter === '/departmentTask'" :to="{ path: '/departmentTask' }">部门任务</el-breadcrumb-item> <el-breadcrumb-item v-if="isDepartment === true && (currentRouter === '/departmentTask' || currentRouter === '/taskDetails')" :to="{ path: '/departmentTask' }">部门任务</el-breadcrumb-item>
<el-breadcrumb-item v-if="currentRouter === '/unpublishedTask'" >未发布任务</el-breadcrumb-item> <el-breadcrumb-item v-if="currentRouter === '/unpublishedTask'" >未发布任务</el-breadcrumb-item>
<el-breadcrumb-item v-if="currentRouter === '/taskDetails'" >任务详情</el-breadcrumb-item> <el-breadcrumb-item v-if="currentRouter === '/taskDetails'" >任务详情</el-breadcrumb-item>
...@@ -44,15 +44,25 @@ ...@@ -44,15 +44,25 @@
return { return {
authority: '', authority: '',
currentRouter: '', currentRouter: '',
isDepartment: false,
}; };
}, },
//监听属性 类似于data概念 //监听属性 类似于data概念
computed: {}, computed: {
departmentValue () {
return this.$store.state.department;
}
},
//监控data中的数据变化 //监控data中的数据变化
watch: { watch: {
$route(to){ $route(to){
console.log(to.path); console.log(to.path);
this.currentRouter = to.path; this.currentRouter = to.path;
},
departmentValue: function (newVal, oldVal) {
console.log(newVal, oldVal)
this.isDepartment = newVal.department;
console.log(this.isDepartment);
} }
}, },
//方法集合 //方法集合
...@@ -67,6 +77,8 @@ ...@@ -67,6 +77,8 @@
// console.log(datas) // console.log(datas)
this.authority = datas; this.authority = datas;
this.currentRouter = this.$route.path; this.currentRouter = this.$route.path;
// this.isDepartment = this.$store.getters.getDepartment.department;
// console.log(this.isDepartment)
}, },
beforeCreate () { beforeCreate () {
}, //生命周期 - 创建之前 }, //生命周期 - 创建之前
......
...@@ -8,7 +8,8 @@ export default new Vuex.Store({ ...@@ -8,7 +8,8 @@ export default new Vuex.Store({
realData: {}, realData: {},
loginData: {}, loginData: {},
unpublishedData: {}, unpublishedData: {},
superior: {} superior: {},
department: false
}, },
getters: { getters: {
getRealData(state) { getRealData(state) {
...@@ -23,6 +24,9 @@ export default new Vuex.Store({ ...@@ -23,6 +24,9 @@ export default new Vuex.Store({
getSuperior(state) { getSuperior(state) {
return state.superior return state.superior
}, },
getDepartment(state) {
return state.getDepartment
},
}, },
mutations: { mutations: {
changeRealData(state, payload) { changeRealData(state, payload) {
...@@ -37,6 +41,9 @@ export default new Vuex.Store({ ...@@ -37,6 +41,9 @@ export default new Vuex.Store({
changeSuperior(state, payload) { changeSuperior(state, payload) {
state.superior = payload; state.superior = payload;
}, },
changeDepartment(state, payload) {
state.department = payload;
},
}, },
actions: { actions: {
changeRealData(store, payload) { changeRealData(store, payload) {
...@@ -63,6 +70,12 @@ export default new Vuex.Store({ ...@@ -63,6 +70,12 @@ export default new Vuex.Store({
superior: payload superior: payload
}) })
}, },
changeDepartment(store, payload) {
store.commit({
type: 'changeDepartment',
superior: payload
})
},
}, },
modules: { modules: {
} }
......
...@@ -31,12 +31,23 @@ ...@@ -31,12 +31,23 @@
}; };
}, },
//监听属性 类似于data概念 //监听属性 类似于data概念
computed: {}, computed: {
},
//监控data中的数据变化 //监控data中的数据变化
watch: {}, watch: {
},
//方法集合 //方法集合
methods: { methods: {
taskClick(val) { taskClick(val) {
let isDeaprtment = false;
if (val === 'viewTask') {
isDeaprtment = false;
} else {
isDeaprtment = true;
}
this.$store.commit('changeDepartment', {
department: isDeaprtment
})
this.$router.push({name: val}); this.$router.push({name: val});
} }
}, },
......
<!-- 搜索列表 --> <!-- 搜索列表 -->
<template> <template>
<div class='searchList'> <div class='searchList'>
1111111111
</div> </div>
</template> </template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论