|
|
@ -11,7 +11,7 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { Navbar, Sidebar, AppMain, TagsView } from './components' |
|
|
|
// import { GET_ALL_HAVE } from '@/api/jurisdiction' |
|
|
|
import { GET_ALL_HAVE } from '@/api/jurisdiction' |
|
|
|
import ResizeMixin from './mixin/ResizeHandler' |
|
|
|
import { mapMutations } from 'vuex' |
|
|
|
|
|
|
@ -24,6 +24,11 @@ export default { |
|
|
|
TagsView |
|
|
|
}, |
|
|
|
mixins: [ResizeMixin], |
|
|
|
watch: { |
|
|
|
'$route.path'() { |
|
|
|
this.showBtn() |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
sidebar() { |
|
|
|
return this.$store.state.app.sidebar |
|
|
@ -40,17 +45,44 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.getPerList() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
...mapMutations(['SET_PER_LIST']), |
|
|
|
...mapMutations(['SET_PER_LIST','setShowBtnList']), |
|
|
|
|
|
|
|
handleClickOutside() { |
|
|
|
this.$store.dispatch('closeSideBar', { withoutAnimation: false }) |
|
|
|
}, |
|
|
|
// getPerList() { |
|
|
|
// GET_ALL_HAVE({}).then(res => { |
|
|
|
// console.log(res) |
|
|
|
// }) |
|
|
|
// } |
|
|
|
getPerList() { |
|
|
|
GET_ALL_HAVE({}).then(res => { |
|
|
|
let list = [] |
|
|
|
for(let i = 0; i < res.data.length; i++) { |
|
|
|
const item = res.data[i].split('/') |
|
|
|
list[i] = item |
|
|
|
} |
|
|
|
this.SET_PER_LIST(list) |
|
|
|
this.showBtn() |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 判断当前用户在当前界面应该展示哪些按钮 |
|
|
|
showBtn() { |
|
|
|
const perList = [...this.$store.state.user.perList]; |
|
|
|
const code = localStorage.getItem('code'); |
|
|
|
let list = { |
|
|
|
add: false, |
|
|
|
update: false, |
|
|
|
delete: false, |
|
|
|
relation: false, |
|
|
|
reset: false, |
|
|
|
} |
|
|
|
for(var i = 0; i < perList.length; i++) { |
|
|
|
if(perList[i][1] === code) { |
|
|
|
list[perList[i][2]] = true; |
|
|
|
} |
|
|
|
} |
|
|
|
this.setShowBtnList(list) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|