Browse Source

fix: 修改

yanghao 1 tuần trước cách đây
mục cha
commit
e1e1742c1c
1 tập tin đã thay đổi với 9 bổ sung7 xóa
  1. 9 7
      src/views/Home/Index.vue

+ 9 - 7
src/views/Home/Index.vue

@@ -308,6 +308,10 @@ const myoption = ref<any>({
       label: {
         backgroundColor: '#6a7985'
       }
+    },
+    formatter: function (params: any) {
+      const p = params && params[0] ? params[0] : params
+      return `${p.name}: ${p.data}%`
     }
   },
 
@@ -324,7 +328,8 @@ const myoption = ref<any>({
   yAxis: {
     type: 'value',
     axisLabel: {
-      color: '#fff'
+      color: '#fff',
+      formatter: '{value}%'
     }
   },
   series: [
@@ -369,10 +374,11 @@ const initMyoption = async () => {
 
   const list = []
   res.forEach((item) => {
+    // 后端返回 rate 为小数(如 0.85),这里转换为整数百分比(如 85)以便图表显示
     if (item.department === '瑞恒兴域') {
-      list.push(item['瑞恒兴域'])
+      list.push(Math.trunc(Number(item['瑞恒兴域']) * 100))
     } else {
-      list.push(item.rate)
+      list.push(Math.trunc(Number(item.rate) * 100))
     }
   })
 
@@ -1246,10 +1252,6 @@ onBeforeUnmount(() => {
 </script>
 
 <style lang="scss" scoped>
-::v-deep .el-input__wrapper {
-  background-color: transparent;
-  border: none;
-}
 .page-container {
   background-color: #3a6fa3;
   min-height: 90vh;