WorkOutput.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <ChartsContainer title="工作产出">
  3. <div class="content-row" v-if=" type ">
  4. <div class="content-row-list">
  5. <div class="content-row-item">
  6. <div>查获排名</div>
  7. <div>{{ rank.rank || 0 }} / {{ rank.rankCount || 0 }}</div>
  8. </div>
  9. <div class="content-row-item">
  10. <div>有效查获总数</div>
  11. <div>{{ rowTableItem.effectiveSeizureCount.totalCount }}</div>
  12. </div>
  13. <div class="content-row-item">
  14. <div>移交公安总数</div>
  15. <div>{{ rowTableItem.referToPoliceCount.count }}</div>
  16. </div>
  17. <div class="content-row-item">
  18. <div>故意隐匿总数</div>
  19. <div>{{ rowTableItem.willfulConcealmentCount.count }}</div>
  20. </div>
  21. </div>
  22. </div>
  23. <div v-else ref="content" style="height: 100%;">
  24. <el-table v-auto-scroll :data="tableData" border style="width: 100%" height="100%">
  25. <el-table-column prop="deptName" label="统计维度" min-width="100" />
  26. <el-table-column prop="effectiveSeizureCount" label="有效查获总数" />
  27. <el-table-column prop="policeTotal" label="移交公安总数" min-width="100" />
  28. <el-table-column prop="concealTotal" label="故意隐匿总数" min-width="100" />
  29. </el-table>
  30. </div>
  31. </ChartsContainer>
  32. </template>
  33. <script setup>
  34. import ChartsContainer from '../ChartsContainer.vue';
  35. import { ref, watch } from 'vue';
  36. import { getSiteStatistics, getModuleMetrics, getRankInfo } from '@/api/item/items'
  37. import { useTimeOut } from '../pageItems/useTimeOut'
  38. const props = defineProps({
  39. type: {
  40. type: String,
  41. default: '', // department | team
  42. },
  43. })
  44. const tableData = ref([])
  45. const rowTableItem = ref({
  46. effectiveSeizureCount: {},
  47. referToPoliceCount: {},
  48. willfulConcealmentCount: {},
  49. })
  50. const rank = ref({})
  51. const params = inject('provideParams')
  52. // 封装API请求函数
  53. const fetchData = () => {
  54. // 站点统计请求(当没有type时)
  55. if (!props.type && params.value.deptId) {
  56. getSiteStatistics({ deptId: params.value.deptId }).then(res => {
  57. tableData.value = res.data
  58. })
  59. }
  60. // 构建API参数
  61. let apiParams = {}
  62. if (props.type === 'personal') {
  63. apiParams = { userId: params.value.deptId }
  64. } else {
  65. apiParams = { deptId: params.value.deptId }
  66. }
  67. // 模块指标请求(当有type时)
  68. if (props.type && params.value.deptId) {
  69. getModuleMetrics({ ...apiParams, userTypeStr: props.type }).then(res => {
  70. let { moduleResults } = res.data
  71. if (!moduleResults || Object.keys(moduleResults).length === 0) {
  72. moduleResults = {
  73. item: {
  74. effectiveSeizureCount: {},
  75. referToPoliceCount: {},
  76. willfulConcealmentCount: {},
  77. }
  78. }
  79. }
  80. if (props.type === 'personal') {
  81. rowTableItem.value = {
  82. effectiveSeizureCount: {
  83. totalCount: moduleResults.item.effectiveSeizureCount
  84. },
  85. referToPoliceCount: {
  86. count: moduleResults.item.referToPoliceCount
  87. },
  88. willfulConcealmentCount: {
  89. count: moduleResults.item.willfulConcealmentCount
  90. },
  91. }
  92. } else {
  93. rowTableItem.value = moduleResults.item
  94. }
  95. })
  96. // 排名信息请求
  97. getRankInfo({ ...apiParams, level: 'station' }).then(res => {
  98. rank.value = res.data || {};
  99. })
  100. }
  101. }
  102. // 监听props.type变化
  103. watch(() => props.type, () => {
  104. fetchData()
  105. })
  106. // 使用定时器调用fetchData
  107. useTimeOut(() => {
  108. fetchData()
  109. }, [ params ])
  110. </script>
  111. <style lang="scss" scoped>
  112. .content-row {
  113. display: flex;
  114. flex-direction: column;
  115. height: 100%;
  116. .content-row-title {
  117. font-size: 14px;
  118. color: #77DBF4;
  119. height: 30px;
  120. }
  121. .content-row-list {
  122. display: flex;
  123. flex: 1;
  124. row-gap: 30px;
  125. column-gap: 30px;
  126. flex-wrap: wrap;
  127. }
  128. .content-row-item {
  129. width: calc(50% - 15px);
  130. height: calc(50% - 15px);
  131. background: url('../../../../../assets/images/cardBg.png') no-repeat;
  132. background-size: 100% 100%;
  133. display: flex;
  134. flex-direction: column;
  135. justify-content: space-evenly;
  136. align-items: center;
  137. color: #fff;
  138. font-size: 16px;
  139. border-radius: 5px;
  140. padding: 0 15px;
  141. font-weight: bold;
  142. &>div:nth-child(2) {
  143. font-size: 24px;
  144. }
  145. }
  146. }
  147. </style>