departmentDrank.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <script setup lang="ts">
  2. defineOptions({
  3. name: "departmentDrank"
  4. });
  5. import { ref, reactive, nextTick, watch } 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/seachOld.vue";
  14. import { getPersonDimensionChartsList, getChartsList } from "@/api/draw";
  15. import type { TabsPaneContext } from "element-plus";
  16. const router = useRouter();
  17. const activeName = ref("1");
  18. // 排行榜
  19. const rankTableRef = ref();
  20. const chartList = ref([]);
  21. const showLength = ref(0);
  22. const getChartsListApi = async () => {
  23. const { code, data } = await getChartsList({
  24. ...seachParams.value,
  25. type: 1
  26. });
  27. if (code == 200) {
  28. if (data && data.length > 0) {
  29. showLength.value = data?.length;
  30. nextTick(() => {
  31. setTimeout(() => {
  32. rankTableRef.value.init(data, "科室", "姓名");
  33. }, 500);
  34. });
  35. }
  36. }
  37. };
  38. // 柱状图
  39. const barEchartsRef = ref();
  40. const radarRef = ref();
  41. const barDimEchartsRef = ref();
  42. const dataList = reactive({
  43. dimName: []
  44. });
  45. const seachParams = ref();
  46. const getPersonDimensionChartsListApiDimList = async () => {
  47. const { code, data } = await getPersonDimensionChartsList({
  48. ...seachParams.value,
  49. type: 1
  50. });
  51. if (code == 200) {
  52. radarRefList.value = data;
  53. dataList.dimName = [];
  54. if (data && data.length > 0) {
  55. data.map(it => {
  56. if (it.dimensionList.length > 0) {
  57. it.dimensionList.map((item, index) => {
  58. dataList.dimName.push({
  59. name: item.dimName,
  60. id: item.dimId
  61. });
  62. });
  63. }
  64. });
  65. }
  66. }
  67. };
  68. const radarRefList = ref([]);
  69. const barDimEchartsList = reactive({
  70. data: null,
  71. type: null
  72. });
  73. const init = (item, type, val) => {
  74. seachParams.value = item;
  75. barDimEchartsList.data = null;
  76. barDimEchartsList.type = null;
  77. if (Number(type)) {
  78. nextTick(() => {
  79. barDimEchartsList.data = item;
  80. barDimEchartsList.type = 1;
  81. if (val) {
  82. getPersonDimensionChartsListApiDimList();
  83. } else {
  84. radarRefList.value = [];
  85. }
  86. getChartsListApi();
  87. activeName.value = "1";
  88. });
  89. } else {
  90. showLength.value = 0;
  91. return;
  92. }
  93. };
  94. // 维度表格
  95. const paramsIndex = ref({});
  96. const personListRef = ref();
  97. const radarRefList2 = ref([]);
  98. const handleClick = (tab: TabsPaneContext, event: Event) => {
  99. loading.value = true;
  100. if (tab.props.label == "总览") {
  101. getChartsListApi();
  102. } else {
  103. nextTick(() => {
  104. Object.assign(paramsIndex.value, {
  105. ...seachParams.value,
  106. dimId: tab.props.name,
  107. dimensionName: tab.props.label,
  108. type: 1
  109. });
  110. radarRefList2.value = [];
  111. setTimeout(() => {
  112. const data = [];
  113. const lists = [...radarRefList.value];
  114. lists.forEach(el => {
  115. data.push({ ...el });
  116. });
  117. data[0].dimensionList = data[0].dimensionList.filter(item => {
  118. if (item.dimId === tab.props.name) {
  119. return true;
  120. }
  121. });
  122. radarRefList2.value = data;
  123. }, 1000);
  124. });
  125. }
  126. setTimeout(() => {
  127. loading.value = false;
  128. }, 1000);
  129. };
  130. const fullBig = (item: any) => {
  131. console.log(item);
  132. router.push({
  133. path: "/fullBig",
  134. query: {
  135. ...item,
  136. ...seachParams.value,
  137. type: 1
  138. }
  139. });
  140. };
  141. const loading = ref(false);
  142. </script>
  143. <template>
  144. <div class="w-[100%]">
  145. <div class="w-[100%]">
  146. <seachData @handClick="init" />
  147. <div v-if="showLength > 0">
  148. <div class="flex mr-2">
  149. <radar ref="radarRef" :radarRefList="radarRefList" />
  150. </div>
  151. <el-tabs
  152. v-model="activeName"
  153. v-loading="loading"
  154. class="demo-tabs"
  155. :lazy="true"
  156. @tab-click="handleClick"
  157. >
  158. <el-tab-pane label="总览" name="1">
  159. <div class="flex mr-8">
  160. <rankTable ref="rankTableRef" />
  161. </div>
  162. <!-- 总得分 -->
  163. <div class="mt-5 w-full pr-8 h-60">
  164. <barEcharts
  165. ref="barEchartsRef"
  166. :title="'总得分'"
  167. :barDimEchartsList="barDimEchartsList"
  168. />
  169. </div>
  170. <!-- 维度得分 -->
  171. <div class="flex justify-between flex-wrap items-center">
  172. <div v-for="(item, index) in dataList.dimName" :key="index">
  173. <div class="mt-5 pr-8 h-60 w-[600px]">
  174. <barDimEcharts
  175. ref="barDimEchartsRef"
  176. :title="item.name"
  177. :barDimEchartsList="barDimEchartsList"
  178. :itemDim="item"
  179. />
  180. </div>
  181. </div>
  182. </div>
  183. </el-tab-pane>
  184. <el-tab-pane
  185. v-for="(item, index) in dataList.dimName"
  186. :key="index"
  187. :label="item.name"
  188. :name="item.id"
  189. :lazy="true"
  190. >
  191. <div class="w-full">
  192. <div class="flex justify-between">
  193. <personList
  194. ref="personListRef"
  195. :key="item.id + index"
  196. class="w-11/12"
  197. :paramsIndex="paramsIndex"
  198. :detailData="radarRefList2"
  199. />
  200. <div
  201. class="w-[30px] h-[30px] mr-10 cursor-pointer"
  202. @click="fullBig(item)"
  203. >
  204. <img class="w-full h-full" :src="qvanping" alt="" />
  205. </div>
  206. </div>
  207. <div class="w-full h-60 mt-5 pr-8">
  208. <barEcharts
  209. ref="barEchartsRef"
  210. :title="item.name"
  211. :barDimEchartsList="barDimEchartsList"
  212. :itemDim="item"
  213. />
  214. </div>
  215. </div>
  216. </el-tab-pane>
  217. </el-tabs>
  218. </div>
  219. </div>
  220. </div>
  221. </template>