ystl_myq 6 mesi fa
parent
commit
507023caad

+ 14 - 8
src/components/echarts/bar.vue

@@ -64,19 +64,25 @@ const init = async (item?: any, type?: any, itemDim?: any) => {
     dimId: itemDim?.id,
     type
   });
+  let aa = [];
+  let bb = [];
   if (code === 200) {
     // dataListInit = data.sort((a, b) => a.ranking - b.ranking);
     if (data.length > 0) {
       data.map((it, id) => {
-        if (id < 10) {
-          if (dataList.data.length < 10) {
-            dataList.title.push(it.assessmentObjectName);
-            dataList.data.push(it.totalScore);
-          }
-        }
+        // if (id < 10) {
+        // if (dataList.data.length < 10) {
+        dataList.title.push(it.assessmentObjectName);
+        dataList.data.push(it.totalScore);
+        aa.push(it.assessmentObjectName);
+        bb.push(it.totalScore);
       });
     }
   }
+  if (aa.length > 10 || bb.length > 10) {
+    aa.splice(10); // 从索引 10 开始删除所有元素
+    bb.splice(10); // 从索引 10 开始删除所有元素
+  }
   setOptions({
     title: {
       text: `${props.title}Top10`
@@ -96,7 +102,7 @@ const init = async (item?: any, type?: any, itemDim?: any) => {
     xAxis: [
       {
         type: "category",
-        data: dataList.title,
+        data: aa,
         axisTick: {
           alignWithLabel: true
         },
@@ -121,7 +127,7 @@ const init = async (item?: any, type?: any, itemDim?: any) => {
         type: "bar",
         // barWidth: "30%",
         barWidth: props.title == "总得分" ? "30%" : "40%",
-        data: dataList.data
+        data: bb
       }
     ]
   });

+ 16 - 8
src/components/echarts/barDim.vue

@@ -96,14 +96,22 @@ const init = async (item?: any, type?: number, dimList?: any) => {
     dataFullBig = data;
   }
   if (dataFullBig) {
+    let aa = [];
+    let bb = [];
     dataFullBig.map((it, id) => {
-      if (id < 10) {
-        if (dataList.data.length < 10) {
-          dataList.title.push(it.assessmentObjectName);
-          dataList.data.push(it.totalScore);
-        }
-      }
+      // if (id < 10) {
+      // if (dataList.data.length < 10) {
+      // }
+      // }
+      dataList.title.push(it.assessmentObjectName);
+      dataList.data.push(it.totalScore);
+      aa.push(it.assessmentObjectName);
+      bb.push(it.totalScore);
     });
+    if (aa.length > 10 || bb.length > 10) {
+      aa.splice(10); // 从索引 10 开始删除所有元素
+      bb.splice(10); // 从索引 10 开始删除所有元素
+    }
     setOptions({
       title: {
         text: `${props.title}Top10`
@@ -123,7 +131,7 @@ const init = async (item?: any, type?: number, dimList?: any) => {
       xAxis: [
         {
           type: "category",
-          data: dataList.title,
+          data: aa,
           axisTick: {
             alignWithLabel: true
           },
@@ -147,7 +155,7 @@ const init = async (item?: any, type?: number, dimList?: any) => {
           name: "得分",
           type: "bar",
           barWidth: props.title == "总得分" ? "30%" : "40%",
-          data: dataList.data
+          data: bb
         }
       ]
     });

+ 3 - 1
src/components/rankTable/draw.vue

@@ -226,6 +226,7 @@ const tableConfig = reactive({});
 const rawData = ref([]);
 const init = (item, deptNames, names) => {
   rawData.value = item;
+  console.log("item", item);
   deptName.value = deptNames;
   name.value = names;
   if ($route.name != "workerDrak") {
@@ -278,6 +279,7 @@ const createColumns = () => {
     item.dimensionList.forEach(dim => {
       if (!headerMap.has(dim.dimName)) {
         // 存储维度相关信息,包括 totalSore
+        console.log("dim", dim);
         headerMap.set(dim.dimName, {
           totalSore: dim.totalSore,
           quotas: [] // 用于存储 quota 列表
@@ -286,6 +288,7 @@ const createColumns = () => {
       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 });
         }
       });
@@ -331,7 +334,6 @@ const loadData = () => {
 
     item.dimensionList.forEach(dim => {
       let totalScore = 0;
-
       // 填充指标得分
       dim.quotaList.forEach(quota => {
         const fieldName = `${dim.dimName}_${quota.quotaName}`;