left.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div>
  3. <div class="flex flex-col flex-center">
  4. <span class="font-16 grey-6 bold">年度资金管理</span>
  5. <base-button v-if='user.info.viewStage === 1' class="mt-20" title="全县投资情况" icon="" :type='active === -1 ? "1" :"2" ' @click='viewAll'/>
  6. <div v-else style='height: 55px'></div>
  7. <div class='full-width flex flex-center mt-20'>
  8. <el-tabs v-model="activeName" class="font-16" @tab-change="getOrg">
  9. <el-tab-pane label="部门" name="1"/>
  10. <el-tab-pane label="乡镇" name="2"/>
  11. </el-tabs>
  12. </div>
  13. <div class='content hide-scrollbar'>
  14. <div v-for='(i,index) in deptList' class='item white bold font-16' :key='i.id'
  15. :class='active === index ? "item-select white" : "" ' @click='change(index)'>
  16. {{ i.deptName }}
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import baseButton from '@/components/base-button.vue'
  24. import { useStore } from '@/store/user.js'
  25. export default {
  26. name: 'left',
  27. components: { baseButton },
  28. setup () {
  29. const user = useStore()
  30. return { user }
  31. },
  32. data () {
  33. return {
  34. activeName: '1',
  35. deptList: [],
  36. active: -1
  37. }
  38. },
  39. created () {
  40. this.getOrg()
  41. },
  42. methods: {
  43. getOrg () {
  44. this.$api.common.deptList({ type: this.activeName }).then(res => {
  45. if (res.code === 200) {
  46. this.deptList = res.data.map(e => {
  47. e.checked = false
  48. return e
  49. })
  50. if (this.active !== -1) {
  51. this.change(0)
  52. }
  53. } else {
  54. this.$message.error(res.msg)
  55. }
  56. })
  57. },
  58. change (index) {
  59. this.active = index
  60. this.$emit('change', this.deptList[index])
  61. },
  62. viewAll () {
  63. this.active = -1
  64. this.$emit('change', null)
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang='scss' scoped>
  70. .content {
  71. height: 785px;
  72. overflow-y: scroll
  73. }
  74. .item {
  75. padding: 10px 20px;
  76. margin-bottom: 10px;
  77. color: #ABADAA;
  78. border-bottom: #ABADAA solid 0.5px;
  79. }
  80. .item-select {
  81. background-color: #4390F9;
  82. border-radius: 10px;
  83. padding: 10px 20px;
  84. margin-bottom: 10px;
  85. color: white;
  86. }
  87. </style>