index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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 ? 'red' : 'blue'"
  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. @avg="avg"
  62. />
  63. </div>
  64. <span class="font-16 bold full-width text-left mt-20"
  65. >项目入库统计 单位(个)</span
  66. >
  67. <div class="full-width mt-10" style="background-color: #f7fafd">
  68. <chart2
  69. :dept-id="dept"
  70. :quarter="
  71. yearType.value === 0 || yearType === '0' ? '' : yearType
  72. "
  73. :year="year"
  74. />
  75. </div>
  76. </div>
  77. <div class="white-bg padding"></div>
  78. <div class="flex-child-average">
  79. <amount
  80. v-if="user.info.viewStage === 1 && dept === null"
  81. :type="yearType"
  82. :deptId="dept"
  83. :year="year"
  84. />
  85. <complete v-else :type="yearType" :deptId="dept" :year="year" />
  86. </div>
  87. </div>
  88. </basic-container>
  89. </el-col>
  90. </div>
  91. </div>
  92. </template>
  93. <route>
  94. {
  95. path: '/',
  96. name: '年度投资管理',
  97. }
  98. </route>
  99. <script>
  100. import BasicContainer from '@/components/basic-container/main.vue'
  101. import left from './components/left.vue'
  102. import years from '@/views/invest/components/years.vue'
  103. import amount from '@/views/invest/components/amount.vue'
  104. import chart from '@/views/invest/components/chart.vue'
  105. import chart2 from '@/views/invest/components/chart2.vue'
  106. import complete from '@/views/invest/components/complete.vue'
  107. import { useStore } from '@/store/user.js'
  108. export default {
  109. name: 'index',
  110. components: { BasicContainer, left, years, amount, chart, chart2, complete },
  111. setup() {
  112. const user = useStore()
  113. return { user }
  114. },
  115. data() {
  116. return {
  117. yearType: {
  118. value: 0
  119. },
  120. dept: null,
  121. year: '',
  122. hasChildrenDept: false,
  123. years: [
  124. {
  125. value: 2023
  126. },
  127. {
  128. value: 2022
  129. },
  130. {
  131. value: 2021
  132. },
  133. {
  134. value: 2020
  135. },
  136. {
  137. value: 2019
  138. },
  139. {
  140. value: 2018
  141. },
  142. {
  143. value: 2017
  144. }
  145. ],
  146. isAverage: true
  147. }
  148. },
  149. created() {
  150. this.year = new Date().getFullYear()
  151. this.isBelowAverage()
  152. this.deptDetail()
  153. },
  154. methods: {
  155. deptDetail() {
  156. this.$api.system
  157. .getDeptDetail({ id: this.user.info.deptId })
  158. .then(res => {
  159. if (res.code === 200) {
  160. this.hasChildrenDept = res.data.hasChildren
  161. this.dept = res.data.id
  162. }
  163. })
  164. },
  165. changeDept(res) {
  166. if (res === null) {
  167. this.dept = null
  168. return
  169. }
  170. this.dept = res.id
  171. },
  172. change(index) {
  173. this.yearType = index
  174. },
  175. yearSelect(res) {
  176. this.year = res
  177. },
  178. isBelowAverage() {
  179. this.$api.invest.belowAverage().then(res => {
  180. if (res.code === 200) {
  181. // this.isAverage = res.data
  182. }
  183. })
  184. },
  185. avg(res) {
  186. console.log(res)
  187. this.isAverage = res
  188. }
  189. }
  190. }
  191. </script>
  192. <style scoped></style>