中英文切换 初始化
This commit is contained in:
@@ -49,6 +49,7 @@ import { RootState } from '../store';
|
||||
import { getUser } from '../api/user';
|
||||
import utils, { errorLevelOptions, getWorkOrderTypeText, levelColorMap, levelNum2Text, levelText2Num, workOrderTypeOptions } from '../lib/utils';
|
||||
import { getAlarmList } from '../api/alarmApi';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const { Option } = Select;
|
||||
const { Search } = Input;
|
||||
@@ -66,14 +67,9 @@ const priorityConfig = {
|
||||
|
||||
|
||||
// 工单状态数字映射
|
||||
const orderStatusConfig = {
|
||||
1: { label: '待处理', textColor: '#1890ff' },
|
||||
2: { label: '执行中', textColor: '#1890ff' },
|
||||
4: { label: '挂起', textColor: '#faad14' },
|
||||
3: { label: '已完成', textColor: '#52c41a' },
|
||||
};
|
||||
|
||||
const WorkOrderPage = () => {
|
||||
const { t } = useTranslation();
|
||||
const [activeTab, setActiveTab] = useState('1');
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<string[]>([]); // 批量选中
|
||||
const [selectedRowKey, setSelectedRowKey] = useState('');
|
||||
@@ -112,13 +108,20 @@ const WorkOrderPage = () => {
|
||||
{ value: 2, label: '中' },
|
||||
{ value: 3, label: '低' }
|
||||
];
|
||||
const orderStatusConfig = {
|
||||
1: { label: t('constants.pending'), textColor: '#1890ff' },
|
||||
2: { label: t('workOrder.inProgress'), textColor: '#1890ff' },
|
||||
4: { label: t('workOrder.suspend'), textColor: '#faad14' },
|
||||
3: { label: t('workOrder.completed'), textColor: '#52c41a' },
|
||||
};
|
||||
|
||||
|
||||
// 状态选项
|
||||
const statusOptions = [
|
||||
{ value: 1, label: '待处理' },
|
||||
{ value: 2, label: '执行中' },
|
||||
{ value: 3, label: '已完成' },
|
||||
{ value: 4, label: '已挂起' }
|
||||
{ value: 1, label: t('constants.pending') },
|
||||
{ value: 2, label: t('workOrder.inProgress') },
|
||||
{ value: 3, label: t('workOrder.completed') },
|
||||
{ value: 4, label: t('workOrder.suspended') }
|
||||
];
|
||||
|
||||
// 分页状态
|
||||
@@ -397,7 +400,7 @@ const WorkOrderPage = () => {
|
||||
latitude: item.latitude || 0,
|
||||
},
|
||||
deviceAlias: item.drone_callsign || item.device_sn
|
||||
|| '无人机',
|
||||
|| t('constants.uav'),
|
||||
|
||||
}));
|
||||
|
||||
@@ -467,15 +470,15 @@ const WorkOrderPage = () => {
|
||||
|
||||
const getOrderStatusPieData = () => {
|
||||
const statusMap = {
|
||||
1: '待处理',
|
||||
2: '执行中',
|
||||
3: '已完成',
|
||||
4: '已挂起',
|
||||
1: t('constants.pending'),
|
||||
2: t('workOrder.inProgress'),
|
||||
3: t('workOrder.completed'),
|
||||
4: t('workOrder.suspended'),
|
||||
};
|
||||
const countMap: Record<string, number> = {};
|
||||
|
||||
workOrderList.forEach((item: any) => {
|
||||
const label = statusMap[item.orderStatus] || '其他';
|
||||
const label = statusMap[item.orderStatus] || t('constants.others');
|
||||
countMap[label] = (countMap[label] || 0) + 1;
|
||||
});
|
||||
|
||||
@@ -770,10 +773,10 @@ const WorkOrderPage = () => {
|
||||
if (!record?.id) return messageApi.warning('无效工单');
|
||||
try {
|
||||
await deleteWorkOrder(record.id);
|
||||
messageApi.success('删除成功');
|
||||
messageApi.success(t('common.deleteSuccess'));
|
||||
getWorkOrderList();
|
||||
} catch (e) {
|
||||
messageApi.error('删除失败');
|
||||
messageApi.error(t('common.deleteFail'));
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
@@ -819,23 +822,23 @@ const WorkOrderPage = () => {
|
||||
// 表格列
|
||||
const columns = [
|
||||
{ title: '工单编号', dataIndex: 'orderNo', key: 'orderNo', width: 150 },
|
||||
{ title: '工单标题', dataIndex: 'orderTitle', key: 'orderTitle', width: 200, ellipsis: true },
|
||||
{ title: t('workOrder.orderTitle'), dataIndex: 'orderTitle', key: 'orderTitle', width: 200, ellipsis: true },
|
||||
{
|
||||
title: '来源',
|
||||
title: t('workOrder.source'),
|
||||
dataIndex: 'sourceType',
|
||||
key: 'sourceType',
|
||||
width: 90,
|
||||
render: (t) => sourceTypeMap[t] || t
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
title: t('common.type'),
|
||||
dataIndex: 'orderType',
|
||||
key: 'orderType',
|
||||
width: 80,
|
||||
render: (val) => getWorkOrderTypeText(val)
|
||||
},
|
||||
{
|
||||
title: '优先级',
|
||||
title: t('workOrder.priority'),
|
||||
dataIndex: 'priorityLevel',
|
||||
key: 'priorityLevel',
|
||||
width: 80,
|
||||
@@ -846,9 +849,9 @@ const WorkOrderPage = () => {
|
||||
)
|
||||
},
|
||||
{ title: '设备', dataIndex: 'deviceId', key: 'deviceId', width: 160, ellipsis: true },
|
||||
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime', width: 160 },
|
||||
{ title: t('common.createTime'), dataIndex: 'createTime', key: 'createTime', width: 160 },
|
||||
{
|
||||
title: '状态',
|
||||
title: t('roles.status'),
|
||||
dataIndex: 'orderStatus',
|
||||
key: 'orderStatus',
|
||||
width: 100,
|
||||
@@ -860,15 +863,15 @@ const WorkOrderPage = () => {
|
||||
)
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
title: t('roles.actions'),
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: "right",
|
||||
render: (_, record) => (
|
||||
<Space size={4}>
|
||||
<Button type="link" size="small" icon={<EyeOutlined />} onClick={() => handleRowSelect(record)}>查看</Button>
|
||||
<Button type="link" size="small" icon={<EditOutlined />} onClick={() => { handleRowSelect(record); openEditModal(); }}>修改</Button>
|
||||
<Popconfirm title="确定删除?" onConfirm={() => handleDelete(record)}>
|
||||
<Button type="link" size="small" icon={<EyeOutlined />} onClick={() => handleRowSelect(record)}>{t('common.view')}</Button>
|
||||
<Button type="link" size="small" icon={<EditOutlined />} onClick={() => { handleRowSelect(record); openEditModal(); }}>{t('workOrder.modify')}</Button>
|
||||
<Popconfirm title={t('common.confirmDelete')} onConfirm={() => handleDelete(record)}>
|
||||
<Button type="link" size="small" danger icon={<DeleteOutlined />}>
|
||||
删除
|
||||
</Button>
|
||||
@@ -942,11 +945,11 @@ const WorkOrderPage = () => {
|
||||
<Form form={queryForm} layout="inline" initialValues={{
|
||||
orderStatus: 1
|
||||
}}>
|
||||
<Form.Item name="orderType" label="工单类型">
|
||||
<Form.Item name="orderType" label={t('workOrder.orderType')}>
|
||||
<Select style={{ width: 120 }} size="small" options={workOrderTypeOptions} allowClear showSearch optionFilterProp="label" filterOption={(input, option) => option.label.toLowerCase().includes(input.toLowerCase())} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="priorityLevel" label="优先级">
|
||||
<Form.Item name="priorityLevel" label={t('workOrder.priority')}>
|
||||
<Select style={{ width: 120 }} size="small" options={errorLevelOptions} allowClear />
|
||||
</Form.Item>
|
||||
|
||||
@@ -954,7 +957,7 @@ const WorkOrderPage = () => {
|
||||
<RangePicker style={{ width: 320 }} size="small" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="orderStatus" label="状态" >
|
||||
<Form.Item name="orderStatus" label={t('roles.status')} >
|
||||
<Select style={{ width: 120 }} size="small" options={statusOptions} allowClear />
|
||||
</Form.Item>
|
||||
|
||||
@@ -963,8 +966,8 @@ const WorkOrderPage = () => {
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Space>
|
||||
<Button size="small" onClick={handleReset}>重置</Button>
|
||||
<Button type="primary" size="small" icon={<SearchOutlined />} onClick={handleQuery}>查询</Button>
|
||||
<Button size="small" onClick={handleReset}>{t('common.reset')}</Button>
|
||||
<Button type="primary" size="small" icon={<SearchOutlined />} onClick={handleQuery}>{t('common.search2')}</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
@@ -1168,14 +1171,14 @@ const WorkOrderPage = () => {
|
||||
size="small"
|
||||
columns={[
|
||||
{ title: '工单编号', dataIndex: 'orderNo', width: 260 },
|
||||
{ title: '工单标题', dataIndex: 'orderTitle', ellipsis: true },
|
||||
{ title: t('workOrder.orderTitle'), dataIndex: 'orderTitle', ellipsis: true },
|
||||
{
|
||||
title: '计划执行时间',
|
||||
dataIndex: 'planStartTime',
|
||||
render: t => dayjs(t).format('YYYY-MM-DD HH:mm')
|
||||
},
|
||||
{
|
||||
title: '优先级',
|
||||
title: t('workOrder.priority'),
|
||||
dataIndex: 'priorityLevel',
|
||||
render: p => (
|
||||
<Tag
|
||||
@@ -1190,7 +1193,7 @@ const WorkOrderPage = () => {
|
||||
)
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
title: t('roles.status'),
|
||||
dataIndex: 'orderStatus',
|
||||
render: s => orderStatusConfig[s]?.label
|
||||
},
|
||||
@@ -1314,10 +1317,10 @@ const WorkOrderPage = () => {
|
||||
const status = currentDetail?.orderStatus;
|
||||
// 流程节点
|
||||
const steps = [
|
||||
{ label: '已创建', step: 1 },
|
||||
{ label: '执行中', step: 2 },
|
||||
{ label: '已挂起', step: 3 },
|
||||
{ label: '已完成', step: 4 },
|
||||
{ label: t('workOrder.created'), step: 1 },
|
||||
{ label: t('workOrder.inProgress'), step: 2 },
|
||||
{ label: t('workOrder.suspended'), step: 3 },
|
||||
{ label: t('workOrder.completed'), step: 4 },
|
||||
];
|
||||
|
||||
// 判断节点是否激活
|
||||
@@ -1433,11 +1436,11 @@ const WorkOrderPage = () => {
|
||||
</Button>
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Button icon={<EditOutlined />} block onClick={openEditModal} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>修改</Button>
|
||||
<Button icon={<EditOutlined />} block onClick={openEditModal} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>{t('workOrder.modify')}</Button>
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Popconfirm title="确定挂起?" onConfirm={handleSuspend}>
|
||||
<Button icon={<PauseOutlined />} danger ghost block style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>挂起</Button>
|
||||
<Popconfirm title={t('workOrder.confirmSuspend')} onConfirm={handleSuspend}>
|
||||
<Button icon={<PauseOutlined />} danger ghost block style={{ borderRadius: 8, height: 36, fontWeight: 600 }}>{t('workOrder.suspend')}</Button>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
<div style={{ flex: 1 }}>
|
||||
@@ -1446,7 +1449,9 @@ const WorkOrderPage = () => {
|
||||
style={{ background: '#00B42A', color: '#fff', border: 'none', borderRadius: 8, height: 36, fontWeight: 600 }}
|
||||
block
|
||||
onClick={openCompleteModal}
|
||||
>完成</Button>
|
||||
>
|
||||
{t('workOrder.complete')}
|
||||
</Button>
|
||||
</div>
|
||||
{isShowDispatch && (
|
||||
<div style={{ flex: 1 }}>
|
||||
@@ -1456,7 +1461,7 @@ const WorkOrderPage = () => {
|
||||
onClick={openDispatchUserModal} style={{ borderRadius: 8, height: 36, fontWeight: 600 }}
|
||||
icon={<PlayCircleFilled />}
|
||||
>
|
||||
派单
|
||||
{t('workOrder.dispatch')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
@@ -1465,7 +1470,7 @@ const WorkOrderPage = () => {
|
||||
|
||||
</Card>
|
||||
|
||||
<Card bordered={false} title={<Text strong style={{ fontSize: 14, color: '#1D2129' }}>AI 建议与关联信息</Text>}
|
||||
<Card bordered={false} title={<Text strong style={{ fontSize: 14, color: '#1D2129' }}>{t('workOrder.aiSuggestion')}</Text>}
|
||||
style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: '16px' }}>
|
||||
<Row gutter={12} style={{ marginBottom: 16 }}>
|
||||
<Col span={8}>
|
||||
@@ -1473,8 +1478,8 @@ const WorkOrderPage = () => {
|
||||
<div style={{ width: 32, height: 32, background: '#fff', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px', boxShadow: '0 2px 6px rgba(114,46,209,0.1)' }}>
|
||||
<RobotOutlined style={{ fontSize: 18, color: '#722ED1' }} />
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>建议携带</div>
|
||||
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>红外热像设备</div>
|
||||
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>{t('workOrder.suggestedEquipment')}</div>
|
||||
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>{t('workOrder.thermalCamera')}</div>
|
||||
</div>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
@@ -1482,7 +1487,7 @@ const WorkOrderPage = () => {
|
||||
<div style={{ width: 32, height: 32, background: '#fff', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px', boxShadow: '0 2px 6px rgba(0,180,42,0.1)' }}>
|
||||
<ThunderboltOutlined style={{ fontSize: 18, color: '#00B42A' }} />
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>优先复检组件</div>
|
||||
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>{t('workOrder.priorityInspect')}</div>
|
||||
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129' }}>B-12-03 / B-12-05</div>
|
||||
</div>
|
||||
</Col>
|
||||
@@ -1491,7 +1496,7 @@ const WorkOrderPage = () => {
|
||||
<div style={{ width: 32, height: 32, background: '#fff', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', margin: '0 auto 10px', boxShadow: '0 2px 6px rgba(247,186,30,0.1)' }}>
|
||||
<RiseOutlined style={{ fontSize: 18, color: '#F7BA1E' }} />
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>预计影响发电</div>
|
||||
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 4 }}>{t('workOrder.estimatedImpact')}</div>
|
||||
<div style={{ fontSize: 13, fontWeight: 800, color: '#1D2129' }}>2.1%</div>
|
||||
</div>
|
||||
</Col>
|
||||
@@ -1499,7 +1504,7 @@ const WorkOrderPage = () => {
|
||||
|
||||
<Row gutter={12}>
|
||||
<Col span={13}>
|
||||
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129', marginBottom: 12 }}>关联告警趋势 <Text type="secondary" style={{ fontSize: 11, fontWeight: 400 }}>(近 7 天)</Text></div>
|
||||
<div style={{ fontSize: 12, fontWeight: 700, color: '#1D2129', marginBottom: 12 }}>{t('workOrder.relatedAlertTrend')} <Text type="secondary" style={{ fontSize: 11, fontWeight: 400 }}>{t('workOrder.near7Days')}</Text></div>
|
||||
<UniversalLineChart
|
||||
data={alarmChartData}
|
||||
xKey="date"
|
||||
@@ -1511,9 +1516,9 @@ const WorkOrderPage = () => {
|
||||
smooth
|
||||
dot
|
||||
series={[
|
||||
{ key: 'ERROR', name: '高告警', color: '#FF4D4F', strokeWidth: 2 },
|
||||
{ key: 'WARNING', name: '中告警', color: '#FA8C16', strokeWidth: 2 },
|
||||
{ key: 'INFO', name: '低告警', color: '#52c41a', strokeWidth: 2 },
|
||||
{ key: 'ERROR', name: t('workOrder.highAlarm'), color: '#FF4D4F', strokeWidth: 2 },
|
||||
{ key: 'WARNING', name: t('workOrder.midAlarm'), color: '#FA8C16', strokeWidth: 2 },
|
||||
{ key: 'INFO', name: t('workOrder.lowAlarm'), color: '#52c41a', strokeWidth: 2 },
|
||||
]}
|
||||
/>
|
||||
</Col>
|
||||
@@ -1532,7 +1537,7 @@ const WorkOrderPage = () => {
|
||||
)} </div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
|
||||
{latestThreeAlarm.length === 0 ? (
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>近7天无告警记录</Text>
|
||||
<Text type="secondary" style={{ fontSize: 11 }}>{t('workOrder.noAlerts7d')}</Text>
|
||||
) : (
|
||||
<>
|
||||
{latestThreeAlarm.map((item, idx) => (
|
||||
@@ -1588,36 +1593,36 @@ const WorkOrderPage = () => {
|
||||
</Row>
|
||||
|
||||
{/* 修改工单弹窗 */}
|
||||
<Modal title="修改工单" open={editModalVisible} onCancel={() => setEditModalVisible(false)} footer={null} width={520}>
|
||||
<Modal title={t('workOrder.modifyOrder')} open={editModalVisible} onCancel={() => setEditModalVisible(false)} footer={null} width={520}>
|
||||
<Form form={form} layout="vertical" onFinish={submitEdit}>
|
||||
<FormItem name="orderTitle" label="工单标题" rules={[{ required: true, message: '请输入工单标题' }]}>
|
||||
<Input placeholder="请输入工单标题" />
|
||||
<FormItem name="orderTitle" label={t('workOrder.orderTitle')} rules={[{ required: true, message: t('workOrder.pleaseInputTitle') }]}>
|
||||
<Input placeholder={t('workOrder.pleaseInputTitle')} />
|
||||
</FormItem>
|
||||
<FormItem name="orderType" label="工单类型" rules={[{ required: true, message: '请选择工单类型' }]}>
|
||||
<Select placeholder="请选择工单类型" options={workOrderTypeOptions} />
|
||||
<FormItem name="orderType" label={t('workOrder.orderType')} rules={[{ required: true, message: t('workOrder.pleaseSelectType') }]}>
|
||||
<Select placeholder={t('workOrder.pleaseSelectType')} options={workOrderTypeOptions} />
|
||||
|
||||
</FormItem>
|
||||
<FormItem name="priorityLevel" label="优先级" rules={[{ required: true, message: '请选择优先级' }]}>
|
||||
{/*<Select placeholder="请选择优先级">
|
||||
<FormItem name="priorityLevel" label={t('workOrder.priority')} rules={[{ required: true, message: t('workOrder.pleaseSelectPriority') }]}>
|
||||
{/*<Select placeholder={t('workOrder.pleaseSelectPriority')}>
|
||||
<Option value={1}>ERROR(高)</Option><Option value={2}>WARNING</Option><Option value={3}>INFO</Option>
|
||||
</Select>*/}
|
||||
<Form.Item name="priorityLevel" label="优先级">
|
||||
<Form.Item name="priorityLevel" label={t('workOrder.priority')}>
|
||||
<Select options={errorLevelOptions} allowClear />
|
||||
</Form.Item>
|
||||
</FormItem>
|
||||
<FormItem name="taskDescription" label="任务描述" rules={[{ required: true, message: '请输入任务描述' }]}>
|
||||
<FormItem name="taskDescription" label={t('workOrder.taskDescription')} rules={[{ required: true, message: '请输入任务描述' }]}>
|
||||
<Input.TextArea rows={4} placeholder="请输入任务描述" />
|
||||
</FormItem>
|
||||
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
|
||||
<Button onClick={() => setEditModalVisible(false)}>取消</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认修改</Button>
|
||||
<Button onClick={() => setEditModalVisible(false)}>{t('common.cancel')}</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>{t('profile.confirmChange')}</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
{/* 派单弹窗:选择人员 */}
|
||||
<Modal
|
||||
title="工单派单"
|
||||
title={t('workOrder.dispatchOrder')}
|
||||
open={dispatchUserModalVisible}
|
||||
onCancel={() => setDispatchUserModalVisible(false)}
|
||||
footer={null}
|
||||
@@ -1641,8 +1646,8 @@ const WorkOrderPage = () => {
|
||||
</FormItem>
|
||||
<FormItem
|
||||
name="assignUserId"
|
||||
label="选择接收人员"
|
||||
rules={[{ required: true, message: '请选择派单人员' }]}
|
||||
label={t('workOrder.selectReceiver')}
|
||||
rules={[{ required: true, message: t('workOrder.pleaseSelectDispatcher') }]}
|
||||
>
|
||||
<Select
|
||||
placeholder="请选择人员"
|
||||
@@ -1659,15 +1664,15 @@ const WorkOrderPage = () => {
|
||||
/>
|
||||
</FormItem>
|
||||
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
|
||||
<Button onClick={() => setDispatchUserModalVisible(false)}>取消</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认派单</Button>
|
||||
<Button onClick={() => setDispatchUserModalVisible(false)}>{t('common.cancel')}</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>{t('workOrder.confirmDispatch')}</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
|
||||
{/* 执行工单弹窗 */}
|
||||
<Modal title="执行工单" open={dispatchModalVisible} onCancel={() => setDispatchModalVisible(false)} footer={null} width={550}>
|
||||
<Modal title={t('workOrder.executeOrder')} open={dispatchModalVisible} onCancel={() => setDispatchModalVisible(false)} footer={null} width={550}>
|
||||
<Form form={form} layout="vertical" onFinish={submitExecute}>
|
||||
<FormItem name="orderIds" label="工单ID" hidden><Input /></FormItem>
|
||||
<FormItem label="选中工单">
|
||||
@@ -1693,7 +1698,7 @@ const WorkOrderPage = () => {
|
||||
</FormItem>
|
||||
<FormItem
|
||||
name="deviceId"
|
||||
label="选择执行设备"
|
||||
label={t('workOrder.selectDevice')}
|
||||
>
|
||||
{/*<Select
|
||||
style={{ width: "80%", marginBottom: 8 }}
|
||||
@@ -1708,8 +1713,8 @@ const WorkOrderPage = () => {
|
||||
String(option?.label || "").toLowerCase().includes(input.toLowerCase())
|
||||
}
|
||||
options={[
|
||||
{ label: <span>机器人</span>, options: devices.map(item => ({ value: item.device_sn || item.serialNumber, label: item.deviceAlias || item.deviceName || '未知设备' })) },
|
||||
{ label: <span>无人机</span>, options: planedevices.map(item => ({ value: item.device_sn, label: item.drone_callsign || item.callsign || '未知设备' })) },
|
||||
{ label: <span>devices.robot</span>, options: devices.map(item => ({ value: item.device_sn || item.serialNumber, label: item.deviceAlias || item.deviceName || '未知设备' })) },
|
||||
{ label: <span>constants.uav</span>, options: planedevices.map(item => ({ value: item.device_sn, label: item.drone_callsign || item.callsign || '未知设备' })) },
|
||||
]}
|
||||
/>*/}
|
||||
|
||||
@@ -1724,7 +1729,7 @@ const WorkOrderPage = () => {
|
||||
}}
|
||||
>
|
||||
{/* 机器人设备分组 */}
|
||||
<Select.OptGroup label="机器人">
|
||||
<Select.OptGroup label={t('devices.robot')}>
|
||||
{deviceAll
|
||||
.filter(item => item.serialNumber)
|
||||
.map(device => (
|
||||
@@ -1738,7 +1743,7 @@ const WorkOrderPage = () => {
|
||||
</Select.OptGroup>
|
||||
|
||||
{/* 无人机分组 */}
|
||||
<Select.OptGroup label="无人机">
|
||||
<Select.OptGroup label={t('constants.uav')}>
|
||||
{deviceAll
|
||||
.filter(item => item.device_sn)
|
||||
.map(device => (
|
||||
@@ -1755,7 +1760,7 @@ const WorkOrderPage = () => {
|
||||
|
||||
{/*<FormItem
|
||||
name="startTime"
|
||||
label="执行开始时间"
|
||||
label={t('workOrder.execStartTime')}
|
||||
>
|
||||
<DatePicker
|
||||
showTime
|
||||
@@ -1765,33 +1770,33 @@ const WorkOrderPage = () => {
|
||||
/>
|
||||
</FormItem>*/}
|
||||
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
|
||||
<Button onClick={() => setDispatchModalVisible(false)}>取消</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认执行</Button>
|
||||
<Button onClick={() => setDispatchModalVisible(false)}>{t('common.cancel')}</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>{t('workOrder.confirmExecute')}</Button>
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
{/* 完成工单弹窗 */}
|
||||
<Modal title="完成工单" open={completeModalVisible} onCancel={() => setCompleteModalVisible(false)} footer={null} width={500}>
|
||||
<Modal title={t('workOrder.completeOrder')} open={completeModalVisible} onCancel={() => setCompleteModalVisible(false)} footer={null} width={500}>
|
||||
<Form form={completeForm} layout="vertical" onFinish={submitComplete}>
|
||||
<Form.Item name="id" hidden><Input /></Form.Item>
|
||||
<Form.Item name="orderNo" label="工单编号"><Input disabled /></Form.Item>
|
||||
<Form.Item name="handleResult" label="处理结果" rules={[{ required: true, message: '请输入处理结果' }]}>
|
||||
<Form.Item name="handleResult" label={t('alerts.handleResult')} rules={[{ required: true, message: '请输入处理结果' }]}>
|
||||
<Select placeholder="请选择处理结果">
|
||||
<Option value="已处理完成">已处理完成</Option><Option value="已修复">已修复</Option><Option value="无需处理">无需处理</Option><Option value="问题已闭环">问题已闭环</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="handleRemark" label="处理备注"><Input.TextArea rows={4} placeholder="请填写处理详情、备注信息" /></Form.Item>
|
||||
<Form.Item name="handleRemark" label={t('alerts.handleRemark')}><Input.TextArea rows={4} placeholder="请填写处理详情、备注信息" /></Form.Item>
|
||||
<Form.Item style={{ textAlign: 'right', marginBottom: 0 }}>
|
||||
<Button onClick={() => setCompleteModalVisible(false)}>取消</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认完成</Button>
|
||||
<Button onClick={() => setCompleteModalVisible(false)}>{t('common.cancel')}</Button>
|
||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>{t('workOrder.confirmComplete')}</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
|
||||
{/* 近7天全部告警弹窗 */}
|
||||
<Modal
|
||||
title="近7天全部关联告警"
|
||||
title={t('workOrder.relatedAlerts7d')}
|
||||
open={alarmAllModalVisible}
|
||||
onCancel={() => setAlarmAllModalVisible(false)}
|
||||
width={900}
|
||||
@@ -1816,33 +1821,33 @@ const WorkOrderPage = () => {
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '告警级别',
|
||||
title: t('alerts.alertLevel'),
|
||||
dataIndex: 'alarmLevel',
|
||||
width: 90,
|
||||
render: (level) => {
|
||||
const color = levelColorMap[level] || '#86909C';
|
||||
const label = priorityConfig[level]?.label || '未知';
|
||||
const label = priorityConfig[level]?.label || t('constants.locationUnknown');
|
||||
return <Tag color={color}>{label}</Tag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '告警时间',
|
||||
title: t('alerts.alertTime'),
|
||||
dataIndex: 'alarmTime',
|
||||
width: 170,
|
||||
render: (t) => dayjs(t).format('YYYY-MM-DD HH:mm:ss')
|
||||
},
|
||||
{
|
||||
title: '设备名称',
|
||||
title: t('devices.deviceName'),
|
||||
dataIndex: 'deviceName',
|
||||
ellipsis: true,
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
title: '处理状态',
|
||||
title: t('alerts.handleStatus'),
|
||||
dataIndex: 'handleStatus',
|
||||
width: 100,
|
||||
render: (s) => {
|
||||
const map = { 1: '待处理', 2: '已关闭', };
|
||||
const map = { 1: t('constants.pending'), 2: t('constants.closed'), };
|
||||
let tagColor = 'default';
|
||||
if (s === 1) tagColor = 'orange';
|
||||
if (s === 2) tagColor = 'green';
|
||||
|
||||
Reference in New Issue
Block a user