bugfix 20240111

This commit is contained in:
lb
2024-01-11 16:03:33 +08:00
parent c8d392ce51
commit b16ee86def
17 changed files with 139 additions and 32 deletions

View File

@@ -70,7 +70,20 @@ const GoodRateChart = (props) => {
</Radio.Button>
</Radio.Group>
</div>
<ReactECharts key={updateKey} option={options} />
{options && <ReactECharts key={updateKey} option={options} />}
{!options && (
<p
style={{
paddingTop: "88px",
color: "#fffc",
textAlign: "center",
fontSize: "24px",
userSelect: "none",
}}
>
暂无数据
</p>
)}
</div>
);
};
@@ -79,6 +92,13 @@ export default GoodRateChart;
function getOptions(dataList, showMore, dateType) {
const list = [...dataList].sort((a, b) => a.dataTime - b.dataTime);
console.log(
"list ",
list.filter((item) => item.sum)
);
if (list.length === 0 || list.filter((item) => item.sum).length == 0)
return null;
// data: Array(7)
// .fill(1)
// .map((_, index) => {
@@ -140,7 +160,7 @@ function getOptions(dataList, showMore, dateType) {
};
const seriesTeam = [
{
name: '白班',
name: "白班",
data: list.map((item) => (item.day * 100).toFixed(2)),
type: "line",
areaStyle: {
@@ -153,7 +173,7 @@ function getOptions(dataList, showMore, dateType) {
// smooth: true,
},
{
name: '夜班',
name: "夜班",
data: list.map((item) => (item.night * 100).toFixed(2)),
type: "line",
areaStyle: {
@@ -175,7 +195,9 @@ function getOptions(dataList, showMore, dateType) {
trigger: "axis",
color: "#fff",
// formatter: "{b} {c}%",
formatter: showMore ? "{a0} {c0}%<br />{a1} {c1}%<br />{a2} {c2}%" : "{b} {c}%",
formatter: showMore
? "{a0} {c0}%<br />{a1} {c1}%<br />{a2} {c2}%"
: "{b} {c}%",
axisPointer: {
type: "shadow",
},
@@ -187,10 +209,12 @@ function getOptions(dataList, showMore, dateType) {
},
series: [
{
name: '总量',
data: list.map((item) => (item.sum * 100).toFixed(2)),
name: "总量",
data: list.map((item) =>
item.sum != null ? (item.sum * 100).toFixed(2) : "-- "
),
type: "line",
symbol: 'circle',
symbol: "circle",
symbolSize: 6,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [

View File

@@ -4,7 +4,7 @@ import { ScrollBoard } from "@jiaminghi/data-view-react";
import { useSelector } from "react-redux";
function getRate(decimal) {
return (decimal.toFixed(2) * 100).toFixed(2) + "%";
return decimal != null ? (decimal.toFixed(2) * 100).toFixed(2) + "%" : undefined;
}
const TodayTableData = (props) => {
@@ -57,14 +57,14 @@ const TodayTableData = (props) => {
};
return (
<div className={cls.todayTableData}>
{config.data.lenght != 0 && (
{config.data.length != 0 && (
<ScrollBoard
className={cls.paddingCeil}
config={config}
style={{ width: "100%", color: "#fffc" }}
/>
)}
{config.data.lenght == 0 && (
{config.data.length == 0 && (
<p
style={{
color: "#cccf",