draw.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <el-table :data="tableData" style="width: 100%">
  3. <el-table-column type="index" label="排名" width="80" fixed>
  4. <template #default="scope">
  5. <div v-if="scope.$index > 2" class="diamond">
  6. {{ scope.row.ranking }}
  7. </div>
  8. <div v-else class="text-center">
  9. <img :src="RANK_IMG[scope.row.ranking - 1]" alt="" />
  10. </div>
  11. </template>
  12. </el-table-column>
  13. <el-table-column prop="deptName" :label="deptName" fixed width="150" />
  14. <el-table-column
  15. v-if="name"
  16. prop="assessmentObjectName"
  17. :label="name"
  18. fixed
  19. width="100"
  20. />
  21. <div v-for="(item, index) in tableData.dimensionList" :key="index">
  22. <el-table-column :label="`${item.dimName}(${item.soreRate}%)`">
  23. <el-table-column
  24. v-for="(it, id) in item.quotaList"
  25. :key="id"
  26. :prop="it.quotaScore"
  27. :label="`${it.quotaName}(${it.quotaWeight}%)`"
  28. width="140"
  29. />
  30. </el-table-column>
  31. <el-table-column :prop="item.totalSore" label="总分`" />
  32. </div>
  33. <el-table-column prop="allScore" label="总得分" fixed width="150" />
  34. </el-table>
  35. </template>
  36. <script lang="ts" setup>
  37. import { computed, reactive, ref } from "vue";
  38. import rank1 from "@/assets/rank/rank1.png";
  39. import rank2 from "@/assets/rank/rank2.png";
  40. import rank3 from "@/assets/rank/rank3.png";
  41. const RANK_IMG = [rank1, rank2, rank3];
  42. const tableData = ref([]);
  43. const deptName = ref("");
  44. const name = ref("");
  45. const init = (item, deptNames, names) => {
  46. tableData.value = item;
  47. deptName.value = deptNames;
  48. name.value = names;
  49. };
  50. defineExpose({
  51. init
  52. });
  53. </script>
  54. <style lang="scss" scoped>
  55. .diamond {
  56. display: flex;
  57. align-items: center;
  58. justify-content: center;
  59. width: 25px; /* 菱形宽度 */
  60. height: 25px; /* 菱形高度 */
  61. padding-top: 1px;
  62. margin: auto;
  63. clip-path: polygon(
  64. 50% 0%,
  65. 100% 25%,
  66. 100% 75%,
  67. 50% 100%,
  68. 0% 75%,
  69. 0% 25%
  70. ); /* 定义六边形的形状 */
  71. font-size: 12px;
  72. color: white;
  73. background-color: #d3e8f0; /* 背景颜色 */
  74. }
  75. </style>