diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 60e5829..5739b54 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -228,13 +228,11 @@ export default function AppLayout() { style={{ border: '1px solid #e5e7eb', borderRadius: 8, - //borderLeft: 0, - //borderRight: 0, - //borderBottom: 0, + margin: 4, marginBottom: 50 }} - styles={{ body: { padding: '12px 8px' } }} + styles={{ body: { padding: '12px 4px' } }} >
@@ -244,15 +242,15 @@ export default function AppLayout() { {/* 电站 */} -
+
装机容量:{currentStation.capacity || '1.00'} MWp
并网时间:{currentStation.gridTime || '2024-01-15'}
电站地址:{currentStation.address || '浙江省杭州市'}
电站类型:{currentStation.type || '地面电站'}
-
- 运行状态 - ● - 正常运行 +
+ 运行状态: + ● + 正常运行
diff --git a/src/components/SystemSetting/BasicSettings.tsx b/src/components/SystemSetting/BasicSettings.tsx index c5b44e1..f3842a1 100644 --- a/src/components/SystemSetting/BasicSettings.tsx +++ b/src/components/SystemSetting/BasicSettings.tsx @@ -34,6 +34,7 @@ import { SafetyCertificateOutlined, ToolOutlined, RightOutlined, + EyeOutlined, } from '@ant-design/icons'; import { Smartphone, @@ -367,7 +368,16 @@ const BasicSettings = () => { ) }, - { title: '操作', key: 'action', width: 60, render: () => , fixed: 'right' }, + { + title: '操作', key: 'action', width: 60, render: () => , fixed: 'right' + }, ]} dataSource={[ { name: '张运维', role: '超级管理员', phone: '138****0001', email: 'zhangyw@pvsmart.com', status: '在线' }, diff --git a/src/components/SystemSetting/Organization.tsx b/src/components/SystemSetting/Organization.tsx index 719756d..349bd43 100644 --- a/src/components/SystemSetting/Organization.tsx +++ b/src/components/SystemSetting/Organization.tsx @@ -121,7 +121,7 @@ export default function Organization() { const columns = [ { title: '组织名称', dataIndex: 'orgName' }, - { title: '组织编码', dataIndex: 'orgCode' }, + //{ title: '组织编码', dataIndex: 'orgCode' }, { title: '负责人', dataIndex: 'manager' }, { title: '联系电话', dataIndex: 'phone' }, { title: '邮箱', dataIndex: 'email' }, @@ -189,9 +189,9 @@ export default function Organization() { - + {/* - + */} diff --git a/src/components/SystemSetting/SerialNumGenerate.jsx b/src/components/SystemSetting/SerialNumGenerate.jsx index a1905f3..75306db 100644 --- a/src/components/SystemSetting/SerialNumGenerate.jsx +++ b/src/components/SystemSetting/SerialNumGenerate.jsx @@ -7,6 +7,11 @@ import QRCode from 'qrcode'; import DictManager from "../DictManager"; import request from '../../api/request'; import { Country, State } from 'country-state-city'; +import { + EyeOutlined, + EditOutlined, + DeleteOutlined, +} from '@ant-design/icons'; // 接口导入 import { @@ -378,12 +383,14 @@ const SerialNumGenerate = () => { fixed: "right", render: (_, r) => ( - + handleDelete(r.id)} > - + ) diff --git a/src/components/SystemSetting/StationManage.tsx b/src/components/SystemSetting/StationManage.tsx index 0440506..18445cc 100644 --- a/src/components/SystemSetting/StationManage.tsx +++ b/src/components/SystemSetting/StationManage.tsx @@ -225,7 +225,7 @@ export default function StationManage() { // ====================== 表格列 ====================== const columns = [ { title: '场站名称', dataIndex: 'siteName' }, - { title: '场站编号', dataIndex: 'siteCode' }, + //{ title: '场站编号', dataIndex: 'siteCode' }, { title: '所属组织', dataIndex: 'orgId', @@ -316,21 +316,19 @@ export default function StationManage() { - - + + - - - + diff --git a/src/components/alerts/AlarmOverview.tsx b/src/components/alerts/AlarmOverview.tsx index dafcac3..f53b4e2 100644 --- a/src/components/alerts/AlarmOverview.tsx +++ b/src/components/alerts/AlarmOverview.tsx @@ -5,9 +5,10 @@ import { } from 'antd'; import { BellOutlined, ClockCircleOutlined, CheckCircleOutlined, ExclamationCircleOutlined, - SearchOutlined, ReloadOutlined, FileTextOutlined, NotificationOutlined + SearchOutlined, ReloadOutlined, FileTextOutlined, NotificationOutlined, + EyeOutlined, + EditOutlined } from '@ant-design/icons'; -import { Line, Pie, Bar } from '@ant-design/charts'; import dayjs from 'dayjs'; import { exportTable } from "../../lib/utils.js" @@ -265,9 +266,21 @@ export default function AlarmCenterPage() { fixed: 'right', render: (_, record) => ( - - {/* 新增修改按钮 */} - + + + ) diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 547bca5..d1fbc25 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -1,5 +1,5 @@ -import React, { useState, useEffect } from 'react'; -import { Card, Row, Col, Statistic, Button, Space, Tag, Typography, Table } from 'antd'; +import React, { useState, useEffect, useRef } from 'react'; +import { Card, Row, Col, Statistic, Button, Space, Tag, Typography, Table, message } from 'antd'; import { CloudOutlined, ThunderboltOutlined, BarChartOutlined, RiseOutlined, BellOutlined, WalletOutlined, @@ -14,18 +14,27 @@ import { BranchesOutlined, RobotOutlined } from '@ant-design/icons'; -import { Line, Bar, Pie, } from '@ant-design/charts'; +import { Line, Bar, Pie } from '@ant-design/charts'; import { getWeatherData, getWeatherType } from '../lib/utils'; import WeatherDisplay from '../components/Weather'; import bgMain from '../assets/images/bgmain.jpg'; import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../components/recharts'; - +// 👇 在这里引入你的工单接口(改成你真实的接口地址) +import { addWorkOrder } from '../api/workOrder'; +import { useSelector } from 'react-redux'; const { Text } = Typography; - export default function StationDashboard() { + // 👇 消息提示(修复缺失) + const [messageApi, contextHolder] = message.useMessage(); + + // 👇 获取当前选中的电站(从redux拿,修复缺失) + const { currentStation } = useSelector((state) => state.station); + const { userInfo } = useSelector((state) => state.user); + + // 天气数据 const [weatherdata, setWeatherData] = useState({ province: "江苏省", city: "南通市", @@ -41,7 +50,7 @@ export default function StationDashboard() { }); const weatherType = getWeatherType(weatherdata.weather); - // 请求天气接口 + // 请求天气 useEffect(() => { const fetchWeather = async () => { try { @@ -90,7 +99,7 @@ export default function StationDashboard() { { type: "严重", content: "A05阵列热斑处置建议:建议现场复核PV-A05-018至PV-A05-020组件接线和旁路二极管状态,必要时更换异常组件。", desc: "整体发电偏差-2.8%" } ]; - // 图表配置 —— 终极美化版(渐变+紧凑+高级) + // 图表数据 const powerTrendData = [ { time: '00:00', actual: 1800, predict: 1600 }, { time: '04:00', actual: 1500, predict: 1400 }, @@ -135,25 +144,73 @@ export default function StationDashboard() { const cardStyle = { borderRadius: 12, border: '1px solid #f0f0f0', boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }; - // 顶部卡片微型图表配置 - const tinyAreaConfig = { - height: 40, - autoFit: true, - data: [264, 417, 438, 887, 309, 397, 550, 575, 563, 430, 525, 592, 492, 467, 513, 546, 983, 340, 539, 243, 226, 192], - smooth: true, - areaStyle: { fill: 'l(270) 0:#ffffff 0.5:#165DFF 1:#165DFF', fillOpacity: 0.1 }, - line: { color: '#165DFF' }, + // ============================================== + // 👇 【完整完善】生成清洗工单(核心修复) + // ============================================== + // ============================================== + // 【正确匹配接口字段】生成清洗工单 + // ============================================== + const handleaddOrder = async () => { + if (!currentStation) { + messageApi.warning('请先选择电站'); + return; + } + try { + // 严格按照你给的接口字段传参 + const params = { + id: '', // 主键ID(新增为空) + orderNo: '', // 工单编号(后端生成) + orderTitle: '光伏组件清洗工单', // 工单标题 + sourceType: 3, // 来源 3=清洗 + orderType: 3, // 类型 3=清洗 + priorityLevel: 2, // 优先级 2=中 + deviceId: currentStation.id || '', + deviceName: currentStation.siteName || '电站', + deviceType: 1, // 设备类型:电站 + siteId: currentStation.id || '', + siteName: currentStation.siteName || '', + orgId: userInfo?.orgId || '', + assigneeId: '', + assigneeName: '', + collaboratorIds: '', + collaboratorNames: '', + planStartTime: '', + planEndTime: '', + deadlineTime: '', + actualStartTime: '', + actualEndTime: '', + orderStatus: 1, // 状态 1=待处理 + alarmId: '', + alarmNo: '', + taskDescription: '根据电站清洁度建议进行组件清洗,提升发电效率', + aiSuggestion: '系统自动生成清洗建议,预计提升发电量2.6%', + requiredEquipment: '清洗设备、水枪、抹布', + estimatedImpact: '2.6', // 影响发电量(%) 数字 + handleResult: '', + handleRemark: '' + }; + + const res = await addWorkOrder(params); + + if (res.code === 0 || res.code === 200) { + messageApi.success('✅ 清洗工单生成成功'); + } else { + messageApi.error(res.msg || '❌ 工单生成失败'); + } + } catch (error) { + messageApi.error('❌ 工单生成接口调用失败'); + console.error(error); + } }; - const tinyColumnConfig = { - height: 40, - autoFit: true, - data: [274, 337, 81, 497, 666, 219, 269], - color: '#00B42A', - }; + return (
+ {/* 👇 必须加这个,message才能正常显示 */} + {contextHolder} + + {/* 顶部统计卡片 */} {[ { title: '今日发电量', value: '4,752', unit: 'kWh', sub: '日目标 5,000 kWh', color: '#00B42A', bg: '#E8FFEA', icon: }, @@ -164,16 +221,12 @@ export default function StationDashboard() { { title: '节省运维成本', value: '¥ 36,540', unit: '', sub: '本月累计节省', color: '#FF7D00', bg: '#FFF7E8', icon: }, ].map((item, idx) => ( - +
{item.title}
@@ -188,16 +241,17 @@ export default function StationDashboard() { display: 'flex', justifyContent: 'center', alignItems: 'center', boxShadow: `0 2px 8px ${item.color}1A` }}> - {React.cloneElement(item.icon as React.ReactElement, { style: { fontSize: 22, color: item.color } })} + {React.cloneElement(item.icon, { style: { fontSize: 22, color: item.color } })}
))}
+ {/* 主体布局 */} - {/* 左侧:图表列 */} + {/* 左侧图表 */} 发电趋势} extra={} bordered={false} style={cardStyle} bodyStyle={{ padding: '8px' }}> @@ -210,20 +264,11 @@ export default function StationDashboard() { dot backgroundColor="transparent" series={[ - { - key: 'actual', - name: '实际', - color: '#165DFF', - strokeWidth: 3, - }, - { - key: 'predict', - name: '预测', - color: '#00B42A', - strokeWidth: 2, - }, + { key: 'actual', name: '实际', color: '#165DFF', strokeWidth: 3 }, + { key: 'predict', name: '预测', color: '#00B42A', strokeWidth: 2 }, ]} - /> + /> + 辐照度与温度趋势} bordered={false} style={cardStyle} bodyStyle={{ padding: '8px' }}> + /> + 逆变器效率对比} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}> + series={[{ key: 'efficiency', name: '效率', color: '#165DFF' }]} + /> + 运维任务进度} extra={} bordered={false} style={cardStyle} bodyStyle={{ padding: '12px' }}>
+ /> +
总任务
12
@@ -283,7 +315,7 @@ export default function StationDashboard() { - {/* 中间:底图与状态 */} + {/* 中间 */}