feat(设备管理): 添加设备工单关联功能
实现设备与工单的关联功能,包括: 1. 后端添加设备工单列表接口 2. 前端API添加设备工单相关方法 3. 设备详情页增加工单标签页 4. 设备管理页添加查看/创建工单按钮 5. 工单管理页支持从设备跳转查看/创建工单
This commit is contained in:
@@ -40,6 +40,7 @@ import {
|
||||
} from '@ant-design/icons';
|
||||
import axios from 'axios';
|
||||
import dayjs from 'dayjs';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { designTokens } from '../config/theme';
|
||||
import {
|
||||
PAGINATION_CONFIG,
|
||||
@@ -221,6 +222,7 @@ const ResizableTitle = props => {
|
||||
};
|
||||
|
||||
function DeviceManagement() {
|
||||
const navigate = useNavigate();
|
||||
const [devices, setDevices] = useState([]);
|
||||
const [allDevices, setAllDevices] = useState([]);
|
||||
const [racks, setRacks] = useState([]);
|
||||
@@ -756,6 +758,16 @@ function DeviceManagement() {
|
||||
setDetailModalVisible(true);
|
||||
};
|
||||
|
||||
// 查看设备关联的工单
|
||||
const handleViewDeviceTickets = device => {
|
||||
navigate(`/tickets?deviceId=${device.deviceId}&deviceName=${encodeURIComponent(device.name)}&serialNumber=${encodeURIComponent(device.serialNumber || '')}&view=true`);
|
||||
};
|
||||
|
||||
// 为设备创建工单
|
||||
const handleCreateTicketForDevice = device => {
|
||||
navigate(`/tickets?deviceId=${device.deviceId}&deviceName=${encodeURIComponent(device.name)}&serialNumber=${encodeURIComponent(device.serialNumber || '')}&create=true`);
|
||||
};
|
||||
|
||||
// 打开批量状态变更模态框
|
||||
const showBatchStatusModal = () => {
|
||||
if (selectedDevices.length === 0) {
|
||||
@@ -2163,6 +2175,24 @@ function DeviceManagement() {
|
||||
>
|
||||
关闭
|
||||
</Button>,
|
||||
<Button
|
||||
key="viewTickets"
|
||||
onClick={() => {
|
||||
handleViewDeviceTickets(selectedDevice);
|
||||
}}
|
||||
style={secondaryActionStyle}
|
||||
>
|
||||
查看工单
|
||||
</Button>,
|
||||
<Button
|
||||
key="createTicket"
|
||||
onClick={() => {
|
||||
handleCreateTicketForDevice(selectedDevice);
|
||||
}}
|
||||
style={secondaryActionStyle}
|
||||
>
|
||||
创建工单
|
||||
</Button>,
|
||||
<Button
|
||||
key="edit"
|
||||
type="primary"
|
||||
|
||||
Reference in New Issue
Block a user