装备台账
This commit is contained in:
parent
b3323de0d0
commit
752e11fa0c
|
|
@ -175,6 +175,7 @@ export default {
|
||||||
|
|
||||||
if (res4.data && res4.data.length > 0) {
|
if (res4.data && res4.data.length > 0) {
|
||||||
this.dataMap.major = res4.data.map((item) => ({
|
this.dataMap.major = res4.data.map((item) => ({
|
||||||
|
...item,
|
||||||
name: item.type,
|
name: item.type,
|
||||||
value: item.total,
|
value: item.total,
|
||||||
}))
|
}))
|
||||||
|
|
@ -184,6 +185,7 @@ export default {
|
||||||
const res5 = await getTenMajorApi(this.queryParams)
|
const res5 = await getTenMajorApi(this.queryParams)
|
||||||
if (res5.data && res5.data.length > 0) {
|
if (res5.data && res5.data.length > 0) {
|
||||||
this.dataMap.process = res5.data.map((item) => ({
|
this.dataMap.process = res5.data.map((item) => ({
|
||||||
|
...item,
|
||||||
name: item.type,
|
name: item.type,
|
||||||
value: item.total,
|
value: item.total,
|
||||||
}))
|
}))
|
||||||
|
|
@ -216,10 +218,17 @@ export default {
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
orient: 'vertical',
|
orient: 'vertical',
|
||||||
right: '5%',
|
right: '-1%',
|
||||||
top: 'center',
|
top: 'center',
|
||||||
itemWidth: 10,
|
itemWidth: 10,
|
||||||
itemHeight: 10,
|
itemHeight: 10,
|
||||||
|
itemGap: 15,
|
||||||
|
textStyle: {
|
||||||
|
// 👈 图例文字样式
|
||||||
|
fontSize: 16, // 字体大小
|
||||||
|
color: '#3F3F3F',
|
||||||
|
lineHeight: 20, // 行高(让文字更松一点)
|
||||||
|
},
|
||||||
formatter: (name) => {
|
formatter: (name) => {
|
||||||
const item = this.chartData.find((i) => i.name === name)
|
const item = this.chartData.find((i) => i.name === name)
|
||||||
const percent = item.value > 0 && this.total > 0 ? ((item.value / this.total) * 100).toFixed(2) : '0.00'
|
const percent = item.value > 0 && this.total > 0 ? ((item.value / this.total) * 100).toFixed(2) : '0.00'
|
||||||
|
|
@ -230,7 +239,7 @@ export default {
|
||||||
{
|
{
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
radius: ['60%', '80%'],
|
radius: ['60%', '80%'],
|
||||||
center: ['35%', '50%'],
|
center: ['25%', '50%'],
|
||||||
avoidLabelOverlap: false,
|
avoidLabelOverlap: false,
|
||||||
label: { show: false },
|
label: { show: false },
|
||||||
labelLine: { show: false },
|
labelLine: { show: false },
|
||||||
|
|
@ -240,7 +249,7 @@ export default {
|
||||||
graphic: [
|
graphic: [
|
||||||
{
|
{
|
||||||
type: 'group',
|
type: 'group',
|
||||||
left: '35%', // 与饼图 center[0] 保持一致
|
left: '25%', // 与饼图 center[0] 保持一致
|
||||||
top: '42%',
|
top: '42%',
|
||||||
bounding: 'raw',
|
bounding: 'raw',
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -283,7 +292,11 @@ export default {
|
||||||
renderBarChart() {
|
renderBarChart() {
|
||||||
const list = this.dataMap[this.activeTab2]
|
const list = this.dataMap[this.activeTab2]
|
||||||
const xData = list.map((i) => i.name)
|
const xData = list.map((i) => i.name)
|
||||||
const yData = list.map((i) => i.value)
|
const yData = list.map((item) => ({
|
||||||
|
value: item.value,
|
||||||
|
proType: item.proType,
|
||||||
|
}))
|
||||||
|
console.log('🚀 ~ yData:', yData)
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
|
|
@ -296,7 +309,7 @@ export default {
|
||||||
return `
|
return `
|
||||||
<div>
|
<div>
|
||||||
<div>${item.name}</div>
|
<div>${item.name}</div>
|
||||||
<div>数量:${item.value}</div>
|
<div>总数:${item.value}</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
|
|
@ -332,18 +345,22 @@ export default {
|
||||||
{
|
{
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: yData,
|
data: yData,
|
||||||
barWidth: 24,
|
barWidth: 20,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
borderRadius: [12, 12, 0, 0],
|
borderRadius: [12, 12, 0, 0],
|
||||||
color: (params) => {
|
color: (params) => {
|
||||||
const colors = [
|
const colorMap = {
|
||||||
['#5DA9FF', '#8EC5FF'],
|
1: ['#5DA9FF', '#8EC5FF'], // 专业1
|
||||||
['#4ED6C8', '#7BE7D7'],
|
2: ['#4ED6C8', '#7BE7D7'], // 专业2
|
||||||
['#FDBA4F', '#FFD78A'],
|
3: ['#FDBA4F', '#FFD78A'], // 专业3
|
||||||
]
|
}
|
||||||
|
|
||||||
|
const type = params.data.proType
|
||||||
|
const colors = colorMap[type] || ['#5DA9FF', '#8EC5FF'] // 兜底色
|
||||||
|
|
||||||
return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||||
{ offset: 0, color: colors[params.dataIndex % 3][0] },
|
{ offset: 0, color: colors[0] },
|
||||||
{ offset: 1, color: colors[params.dataIndex % 3][1] },
|
{ offset: 1, color: colors[1] },
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue