|
@@ -166,6 +166,7 @@ import rank1 from "@/assets/rank/rank1.png";
|
|
|
import rank2 from "@/assets/rank/rank2.png";
|
|
|
import rank3 from "@/assets/rank/rank3.png";
|
|
|
import { useRoute } from "vue-router";
|
|
|
+import { useUserStoreHook } from "@/store/modules//user";
|
|
|
const $prop = defineProps({
|
|
|
rankTableRefList: Object
|
|
|
});
|
|
@@ -232,6 +233,11 @@ const init = (item, deptNames, names) => {
|
|
|
if ($route.name != "workerDrak") {
|
|
|
averageData(item.averageSore);
|
|
|
}
|
|
|
+ if ($route.name == "healthDrank" || $route.name == "healthRank") {
|
|
|
+ tabTitle.value = "医疗组";
|
|
|
+ } else {
|
|
|
+ tabTitle.value = "科室";
|
|
|
+ }
|
|
|
// 初始化
|
|
|
createColumns();
|
|
|
loadData();
|
|
@@ -242,54 +248,127 @@ defineExpose({
|
|
|
|
|
|
// 生成动态表头
|
|
|
// 生成动态表头
|
|
|
+const tabTitle = ref();
|
|
|
const createColumns = () => {
|
|
|
- const columns = [
|
|
|
- {
|
|
|
- title: "排名",
|
|
|
- field: "ranking",
|
|
|
- width: 70,
|
|
|
- slots: { default: "imgUrl_default" },
|
|
|
- fixed: "left" // 将此列固定在左侧
|
|
|
- },
|
|
|
- {
|
|
|
- title: "姓名",
|
|
|
- field: "assessmentObjectName",
|
|
|
- width: 100,
|
|
|
- fixed: "left" // 将此列固定在左侧
|
|
|
- },
|
|
|
- {
|
|
|
- title: "部门",
|
|
|
- field: "deptName",
|
|
|
- width: 150,
|
|
|
- fixed: "left" // 将此列固定在左侧
|
|
|
- },
|
|
|
- {
|
|
|
- title: "总得分",
|
|
|
- field: "allScore",
|
|
|
- width: 150,
|
|
|
- fixed: "right", // 将此列固定在右侧
|
|
|
- slots: { default: "dim-allScore" }
|
|
|
- }
|
|
|
- ];
|
|
|
+ let columns = [];
|
|
|
+ if ($route.name == "workerDrak") {
|
|
|
+ columns = [
|
|
|
+ {
|
|
|
+ title: "排名",
|
|
|
+ field: "ranking",
|
|
|
+ width: 70,
|
|
|
+ slots: { default: "imgUrl_default" },
|
|
|
+ fixed: "left" // 将此列固定在左侧
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "姓名",
|
|
|
+ field: "assessmentObjectName",
|
|
|
+ width: 100,
|
|
|
+ fixed: "left" // 将此列固定在左侧
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "部门",
|
|
|
+ field: "deptName",
|
|
|
+ width: 150,
|
|
|
+ fixed: "left" // 将此列固定在左侧
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "总得分",
|
|
|
+ field: "allScore",
|
|
|
+ sortable: true,
|
|
|
+ width: 150,
|
|
|
+ fixed: "right", // 将此列固定在右侧
|
|
|
+ slots: { default: "dim-allScore" }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ columns = [
|
|
|
+ {
|
|
|
+ title: "排名",
|
|
|
+ field: "ranking",
|
|
|
+ width: 70,
|
|
|
+ slots: { default: "imgUrl_default" },
|
|
|
+ fixed: "left" // 将此列固定在左侧
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: tabTitle.value,
|
|
|
+ field: "assessmentObjectName",
|
|
|
+ width: 100,
|
|
|
+ fixed: "left" // 将此列固定在左侧
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "总得分",
|
|
|
+ field: "allScore",
|
|
|
+ width: 150,
|
|
|
+ sortable: true,
|
|
|
+ fixed: "right", // 将此列固定在右侧
|
|
|
+ slots: { default: "dim-allScore" }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
const headerMap = new Map();
|
|
|
-
|
|
|
+ console.log("value", rawData.value);
|
|
|
// 遍历数据生成表头结构
|
|
|
+ // rawData.value.forEach(item => {
|
|
|
+ // item.dimensionList.forEach(dim => {
|
|
|
+ // if (!headerMap.has(dim.dimName)) {
|
|
|
+ // // 存储维度相关信息,包括 totalSore
|
|
|
+ // console.log("dim", dim);
|
|
|
+ // headerMap.set(dim.dimName, {
|
|
|
+ // totalSore: dim.totalSore,
|
|
|
+ // quotas: [] // 用于存储 quota 列表
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // dim.quotaList.forEach(quota => {
|
|
|
+ // const dimData = headerMap.get(dim.dimName);
|
|
|
+ // if (!dimData.quotas.some(q => q.quotaName === quota.quotaName)) {
|
|
|
+ // dimData.quotas.push({ quotaName: quota.quotaName });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+
|
|
|
+ // // 构建多级表头
|
|
|
+ // headerMap.forEach((dimData, dimName) => {
|
|
|
+ // const children = dimData.quotas.map(quota => ({
|
|
|
+ // title: quota.quotaName,
|
|
|
+ // width: 120,
|
|
|
+ // sortable: true,
|
|
|
+ // field: `${dimName}_${quota.quotaName}` // 确保字段唯一
|
|
|
+ // }));
|
|
|
+
|
|
|
+ // // 添加维度名称及其对应的子列
|
|
|
+ // columns.push({
|
|
|
+ // title: dimName,
|
|
|
+ // children
|
|
|
+ // });
|
|
|
+
|
|
|
+ // // 添加该维度的总分列
|
|
|
+ // columns.push({
|
|
|
+ // title: `总分`, // 可根据需要调整标题
|
|
|
+ // field: `${dimName}_totalSore`,
|
|
|
+ // width: 120,
|
|
|
+ // sortable: true
|
|
|
+ // });
|
|
|
+ // });
|
|
|
rawData.value.forEach(item => {
|
|
|
item.dimensionList.forEach(dim => {
|
|
|
if (!headerMap.has(dim.dimName)) {
|
|
|
- // 存储维度相关信息,包括 totalSore
|
|
|
- console.log("dim", dim);
|
|
|
+ // 存储维度相关信息,包括 totalSore 和 dimWeight
|
|
|
headerMap.set(dim.dimName, {
|
|
|
- totalSore: dim.totalSore,
|
|
|
+ dimWeight: dim.dimWeight || "0", // 默认值为 "-"
|
|
|
+ totalSore: dim.totalSore || "0", // 默认值为 "-"
|
|
|
quotas: [] // 用于存储 quota 列表
|
|
|
});
|
|
|
}
|
|
|
dim.quotaList.forEach(quota => {
|
|
|
const dimData = headerMap.get(dim.dimName);
|
|
|
if (!dimData.quotas.some(q => q.quotaName === quota.quotaName)) {
|
|
|
- console.log("你是那个", quota);
|
|
|
- dimData.quotas.push({ quotaName: quota.quotaName });
|
|
|
+ dimData.quotas.push({
|
|
|
+ quotaName: quota.quotaName,
|
|
|
+ quotaWeight: quota.quotaWeight || "0" // 默认值为 "-"
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
});
|
|
@@ -298,14 +377,15 @@ const createColumns = () => {
|
|
|
// 构建多级表头
|
|
|
headerMap.forEach((dimData, dimName) => {
|
|
|
const children = dimData.quotas.map(quota => ({
|
|
|
- title: quota.quotaName,
|
|
|
+ title: `${quota.quotaName} (${quota.quotaWeight}%)`, // 在 title 后拼接 quotaWeight
|
|
|
width: 120,
|
|
|
+ sortable: true,
|
|
|
field: `${dimName}_${quota.quotaName}` // 确保字段唯一
|
|
|
}));
|
|
|
|
|
|
// 添加维度名称及其对应的子列
|
|
|
columns.push({
|
|
|
- title: dimName,
|
|
|
+ title: `${dimName} (${dimData.dimWeight}%)`, // 在 title 后拼接 dimWeight
|
|
|
children
|
|
|
});
|
|
|
|
|
@@ -313,10 +393,10 @@ const createColumns = () => {
|
|
|
columns.push({
|
|
|
title: `总分`, // 可根据需要调整标题
|
|
|
field: `${dimName}_totalSore`,
|
|
|
- width: 120
|
|
|
+ width: 120,
|
|
|
+ sortable: true
|
|
|
});
|
|
|
});
|
|
|
-
|
|
|
gridOptions.columns = columns;
|
|
|
};
|
|
|
|
|
@@ -352,6 +432,7 @@ const loadData = () => {
|
|
|
setTimeout(() => {
|
|
|
gridOptions.data = tableData;
|
|
|
gridOptions.loading = false;
|
|
|
+ useUserStoreHook().tabload = false;
|
|
|
}, 500);
|
|
|
};
|
|
|
|