yusm 3 tygodni temu
rodzic
commit
37f29b1ace

+ 26 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/dashboard/index.vue

@@ -987,6 +987,7 @@ export default {
       yAxisNames = ["工时(h)", "平均工时(h)"],
       visibleSize = 8,
       unit = "h",
+      deptOpenIdMap = null,
     }) {
       const zoomEnd = this.getCategoryZoom(names, visibleSize);
       const hasZoom = names.length > visibleSize;
@@ -1029,8 +1030,16 @@ export default {
         tooltip: {
           trigger: "axis",
           axisPointer: { type: "shadow" },
+          enterable: deptOpenIdMap ? this.needWxOpenData : false,
           formatter: (params) => {
-            let result = params[0].name + "<br/>";
+            const deptName = params[0].name;
+            let result = "";
+            if (deptOpenIdMap && this.needWxOpenData) {
+              const openId = deptOpenIdMap[deptName] || null;
+              result = this.deptNameHtml(deptName, openId) + "<br/>";
+            } else {
+              result = deptName + "<br/>";
+            }
             params.forEach((p) => {
               result +=
                 p.marker + p.seriesName + ": " + p.value + " " + unit + "<br/>";
@@ -1258,12 +1267,18 @@ export default {
         Number((item.avgWorkingTime || 0).toFixed(2)),
       );
 
+      const deptOpenIdMap3 = {};
+      this.deptHoursData.forEach((item) => {
+        deptOpenIdMap3[item.departmentName] = item._deptOpenId || null;
+      });
+
       const option = this.buildBarLineOption({
         names: depts,
         barSeries: [{ name: "总时长", data: totalHours, color: "#5470C6" }],
         lineSeries: [{ name: "人均工时", data: avgHours, color: "#FF7F0E" }],
         yAxisNames: ["总时长", "人均工时"],
         visibleSize: 8,
+        deptOpenIdMap: deptOpenIdMap3,
       });
       this.chart3.setOption(option);
       this.chart3.resize({ width, height: 300 });
@@ -1492,6 +1507,10 @@ export default {
       const workingTimes = this.top3OvertimeProjectDept.map((item) =>
         Number(item.workingTime || 0),
       );
+      const deptOpenIdMap6 = {};
+      this.top3OvertimeProjectDept.forEach((item) => {
+        deptOpenIdMap6[item.departmentName] = item._deptOpenId || null;
+      });
       const option = this.buildBarLineOption({
         names,
         barSeries: [
@@ -1500,6 +1519,7 @@ export default {
         lineSeries: [{ name: "总工时", data: workingTimes, color: "#FF7F0E" }],
         yAxisNames: ["加班总时长", "总工时"],
         visibleSize: 8,
+        deptOpenIdMap: deptOpenIdMap6,
       });
       this.chart6.setOption(option);
       this.chart6.resize({ width, height: 380 });
@@ -1525,6 +1545,10 @@ export default {
       const maxOvertimeHours = this.deptOvertimeSummary.map((item) =>
         Number(item.maxOvertimeHours || 0),
       );
+      const deptOpenIdMap7 = {};
+      this.deptOvertimeSummary.forEach((item) => {
+        deptOpenIdMap7[item.departmentName] = item._deptOpenId || null;
+      });
       const option = this.buildBarLineOption({
         names,
         barSeries: [
@@ -1536,6 +1560,7 @@ export default {
         ],
         yAxisNames: ["加班总时长", "平均/最大加班时长"],
         visibleSize: 8,
+        deptOpenIdMap: deptOpenIdMap7,
       });
       this.chart7.setOption(option);
       this.chart7.resize({ width, height: 380 });