2026-05-15 09:37:22 +08:00
|
|
|
|
import React, { useState, useRef, useEffect } from 'react';
|
2026-05-13 13:16:36 +08:00
|
|
|
|
import {
|
2026-05-14 08:45:14 +08:00
|
|
|
|
Form, Select, Button, Space, message, Card, Typography,
|
|
|
|
|
|
Row, Col, Modal, Input
|
2026-05-13 13:16:36 +08:00
|
|
|
|
} from 'antd';
|
|
|
|
|
|
import QRCode from 'qrcode';
|
2026-05-14 08:45:14 +08:00
|
|
|
|
import DictManager from "../DictManager";
|
2026-05-15 10:03:33 +08:00
|
|
|
|
import request from '../../api/request'; import { Country, State } from 'country-state-city';
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-05-13 13:16:36 +08:00
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
// 接口导入
|
|
|
|
|
|
import {
|
|
|
|
|
|
getRobotTypeListApi,
|
|
|
|
|
|
addRobotTypeApi,
|
|
|
|
|
|
updateRobotTypeApi,
|
|
|
|
|
|
deleteRobotTypeApi,
|
|
|
|
|
|
getRobotProvinceListApi,
|
|
|
|
|
|
addRobotProvinceApi,
|
|
|
|
|
|
updateRobotProvinceApi,
|
|
|
|
|
|
deleteRobotProvinceApi,
|
|
|
|
|
|
getRobotModelPageApi,
|
2026-05-15 10:03:33 +08:00
|
|
|
|
addRobotModelApi,
|
|
|
|
|
|
updateRobotModelApi,
|
|
|
|
|
|
deleteRobotModelApi,
|
|
|
|
|
|
getRobotCountryListApi,
|
|
|
|
|
|
addRobotCountryApi,
|
|
|
|
|
|
updateRobotCountryApi,
|
|
|
|
|
|
deleteRobotCountryApi,
|
|
|
|
|
|
getRobotConfigListApi,
|
|
|
|
|
|
addRobotConfigApi,
|
|
|
|
|
|
updateRobotConfigApi,
|
|
|
|
|
|
deleteRobotConfigApi,
|
2026-05-15 09:37:22 +08:00
|
|
|
|
} from '../../api/systemSetting';
|
2026-05-13 13:16:36 +08:00
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
const { Text } = Typography;
|
2026-05-13 13:16:36 +08:00
|
|
|
|
|
|
|
|
|
|
const SerialNumGenerate = () => {
|
2026-05-15 10:03:33 +08:00
|
|
|
|
// 获取国家
|
|
|
|
|
|
const countries1 = Country.getAllCountries();
|
|
|
|
|
|
// 根据国家获取省份
|
|
|
|
|
|
const states = State.getStatesOfCountry('CN');
|
2026-05-13 13:16:36 +08:00
|
|
|
|
const [form] = Form.useForm();
|
|
|
|
|
|
const [qrUrl, setQrUrl] = useState('');
|
2026-05-13 13:31:49 +08:00
|
|
|
|
const [serialNumber, setSerialNumber] = useState('');
|
|
|
|
|
|
const [qrJson, setQrJson] = useState('');
|
2026-05-13 13:16:36 +08:00
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
|
|
const qrRef = useRef(null);
|
2026-05-13 13:31:49 +08:00
|
|
|
|
|
2026-05-14 08:45:14 +08:00
|
|
|
|
const [queryCode, setQueryCode] = useState('');
|
|
|
|
|
|
const [queryLoading, setQueryLoading] = useState(false);
|
2026-05-13 13:16:36 +08:00
|
|
|
|
const [manageVisible, setManageVisible] = useState(false);
|
|
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
// 接口数据
|
|
|
|
|
|
const [types, setTypes] = useState([]);
|
|
|
|
|
|
const [models, setModels] = useState([]);
|
|
|
|
|
|
const [provinces, setProvinces] = useState([]);
|
2026-05-15 10:03:33 +08:00
|
|
|
|
const [countries, setCountries] = useState([]);
|
|
|
|
|
|
const [configs, setConfigs] = useState([]);
|
2026-05-15 09:37:22 +08:00
|
|
|
|
|
|
|
|
|
|
// 初始化加载
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
loadTypeList();
|
|
|
|
|
|
loadModelList();
|
|
|
|
|
|
loadProvinceList();
|
2026-05-15 10:03:33 +08:00
|
|
|
|
loadCountryList();
|
|
|
|
|
|
loadConfigList();
|
2026-05-15 09:37:22 +08:00
|
|
|
|
}, []);
|
2026-05-13 13:16:36 +08:00
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
// 加载机器人类型
|
|
|
|
|
|
const loadTypeList = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getRobotTypeListApi({});
|
2026-05-15 10:03:33 +08:00
|
|
|
|
if (res?.code == 200) {
|
|
|
|
|
|
setTypes(res.data || []);
|
|
|
|
|
|
}
|
2026-05-15 09:37:22 +08:00
|
|
|
|
} catch (e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 加载机器人型号
|
|
|
|
|
|
const loadModelList = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getRobotModelPageApi({ pageNum: 1, pageSize: 100 });
|
2026-05-15 10:03:33 +08:00
|
|
|
|
if (res?.code == 200) {
|
|
|
|
|
|
setModels(res?.data || []);
|
|
|
|
|
|
}
|
2026-05-15 09:37:22 +08:00
|
|
|
|
} catch (e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 加载省份
|
|
|
|
|
|
const loadProvinceList = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getRobotProvinceListApi({});
|
|
|
|
|
|
setProvinces(res.rows || []);
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
message.error('加载省份失败');
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-15 10:03:33 +08:00
|
|
|
|
// 加载国家
|
|
|
|
|
|
const loadCountryList = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getRobotCountryListApi({});
|
|
|
|
|
|
setCountries(res.rows || []);
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
message.error('加载国家失败');
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 加载配置
|
|
|
|
|
|
const loadConfigList = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getRobotConfigListApi({});
|
|
|
|
|
|
setConfigs(res.rows || []);
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
message.error('加载配置失败');
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
// 生成序号
|
2026-05-13 13:31:49 +08:00
|
|
|
|
const generateSerialSuffix = () => {
|
|
|
|
|
|
const num = Math.floor(Math.random() * 100000000).toString(16).toUpperCase().padStart(8, '0');
|
|
|
|
|
|
const check = Math.floor(Math.random() * 256).toString(16).toUpperCase().padStart(2, '0');
|
|
|
|
|
|
return `${num}-${check}`;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
// 生成二维码
|
2026-05-13 13:16:36 +08:00
|
|
|
|
const generateQRCode = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const values = await form.validateFields();
|
2026-05-13 13:31:49 +08:00
|
|
|
|
const { model, config, type, country, province } = values;
|
|
|
|
|
|
const ts = Date.now();
|
|
|
|
|
|
const suffix = generateSerialSuffix();
|
|
|
|
|
|
const sn = `${model}${config}-${country}-${province}-${ts}-${suffix}`;
|
|
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
const qrData = { model, config, type, country, province, sn };
|
2026-05-13 13:31:49 +08:00
|
|
|
|
const qrContent = JSON.stringify(qrData, null, 2);
|
2026-05-13 13:16:36 +08:00
|
|
|
|
const url = await QRCode.toDataURL(qrContent);
|
2026-05-13 13:31:49 +08:00
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
setSerialNumber(sn);
|
|
|
|
|
|
setQrJson(qrContent);
|
|
|
|
|
|
setQrUrl(url);
|
2026-05-13 13:16:36 +08:00
|
|
|
|
message.success('生成成功!');
|
2026-05-13 13:31:49 +08:00
|
|
|
|
} catch (err) {
|
|
|
|
|
|
message.error('请完善信息');
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
// 下载
|
2026-05-13 13:31:49 +08:00
|
|
|
|
const downloadQRCode = () => {
|
|
|
|
|
|
if (!qrRef.current || !qrUrl) {
|
|
|
|
|
|
message.warning('请先生成二维码');
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
const link = document.createElement('a');
|
|
|
|
|
|
link.download = `${serialNumber || 'qrcode'}.png`;
|
|
|
|
|
|
link.href = qrUrl;
|
|
|
|
|
|
link.click();
|
2026-05-13 13:16:36 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
// 保存序列号
|
2026-05-13 13:16:36 +08:00
|
|
|
|
const saveToDatabase = async () => {
|
2026-05-15 09:37:22 +08:00
|
|
|
|
if (!serialNumber) return message.warning('请先生成');
|
2026-05-13 13:16:36 +08:00
|
|
|
|
setLoading(true);
|
|
|
|
|
|
try {
|
2026-05-15 09:37:22 +08:00
|
|
|
|
await request({
|
|
|
|
|
|
url: '/iot/device/saveSerial',
|
|
|
|
|
|
method: 'post',
|
|
|
|
|
|
data: {
|
|
|
|
|
|
serialNumber,
|
|
|
|
|
|
model: form.getFieldValue('model'),
|
|
|
|
|
|
config: form.getFieldValue('config'),
|
|
|
|
|
|
type: form.getFieldValue('type'),
|
|
|
|
|
|
country: form.getFieldValue('country'),
|
|
|
|
|
|
province: form.getFieldValue('province'),
|
|
|
|
|
|
qrCode: qrUrl,
|
|
|
|
|
|
qrJson: qrJson
|
|
|
|
|
|
}
|
2026-05-13 13:31:49 +08:00
|
|
|
|
});
|
2026-05-13 13:16:36 +08:00
|
|
|
|
message.success('保存成功');
|
2026-05-15 09:37:22 +08:00
|
|
|
|
} catch (e) {
|
2026-05-13 13:16:36 +08:00
|
|
|
|
message.error('保存失败');
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
// 查询
|
2026-05-14 08:45:14 +08:00
|
|
|
|
const handleQueryQRCode = async () => {
|
|
|
|
|
|
if (!queryCode) return message.warning('请输入序列号');
|
|
|
|
|
|
setQueryLoading(true);
|
|
|
|
|
|
try {
|
2026-05-15 09:37:22 +08:00
|
|
|
|
const res = await request({
|
|
|
|
|
|
url: '/iot/device/querySerial',
|
|
|
|
|
|
method: 'get',
|
|
|
|
|
|
params: { sn: queryCode }
|
|
|
|
|
|
});
|
|
|
|
|
|
if (res.data) {
|
|
|
|
|
|
setSerialNumber(res.data.serialNumber);
|
|
|
|
|
|
setQrUrl(res.data.qrCode);
|
|
|
|
|
|
setQrJson(res.data.qrJson);
|
|
|
|
|
|
form.setFieldsValue({
|
|
|
|
|
|
model: res.data.model,
|
|
|
|
|
|
config: res.data.config,
|
|
|
|
|
|
type: res.data.type,
|
|
|
|
|
|
country: res.data.country,
|
|
|
|
|
|
province: res.data.province
|
|
|
|
|
|
});
|
2026-05-14 08:45:14 +08:00
|
|
|
|
message.success('查询成功');
|
|
|
|
|
|
} else {
|
2026-05-15 09:37:22 +08:00
|
|
|
|
message.warning('未查询到数据');
|
2026-05-14 08:45:14 +08:00
|
|
|
|
}
|
2026-05-15 09:37:22 +08:00
|
|
|
|
} catch (e) {
|
2026-05-14 08:45:14 +08:00
|
|
|
|
message.error('查询失败');
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
setQueryLoading(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-15 10:03:33 +08:00
|
|
|
|
// ==================== 类型 ====================
|
2026-05-15 09:37:22 +08:00
|
|
|
|
const handleAddType = async (values) => {
|
2026-05-15 10:03:33 +08:00
|
|
|
|
return await addRobotTypeApi({
|
2026-05-15 09:37:22 +08:00
|
|
|
|
storeValue: values.storeValue,
|
2026-05-15 10:03:33 +08:00
|
|
|
|
displayName: values.displayName,
|
2026-05-15 09:37:22 +08:00
|
|
|
|
remark: values.remark || ''
|
2026-05-15 10:03:33 +08:00
|
|
|
|
});
|
2026-05-15 09:37:22 +08:00
|
|
|
|
};
|
|
|
|
|
|
const handleUpdateType = async (values) => {
|
2026-05-15 10:03:33 +08:00
|
|
|
|
return await updateRobotTypeApi({
|
2026-05-15 09:37:22 +08:00
|
|
|
|
id: values.id,
|
|
|
|
|
|
storeValue: values.storeValue,
|
2026-05-15 10:03:33 +08:00
|
|
|
|
displayName: values.displayName,
|
2026-05-15 09:37:22 +08:00
|
|
|
|
remark: values.remark || ''
|
2026-05-15 10:03:33 +08:00
|
|
|
|
});
|
2026-05-15 09:37:22 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-15 10:03:33 +08:00
|
|
|
|
// ==================== 型号 ====================
|
2026-05-15 09:37:22 +08:00
|
|
|
|
const handleAddModel = async (values) => {
|
2026-05-15 10:03:33 +08:00
|
|
|
|
return await addRobotModelApi({
|
2026-05-15 09:37:22 +08:00
|
|
|
|
modelName: values.modelName,
|
|
|
|
|
|
storeValue: values.storeValue,
|
2026-05-15 10:03:33 +08:00
|
|
|
|
displayName: ''
|
|
|
|
|
|
});
|
2026-05-15 09:37:22 +08:00
|
|
|
|
};
|
|
|
|
|
|
const handleUpdateModel = async (values) => {
|
2026-05-15 10:03:33 +08:00
|
|
|
|
return await updateRobotModelApi({
|
2026-05-15 09:37:22 +08:00
|
|
|
|
id: values.id,
|
|
|
|
|
|
modelName: values.modelName,
|
2026-05-15 10:03:33 +08:00
|
|
|
|
displayName: values.displayName
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== 省份 ====================
|
|
|
|
|
|
const handleAddProvince = async (values) => {
|
|
|
|
|
|
return await addRobotProvinceApi({
|
2026-05-15 09:37:22 +08:00
|
|
|
|
storeValue: values.storeValue,
|
2026-05-15 10:03:33 +08:00
|
|
|
|
displayName: values.displayName,
|
|
|
|
|
|
remark: values.remark || ''
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleUpdateProvince = async (values) => {
|
|
|
|
|
|
return await updateRobotProvinceApi({
|
|
|
|
|
|
id: values.id,
|
|
|
|
|
|
storeValue: values.storeValue,
|
|
|
|
|
|
displayName: values.displayName,
|
2026-05-15 09:37:22 +08:00
|
|
|
|
remark: values.remark || ''
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-15 10:03:33 +08:00
|
|
|
|
// ==================== 国家 ====================
|
|
|
|
|
|
const handleAddCountry = async (values) => {
|
|
|
|
|
|
return await addRobotCountryApi({
|
|
|
|
|
|
countryName: values.countryName,
|
|
|
|
|
|
displayName: values.displayName
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleUpdateCountry = async (values) => {
|
|
|
|
|
|
return await updateRobotCountryApi({
|
|
|
|
|
|
id: values.id,
|
|
|
|
|
|
countryName: values.countryName,
|
|
|
|
|
|
displayName: values.displayName
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== 配置 ====================
|
|
|
|
|
|
const handleAddConfig = async (values) => {
|
|
|
|
|
|
return await addRobotConfigApi({
|
|
|
|
|
|
configName: values.configName,
|
|
|
|
|
|
displayName: values.displayName
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
const handleUpdateConfig = async (values) => {
|
|
|
|
|
|
return await updateRobotConfigApi({
|
|
|
|
|
|
id: values.id,
|
|
|
|
|
|
configName: values.configName,
|
|
|
|
|
|
displayName: values.displayName
|
2026-05-15 09:37:22 +08:00
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-13 13:16:36 +08:00
|
|
|
|
return (
|
|
|
|
|
|
<div style={{ padding: '0 20px', minHeight: '100vh' }}>
|
|
|
|
|
|
<Card
|
|
|
|
|
|
title="机器人序列号二维码生成器"
|
2026-05-13 13:31:49 +08:00
|
|
|
|
style={{ maxWidth: 1000, margin: '0 auto', borderRadius: 12 }}
|
2026-05-13 13:16:36 +08:00
|
|
|
|
extra={<Button type="primary" onClick={() => setManageVisible(true)}>数据管理</Button>}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Row gutter={[32, 24]}>
|
|
|
|
|
|
<Col xs={24} md={14}>
|
|
|
|
|
|
<Form form={form} initialValues={{ type: 'mower' }} labelCol={{ md: 5 }} wrapperCol={{ md: 19 }} size="large">
|
|
|
|
|
|
<Form.Item name="model" label="型号" rules={[{ required: true }]}>
|
|
|
|
|
|
<Select placeholder="选择型号">
|
2026-05-15 09:37:22 +08:00
|
|
|
|
{models.map(m => (
|
2026-05-15 10:03:33 +08:00
|
|
|
|
<Select.Option key={m.id} value={m.displayName}>{m.modelName}</Select.Option>
|
2026-05-15 09:37:22 +08:00
|
|
|
|
))}
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</Select>
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item name="config" label="配置" rules={[{ required: true }]}>
|
|
|
|
|
|
<Select placeholder="选择配置">
|
2026-05-15 10:03:33 +08:00
|
|
|
|
{configs.map(c => (
|
|
|
|
|
|
<Select.Option key={c.id} value={c.displayName}>{c.configName}</Select.Option>
|
|
|
|
|
|
))}
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</Select>
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item name="type" label="类型" rules={[{ required: true }]}>
|
|
|
|
|
|
<Select placeholder="选择类型">
|
2026-05-15 09:37:22 +08:00
|
|
|
|
{types.map(t => (
|
2026-05-15 10:03:33 +08:00
|
|
|
|
<Select.Option key={t.id} value={t.displayName}>{t.storeValue}</Select.Option>
|
2026-05-15 09:37:22 +08:00
|
|
|
|
))}
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</Select>
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item name="country" label="国家" rules={[{ required: true }]}>
|
|
|
|
|
|
<Select placeholder="选择国家">
|
2026-05-15 10:03:33 +08:00
|
|
|
|
{countries.map(c => (
|
|
|
|
|
|
<Select.Option key={c.id} value={c.displayName}>{c.countryName}</Select.Option>
|
|
|
|
|
|
))}
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</Select>
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item name="province" label="省份" rules={[{ required: true }]}>
|
|
|
|
|
|
<Select placeholder="选择省份">
|
2026-05-15 09:37:22 +08:00
|
|
|
|
{provinces.map(p => (
|
2026-05-15 10:03:33 +08:00
|
|
|
|
<Select.Option key={p.id} value={p.displayName}>{p.storeValue}</Select.Option>
|
2026-05-15 09:37:22 +08:00
|
|
|
|
))}
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</Select>
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item wrapperCol={{ offset: 5 }}>
|
2026-05-13 13:31:49 +08:00
|
|
|
|
<Button type="primary" onClick={generateQRCode} block>
|
|
|
|
|
|
生成序列号 & 二维码
|
|
|
|
|
|
</Button>
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</Form.Item>
|
|
|
|
|
|
</Form>
|
2026-05-14 08:45:14 +08:00
|
|
|
|
|
|
|
|
|
|
<Card size="small" title="查询历史二维码" style={{ marginTop: 20 }}>
|
|
|
|
|
|
<Space style={{ width: '100%' }}>
|
|
|
|
|
|
<Input
|
|
|
|
|
|
value={queryCode}
|
2026-05-15 10:03:33 +08:00
|
|
|
|
onChange={(e) => setQueryCode(e.target.value)}
|
2026-05-14 08:45:14 +08:00
|
|
|
|
placeholder="输入序列号查询"
|
2026-05-15 09:37:22 +08:00
|
|
|
|
style={{ width: '300px' }}
|
2026-05-14 08:45:14 +08:00
|
|
|
|
/>
|
|
|
|
|
|
<Button type="primary" loading={queryLoading} onClick={handleQueryQRCode}>
|
|
|
|
|
|
查询
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
</Card>
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
|
|
|
|
<Col xs={24} md={10}>
|
|
|
|
|
|
<div style={{
|
|
|
|
|
|
padding: 20, background: '#fafafa', borderRadius: 12, border: '1px dashed #d9d9d9',
|
|
|
|
|
|
display: 'flex', flexDirection: 'column', alignItems: 'center', minHeight: 480
|
|
|
|
|
|
}}>
|
2026-05-13 13:31:49 +08:00
|
|
|
|
{serialNumber && (
|
2026-05-15 09:37:22 +08:00
|
|
|
|
<div style={{ padding: 12, background: '#e6f7ff', borderRadius: 8, width: '100%', textAlign: 'center', marginBottom: 20 }}>
|
|
|
|
|
|
<Text strong style={{ fontSize: 15 }}>序列号:{serialNumber}</Text>
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{qrUrl ? (
|
2026-05-15 09:37:22 +08:00
|
|
|
|
<img ref={qrRef} src={qrUrl} style={{ width: 240, height: 240 }} alt="qrcode" />
|
2026-05-13 13:16:36 +08:00
|
|
|
|
) : (
|
|
|
|
|
|
<div style={{ color: '#999', padding: '60px 0' }}>请先生成二维码</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
<Space style={{ marginTop: 24 }}>
|
2026-05-13 13:31:49 +08:00
|
|
|
|
<Button onClick={downloadQRCode}>下载二维码</Button>
|
2026-05-14 08:45:14 +08:00
|
|
|
|
<Button type="primary" loading={loading} onClick={saveToDatabase}>保存</Button>
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</Space>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
|
|
<Modal
|
|
|
|
|
|
open={manageVisible}
|
2026-05-13 13:31:49 +08:00
|
|
|
|
title="数据管理"
|
2026-05-13 13:16:36 +08:00
|
|
|
|
width={900}
|
|
|
|
|
|
onCancel={() => setManageVisible(false)}
|
2026-05-13 13:31:49 +08:00
|
|
|
|
footer={<Button onClick={() => setManageVisible(false)}>关闭</Button>}
|
2026-05-15 09:37:22 +08:00
|
|
|
|
destroyOnClose
|
2026-05-13 13:16:36 +08:00
|
|
|
|
>
|
2026-05-15 09:37:22 +08:00
|
|
|
|
{/* 机器人类型 */}
|
|
|
|
|
|
<DictManager
|
|
|
|
|
|
title="机器人类型"
|
|
|
|
|
|
data={types}
|
|
|
|
|
|
fields={[
|
2026-05-15 10:03:33 +08:00
|
|
|
|
{ name: 'storeValue', label: '类型名称', required: true },
|
|
|
|
|
|
{ name: 'displayName', label: '存储值', required: true },
|
2026-05-15 09:37:22 +08:00
|
|
|
|
{ name: 'remark', label: '备注', required: false }
|
|
|
|
|
|
]}
|
|
|
|
|
|
onAdd={handleAddType}
|
|
|
|
|
|
onUpdate={handleUpdateType}
|
|
|
|
|
|
onDelete={deleteRobotTypeApi}
|
|
|
|
|
|
refresh={loadTypeList}
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
{/* 机器人型号 */}
|
|
|
|
|
|
<DictManager
|
|
|
|
|
|
title="机器人型号"
|
|
|
|
|
|
data={models}
|
|
|
|
|
|
fields={[
|
|
|
|
|
|
{ name: 'modelName', label: '型号名称', required: true },
|
|
|
|
|
|
{ name: 'storeValue', label: '存储值', required: true },
|
|
|
|
|
|
]}
|
|
|
|
|
|
onAdd={handleAddModel}
|
|
|
|
|
|
onUpdate={handleUpdateModel}
|
2026-05-15 10:03:33 +08:00
|
|
|
|
onDelete={deleteRobotModelApi}
|
2026-05-15 09:37:22 +08:00
|
|
|
|
refresh={loadModelList}
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
2026-05-15 10:03:33 +08:00
|
|
|
|
{/* 国家 */}
|
|
|
|
|
|
<DictManager
|
|
|
|
|
|
title="国家"
|
|
|
|
|
|
data={countries}
|
|
|
|
|
|
fields={[
|
|
|
|
|
|
{ name: 'countryName', label: '国家名称', required: true },
|
|
|
|
|
|
{ name: 'displayName', label: '存储值', required: true },
|
|
|
|
|
|
]}
|
|
|
|
|
|
onAdd={handleAddCountry}
|
|
|
|
|
|
onUpdate={handleUpdateCountry}
|
|
|
|
|
|
onDelete={deleteRobotCountryApi}
|
|
|
|
|
|
refresh={loadCountryList}
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
2026-05-15 09:37:22 +08:00
|
|
|
|
{/* 省份 */}
|
|
|
|
|
|
<DictManager
|
|
|
|
|
|
title="省份"
|
|
|
|
|
|
data={provinces}
|
|
|
|
|
|
fields={[
|
2026-05-15 10:03:33 +08:00
|
|
|
|
{ name: 'storeValue', label: '省份名称', required: true },
|
|
|
|
|
|
{ name: 'displayName', label: '存储值', required: true },
|
2026-05-15 09:37:22 +08:00
|
|
|
|
{ name: 'remark', label: '备注', required: false }
|
|
|
|
|
|
]}
|
2026-05-15 10:03:33 +08:00
|
|
|
|
onAdd={handleAddProvince}
|
|
|
|
|
|
onUpdate={handleUpdateProvince}
|
2026-05-15 09:37:22 +08:00
|
|
|
|
onDelete={deleteRobotProvinceApi}
|
|
|
|
|
|
refresh={loadProvinceList}
|
|
|
|
|
|
/>
|
2026-05-15 10:03:33 +08:00
|
|
|
|
|
|
|
|
|
|
{/* 配置 */}
|
|
|
|
|
|
<DictManager
|
|
|
|
|
|
title="配置"
|
|
|
|
|
|
data={configs}
|
|
|
|
|
|
fields={[
|
|
|
|
|
|
{ name: 'configName', label: '配置名称', required: true },
|
|
|
|
|
|
{ name: 'displayName', label: '存储值', required: true },
|
|
|
|
|
|
]}
|
|
|
|
|
|
onAdd={handleAddConfig}
|
|
|
|
|
|
onUpdate={handleUpdateConfig}
|
|
|
|
|
|
onDelete={deleteRobotConfigApi}
|
|
|
|
|
|
refresh={loadConfigList}
|
|
|
|
|
|
/>
|
2026-05-13 13:16:36 +08:00
|
|
|
|
</Modal>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default SerialNumGenerate;
|