index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <div class="flex flex-center full-width">
  3. <div class="full-width flex mt-10">
  4. <el-col :span="4" v-if="hasChildrenDept">
  5. <basic-container>
  6. <left :has-children="hasChildrenDept" @change="changeDept" />
  7. </basic-container>
  8. </el-col>
  9. <el-col :span="hasChildrenDept ? 20 : 24">
  10. <basic-container>
  11. <div class="flex flex-align-start">
  12. <el-select
  13. v-model="year"
  14. clearable
  15. style="width: 15%"
  16. @change="yearSelect"
  17. >
  18. <el-option
  19. v-for="item in years"
  20. :key="item.value"
  21. :label="item.value"
  22. :value="item.value"
  23. />
  24. </el-select>
  25. </div>
  26. <div class="mt-20">
  27. <years :dept-id="dept" :year="year" @change="change" />
  28. </div>
  29. </basic-container>
  30. <basic-container>
  31. <div class="flex">
  32. <div
  33. class="flex-child-average full-width flex flex-col flex-justify-start"
  34. >
  35. <div class="flex flex-center flex-justify-between">
  36. <span class="font-16 bold full-width text-left"
  37. >投资数据统计 单位(亿元)</span
  38. >
  39. <div
  40. class="flex flex-center"
  41. :class="isAverage ? 'green' : 'red'"
  42. >
  43. <el-icon>
  44. <Warning />
  45. </el-icon>
  46. <span
  47. class="full-width text-right ml-5 nowrap mr-20"
  48. v-if="isAverage"
  49. >上月已完成平均投资指标</span
  50. >
  51. <span class="full-width text-right ml-5 nowrap mr-20" v-else
  52. >上月未完成平均投资指标</span
  53. >
  54. </div>
  55. </div>
  56. <div class="full-width mt-10" style="background-color: #f7fafd">
  57. <chart
  58. :dept-id="dept"
  59. :quarter="yearType.value === 0 ? '' : yearType"
  60. :year="year"
  61. />
  62. </div>
  63. <span class="font-16 bold full-width text-left mt-20"
  64. >项目入库统计 单位(个)</span
  65. >
  66. <div class="full-width mt-10" style="background-color: #f7fafd">
  67. <chart2
  68. :dept-id="dept"
  69. :quarter="
  70. yearType.value === 0 || yearType === '0' ? '' : yearType
  71. "
  72. :year="year"
  73. />
  74. </div>
  75. </div>
  76. <div class="white-bg padding"></div>
  77. <div class="flex-child-average">
  78. <amount
  79. v-if="user.info.viewStage === 1 && dept === null"
  80. :type="yearType"
  81. :deptId="dept"
  82. :year="year"
  83. />
  84. <complete v-else :type="yearType" :deptId="dept" :year="year" />
  85. </div>
  86. </div>
  87. </basic-container>
  88. </el-col>
  89. </div>
  90. </div>
  91. </template>
  92. <route>
  93. {
  94. path: '/',
  95. name: '年度投资管理',
  96. }
  97. </route>
  98. <script>
  99. import BasicContainer from '@/components/basic-container/main.vue'
  100. import left from './components/left.vue'
  101. import years from '@/views/invest/components/years.vue'
  102. import amount from '@/views/invest/components/amount.vue'
  103. import chart from '@/views/invest/components/chart.vue'
  104. import chart2 from '@/views/invest/components/chart2.vue'
  105. import complete from '@/views/invest/components/complete.vue'
  106. import { useStore } from '@/store/user.js'
  107. export default {
  108. name: 'index',
  109. components: { BasicContainer, left, years, amount, chart, chart2, complete },
  110. setup() {
  111. const user = useStore()
  112. return { user }
  113. },
  114. data() {
  115. return {
  116. yearType: {
  117. value: 0
  118. },
  119. dept: null,
  120. year: '',
  121. hasChildrenDept: false,
  122. years: [
  123. {
  124. value: 2023
  125. },
  126. {
  127. value: 2022
  128. },
  129. {
  130. value: 2021
  131. },
  132. {
  133. value: 2020
  134. },
  135. {
  136. value: 2019
  137. },
  138. {
  139. value: 2018
  140. },
  141. {
  142. value: 2017
  143. }
  144. ],
  145. isAverage: false
  146. }
  147. },
  148. created() {
  149. this.year = new Date().getFullYear()
  150. this.deptDetail()
  151. this.getAvg()
  152. },
  153. methods: {
  154. deptDetail() {
  155. this.$api.system
  156. .getDeptDetail({ id: this.user.info.deptId })
  157. .then(res => {
  158. if (res.code === 200) {
  159. this.hasChildrenDept = res.data.hasChildren
  160. this.dept = res.data.id
  161. }
  162. })
  163. },
  164. changeDept(res) {
  165. if (res === null) {
  166. this.dept = null
  167. this.getAvg()
  168. return
  169. }
  170. this.dept = res.id
  171. this.getAvg()
  172. },
  173. getAvg() {
  174. this.$api.invest
  175. .belowAverage({ deptId: this.dept ? this.dept : '' })
  176. .then(res => {
  177. if (res.code === 200) {
  178. this.isAverage = res.data
  179. }
  180. })
  181. },
  182. change(index) {
  183. this.yearType = index
  184. },
  185. yearSelect(res) {
  186. this.year = res
  187. }
  188. }
  189. }
  190. </script>
  191. <style scoped></style>