diff --git a/jsconfig.json b/jsconfig.json index ed50d55..9db10b1 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -6,5 +6,5 @@ }, "jsx": "react" }, - "include": ["src"] + "include": ["src", "types"] } diff --git a/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/HiddenDangerPanel/ExpandedPanel.js b/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/HiddenDangerPanel/ExpandedPanel.js index b98fa51..b641201 100644 --- a/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/HiddenDangerPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/HiddenDangerPanel/ExpandedPanel.js @@ -119,7 +119,6 @@ const tableRows = [ rectificationRate: "97.50%", }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#f07f7f", "#ffd54d", "#45c8b2", "#65a9e8", "#aa83d6"]; @@ -131,7 +130,7 @@ function getChartOption(type, metrics, trend) { color: chartColors, tooltip: { trigger: "item" }, title: { - text: formatValue(total), + text: total, subtext: "隐患总数", left: "28.5%", top: "46%", @@ -153,7 +152,7 @@ function getChartOption(type, metrics, trend) { formatter: (name) => { const index = metrics.findIndex(item => item.name === name); const ratio = total ? (values[index] / total * 100).toFixed(2) : "0.00"; - return `${name} ${formatValue(values[index])} · ${ratio}%`; + return `${name} ${values[index]} · ${ratio}%`; }, }, series: [{ @@ -187,7 +186,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -295,7 +294,6 @@ function HiddenDangerExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/HiddenDangerPanel/index.js b/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/HiddenDangerPanel/index.js index 404b650..4ed3cdf 100644 --- a/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/HiddenDangerPanel/index.js +++ b/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/HiddenDangerPanel/index.js @@ -34,8 +34,6 @@ const departmentRows = [ { id: 4, department: "设备管理部", total: 22410, rectified: 21760, pending: 650, rate: "97.10%" }, { id: 5, department: "综合管理部", total: 16031, rectified: 15455, pending: 576, rate: "96.40%" }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; - function HiddenChart({ type, data }) { const chartRef = useRef(null); @@ -47,7 +45,7 @@ function HiddenChart({ type, data }) { color: ["#65a9e8", "#45c8b2", "#aa83d6", "#f07f7f", "#ffd54d"], tooltip: { trigger: "item" }, title: { - text: formatValue(total), + text: total, subtext: "隐患总数", left: "17%", top: "41%", @@ -195,9 +193,10 @@ function HiddenDangerPanel({ onExpand }) { renderRow={row => ( {row.department} - {formatValue(row.total)} - {formatValue(row.rectified)} - {formatValue(row.pending)} + {row.total} + {row.rectified} + {row.pending} + {row.rate} {row.rate} )} diff --git a/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/SafetyInspectionPanel/ExpandedPanel.js b/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/SafetyInspectionPanel/ExpandedPanel.js index 7e397f0..1c78130 100644 --- a/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/SafetyInspectionPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/BranchOffice/components/LeftPanel/SafetyInspectionPanel/ExpandedPanel.js @@ -141,7 +141,6 @@ const tableRows = [ unplanned: 14, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#45c8b2", "#ffb547"]; @@ -209,7 +208,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -371,7 +370,6 @@ function SafetyInspectionExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "单位执行明细", }} diff --git a/src/pages/Container/Statistics/BranchOffice/components/MiddlePanel/EmergencyManagementPanel/ExpandedPanel.js b/src/pages/Container/Statistics/BranchOffice/components/MiddlePanel/EmergencyManagementPanel/ExpandedPanel.js index 92c59ec..838bb6c 100644 --- a/src/pages/Container/Statistics/BranchOffice/components/MiddlePanel/EmergencyManagementPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/BranchOffice/components/MiddlePanel/EmergencyManagementPanel/ExpandedPanel.js @@ -159,7 +159,6 @@ const tableRows = [ { id: 12, unit: "十公司", name: "周倩", role: "综合部部长", mobile: "187****2468", phone: "3568246" }, { id: 13, unit: "保税物流中心", name: "马超", role: "运营部部长", mobile: "188****9675", phone: "3568967" }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -200,7 +199,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -327,7 +326,6 @@ function EmergencyManagementExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "应急值班明细", }} diff --git a/src/pages/Container/Statistics/BranchOffice/components/MiddlePanel/RiskStatisticsPanel/ExpandedPanel.js b/src/pages/Container/Statistics/BranchOffice/components/MiddlePanel/RiskStatisticsPanel/ExpandedPanel.js index 45bba95..d915b67 100644 --- a/src/pages/Container/Statistics/BranchOffice/components/MiddlePanel/RiskStatisticsPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/BranchOffice/components/MiddlePanel/RiskStatisticsPanel/ExpandedPanel.js @@ -182,7 +182,6 @@ const tableRows = [ low: 665, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff1f10", "#ff7900", "#ffca09", "#4b9eff"]; @@ -194,7 +193,7 @@ function getChartOption(type, metrics, trend) { color: chartColors, tooltip: { trigger: "item", confine: true }, title: { - text: formatValue(total), + text: total, subtext: "风险总数", left: "20.5%", top: "42%", @@ -214,7 +213,7 @@ function getChartOption(type, metrics, trend) { formatter: (name) => { const index = metrics.findIndex(item => item.name === name); const ratio = total ? (values[index] / total * 100).toFixed(2) : "0.00"; - return `${name} ${formatValue(values[index])} · ${ratio}%`; + return `${name} ${values[index]} · ${ratio}%`; }, }, series: [{ @@ -248,7 +247,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -360,7 +359,6 @@ function RiskStatisticsExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: "1.2fr 0.8fr repeat(4, 0.8fr)", - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/BranchOffice/components/RightPanel/FireInspectionPanel/ExpandedPanel.js b/src/pages/Container/Statistics/BranchOffice/components/RightPanel/FireInspectionPanel/ExpandedPanel.js index 8c3dd45..29ca63b 100644 --- a/src/pages/Container/Statistics/BranchOffice/components/RightPanel/FireInspectionPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/BranchOffice/components/RightPanel/FireInspectionPanel/ExpandedPanel.js @@ -134,7 +134,6 @@ const tableRows = [ abnormal: 2, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -175,7 +174,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -283,7 +282,6 @@ function FireInspectionExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/BranchOffice/components/RightPanel/KeyWorkPanel/ExpandedPanel.js b/src/pages/Container/Statistics/BranchOffice/components/RightPanel/KeyWorkPanel/ExpandedPanel.js index 6af4461..51a4bde 100644 --- a/src/pages/Container/Statistics/BranchOffice/components/RightPanel/KeyWorkPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/BranchOffice/components/RightPanel/KeyWorkPanel/ExpandedPanel.js @@ -115,7 +115,6 @@ const tableRows = [ department: "安全环保部", }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -156,7 +155,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -272,7 +271,6 @@ function KeyWorkExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "当天重点作业列表", }} diff --git a/src/pages/Container/Statistics/BranchOffice/components/RightPanel/RelatedPartyPanel/ExpandedPanel.js b/src/pages/Container/Statistics/BranchOffice/components/RightPanel/RelatedPartyPanel/ExpandedPanel.js index 5ba4609..be2bebc 100644 --- a/src/pages/Container/Statistics/BranchOffice/components/RightPanel/RelatedPartyPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/BranchOffice/components/RightPanel/RelatedPartyPanel/ExpandedPanel.js @@ -135,7 +135,6 @@ const tableRows = [ secondPeople: 382, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -176,7 +175,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -292,7 +291,6 @@ function RelatedPartyExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/LeftPanel/FireSafetyPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/LeftPanel/FireSafetyPanel/ExpandedPanel.js index 4ee59aa..4f6847a 100644 --- a/src/pages/Container/Statistics/Supervision/components/LeftPanel/FireSafetyPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/LeftPanel/FireSafetyPanel/ExpandedPanel.js @@ -134,7 +134,6 @@ const tableRows = [ abnormal: 2, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -175,7 +174,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -283,7 +282,6 @@ function FireSafetyExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/LeftPanel/HiddenDangerPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/LeftPanel/HiddenDangerPanel/ExpandedPanel.js index 83239c5..92cf244 100644 --- a/src/pages/Container/Statistics/Supervision/components/LeftPanel/HiddenDangerPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/LeftPanel/HiddenDangerPanel/ExpandedPanel.js @@ -119,7 +119,6 @@ const tableRows = [ rectificationRate: "98.77%", }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#f07f7f", "#ffd54d", "#45c8b2", "#65a9e8", "#aa83d6"]; @@ -131,7 +130,7 @@ function getChartOption(type, metrics, trend) { color: chartColors, tooltip: { trigger: "item" }, title: { - text: formatValue(total), + text: total, subtext: "隐患总数", left: "28.5%", top: "46%", @@ -153,7 +152,7 @@ function getChartOption(type, metrics, trend) { formatter: (name) => { const index = metrics.findIndex(item => item.name === name); const ratio = total ? (values[index] / total * 100).toFixed(2) : "0.00"; - return `${name} ${formatValue(values[index])} · ${ratio}%`; + return `${name} ${values[index]} · ${ratio}%`; }, }, series: [{ @@ -187,7 +186,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -295,7 +294,6 @@ function HiddenDangerExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/LeftPanel/MajorHazardPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/LeftPanel/MajorHazardPanel/ExpandedPanel.js index 11fe609..f0a669a 100644 --- a/src/pages/Container/Statistics/Supervision/components/LeftPanel/MajorHazardPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/LeftPanel/MajorHazardPanel/ExpandedPanel.js @@ -120,7 +120,6 @@ const tableRows = [ completionRate: "100%", }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -161,7 +160,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -273,7 +272,6 @@ function MajorHazardExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/LeftPanel/RiskControlPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/LeftPanel/RiskControlPanel/ExpandedPanel.js index 5982d32..8093096 100644 --- a/src/pages/Container/Statistics/Supervision/components/LeftPanel/RiskControlPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/LeftPanel/RiskControlPanel/ExpandedPanel.js @@ -182,7 +182,6 @@ const tableRows = [ low: 665, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff1f10", "#ff7900", "#ffca09", "#4b9eff"]; @@ -194,7 +193,7 @@ function getChartOption(type, metrics, trend) { color: chartColors, tooltip: { trigger: "item", confine: true }, title: { - text: formatValue(total), + text: total, subtext: "风险总数", left: "20.5%", top: "42%", @@ -214,7 +213,7 @@ function getChartOption(type, metrics, trend) { formatter: (name) => { const index = metrics.findIndex(item => item.name === name); const ratio = total ? (values[index] / total * 100).toFixed(2) : "0.00"; - return `${name} ${formatValue(values[index])} · ${ratio}%`; + return `${name} ${values[index]} · ${ratio}%`; }, }, series: [{ @@ -248,7 +247,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -360,7 +359,6 @@ function RiskControlExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: "1.2fr 0.8fr repeat(4, 0.8fr)", - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/MiddlePanel/EmergencyManagementPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/MiddlePanel/EmergencyManagementPanel/ExpandedPanel.js index 352be63..6b4cc6a 100644 --- a/src/pages/Container/Statistics/Supervision/components/MiddlePanel/EmergencyManagementPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/MiddlePanel/EmergencyManagementPanel/ExpandedPanel.js @@ -159,7 +159,6 @@ const tableRows = [ { id: 12, unit: "十公司", name: "周倩", role: "综合部部长", mobile: "187****2468", phone: "3568246" }, { id: 13, unit: "保税物流中心", name: "马超", role: "运营部部长", mobile: "188****9675", phone: "3568967" }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -200,7 +199,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -327,7 +326,6 @@ function EmergencyManagementExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "应急值班明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/MiddlePanel/SafetyEvaluationPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/MiddlePanel/SafetyEvaluationPanel/ExpandedPanel.js index 1d860cc..9a43707 100644 --- a/src/pages/Container/Statistics/Supervision/components/MiddlePanel/SafetyEvaluationPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/MiddlePanel/SafetyEvaluationPanel/ExpandedPanel.js @@ -120,7 +120,6 @@ const tableRows = [ completionRate: "91.7%", }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -161,7 +160,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -273,7 +272,6 @@ function SafetyEvaluationExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/MiddlePanel/SafetyInspectionPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/MiddlePanel/SafetyInspectionPanel/ExpandedPanel.js index 23d58e7..27b4b04 100644 --- a/src/pages/Container/Statistics/Supervision/components/MiddlePanel/SafetyInspectionPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/MiddlePanel/SafetyInspectionPanel/ExpandedPanel.js @@ -141,7 +141,6 @@ const tableRows = [ unplanned: 14, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#45c8b2", "#ffb547"]; @@ -209,7 +208,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -371,7 +370,6 @@ function SafetyInspectionExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "单位执行明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/RightPanel/FixedColorPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/RightPanel/FixedColorPanel/ExpandedPanel.js index ebfa0fc..6d9d356 100644 --- a/src/pages/Container/Statistics/Supervision/components/RightPanel/FixedColorPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/RightPanel/FixedColorPanel/ExpandedPanel.js @@ -121,7 +121,6 @@ const tableRows = [ blue: 7, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff1f10", "#ff7900", "#ffca09", "#4b9eff"]; @@ -133,7 +132,7 @@ function getChartOption(type, metrics, trend) { color: chartColors, tooltip: { trigger: "item" }, title: { - text: formatValue(total), + text: total, subtext: "封闭区域总数", left: "28.5%", top: "46%", @@ -155,7 +154,7 @@ function getChartOption(type, metrics, trend) { formatter: (name) => { const index = metrics.findIndex(item => item.name === name); const ratio = total ? (values[index] / total * 100).toFixed(2) : "0.00"; - return `${name} ${formatValue(values[index])} · ${ratio}%`; + return `${name} ${values[index]} · ${ratio}%`; }, }, series: [{ @@ -189,7 +188,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -304,7 +303,6 @@ function FixedColorExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/RightPanel/KeyWorkPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/RightPanel/KeyWorkPanel/ExpandedPanel.js index 6f8b19d..17b1fec 100644 --- a/src/pages/Container/Statistics/Supervision/components/RightPanel/KeyWorkPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/RightPanel/KeyWorkPanel/ExpandedPanel.js @@ -110,7 +110,6 @@ const tableRows = [ dangerousWorkStarts: 3, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -151,7 +150,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -267,7 +266,6 @@ function KeyWorkExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/RightPanel/PenaltyStatisticsPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/RightPanel/PenaltyStatisticsPanel/ExpandedPanel.js index 6f49b58..a2861ff 100644 --- a/src/pages/Container/Statistics/Supervision/components/RightPanel/PenaltyStatisticsPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/RightPanel/PenaltyStatisticsPanel/ExpandedPanel.js @@ -113,7 +113,6 @@ const tableRows = [ processingRate: "100%", }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -154,7 +153,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -266,7 +265,6 @@ function PenaltyStatisticsExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/RightPanel/PenaltyStatisticsPanel/index.js b/src/pages/Container/Statistics/Supervision/components/RightPanel/PenaltyStatisticsPanel/index.js index 6a43308..affef0a 100644 --- a/src/pages/Container/Statistics/Supervision/components/RightPanel/PenaltyStatisticsPanel/index.js +++ b/src/pages/Container/Statistics/Supervision/components/RightPanel/PenaltyStatisticsPanel/index.js @@ -10,8 +10,6 @@ const mockRows = [ { id: 4, unit: "蓝天环保", projectCount: 1, penaltyCount: 1, amount: 8000 }, ]; const mockSummary = { projectCount: 4, penaltyCount: 6, amount: 11500 }; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; - function PenaltyStatisticsPanel({ onExpand }) { return ( @@ -29,17 +27,17 @@ function PenaltyStatisticsPanel({ onExpand }) { renderRow={record => ( {record.unit} - {formatValue(record.projectCount)} - {formatValue(record.penaltyCount)} - {formatValue(record.amount)} + {record.projectCount} + {record.penaltyCount} + {record.amount} )} summary={( 合计 - {formatValue(mockSummary.projectCount)} - {formatValue(mockSummary.penaltyCount)} - {formatValue(mockSummary.amount)} + {mockSummary.projectCount} + {mockSummary.penaltyCount} + {mockSummary.amount} )} scrollLimit={4} diff --git a/src/pages/Container/Statistics/Supervision/components/RightPanel/RelatedPartyPanel/ExpandedPanel.js b/src/pages/Container/Statistics/Supervision/components/RightPanel/RelatedPartyPanel/ExpandedPanel.js index ac373f4..c08484d 100644 --- a/src/pages/Container/Statistics/Supervision/components/RightPanel/RelatedPartyPanel/ExpandedPanel.js +++ b/src/pages/Container/Statistics/Supervision/components/RightPanel/RelatedPartyPanel/ExpandedPanel.js @@ -135,7 +135,6 @@ const tableRows = [ secondPeople: 382, }, ]; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; const chartColors = ["#ff4338", "#ff8a23", "#f6c445", "#3d8fe8", "#38bca7"]; @@ -176,7 +175,7 @@ function getChartOption(type, metrics, trend) { type: "category", inverse: true, position: "right", - data: metrics.map(item => formatValue(item.value)), + data: metrics.map(item => item.value), axisLabel: { color: "#3b445c", fontSize: 11, margin: 10 }, axisLine: { show: false }, axisTick: { show: false }, @@ -292,7 +291,6 @@ function RelatedPartyExpandedPanel({ selectedCompany }) { dataSource: tableRows, description: `${scopeName} · ${periodLabel}`, gridColumns: `repeat(${tableColumns.length}, minmax(0, 1fr))`, - renderCell: (record, column) => formatValue(record[column.dataIndex]), scrollLimit: 3, title: "统计明细", }} diff --git a/src/pages/Container/Statistics/Supervision/components/RightPanel/RelatedPartyPanel/index.js b/src/pages/Container/Statistics/Supervision/components/RightPanel/RelatedPartyPanel/index.js index 05d2e92..2b0ab20 100644 --- a/src/pages/Container/Statistics/Supervision/components/RightPanel/RelatedPartyPanel/index.js +++ b/src/pages/Container/Statistics/Supervision/components/RightPanel/RelatedPartyPanel/index.js @@ -23,8 +23,6 @@ const mockSecondRows = [ ]; const mockFirstSummary = { type: "统计", unitCount: 259, peopleCount: 3401 }; const mockSecondSummary = { type: "合计", unitCount: 525, peopleCount: 10956 }; -const formatValue = value => typeof value === "number" ? value.toLocaleString("zh-CN") : value; - function RelatedPartyPanel({ onExpand }) { return ( @@ -45,15 +43,15 @@ function RelatedPartyPanel({ onExpand }) { renderRow={record => ( {record.type} - {formatValue(record.unitCount)} - {formatValue(record.peopleCount)} + {record.unitCount} + {record.peopleCount} )} summary={( {mockFirstSummary.type} - {formatValue(mockFirstSummary.unitCount)} - {formatValue(mockFirstSummary.peopleCount)} + {mockFirstSummary.unitCount} + {mockFirstSummary.peopleCount} )} /> @@ -75,15 +73,15 @@ function RelatedPartyPanel({ onExpand }) { renderRow={record => ( {record.type} - {formatValue(record.unitCount)} - {formatValue(record.peopleCount)} + {record.unitCount} + {record.peopleCount} )} summary={( {mockSecondSummary.type} - {formatValue(mockSecondSummary.unitCount)} - {formatValue(mockSecondSummary.peopleCount)} + {mockSecondSummary.unitCount} + {mockSecondSummary.peopleCount} )} /> diff --git a/src/pages/Container/Statistics/components/ExpandedLayout/index.js b/src/pages/Container/Statistics/components/ExpandedLayout/index.js index 408c377..cb2ff05 100644 --- a/src/pages/Container/Statistics/components/ExpandedLayout/index.js +++ b/src/pages/Container/Statistics/components/ExpandedLayout/index.js @@ -63,9 +63,7 @@ function ExpandedLayout({ {tableConfig.columns.map(column => ( - {column.renderCell - ? column.renderCell(record) - : tableConfig.renderCell?.(record, column) ?? record[column.dataIndex]} + {column.renderCell ? column.renderCell(record) : record[column.dataIndex]} ))} diff --git a/src/pages/Container/Statistics/components/ExpandedLayout/index.module.less b/src/pages/Container/Statistics/components/ExpandedLayout/index.module.less index 66068d9..e16389d 100644 --- a/src/pages/Container/Statistics/components/ExpandedLayout/index.module.less +++ b/src/pages/Container/Statistics/components/ExpandedLayout/index.module.less @@ -103,6 +103,10 @@ font-weight: 600; } + &[data-tone="blue"] strong { + color: #2e75c6; + } + &[data-tone="red"] strong { color: #e8473f; } diff --git a/src/utils/index.js b/src/utils/index.js index ed060ef..da22170 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -59,8 +59,8 @@ export const closeWindow = () => { window.close(); setTimeout(() => { if (!window.closed && !window.opener) { - // window.location.href = "https://gbs-gateway.qhdsafety.com/"; - window.location.href = "http://192.168.198.8:30140/"; + window.location.href = "https://gbs-gateway.qhdsafety.com/"; + // window.location.href = "http://192.168.198.8:30140/"; } }, 500); }; diff --git a/types/statistics-components.d.ts b/types/statistics-components.d.ts new file mode 100644 index 0000000..469b4ca --- /dev/null +++ b/types/statistics-components.d.ts @@ -0,0 +1,246 @@ +declare module "~/pages/Container/Statistics/components/Panel" { + /** 首页统计大块公共外壳的属性。 */ + export interface StatisticsPanelProps { + /** 统计块标题。 */ + title: string; + /** 统计块主体内容。 */ + children: import("react").ReactNode; + /** 点击“更多”时打开第一层放大弹窗。 */ + onExpand: () => void; + /** 标题栏中位于“更多”按钮前的附加内容。 */ + extra?: import("react").ReactNode; + /** 业务统计块追加的 CSS Modules 类名。 */ + className?: string; + } + + /** 渲染首页统计大块公共外壳。 */ + export default function Panel(props: StatisticsPanelProps): import("react").ReactElement; +} + +declare module "~/pages/Container/Statistics/components/OverviewTable" { + /** 首页和第一层弹窗共用的滚动表格属性。 */ + export interface OverviewTableProps> { + /** CSS Grid 的列模板。 */ + columns: string; + /** 表格数据,行类型会传递给 renderRow。 */ + dataSource: T[]; + /** 表头内容。 */ + header: import("react").ReactNode; + /** 根据当前数据行渲染整行内容。 */ + renderRow: (record: T, index: number, dataSource: T[]) => import("react").ReactNode; + /** 表格底部合计行。 */ + summary?: import("react").ReactNode; + /** 超过该行数后启用无缝滚动,默认值为 4。 */ + scrollLimit?: number; + } + + /** 滚动表格单行布局的属性。 */ + export interface OverviewTableRowProps { + /** 行类型,默认值为 body。 */ + type?: "header" | "body" | "summary"; + /** 当前行中的单元格内容。 */ + children: import("react").ReactNode; + } + + /** 渲染滚动表格。 */ + export default function OverviewTable>( + props: OverviewTableProps, + ): import("react").ReactElement; + + /** 渲染滚动表格中的表头、数据行或合计行。 */ + export function OverviewTableRow(props: OverviewTableRowProps): import("react").ReactElement; +} + +declare module "~/pages/Container/Statistics/components/ExpandedLayer" { + /** 当前页面第一层放大弹窗外壳的属性。 */ + export interface ExpandedLayerProps { + /** 是否显示放大弹窗。 */ + open: boolean; + /** 弹窗标题。 */ + title: string; + /** 当前业务的第一层放大内容。 */ + children: import("react").ReactNode; + /** 关闭第一层放大弹窗。 */ + onClose: () => void; + } + + /** 渲染当前页面第一层放大弹窗。 */ + export default function ExpandedLayer(props: ExpandedLayerProps): import("react").ReactElement | null; +} + +declare module "~/pages/Container/Statistics/components/ExpandedLayout" { + /** 第一层放大弹窗顶部的单个指标。 */ + export interface ExpandedMetricItem { + /** 指标名称。 */ + name: string; + /** 指标值,支持数字、百分比和已格式化的字符串。 */ + value: string | number; + /** 指标颜色标识。 */ + tone?: "blue" | "red" | "orange" | "yellow" | "green"; + } + + /** 滚动表格的一行数据,各业务弹窗可以继续添加自己的字段。 */ + export interface ExpandedTableRecord { + /** 行唯一标识。 */ + id: import("react").Key; + [field: string]: any; + } + + /** 第一层放大弹窗底部滚动表格的列配置。 */ + export interface ExpandedTableColumn { + /** 列标题。 */ + title: string; + /** 对应数据行中的字段名。 */ + dataIndex: string; + /** 当前列独立的单元格渲染方法。 */ + renderCell?: (record: ExpandedTableRecord) => import("react").ReactNode; + } + + /** 第一层放大弹窗底部滚动表格的完整配置。 */ + export interface ExpandedTableConfig { + /** 表格标题。 */ + title: string; + /** 表格标题右侧的统计范围等说明。 */ + description: import("react").ReactNode; + /** CSS Grid 的列模板,例如 repeat(4, minmax(0, 1fr))。 */ + gridColumns: string; + /** 超过该行数后启用无缝滚动。 */ + scrollLimit: number; + /** 表格列配置。 */ + columns: ExpandedTableColumn[]; + /** 表格数据。 */ + dataSource: ExpandedTableRecord[]; + } + + /** 第一层放大弹窗右侧的单个业务入口。 */ + export interface ExpandedBusinessEntry { + /** 入口唯一标识。 */ + key: import("react").Key; + /** 入口标题。 */ + title: string; + /** 入口说明。 */ + description: string; + /** 点击入口时打开对应列表弹窗。 */ + onClick: () => void; + } + + /** 第一层放大弹窗右侧的当前统计项。 */ + export interface ExpandedStatisticItem { + /** 统计项名称。 */ + label: string; + /** 统计项内容。 */ + value: import("react").ReactNode; + } + + /** 第一层放大弹窗公共左右布局的属性。 */ + export interface ExpandedLayoutProps { + /** 左侧主标题。 */ + title: string; + /** 左侧副标题。 */ + subtitle: string; + /** 主标题右侧内容,当前通常传入统计周期 Segmented。 */ + headerExtra: import("react").ReactNode; + /** 右侧当前统计中显示的统计周期。 */ + periodText: string; + /** 左侧顶部指标列表。 */ + metrics: ExpandedMetricItem[]; + /** 左侧中间由各业务弹窗自行维护的图表或统计内容。 */ + mainContent: import("react").ReactNode; + /** 左侧底部滚动表格配置。 */ + tableConfig: ExpandedTableConfig; + /** 右侧业务入口列表。 */ + businessEntries: ExpandedBusinessEntry[]; + /** 右侧当前统计列表。 */ + statistics: ExpandedStatisticItem[]; + } + + /** 渲染第一层放大弹窗的公共左右布局。 */ + export default function ExpandedLayout(props: ExpandedLayoutProps): import("react").ReactElement; +} + +declare module "~/pages/Container/Statistics/components/ListDialog" { + /** 第二层列表弹窗公共外框的属性。 */ + export interface ListDialogProps { + /** 列表弹窗标题,用于无障碍说明。 */ + title: string; + /** 业务模块自己的列表内容。 */ + children: import("react").ReactNode; + /** 关闭第二层列表弹窗。 */ + onClose: () => void; + } + + /** 渲染第二层列表弹窗公共外框。 */ + export default function ListDialog(props: ListDialogProps): import("react").ReactElement; +} + +declare module "~/pages/Container/Statistics/components/ListLayout" { + /** 第二层业务列表公共上下布局的属性。 */ + export interface ListLayoutProps { + /** 列表主标题。 */ + title: string; + /** 列表副标题。 */ + subtitle: string; + /** 点击右上角关闭按钮时执行的方法。 */ + onBack: () => void; + /** 搜索区域内容。 */ + searchContent: import("react").ReactNode; + /** 表格区域内容。 */ + tableContent: import("react").ReactNode; + /** 底部统计范围等说明。 */ + footerContent: import("react").ReactNode; + } + + /** 渲染第二层业务列表公共上下布局。 */ + export default function ListLayout(props: ListLayoutProps): import("react").ReactElement; +} + +declare module "~/pages/Container/Statistics/components/DetailDialog" { + /** 第三层详情弹窗公共外框的属性。 */ + export interface DetailDialogProps { + /** 详情弹窗标题。 */ + title: string; + /** 业务模块自己的详情字段内容。 */ + children: import("react").ReactNode; + /** 关闭第三层详情弹窗。 */ + onClose: () => void; + } + + /** 渲染第三层详情弹窗公共外框。 */ + export default function DetailDialog(props: DetailDialogProps): import("react").ReactElement; +} + +declare module "~/pages/Container/Statistics/components/Header" { + /** 首页当前选中的统计范围。 */ + export interface StatisticsCompanyOption { + /** Select 使用的选项值。 */ + value: string | number; + /** Select 显示的选项文字。 */ + label: string; + /** 页面统计和弹窗中显示的公司名称。 */ + name: string; + } + + /** 首页天气接口当前天气数据。 */ + export interface StatisticsWeatherNow { + text?: string; + temp?: string | number; + wind_class?: string; + } + + /** 首页公共头部对外暴露的属性,接口方法由 Connect 注入。 */ + export interface StatisticsHeaderProps { + /** 页面历史对象,仅使用返回上一页能力。 */ + history: { goBack: () => void }; + /** 当前选择的统计范围。 */ + selectedCompany: StatisticsCompanyOption; + /** 天气数据,兼容接口 now 包装和直接返回两种结构。 */ + weather: StatisticsWeatherNow | { now: StatisticsWeatherNow }; + /** 天气请求状态。 */ + weatherLoading: boolean; + /** 切换统计范围时更新首页状态。 */ + onCompanyChange: (company: StatisticsCompanyOption) => void; + } + + /** 渲染统计页面公共头部。 */ + export default function Header(props: StatisticsHeaderProps): import("react").ReactElement; +}