预设路线搜索功能
This commit is contained in:
@@ -539,7 +539,7 @@ export default function RobotTaskPage({ devices }) {
|
|||||||
<Input
|
<Input
|
||||||
placeholder="搜索..."
|
placeholder="搜索..."
|
||||||
size="small"
|
size="small"
|
||||||
style={{ width: 100 }}
|
style={{ width: 200 }}
|
||||||
value={routeSearch}
|
value={routeSearch}
|
||||||
onChange={e => setRouteSearch(e.target.value)}
|
onChange={e => setRouteSearch(e.target.value)}
|
||||||
/>
|
/>
|
||||||
@@ -550,76 +550,84 @@ export default function RobotTaskPage({ devices }) {
|
|||||||
style={cardStyle}
|
style={cardStyle}
|
||||||
>
|
>
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||||
{routeList.map(route => (
|
{routeList
|
||||||
<div
|
.filter(item => {
|
||||||
key={route.id}
|
if (!routeSearch) return true;
|
||||||
style={{
|
const name = (item.workName || item.name || '').toLowerCase();
|
||||||
padding: 12,
|
const id = String(item.id || '').toLowerCase();
|
||||||
borderRadius: 8,
|
const key = routeSearch.toLowerCase();
|
||||||
background: '#F7F8FA',
|
return name.includes(key) || id.includes(key);
|
||||||
cursor: 'pointer',
|
})
|
||||||
border: '1px solid transparent',
|
.map(route => (
|
||||||
display: 'flex',
|
<div
|
||||||
gap: 12,
|
key={route.id}
|
||||||
alignItems: 'center'
|
style={{
|
||||||
}}
|
padding: 12,
|
||||||
onMouseEnter={e => e.currentTarget.style.borderColor = '#165DFF'}
|
borderRadius: 8,
|
||||||
onMouseLeave={e => e.currentTarget.style.borderColor = 'transparent'}
|
background: '#F7F8FA',
|
||||||
>
|
cursor: 'pointer',
|
||||||
{/* 路线预览图 */}
|
border: '1px solid transparent',
|
||||||
<div style={{
|
display: 'flex',
|
||||||
width: 40,
|
gap: 12,
|
||||||
height: 40,
|
alignItems: 'center'
|
||||||
borderRadius: 6,
|
}}
|
||||||
background: '#e8f3ff',
|
onMouseEnter={e => e.currentTarget.style.borderColor = '#165DFF'}
|
||||||
overflow: 'hidden',
|
onMouseLeave={e => e.currentTarget.style.borderColor = 'transparent'}
|
||||||
flexShrink: 0
|
>
|
||||||
}}>
|
{/* 路线预览图 */}
|
||||||
{route.imgUrl ? (
|
<div style={{
|
||||||
<img
|
width: 40,
|
||||||
src={route.imgUrl}
|
height: 40,
|
||||||
alt={route.workName || route.name}
|
borderRadius: 6,
|
||||||
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
background: '#e8f3ff',
|
||||||
/>
|
overflow: 'hidden',
|
||||||
) : (
|
flexShrink: 0
|
||||||
<div style={{
|
}}>
|
||||||
width: '100%',
|
{route.imgUrl ? (
|
||||||
height: '100%',
|
<img
|
||||||
display: 'flex',
|
src={route.imgUrl}
|
||||||
alignItems: 'center',
|
alt={route.workName || route.name}
|
||||||
justifyContent: 'center',
|
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
||||||
color: '#165DFF'
|
/>
|
||||||
}}>
|
) : (
|
||||||
<EyeOutlined />
|
<div style={{
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
color: '#165DFF'
|
||||||
|
}}>
|
||||||
|
<EyeOutlined />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 路线信息 */}
|
||||||
|
<div style={{ flex: 1, minWidth: 0 }}>
|
||||||
|
<div style={{ fontWeight: 600, fontSize: 14, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
||||||
|
{route.workName || route.name || '未命名路线'}
|
||||||
|
</div>
|
||||||
|
<div style={{ fontSize: 12, color: '#86909C', marginTop: 4 }}>
|
||||||
|
ID: {route.id}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* 路线信息 */}
|
|
||||||
<div style={{ flex: 1, minWidth: 0 }}>
|
|
||||||
<div style={{ fontWeight: 600, fontSize: 14, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
||||||
{route.workName || route.name || '未命名路线'}
|
|
||||||
</div>
|
|
||||||
<div style={{ fontSize: 12, color: '#86909C', marginTop: 4 }}>
|
|
||||||
ID: {route.id}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 执行按钮 */}
|
||||||
|
<Tooltip title="执行航线">
|
||||||
|
<Button
|
||||||
|
type="text"
|
||||||
|
icon={<PlayCircleOutlined style={{ color: '#165DFF', fontSize: 28 }} />}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
setSelectedPathWork(route);
|
||||||
|
setIsTaskModalOpen(true);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
))}
|
||||||
{/* 执行按钮 */}
|
|
||||||
<Tooltip title="执行航线">
|
|
||||||
<Button
|
|
||||||
type="text"
|
|
||||||
icon={<PlayCircleOutlined style={{ color: '#165DFF', fontSize: 28 }} />}
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
setSelectedPathWork(route);
|
|
||||||
setIsTaskModalOpen(true);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
Reference in New Issue
Block a user