项目报表修改
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-12-30 10:24:50 +08:00
parent 264f00f5a8
commit 040814c3d6
1 changed files with 50 additions and 19 deletions

View File

@ -33,7 +33,7 @@
import BaseContainer from '@/components/BaseContainer' import BaseContainer from '@/components/BaseContainer'
let echarts = require('echarts/lib/echarts'); let echarts = require('echarts/lib/echarts');
// require('echarts/lib/chart/line'); require('echarts/lib/component/markLine');
require('echarts/lib/chart/funnel'); require('echarts/lib/chart/funnel');
require('echarts/lib/chart/bar'); require('echarts/lib/chart/bar');
// //
@ -158,7 +158,8 @@ export default {
} }
}, },
legend: { legend: {
data: obj.legendData data: obj.legendData,
bottom: 0
}, },
series: [ series: [
{ {
@ -262,7 +263,9 @@ export default {
type: 'shadow' type: 'shadow'
} }
}, },
legend: {}, legend: {
bottom: 0
},
xAxis: [ xAxis: [
{ {
type: 'category', type: 'category',
@ -306,16 +309,17 @@ export default {
let obj2 = { let obj2 = {
xAxisData: [], xAxisData: [],
seriesData: [], seriesData: [],
medianValue: 0,
unit: this.$t("trials:reportForms:cjart:unit:DaysDiff"), unit: this.$t("trials:reportForms:cjart:unit:DaysDiff"),
titleText: this.$t("trials:reportForms:cjart:title:dataDistribution"), titleText: this.$t("trials:reportForms:cjart:title:dataDistribution"),
} }
if (OtherInfo.PDList && OtherInfo.PDList.length > 0) { if (OtherInfo.PDList && OtherInfo.PDList.length > 0) {
OtherInfo.PDList.forEach(item => { OtherInfo.PDList.forEach(item => {
obj.xAxisData.push(item.SubjectCode) obj2.xAxisData.push(item.SubjectCode)
obj.seriesData.push(item.DaysDiff) obj2.seriesData.push(item.DaysDiff)
}) })
} }
obj2.medianValue = this.calculateMedian(obj2.seriesData)
this.initChart_bottom(obj) this.initChart_bottom(obj)
this.initChart_bottom_right(obj2) this.initChart_bottom_right(obj2)
} }
@ -373,29 +377,56 @@ export default {
xAxis: { xAxis: {
type: 'category', type: 'category',
data: obj.xAxisData data: obj.xAxisData
// data: ['aaa', 'bbb', 'ccc']
}, },
yAxis: { yAxis: {
name: obj.unit, name: obj.unit,
type: 'value' type: 'value'
}, },
series: [ series: {
{ markLine: {
markLine: { // symbol: ['none', 'none'], // 线
data: [ label: {
{ show: true,
type: 'average', name: this.$t("trials:reportForms:cjart:data:average") position: 'end', // 线
} formatter: `${this.$t('trials:reportForms:cjart:data:median')}: {c}` // 使 {c} yAxis
]
}, },
data: obj.seriesData, data: [
type: 'bar', {
barWidth: 20, name: this.$t('trials:reportForms:cjart:data:median'),
} // yAxis
] yAxis: obj.medianValue,
lineStyle: {
type: 'dashed', // 线
color: this.color[7]
}
}
]
},
data: obj.seriesData,
// data: [1, 2, 3],
type: 'bar',
barWidth: 20,
}
}; };
// 4. 使 // 4. 使
this.chart_bottom_right.setOption(option); this.chart_bottom_right.setOption(option);
}, },
calculateMedian(numbers) {
// 1.
const sorted = [...numbers].sort((a, b) => a - b);
const middle = Math.floor(sorted.length / 2);
// 2.
if (sorted.length % 2 === 0) {
//
return (sorted[middle - 1] + sorted[middle]) / 2;
} else {
//
return sorted[middle];
}
}
} }
} }
</script> </script>