workerDrak.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <script setup lang="ts">
  2. defineOptions({
  3. name: "workerDrak"
  4. });
  5. import { ref, reactive } from "vue";
  6. import { useRouter } from "vue-router";
  7. import radar from "@/components/echarts/radar.vue";
  8. import barEcharts from "@/components/echarts/bar.vue";
  9. import barDimEcharts from "@/components/echarts/barDim.vue";
  10. import rankTable from "@/components/rankTable/draw.vue";
  11. import personList from "@/components/personList/index.vue";
  12. import qvanping from "@/assets/rank/qvanping@2x.png";
  13. import seachData from "./componements/seach.vue";
  14. import {
  15. getPersonDimensionChartsList,
  16. getPersonDimensionChartsRanking,
  17. getChartsList
  18. } from "@/api/draw";
  19. import type { TabsPaneContext } from "element-plus";
  20. const router = useRouter();
  21. const value = ref("");
  22. const radarRef = ref();
  23. const rankTableRef = ref();
  24. const activeName = ref("1");
  25. const barEchartsRef = ref();
  26. const barDimEchartsRef = ref();
  27. const seachParams = ref();
  28. // 排行榜
  29. const chartList = ref([]);
  30. const getChartsListApi = async () => {
  31. const { code, data } = await getChartsList({
  32. ...seachParams.value,
  33. type: 0
  34. });
  35. if (code == 200) {
  36. rankTableRef.value.init(data, "科室", "姓名");
  37. }
  38. };
  39. // 雷达图
  40. const dataList = reactive({
  41. dimName: []
  42. });
  43. const getPersonDimensionChartsListApi = async (
  44. dimensionName?: string,
  45. dimId?: number | string
  46. ) => {
  47. const { code, data } = await getPersonDimensionChartsList({
  48. ...seachParams.value,
  49. dimId,
  50. dimensionName,
  51. type: 0
  52. });
  53. if (code == 200) {
  54. if (data.length > 0) {
  55. data.dimensionList.map(item => {
  56. dataList.dimName.push({
  57. name: item.dimName,
  58. id: item.dimId
  59. });
  60. });
  61. if (dimensionName && dimId) {
  62. personListRef.value.init(data);
  63. } else {
  64. radarRef.value.initChart(data);
  65. }
  66. }
  67. }
  68. // console.log(res);
  69. };
  70. // 柱状图
  71. const getPersonDimensionChartsRankingApi = async (
  72. dimensionName?: string,
  73. dimId?: number | string
  74. ) => {
  75. const { code, data } = await getPersonDimensionChartsRanking({
  76. ...seachParams.value,
  77. dimId,
  78. dimensionName,
  79. type: 0
  80. });
  81. if (code == 200) {
  82. if (data.length > 0) {
  83. barEchartsRef.value.init(data);
  84. }
  85. }
  86. };
  87. const init = item => {
  88. seachParams.value = item;
  89. getPersonDimensionChartsListApi();
  90. getPersonDimensionChartsRankingApi();
  91. getChartsListApi();
  92. barDimEchartsRef.value.init(seachParams.value, 0);
  93. };
  94. // 维度表格
  95. const personListRef = ref();
  96. const handleClick = (tab: TabsPaneContext, event: Event) => {
  97. console.log(tab, event);
  98. if (tab.props.label == "总览") {
  99. getPersonDimensionChartsListApi();
  100. getPersonDimensionChartsRankingApi();
  101. getChartsListApi();
  102. } else {
  103. getPersonDimensionChartsListApi(tab.props.label, tab.props.name);
  104. getPersonDimensionChartsRankingApi(tab.props.label, tab.props.name);
  105. }
  106. barEchartsRef.value.init(tab.props);
  107. };
  108. const fullBig = (item: any) => {
  109. router.push({
  110. path: "/fullBig",
  111. query: { title: item, ...seachParams.value, type: 0 }
  112. });
  113. };
  114. </script>
  115. <template>
  116. <div class="w-[100%]">
  117. <div class="w-[100%]">
  118. <seachData @handClick="init" />
  119. <div v-if="dataList.dimName.length > 0">
  120. <div class="flex mr-2">
  121. <radar ref="radarRef" />
  122. </div>
  123. <el-tabs
  124. v-model="activeName"
  125. class="demo-tabs"
  126. :lazy="true"
  127. @tab-click="handleClick"
  128. >
  129. <el-tab-pane label="总览" name="1">
  130. <div class="flex mr-8">
  131. <rankTable ref="rankTableRef" />
  132. </div>
  133. <!-- 总得分 -->
  134. <div class="mt-5 pr-8 w-full h-60">
  135. <barEcharts ref="barEchartsRef" :title="'总得分'" />
  136. </div>
  137. <!-- 维度得分 -->
  138. <div
  139. v-for="(item, index) in dataList.dimName"
  140. :key="index"
  141. class="flex justify-between flex-wrap items-center"
  142. >
  143. <div class="mt-5 pr-8 w-1/2 h-60">
  144. <barDimEcharts ref="barDimEchartsRef" :title="item.name" />
  145. </div>
  146. </div>
  147. </el-tab-pane>
  148. <el-tab-pane
  149. v-for="(item, index) in dataList.dimName"
  150. :key="index"
  151. :label="item.name"
  152. :name="item.id"
  153. :lazy="true"
  154. >
  155. <div class="w-full">
  156. <div class="flex justify-between">
  157. <personList ref="personListRef" class="w-11/12" />
  158. <div
  159. class="w-[30px] h-[30px] mr-10 cursor-pointer"
  160. @click="fullBig(item.name)"
  161. >
  162. <img class="w-full h-full" :src="qvanping" alt="" />
  163. </div>
  164. </div>
  165. <div class="w-full h-60 mt-5 pr-8">
  166. <barEcharts ref="barEchartsRef" :title="item.name" />
  167. </div>
  168. </div>
  169. </el-tab-pane>
  170. </el-tabs>
  171. </div>
  172. </div>
  173. </div>
  174. </template>