Преглед изворни кода

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

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

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

@@ -96,6 +96,13 @@ const updateGenderChart = (data) => {
96
       textStyle: { color: '#fff' },
96
       textStyle: { color: '#fff' },
97
       formatter: '{b}: {c} ({d}%)'
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
     series: [{
106
     series: [{
100
       type: 'pie',
107
       type: 'pie',
101
       radius: ['38%', '55%'],
108
       radius: ['38%', '55%'],
@@ -120,6 +127,13 @@ const updateNationChart = (data) => {
120
       textStyle: { color: '#fff' },
127
       textStyle: { color: '#fff' },
121
       formatter: '{b}: {c} ({d}%)'
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
     series: [{
137
     series: [{
124
       type: 'pie',
138
       type: 'pie',
125
       radius: ['38%', '55%'],
139
       radius: ['38%', '55%'],
@@ -144,6 +158,13 @@ const updatePoliticalChart = (data) => {
144
       textStyle: { color: '#fff' },
158
       textStyle: { color: '#fff' },
145
       formatter: '{b}: {c} ({d}%)'
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
     series: [{
168
     series: [{
148
       type: 'pie',
169
       type: 'pie',
149
       radius: ['38%', '55%'],
170
       radius: ['38%', '55%'],

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

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

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

@@ -1,17 +1,25 @@
1
 <template>
1
 <template>
2
   <InfoCard :title="title">
2
   <InfoCard :title="title">
3
     <div class="radar-section">
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
       <div class="radar-list">
13
       <div class="radar-list">
6
         <div class="radar-item" v-for="(item, index) in computedRadarData" :key="index">
14
         <div class="radar-item" v-for="(item, index) in computedRadarData" :key="index">
7
           <span class="item-label">{{ item.name }}</span>
15
           <span class="item-label">{{ item.name }}</span>
8
           <div class="progress-row">
16
           <div class="progress-row">
9
             <div class="progress-bar">
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
                 <span class="progress-end" :style="{ background: item.color }"></span>
20
                 <span class="progress-end" :style="{ background: item.color }"></span>
21
+              </div>
13
             </div>
22
             </div>
14
-          </div>
15
             <span class="item-value">{{ item.finalScore || 0 }}</span>
23
             <span class="item-value">{{ item.finalScore || 0 }}</span>
16
           </div>
24
           </div>
17
         </div>
25
         </div>
@@ -181,6 +189,62 @@ onUnmounted(() => {
181
   gap: 20px;
189
   gap: 20px;
182
   min-height: 400px;
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
   .radar-chart {
248
   .radar-chart {
185
     flex: 1;
249
     flex: 1;
186
     min-width: 300px;
250
     min-width: 300px;

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

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