Просмотр исходного кода

style(employee-profile): optimize chart legend display and layout

1. 注释掉员工个人能力模块的正常线图例
2. 给多个分布图表添加图例配置
3. 重构雷达图组件,新增图例说明区域并完善样式
4. 调整柱状图的轴标签旋转角度和系列名称
huoyi 1 неделя назад
Родитель
Сommit
b32914413a

+ 21 - 0
src/views/portraitManagement/components/ProfileBasicDistribution.vue

@@ -96,6 +96,13 @@ const updateGenderChart = (data) => {
96 96
       textStyle: { color: '#fff' },
97 97
       formatter: '{b}: {c} ({d}%)'
98 98
     },
99
+    legend: {
100
+      show: true,
101
+      textStyle: { color: '#fff' },
102
+      top: 0,
103
+      itemWidth: 10,
104
+      itemHeight: 10
105
+    },
99 106
     series: [{
100 107
       type: 'pie',
101 108
       radius: ['38%', '55%'],
@@ -120,6 +127,13 @@ const updateNationChart = (data) => {
120 127
       textStyle: { color: '#fff' },
121 128
       formatter: '{b}: {c} ({d}%)'
122 129
     },
130
+    legend: {
131
+      show: true,
132
+      textStyle: { color: '#fff' },
133
+      top: 0,
134
+      itemWidth: 10,
135
+      itemHeight: 10
136
+    },
123 137
     series: [{
124 138
       type: 'pie',
125 139
       radius: ['38%', '55%'],
@@ -144,6 +158,13 @@ const updatePoliticalChart = (data) => {
144 158
       textStyle: { color: '#fff' },
145 159
       formatter: '{b}: {c} ({d}%)'
146 160
     },
161
+    legend: {
162
+      show: true,
163
+      textStyle: { color: '#fff' },
164
+      top: 0,
165
+      itemWidth: 10,
166
+      itemHeight: 10
167
+    },
147 168
     series: [{
148 169
       type: 'pie',
149 170
       radius: ['38%', '55%'],

+ 22 - 1
src/views/portraitManagement/components/ProfilePositionDistribution.vue

@@ -96,6 +96,12 @@ const updateSkillChart = (data) => {
96 96
       textStyle: { color: '#fff' },
97 97
       formatter: '{b}: {c}'
98 98
     },
99
+    legend: {
100
+      show: true,
101
+      textStyle: { color: '#fff' },
102
+      top: 0,
103
+      data: ['职业资格等级']
104
+    },
99 105
     xAxis: {
100 106
       type: 'category',
101 107
       data: chartData.categories,
@@ -110,6 +116,7 @@ const updateSkillChart = (data) => {
110 116
     },
111 117
     series: [{
112 118
       type: 'bar',
119
+      name: '职业资格等级',
113 120
       data: chartData.values,
114 121
       itemStyle: {
115 122
         color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
@@ -137,10 +144,16 @@ const updateOperateChart = (data) => {
137 144
       textStyle: { color: '#fff' },
138 145
       formatter: '{b}: {c}'
139 146
     },
147
+    legend: {
148
+      show: true,
149
+      textStyle: { color: '#fff' },
150
+      top: 0,
151
+      data: ['开机年限']
152
+    },
140 153
     xAxis: {
141 154
       type: 'category',
142 155
       data: chartData.categories,
143
-      axisLabel: { color: '#a0c4ff', fontSize: 10 },
156
+      axisLabel: { color: '#a0c4ff', fontSize: 10,rotate: 30 },
144 157
       axisLine: { lineStyle: { color: 'rgba(15,70,250,0.3)' } }
145 158
     },
146 159
     yAxis: {
@@ -151,6 +164,7 @@ const updateOperateChart = (data) => {
151 164
     },
152 165
     series: [{
153 166
       type: 'bar',
167
+      name: '开机年限',
154 168
       data: chartData.values,
155 169
       itemStyle: {
156 170
         color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
@@ -177,6 +191,12 @@ const updatePostChart = (data) => {
177 191
       textStyle: { color: '#fff' },
178 192
       formatter: '{b}: {c}'
179 193
     },
194
+    legend: {
195
+      show: true,
196
+      textStyle: { color: '#fff' },
197
+      top: 0,
198
+      data: ['岗位资质']
199
+    },
180 200
     xAxis: {
181 201
       type: 'category',
182 202
       data: chartData.categories,
@@ -191,6 +211,7 @@ const updatePostChart = (data) => {
191 211
     },
192 212
     series: [{
193 213
       type: 'bar',
214
+      name: '岗位资质',
194 215
       data: chartData.values,
195 216
       itemStyle: {
196 217
         color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [

+ 68 - 4
src/views/portraitManagement/components/ProfileRadar.vue

@@ -1,17 +1,25 @@
1 1
 <template>
2 2
   <InfoCard :title="title">
3 3
     <div class="radar-section">
4
-      <div ref="radarChartRef" class="radar-chart"></div>
4
+      <div>
5
+        <div class="chart-legend">
6
+          <div class="legend-item legend-warning"><span></span>预警线(低于75分)</div>
7
+          <!-- <div class="legend-item legend-normal"><span></span>正常线(75~90分)</div> -->
8
+          <div class="legend-item legend-excellent"><span></span>优秀线(高于90分)</div>
9
+          <div class="legend-item legend-current"><span></span>当前员工分值</div>
10
+        </div>
11
+        <div ref="radarChartRef" class="radar-chart"></div>
12
+      </div>
5 13
       <div class="radar-list">
6 14
         <div class="radar-item" v-for="(item, index) in computedRadarData" :key="index">
7 15
           <span class="item-label">{{ item.name }}</span>
8 16
           <div class="progress-row">
9 17
             <div class="progress-bar">
10
-            <div class="progress-fill"
11
-              :style="{ width: ((item.finalScore || 0) / (computedMaxScore || 1) * 100) + '%', background: `linear-gradient(90deg, ${item.color}33, ${item.color})` }">
18
+              <div class="progress-fill"
19
+                :style="{ width: ((item.finalScore || 0) / (computedMaxScore || 1) * 100) + '%', background: `linear-gradient(90deg, ${item.color}33, ${item.color})` }">
12 20
                 <span class="progress-end" :style="{ background: item.color }"></span>
21
+              </div>
13 22
             </div>
14
-          </div>
15 23
             <span class="item-value">{{ item.finalScore || 0 }}</span>
16 24
           </div>
17 25
         </div>
@@ -181,6 +189,62 @@ onUnmounted(() => {
181 189
   gap: 20px;
182 190
   min-height: 400px;
183 191
 
192
+  .chart-legend {
193
+    display: flex;
194
+    justify-content: center;
195
+    align-items: center;
196
+    flex-wrap: wrap;
197
+    gap: 10px 18px;
198
+    padding-top: 8px;
199
+    color: #fff;
200
+    font-size: 14px;
201
+  }
202
+
203
+  .legend-item {
204
+    display: flex;
205
+    align-items: center;
206
+    gap: 6px;
207
+
208
+    span {
209
+      width: 24px;
210
+      height: 10px;
211
+      border: 2px solid currentColor;
212
+      border-radius: 2px;
213
+    }
214
+  }
215
+
216
+  .legend-warning {
217
+    color: #fe4322;
218
+
219
+    span {
220
+      background-color: #fe4322;
221
+    }
222
+  }
223
+
224
+  .legend-normal {
225
+    color: #fff;
226
+
227
+    span {
228
+      background-color: #fff;
229
+    }
230
+  }
231
+
232
+  .legend-excellent {
233
+    color: #8EC742;
234
+
235
+    span {
236
+      background-color: #8EC742;
237
+    }
238
+  }
239
+
240
+  .legend-current {
241
+    color: #1890ff;
242
+
243
+    span {
244
+      background-color: #1890ff;
245
+    }
246
+  }
247
+
184 248
   .radar-chart {
185 249
     flex: 1;
186 250
     min-width: 300px;

+ 1 - 1
src/views/portraitManagement/employeeProfile/index.vue

@@ -135,7 +135,7 @@
135 135
             <Card title="个人能力">
136 136
               <div class="chart-legend">
137 137
                 <div class="legend-item legend-warning"><span></span>预警线(低于75分)</div>
138
-                <div class="legend-item legend-normal"><span></span>正常线(75~90分)</div>
138
+                <!-- <div class="legend-item legend-normal"><span></span>正常线(75~90分)</div> -->
139 139
                 <div class="legend-item legend-excellent"><span></span>优秀线(高于90分)</div>
140 140
                 <div class="legend-item legend-current"><span></span>当前员工分值</div>
141 141
               </div>