航线任务面板 工作任务看板 数据获取逻辑优化,溢出换行显示优化
This commit is contained in:
@@ -90,11 +90,10 @@ export default function WayLinePage({ onRefresh }) {
|
||||
|
||||
// 当MQTT数据更新时,更新持久化数据(只在有新数据时更新)
|
||||
const handleMqttMessage = (topic, message) => {
|
||||
console.log('WayLinePage MQTT 消息到达 - Topic:', topic);
|
||||
console.log('WayLinePage MQTT 消息内容:', message);
|
||||
|
||||
try {
|
||||
const parsedMessage = JSON.parse(message);
|
||||
console.log('WayLinePage 解析后的消息:', parsedMessage);
|
||||
//console.log('WayLinePage 解析后的消息:', parsedMessage);
|
||||
|
||||
if (parsedMessage.data && parsedMessage.data.host) {
|
||||
const { host } = parsedMessage.data;
|
||||
@@ -213,7 +212,6 @@ export default function WayLinePage({ onRefresh }) {
|
||||
if (listDrone.gateway_sn && listDrone.gateway_sn !== listDrone.device_sn) {
|
||||
topics.push(`thing/product/${listDrone.gateway_sn}/osd`);
|
||||
}
|
||||
console.log('WayLinePage 订阅的MQTT主题:', topics);
|
||||
return topics;
|
||||
}, [listDrone]);
|
||||
|
||||
@@ -250,11 +248,6 @@ export default function WayLinePage({ onRefresh }) {
|
||||
};
|
||||
|
||||
fetchRealtime();
|
||||
listDroneTimerRef.current = setInterval(fetchRealtime, 3000);
|
||||
|
||||
return () => {
|
||||
if (listDroneTimerRef.current) clearInterval(listDroneTimerRef.current);
|
||||
};
|
||||
}, [listDrone]);
|
||||
|
||||
// 工作看板 独立筛选状态
|
||||
@@ -521,6 +514,8 @@ export default function WayLinePage({ onRefresh }) {
|
||||
const getBoardTask = async () => {
|
||||
if (!planedevices?.length) return;
|
||||
try {
|
||||
console.log('获取看板任务数据,当前筛选条件:')
|
||||
|
||||
const defaultStart = dayjs().startOf('day').unix();
|
||||
const defaultEnd = dayjs().endOf('day').unix();
|
||||
|
||||
@@ -530,6 +525,7 @@ export default function WayLinePage({ onRefresh }) {
|
||||
|
||||
const sns = boardDrone ? [boardDrone.gateway_sn] : planedevices.map(item => item.gateway_sn);
|
||||
const res = await getsinglePlan({ sns, beginAt, endAt });
|
||||
console.log('看板任务数据接口返回:', res);
|
||||
if (res?.code === 200) {
|
||||
let combinedList = [];
|
||||
if (res.data) {
|
||||
@@ -537,6 +533,7 @@ export default function WayLinePage({ onRefresh }) {
|
||||
if (item.list) combinedList = combinedList.concat(item.list);
|
||||
});
|
||||
}
|
||||
console.log('看板任务列表:', combinedList);
|
||||
setBoardTaskList(combinedList);
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -563,7 +560,7 @@ export default function WayLinePage({ onRefresh }) {
|
||||
|
||||
useEffect(() => {
|
||||
getBoardTask();
|
||||
}, [boardDrone, boardDateRange]);
|
||||
}, [boardDrone, boardDateRange, planedevices?.length]);
|
||||
|
||||
// 任务状态标签
|
||||
const getStatusTag = (status) => {
|
||||
@@ -1398,12 +1395,26 @@ export default function WayLinePage({ onRefresh }) {
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
|
||||
{col.list.map((task, tidx) => (
|
||||
<div key={tidx} style={{ background: '#fff', borderRadius: 8, padding: 10, boxShadow: '0 2px 4px rgba(0,0,0,0.04)', border: '1px solid #F1F2F5' }}>
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: '#165DFF', marginBottom: 6, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
||||
{/* 任务名称:自动换行 */}
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: '#165DFF', marginBottom: 6, wordBreak: 'break-all', whiteSpace: 'normal' }}>
|
||||
{task.name}
|
||||
</div> <div style={{ fontSize: 10, color: '#86909C' }}>
|
||||
<div style={{ marginBottom: 2 }}>装备: {task.device || 'UAV-A01'}</div>
|
||||
{task.begin_at && <div style={{ marginTop: 2 }}>开始时间: {task.begin_at}</div>}
|
||||
{task.completed_at && <div style={{ marginTop: 2 }}>完成时间: {task.completed_at}</div>}
|
||||
</div>
|
||||
|
||||
{/* 设备 & 时间:自动换行 */}
|
||||
<div style={{ fontSize: 10, color: '#86909C', lineHeight: '1.4' }}>
|
||||
<div style={{ marginBottom: 2, wordBreak: 'break-all', whiteSpace: 'normal' }}>
|
||||
装备: {task.device || 'UAV-A01'}
|
||||
</div>
|
||||
{task.begin_at && (
|
||||
<div style={{ marginTop: 2, wordBreak: 'break-all', whiteSpace: 'normal' }}>
|
||||
开始时间: {task.begin_at}
|
||||
</div>
|
||||
)}
|
||||
{task.completed_at && (
|
||||
<div style={{ marginTop: 2, wordBreak: 'break-all', whiteSpace: 'normal' }}>
|
||||
完成时间: {task.completed_at}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user