tabLeft3.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div class="left">
  3. <ul>
  4. <li :class="{active:ind===item.id}" v-for="(item, index) in tabList" :key="index" @click="skip(item.id)">
  5. <img :src="require('@/assets/inco/statistics'+item.id+'.png')" alt="" v-if="ind!==item.id">
  6. <img :src="require('@/assets/inco/statistics'+item.id+'ac.png')" alt="" v-else>
  7. {{ item.name }}
  8. </li>
  9. </ul>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. components: {},
  15. props: {
  16. ind: {
  17. type: Number,
  18. default: 0
  19. }
  20. },
  21. data () {
  22. return {
  23. tabList: [
  24. { name: '库房设置', id: 0, ip: 700 },
  25. { name: '统计报表', id: 1, ip: 999999 },
  26. { name: '藏品移库', id: 2, ip: 800 }
  27. ]
  28. }
  29. },
  30. methods: {
  31. skip (index) {
  32. this.$router.push(`/layout/statistics${index}`).catch(() => {})
  33. }
  34. },
  35. mounted () {
  36. // 获取用户权限数据
  37. let temp2 = localStorage.getItem('daliCK_limits')
  38. temp2 = JSON.parse(temp2)
  39. const tempList1 = []
  40. temp2.forEach(v => {
  41. if (v.authority) {
  42. if ((this.tabList.filter(p => p.ip === v.id))[0]) tempList1.push((this.tabList.filter(p => p.ip === v.id))[0])
  43. }
  44. })
  45. tempList1.push({ name: '统计报表', id: 1, ip: 99999 })
  46. this.tabList = tempList1
  47. }
  48. }
  49. </script>
  50. <style lang='less' scoped>
  51. .left {
  52. width: 220px;
  53. min-width: 130px;
  54. height: 868px;
  55. background-color: #fff;
  56. box-shadow: 1px 1px 10px 1px;
  57. ul {
  58. li {
  59. cursor: pointer;
  60. color: black;
  61. font-size: 16px;
  62. height: 60px;
  63. display: flex;
  64. align-items: center;
  65. img{
  66. margin: 3px 15px 0 35px;
  67. width: 20px;
  68. height: 20px;
  69. }
  70. }
  71. li:hover{
  72. background:#3E5EB3 ;
  73. }
  74. .active {
  75. background:#3E5EB3 ;
  76. color: #fff;
  77. }
  78. }
  79. }</style>