index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div class="flex flex-center full-width">
  3. <div class="full-width flex mt-10">
  4. <el-col :span="6" v-if="hasChildrenDept">
  5. <el-card shadow="hover" style="bottom: 0">
  6. <left :has-children="hasChildrenDept" @change="changeDept" />
  7. </el-card>
  8. </el-col>
  9. <el-col class="ml-10" :span="hasChildrenDept ? 18 : 24">
  10. <el-card shadow="hover">
  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. </el-card>
  30. <el-card shadow="hover" class="mt-10">
  31. <div class="flex query-screen">
  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. <div class="flex flex-center">
  37. <span class="font-16 bold full-width text-left"
  38. >投资数据统计 单位(亿元)</span
  39. >
  40. <el-tooltip
  41. effect="dark"
  42. content="平均值:年度责任目标/ 11 ,注:(1,2月合并)</br>投资统计:每月项目实际投资总和"
  43. placement="bottom"
  44. raw-content
  45. >
  46. </el-tooltip>
  47. </div>
  48. <div
  49. class="flex flex-center"
  50. :class="isAverage ? 'green' : 'red'"
  51. >
  52. <el-icon>
  53. <Warning />
  54. </el-icon>
  55. <span
  56. class="full-width text-right ml-5 nowrap mr-20"
  57. v-if="isAverage"
  58. >上月已完成平均投资指标</span
  59. >
  60. <span class="full-width text-right ml-5 nowrap mr-20" v-else
  61. >上月未完成平均投资指标</span
  62. >
  63. </div>
  64. </div>
  65. <div class="full-width mt-10" style="background-color: #f7fafd">
  66. <chart
  67. :dept-id="dept"
  68. :quarter="yearType.value === 0 ? '' : yearType"
  69. :year="year"
  70. />
  71. </div>
  72. <div class="mt-20 full-width flex flex-center flex-justify-start">
  73. <span class="font-16 bold text-left"
  74. >项目入库统计 单位(个)</span
  75. >
  76. <el-tooltip
  77. effect="dark"
  78. content="当月实际入库和计划入库项目数量"
  79. placement="bottom"
  80. raw-content
  81. >
  82. <el-icon size="16">
  83. <Warning />
  84. </el-icon>
  85. </el-tooltip>
  86. </div>
  87. <div class="full-width mt-10" style="background-color: #f7fafd">
  88. <chart2
  89. :dept-id="dept"
  90. :quarter="
  91. yearType.value === 0 || yearType === '0' ? '' : yearType
  92. "
  93. :year="year"
  94. />
  95. </div>
  96. </div>
  97. <div class="white-bg padding"></div>
  98. <div class="flex-child-average">
  99. <amount
  100. v-if="user.info.viewStage === 1 && dept === null"
  101. :type="yearType"
  102. :deptId="dept"
  103. :year="year"
  104. />
  105. <complete v-else :type="yearType" :deptId="dept" :year="year" />
  106. </div>
  107. </div>
  108. </el-card>
  109. </el-col>
  110. </div>
  111. </div>
  112. </template>
  113. <route>
  114. {
  115. path: '/statistics',
  116. name: '项目投资统计',
  117. }
  118. </route>
  119. <script>
  120. import BasicContainer from '@/components/basic-container/main.vue'
  121. import left from './components/left.vue'
  122. import years from '@/views/invest/components/years.vue'
  123. import amount from '@/views/invest/components/amount.vue'
  124. import chart from '@/views/invest/components/chart.vue'
  125. import chart2 from '@/views/invest/components/chart2.vue'
  126. import complete from '@/views/invest/components/complete.vue'
  127. import { useStore } from '@/store/user.js'
  128. export default {
  129. name: 'index',
  130. // eslint-disable-next-line vue/no-unused-components
  131. components: { BasicContainer, left, years, amount, chart, chart2, complete },
  132. setup() {
  133. const user = useStore()
  134. return { user }
  135. },
  136. data() {
  137. return {
  138. yearType: {
  139. value: 0
  140. },
  141. dept: null,
  142. year: '',
  143. hasChildrenDept: false,
  144. years: [
  145. {
  146. value: 2023
  147. },
  148. {
  149. value: 2022
  150. },
  151. {
  152. value: 2021
  153. },
  154. {
  155. value: 2020
  156. },
  157. {
  158. value: 2019
  159. },
  160. {
  161. value: 2018
  162. },
  163. {
  164. value: 2017
  165. }
  166. ],
  167. isAverage: false
  168. }
  169. },
  170. created() {
  171. this.year = new Date().getFullYear()
  172. this.deptDetail()
  173. this.getAvg()
  174. },
  175. methods: {
  176. deptDetail() {
  177. this.$api.system
  178. .getDeptDetail({ id: this.user.info.deptId })
  179. .then(res => {
  180. if (res.code === 200) {
  181. this.hasChildrenDept = res.data.hasChildren
  182. this.dept = res.data.id
  183. }
  184. })
  185. },
  186. changeDept(res) {
  187. if (res === null) {
  188. this.dept = null
  189. this.getAvg()
  190. return
  191. }
  192. this.dept = res.id
  193. this.getAvg()
  194. },
  195. getAvg() {
  196. this.$api.invest
  197. .belowAverage({ deptId: this.dept ? this.dept : '' })
  198. .then(res => {
  199. if (res.code === 200) {
  200. this.isAverage = res.data
  201. }
  202. })
  203. },
  204. change(index) {
  205. this.yearType = index
  206. },
  207. yearSelect(res) {
  208. this.year = res
  209. }
  210. }
  211. }
  212. </script>
  213. <style scoped>
  214. .query-screen {
  215. flex-direction: column;
  216. }
  217. </style>