left.vue 1.9 KB

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