homeLeader.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <div class="leftBox">
  3. <div class="topBox">
  4. <div class="card-item-common">
  5. <CardTitle title="公司动态" @moreClick="moreHandle" showMore>
  6. <template #leftTitle>
  7. <div class="news-tabs">
  8. <span
  9. v-for="item in newsTabs"
  10. :key="item.type"
  11. :class="item.type === tabIndex ? 'checked' : ''"
  12. @click="handleTabClick(item.type)"
  13. >
  14. {{ item.label }}
  15. </span>
  16. </div>
  17. </template>
  18. </CardTitle>
  19. <CompanyNews v-if="tabIndex === 0" />
  20. <CardItemSeven3 v-else :type="1" />
  21. </div>
  22. <div class="card-item-common">
  23. <CardTitle
  24. title="回款通知"
  25. @moreClick="toNewPageHandle('/oaSystem/marketCenter/returnMessage')"
  26. showMore
  27. />
  28. <CardItemSeven />
  29. </div>
  30. </div>
  31. <div class="bottomBox">
  32. <div class="card-item-common card-flex-col" style="width: 50%; margin-right: 20px">
  33. <CardTitle title="人员情况" />
  34. <PersonInfo />
  35. </div>
  36. <div class="card-item-common card-flex-col" style="width: 50%">
  37. <ProjectInfo />
  38. </div>
  39. </div>
  40. </div>
  41. <div class="rightBox">
  42. <div class="card-item-common">
  43. <CardTitle title="事项办理" />
  44. <div class="handle-events"> <HandleEvents /> </div>
  45. </div>
  46. <div class="card-item-common card-flex-col">
  47. <CardTitle title="合同信息" />
  48. <CardItemThree @init="initData" />
  49. <CardTitle title="成本情况">
  50. <template #rightTitle>
  51. <span style="font-size: 12px; color: #8b969c"> 单位:元 </span>
  52. </template>
  53. </CardTitle>
  54. <div style="flex: 1"> <MyEchart :options="options" /></div>
  55. </div>
  56. </div>
  57. </template>
  58. <script setup lang="ts">
  59. import { useRouter } from 'vue-router'
  60. import { EChartsOption } from 'echarts'
  61. import * as echarts from 'echarts'
  62. import CompanyNews from './components/CompanyNews.vue'
  63. import CardTitle from './components/CardTitle.vue'
  64. import CardItemSeven from './components/CardItemSeven.vue'
  65. import HandleEvents from './components/HandleEvents.vue'
  66. import CardItemThree from './components/CardItemThree.vue'
  67. import ProjectInfo from './components/ProjectInfo.vue'
  68. import PersonInfo from './components/PersonInfo.vue'
  69. import MyEchart from '@/components/Echart/src/Echart.vue'
  70. import CardItemSeven3 from './components/CardItemSeven3.vue'
  71. import { ref } from 'vue'
  72. const tabIndex = ref(0)
  73. const newsTabs = [
  74. {
  75. label: '公司动态',
  76. type: 0,
  77. path: 'newsLook'
  78. },
  79. {
  80. label: '通知公告',
  81. type: 1,
  82. path: '/noticeLook'
  83. }
  84. ]
  85. const handleTabClick = (type: number) => {
  86. tabIndex.value = type
  87. }
  88. const router = useRouter()
  89. const moreHandle = (index: number | null = null) => {
  90. if (index != null) {
  91. router.push({ path: newsTabs[index].path })
  92. return
  93. }
  94. router.push({ path: newsTabs[tabIndex.value].path })
  95. }
  96. const toNewPageHandle = (path: string | null = null) => {
  97. if (path != null) {
  98. router.push({ path: path })
  99. }
  100. }
  101. /**
  102. * 折线图
  103. */
  104. const chartData = ref([
  105. { value: 0, name: '差旅费用' },
  106. { value: 0, name: '报销成本' },
  107. { value: 0, name: '用款成本' }
  108. ])
  109. const xAxisData = ['差旅费用', '报销成本', '用款成本']
  110. const options = reactive<EChartsOption>({
  111. grid: {
  112. left: '10%',
  113. right: '0%',
  114. bottom: '16%',
  115. top: '10%'
  116. },
  117. xAxis: {
  118. data: xAxisData,
  119. axisLine: {
  120. show: false
  121. },
  122. axisTick: {
  123. show: false
  124. }
  125. },
  126. yAxis: {
  127. splitLine: {
  128. show: true,
  129. lineStyle: {
  130. type: 'dashed',
  131. color: '#E3E3E3'
  132. }
  133. },
  134. axisLine: {
  135. lineStyle: {
  136. color: '#666'
  137. }
  138. }
  139. },
  140. series: [
  141. {
  142. name: 'bar',
  143. type: 'bar',
  144. barWidth: 20,
  145. label: {
  146. show: true,
  147. position: 'top'
  148. },
  149. itemStyle: {
  150. normal: {
  151. barBorderRadius: 10,
  152. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  153. { offset: 0, color: '#7BB5FA' },
  154. { offset: 1, color: '#448ADC' }
  155. ])
  156. }
  157. },
  158. data: chartData.value
  159. }
  160. ]
  161. })
  162. const initData = (result) => {
  163. let isBool = false
  164. if (result.travelCost >= 10000) {
  165. isBool = true
  166. } else if (result.reimbursementCost >= 10000) {
  167. isBool = true
  168. } else if (result.paymentCost >= 10000) {
  169. isBool = true
  170. }
  171. chartData.value[0]['value'] = isBool ? (result.travelCost / 10000).toFixed(2) : result.travelCost
  172. chartData.value[1]['value'] = isBool
  173. ? (result.reimbursementCost / 10000).toFixed(2)
  174. : result.reimbursementCost
  175. chartData.value[2]['value'] = isBool
  176. ? (result.paymentCost / 10000).toFixed(2)
  177. : result.paymentCost
  178. // options['series'][0]['data'] = chartData
  179. }
  180. </script>