|
|
@@ -35,7 +35,7 @@ const PanelHeader = styled.div`
|
|
|
// 主体布局
|
|
|
const MainLayout = styled.div`
|
|
|
display: flex;
|
|
|
- height: calc(100% - 2.3vw);
|
|
|
+ height: calc(100% - 1.6vw);
|
|
|
width: 100%;
|
|
|
`;
|
|
|
|
|
|
@@ -236,7 +236,9 @@ const WindowMonitorChart: React.FC = () => {
|
|
|
const chartRef = useRef<ReactECharts>(null);
|
|
|
// 柱形图圆角和字体自适应
|
|
|
const [barRadius, setBarRadius] = useState(6); // 默认6
|
|
|
- const [barFontSize, setBarFontSize] = useState(12); // 默认12
|
|
|
+ const [barFontSize, setBarFontSize] = useState(12); // 默认12(用于柱顶标签、图例等)
|
|
|
+ const [axisFontSize, setAxisFontSize] = useState(12); // 坐标轴字号
|
|
|
+ const [dotFontSize, setDotFontSize] = useState(14); // x轴状态圆点字号(与坐标轴分离)
|
|
|
|
|
|
// 动态计算圆角和字体大小
|
|
|
const calcBarRadius = () => {
|
|
|
@@ -245,9 +247,15 @@ const WindowMonitorChart: React.FC = () => {
|
|
|
const width = container.offsetWidth;
|
|
|
const radius = Math.max(2, Math.min(16, Math.floor(width * 0.006)));
|
|
|
setBarRadius(radius);
|
|
|
- // 自适应字体大小,最小10,最大18
|
|
|
+ // 自适应字体大小:柱顶/图例用(保持原范围)
|
|
|
const fontSize = Math.max(10, Math.min(18, Math.floor(width * 0.012)));
|
|
|
setBarFontSize(fontSize);
|
|
|
+ // 自适应坐标轴字体大小:略小一些
|
|
|
+ const axisSize = Math.max(10, Math.min(20, Math.floor(width * 0.013)));
|
|
|
+ setAxisFontSize(axisSize);
|
|
|
+ // 自适应圆点字号:略微调小整体尺寸
|
|
|
+ const dotSize = Math.max(axisSize + 6, Math.min(40, Math.floor(width * 0.023)));
|
|
|
+ setDotFontSize(dotSize);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -288,7 +296,7 @@ const WindowMonitorChart: React.FC = () => {
|
|
|
});
|
|
|
// 如需定时模拟更新,可加定时器
|
|
|
} else {
|
|
|
- // 正式环境下用接口数据
|
|
|
+ // 正式环境下用接口数据
|
|
|
const dateTime = getDefaultDate();
|
|
|
apiGet('/todayData/windowMonitor', { params: { dateTime } })
|
|
|
.then(res => {
|
|
|
@@ -406,7 +414,7 @@ const WindowMonitorChart: React.FC = () => {
|
|
|
axisLine: { lineStyle: { color: 'rgba(255,,255,0.3)' } },
|
|
|
axisLabel: {
|
|
|
color: '#CCE6FF',
|
|
|
- fontSize: barFontSize,
|
|
|
+ fontSize: axisFontSize,
|
|
|
align: 'center',
|
|
|
interval: 0,
|
|
|
rotate: 0,
|
|
|
@@ -426,10 +434,10 @@ const WindowMonitorChart: React.FC = () => {
|
|
|
return '{dotGray|●} ' + value;
|
|
|
},
|
|
|
rich: {
|
|
|
- dotRed: { color: '#FF3456', fontSize: Math.floor(barFontSize * 0.6), padding: [0, 5, 0, 0] },
|
|
|
- dotGreen: { color: '#44E695', fontSize: Math.floor(barFontSize * 0.6), padding: [0, 5, 0, 0] },
|
|
|
- dotBlue: { color: '#2D4F72', fontSize: Math.floor(barFontSize * 0.6), padding: [0, 5, 0, 0] },
|
|
|
- dotGray: { color: '#999999', fontSize: Math.floor(barFontSize * 0.6), padding: [0, 5, 0, 0] }
|
|
|
+ dotRed: { color: '#FF3456', fontSize: dotFontSize, padding: [0, Math.floor(dotFontSize * 0.2), 0, 0], fontFamily: 'DingTalk JinBuTi, PingFang SC, Microsoft YaHei, Arial, sans-serif' },
|
|
|
+ dotGreen: { color: '#44E695', fontSize: dotFontSize, padding: [0, Math.floor(dotFontSize * 0.2), 0, 0], fontFamily: 'DingTalk JinBuTi, PingFang SC, Microsoft YaHei, Arial, sans-serif' },
|
|
|
+ dotBlue: { color: '#2D4F72', fontSize: dotFontSize, padding: [0, Math.floor(dotFontSize * 0.2), 0, 0], fontFamily: 'DingTalk JinBuTi, PingFang SC, Microsoft YaHei, Arial, sans-serif' },
|
|
|
+ dotGray: { color: '#999999', fontSize: dotFontSize, padding: [0, Math.floor(dotFontSize * 0.2), 0, 0], fontFamily: 'DingTalk JinBuTi, PingFang SC, Microsoft YaHei, Arial, sans-serif' }
|
|
|
}
|
|
|
},
|
|
|
axisTick: { alignWithLabel: true }
|
|
|
@@ -462,7 +470,7 @@ const WindowMonitorChart: React.FC = () => {
|
|
|
splitLine: { lineStyle: { color: 'rgba(255,255,255,0.1)', type: 'dashed' } },
|
|
|
axisLabel: {
|
|
|
color: '#CCE6FF',
|
|
|
- fontSize: barFontSize
|
|
|
+ fontSize: axisFontSize
|
|
|
}
|
|
|
},
|
|
|
// series用窗口的待取人数和待发人数
|
|
|
@@ -482,6 +490,16 @@ const WindowMonitorChart: React.FC = () => {
|
|
|
},
|
|
|
borderRadius: [barRadius, barRadius, 0, 0] // 圆角自适应
|
|
|
},
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ position: 'top',
|
|
|
+ color: '#CCE6FF',
|
|
|
+ fontSize: barFontSize,
|
|
|
+ fontFamily: 'DingTalk JinBuTi',
|
|
|
+ formatter: function(params: any) {
|
|
|
+ return params.value > 0 ? params.value : '';
|
|
|
+ }
|
|
|
+ },
|
|
|
data: windowData.windowsstatusList.map(item => item.pendingPreparationCount)
|
|
|
},
|
|
|
{
|
|
|
@@ -499,6 +517,16 @@ const WindowMonitorChart: React.FC = () => {
|
|
|
},
|
|
|
borderRadius: [barRadius, barRadius, 0, 0] // 圆角自适应
|
|
|
},
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ position: 'top',
|
|
|
+ color: '#CCE6FF',
|
|
|
+ fontSize: barFontSize,
|
|
|
+ fontFamily: 'DingTalk JinBuTi',
|
|
|
+ formatter: function(params: any) {
|
|
|
+ return params.value > 0 ? params.value : '';
|
|
|
+ }
|
|
|
+ },
|
|
|
data: windowData.windowsstatusList.map(item => item.pendingDispensingCount)
|
|
|
}
|
|
|
]
|