|
@@ -2,9 +2,8 @@ import React, { useState, useEffect, useRef, useMemo } from 'react';
|
|
|
import { Search, Plus, RefreshCw, Edit2, Trash2, Settings, ArrowUpDown } from 'lucide-react';
|
|
import { Search, Plus, RefreshCw, Edit2, Trash2, Settings, ArrowUpDown } from 'lucide-react';
|
|
|
import { padLockApi, PadLockVO, PageParam } from '../api/PadLock';
|
|
import { padLockApi, PadLockVO, PageParam } from '../api/PadLock';
|
|
|
import { padLockTypeApi, PadLockTypeVO, PageParam as PadLockTypePageParam } from '../api/PadLockType';
|
|
import { padLockTypeApi, PadLockTypeVO, PageParam as PadLockTypePageParam } from '../api/PadLockType';
|
|
|
-import { hardwareApi } from '../api/Hardware';
|
|
|
|
|
import { toast } from 'sonner';
|
|
import { toast } from 'sonner';
|
|
|
-import { Modal, Button, Input, Space, Table, Select, TreeSelect, Form, Image, Switch, Radio, Tooltip } from 'antd';
|
|
|
|
|
|
|
+import { Modal, Button, Input, Space, Table, TreeSelect, Form, Image, Switch, Radio, Tooltip } from 'antd';
|
|
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
|
import { handleTree } from '../utils/tree';
|
|
import { handleTree } from '../utils/tree';
|
|
@@ -348,12 +347,6 @@ export default function PadLockManagement({ subMenu }: PadLockManagementProps) {
|
|
|
width: 180,
|
|
width: 180,
|
|
|
ellipsis: true,
|
|
ellipsis: true,
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- title: t('table.hardwareName'),
|
|
|
|
|
- dataIndex: 'hardwareName',
|
|
|
|
|
- width: 150,
|
|
|
|
|
- render: (text: string) => text || '-',
|
|
|
|
|
- },
|
|
|
|
|
{
|
|
{
|
|
|
title: t('table.padLockType'),
|
|
title: t('table.padLockType'),
|
|
|
dataIndex: 'lockTypeName',
|
|
dataIndex: 'lockTypeName',
|
|
@@ -1014,7 +1007,6 @@ function PadLockFormModal({ visible, editingPadLock, onCancel, onSave }: PadLock
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
const [form] = Form.useForm();
|
|
const [form] = Form.useForm();
|
|
|
const [formLoading, setFormLoading] = useState(false);
|
|
const [formLoading, setFormLoading] = useState(false);
|
|
|
- const [hardwareOptions, setHardwareOptions] = useState<{ label: string; value: number }[]>([]);
|
|
|
|
|
const [lockTypeTreeOptions, setLockTypeTreeOptions] = useState<any[]>([]);
|
|
const [lockTypeTreeOptions, setLockTypeTreeOptions] = useState<any[]>([]);
|
|
|
const statusOptions = useMemo(() => {
|
|
const statusOptions = useMemo(() => {
|
|
|
// 使用默认状态选项
|
|
// 使用默认状态选项
|
|
@@ -1024,20 +1016,6 @@ function PadLockFormModal({ visible, editingPadLock, onCancel, onSave }: PadLock
|
|
|
];
|
|
];
|
|
|
}, [t]);
|
|
}, [t]);
|
|
|
|
|
|
|
|
- // 获取硬件列表
|
|
|
|
|
- const getHardwareList = async () => {
|
|
|
|
|
- try {
|
|
|
|
|
- const response = await hardwareApi.listHardware({ pageNo: 1, pageSize: -1 });
|
|
|
|
|
- const options = response.list.map(item => ({
|
|
|
|
|
- label: item.hardwareName,
|
|
|
|
|
- value: item.id!,
|
|
|
|
|
- }));
|
|
|
|
|
- setHardwareOptions(options);
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error(t('padLockManagement.getHardwareListFailed'), error);
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
// 获取挂锁类型列表
|
|
// 获取挂锁类型列表
|
|
|
const getLockTypeList = async () => {
|
|
const getLockTypeList = async () => {
|
|
|
try {
|
|
try {
|
|
@@ -1068,7 +1046,6 @@ function PadLockFormModal({ visible, editingPadLock, onCancel, onSave }: PadLock
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (visible) {
|
|
if (visible) {
|
|
|
- getHardwareList();
|
|
|
|
|
getLockTypeList();
|
|
getLockTypeList();
|
|
|
|
|
|
|
|
if (editingPadLock) {
|
|
if (editingPadLock) {
|
|
@@ -1140,17 +1117,6 @@ function PadLockFormModal({ visible, editingPadLock, onCancel, onSave }: PadLock
|
|
|
wrapperCol={{ span: 18 }}
|
|
wrapperCol={{ span: 18 }}
|
|
|
className="mt-4"
|
|
className="mt-4"
|
|
|
>
|
|
>
|
|
|
- <Form.Item
|
|
|
|
|
- label={t('table.hardwareName')}
|
|
|
|
|
- name="hardwareId"
|
|
|
|
|
- >
|
|
|
|
|
- <Select
|
|
|
|
|
- placeholder={t('form.hardwareNamePlaceholder')}
|
|
|
|
|
- allowClear
|
|
|
|
|
- options={hardwareOptions}
|
|
|
|
|
- />
|
|
|
|
|
- </Form.Item>
|
|
|
|
|
-
|
|
|
|
|
<Form.Item
|
|
<Form.Item
|
|
|
label={t('form.padLockType')}
|
|
label={t('form.padLockType')}
|
|
|
name="lockTypeId"
|
|
name="lockTypeId"
|