RequirementStatisticsRadar.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div class="part-box part-box-pad">
  3. <el-row type="flex" :gutter="20">
  4. <el-col :span="12">
  5. <div class="chart-box" style="height: 520px">
  6. <v-chart v-if="chartOption" :option="chartOption"></v-chart>
  7. </div>
  8. </el-col>
  9. <el-col :span="12">
  10. <el-table :data="dataList" border>
  11. <el-table-column label="毕业要求" min-width="200">
  12. <template slot-scope="scope">
  13. {{ scope.$index + 1 }}.{{ scope.row.name }}
  14. </template>
  15. </el-table-column>
  16. <el-table-column label="预期值" prop="expectValue"></el-table-column>
  17. <el-table-column label="实际值" prop="matrixDegree"></el-table-column>
  18. <el-table-column label="评价结果">
  19. <span
  20. slot-scope="scope"
  21. :class="
  22. scope.row.matrixDegree >= scope.row.expectValue
  23. ? 'color-success'
  24. : 'color-gray'
  25. "
  26. >
  27. {{
  28. scope.row.matrixDegree >= scope.row.expectValue
  29. ? "达成"
  30. : "未达成"
  31. }}
  32. </span>
  33. </el-table-column>
  34. <el-table-column class-name="action-column" label="操作" width="100">
  35. <template slot-scope="scope">
  36. <el-popover placement="right" trigger="hover">
  37. <el-table :data="scope.row.obeSubRequirements" border>
  38. <el-table-column
  39. label="毕业要求指标"
  40. prop="name"
  41. width="120"
  42. ></el-table-column>
  43. <el-table-column
  44. label="达成值"
  45. prop="matrixDegree"
  46. width="100"
  47. ></el-table-column>
  48. </el-table>
  49. <el-button slot="reference" class="btn-act-primary" type="text"
  50. >查看详情</el-button
  51. >
  52. </el-popover>
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. </el-col>
  57. </el-row>
  58. </div>
  59. </template>
  60. <script>
  61. import { maxNum } from "@/plugins/utils";
  62. import { requirementStatisticsRadar } from "../../api";
  63. export default {
  64. name: "requirement-statistics-radar",
  65. props: {
  66. rowData: {
  67. type: Object,
  68. default() {
  69. return {};
  70. },
  71. },
  72. },
  73. data() {
  74. return {
  75. dataList: [],
  76. chartOption: null,
  77. };
  78. },
  79. mounted() {
  80. this.getDetail();
  81. },
  82. methods: {
  83. async getDetail() {
  84. const res = await requirementStatisticsRadar({
  85. cultureProgramId: this.rowData.cultureProgramId,
  86. });
  87. this.dataList = res.obeRequirements || [];
  88. this.updateChartOption();
  89. },
  90. updateChartOption() {
  91. const vals = this.dataList
  92. .map((item) => [item.expectValue, item.matrixDegree])
  93. .flat();
  94. const maxVal = Math.min(maxNum(vals) * 1.2, 1);
  95. const option = {
  96. color: ["#3a5ae5", "#fe5d4e"],
  97. legend: {
  98. top: 0,
  99. data: ["预期值", "实际值"],
  100. itemWidth: 16,
  101. itemHeight: 4,
  102. itemGap: 22,
  103. left: "center",
  104. },
  105. radar: {
  106. shape: "circle",
  107. axisName: {
  108. color: "#1f2230",
  109. fontSize: 14,
  110. },
  111. axisLine: {
  112. lineStyle: {
  113. color: "#d3d5e0",
  114. },
  115. },
  116. indicator: this.dataList.map((item, index) => {
  117. return {
  118. name: `${index + 1}.${item.name}`,
  119. max: maxVal,
  120. };
  121. }),
  122. },
  123. series: [
  124. {
  125. type: "radar",
  126. data: [
  127. {
  128. value: this.dataList.map((item) => item.expectValue),
  129. name: "预期值",
  130. },
  131. {
  132. value: this.dataList.map((item) => item.matrixDegree),
  133. name: "实际值",
  134. },
  135. ],
  136. },
  137. ],
  138. };
  139. this.chartOption = option;
  140. },
  141. },
  142. };
  143. </script>