left.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div>
  3. <div class="flex flex-col flex-center full-height">
  4. <span class="font-16 grey-6 bold">年度资金管理</span>
  5. <div v-if="user.info.viewStage === 1">
  6. <base-button
  7. class="mt-20"
  8. title="全县投资情况"
  9. icon=""
  10. :type="active === -1 ? '1' : '2'"
  11. @click="viewAll"
  12. />
  13. <el-link
  14. type="primary"
  15. class="mt-20 pointer"
  16. @click="
  17. download(
  18. 'https://wutong-1302848345.cos.ap-chengdu.myqcloud.com/wtzx/0c8500447e3947cab5a1353b891db963.docx'
  19. )
  20. "
  21. >智能监测预警分析报告
  22. </el-link
  23. >
  24. </div>
  25. <div v-else style="height: 55px"></div>
  26. <div class="full-width flex flex-center mt-20">
  27. <el-tabs v-model="activeName" class="font-16" @tab-change="getOrg">
  28. <el-tab-pane label="部门" name="1"/>
  29. <el-tab-pane label="乡镇" name="2" v-if="user.info.viewStage === 1"/>
  30. </el-tabs>
  31. </div>
  32. <div class="content hide-scrollbar">
  33. <div
  34. v-for="(i, index) in deptList"
  35. class="item white bold font-16"
  36. :key="i.id"
  37. :class="active === index ? 'item-select white' : ''"
  38. @click="change(index)"
  39. >
  40. {{ i.deptName }}
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import baseButton from '@/components/base-button.vue'
  48. import {useStore} from '@/store/user.js'
  49. export default {
  50. name: 'left',
  51. components: {baseButton},
  52. setup() {
  53. const user = useStore()
  54. return {user}
  55. },
  56. props: {
  57. hasChildren: {
  58. type: Boolean,
  59. default: true
  60. }
  61. },
  62. data() {
  63. return {
  64. activeName: '1',
  65. deptList: [],
  66. active: -1
  67. }
  68. },
  69. created() {
  70. this.getOrg()
  71. },
  72. methods: {
  73. getOrg() {
  74. this.$api.common.deptList({type: this.activeName}).then(res => {
  75. if (res.code === 200) {
  76. this.deptList = res.data.map(e => {
  77. e.checked = false
  78. return e
  79. })
  80. if (this.active !== -1) {
  81. this.change(0)
  82. }
  83. // 如果不是发改局,默认选中第一条
  84. if (this.user.info.viewStage !== 1) {
  85. this.active = 0
  86. this.change(0)
  87. } else {
  88. this.active = -1
  89. this.$emit('change', null)
  90. }
  91. } else {
  92. this.$message.error(res.msg)
  93. }
  94. })
  95. },
  96. change(index) {
  97. this.active = index
  98. this.$emit('change', this.deptList[index])
  99. },
  100. viewAll() {
  101. this.active = -1
  102. this.$emit('change', null)
  103. },
  104. download(url) {
  105. window.open(
  106. url,
  107. '_blank' // <- This is what makes it open in a new window.
  108. )
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .content {
  115. height: 835px;
  116. overflow-y: scroll;
  117. }
  118. .item {
  119. padding: 10px 20px;
  120. margin-bottom: 10px;
  121. color: #abadaa;
  122. border-bottom: #abadaa solid 0.5px;
  123. }
  124. .item-select {
  125. background-color: #4390f9;
  126. border-radius: 10px;
  127. padding: 10px 20px;
  128. margin-bottom: 10px;
  129. color: white;
  130. }
  131. </style>