xx
This commit is contained in:
7
package-lock.json
generated
7
package-lock.json
generated
@@ -20,6 +20,7 @@
|
|||||||
"axios": "^1.15.1",
|
"axios": "^1.15.1",
|
||||||
"cesium": "^1.140.0",
|
"cesium": "^1.140.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
"country-state-city": "^3.2.1",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^17.2.3",
|
||||||
"echarts": "^6.0.0",
|
"echarts": "^6.0.0",
|
||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
@@ -3329,6 +3330,12 @@
|
|||||||
"toggle-selection": "^1.0.6"
|
"toggle-selection": "^1.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/country-state-city": {
|
||||||
|
"version": "3.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/country-state-city/-/country-state-city-3.2.1.tgz",
|
||||||
|
"integrity": "sha512-kxbanqMc6izjhc/EHkGPCTabSPZ2G6eG4/97akAYHJUN4stzzFEvQPZoF8oXDQ+10gM/O/yUmISCR1ZVxyb6EA==",
|
||||||
|
"license": "GPL-3.0"
|
||||||
|
},
|
||||||
"node_modules/css-color-keywords": {
|
"node_modules/css-color-keywords": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz",
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"axios": "^1.15.1",
|
"axios": "^1.15.1",
|
||||||
"cesium": "^1.140.0",
|
"cesium": "^1.140.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
"country-state-city": "^3.2.1",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^17.2.3",
|
||||||
"echarts": "^6.0.0",
|
"echarts": "^6.0.0",
|
||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ export function getRobotModelDetailApi(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 新增机器人型号
|
// 新增机器人型号
|
||||||
export function addRobotModel(data) {
|
export function addRobotModelApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/robot/model',
|
url: '/system/robot/model',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
Table, Input, Button, Form, Space, Card, Modal, message
|
Table, Input, Button, Form, Space, Card, Modal, message, Popconfirm
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import { EditOutlined, DeleteOutlined } from '@ant-design/icons';
|
import { EditOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
@@ -77,11 +77,12 @@ const DictManager = ({
|
|||||||
<Button type="link" icon={<EditOutlined />} onClick={() => handleEdit(record)}>
|
<Button type="link" icon={<EditOutlined />} onClick={() => handleEdit(record)}>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Popconfirm
|
||||||
type="link"
|
title="确定要删除这条数据吗?"
|
||||||
danger
|
description="删除后将无法恢复"
|
||||||
icon={<DeleteOutlined />}
|
okText="确定"
|
||||||
onClick={async () => {
|
cancelText="取消"
|
||||||
|
onConfirm={async () => {
|
||||||
try {
|
try {
|
||||||
const res = await onDelete(record.id);
|
const res = await onDelete(record.id);
|
||||||
if (res?.code === 200) {
|
if (res?.code === 200) {
|
||||||
@@ -95,8 +96,10 @@ const DictManager = ({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Button type="link" danger icon={<DeleteOutlined />}>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import {
|
|||||||
} from 'antd';
|
} from 'antd';
|
||||||
import QRCode from 'qrcode';
|
import QRCode from 'qrcode';
|
||||||
import DictManager from "../DictManager";
|
import DictManager from "../DictManager";
|
||||||
import request from '../../api/request';
|
import request from '../../api/request'; import { Country, State } from 'country-state-city';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 接口导入
|
// 接口导入
|
||||||
import {
|
import {
|
||||||
@@ -18,12 +20,26 @@ import {
|
|||||||
updateRobotProvinceApi,
|
updateRobotProvinceApi,
|
||||||
deleteRobotProvinceApi,
|
deleteRobotProvinceApi,
|
||||||
getRobotModelPageApi,
|
getRobotModelPageApi,
|
||||||
addRebotModel
|
addRobotModelApi,
|
||||||
|
updateRobotModelApi,
|
||||||
|
deleteRobotModelApi,
|
||||||
|
getRobotCountryListApi,
|
||||||
|
addRobotCountryApi,
|
||||||
|
updateRobotCountryApi,
|
||||||
|
deleteRobotCountryApi,
|
||||||
|
getRobotConfigListApi,
|
||||||
|
addRobotConfigApi,
|
||||||
|
updateRobotConfigApi,
|
||||||
|
deleteRobotConfigApi,
|
||||||
} from '../../api/systemSetting';
|
} from '../../api/systemSetting';
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
const SerialNumGenerate = () => {
|
const SerialNumGenerate = () => {
|
||||||
|
// 获取国家
|
||||||
|
const countries1 = Country.getAllCountries();
|
||||||
|
// 根据国家获取省份
|
||||||
|
const states = State.getStatesOfCountry('CN');
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [qrUrl, setQrUrl] = useState('');
|
const [qrUrl, setQrUrl] = useState('');
|
||||||
const [serialNumber, setSerialNumber] = useState('');
|
const [serialNumber, setSerialNumber] = useState('');
|
||||||
@@ -39,29 +55,26 @@ const SerialNumGenerate = () => {
|
|||||||
const [types, setTypes] = useState([]);
|
const [types, setTypes] = useState([]);
|
||||||
const [models, setModels] = useState([]);
|
const [models, setModels] = useState([]);
|
||||||
const [provinces, setProvinces] = useState([]);
|
const [provinces, setProvinces] = useState([]);
|
||||||
const [countries] = useState([
|
const [countries, setCountries] = useState([]);
|
||||||
{ id: 1, value: 'CN', label: '中国' },
|
const [configs, setConfigs] = useState([]);
|
||||||
{ id: 2, value: 'US', label: '美国' },
|
|
||||||
]);
|
|
||||||
const [configs] = useState([
|
|
||||||
{ id: 1, value: 'AIR', label: 'AIR' },
|
|
||||||
{ id: 2, value: 'PRO', label: 'PRO' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
// 初始化加载
|
// 初始化加载
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadTypeList();
|
loadTypeList();
|
||||||
loadModelList();
|
loadModelList();
|
||||||
loadProvinceList();
|
loadProvinceList();
|
||||||
|
loadCountryList();
|
||||||
|
loadConfigList();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// 加载机器人类型
|
// 加载机器人类型
|
||||||
const loadTypeList = async () => {
|
const loadTypeList = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getRobotTypeListApi({});
|
const res = await getRobotTypeListApi({});
|
||||||
setTypes(res.rows || []);
|
if (res?.code == 200) {
|
||||||
|
setTypes(res.data || []);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
message.error('加载类型失败');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -69,9 +82,10 @@ const SerialNumGenerate = () => {
|
|||||||
const loadModelList = async () => {
|
const loadModelList = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getRobotModelPageApi({ pageNum: 1, pageSize: 100 });
|
const res = await getRobotModelPageApi({ pageNum: 1, pageSize: 100 });
|
||||||
setModels(res.rows || []);
|
if (res?.code == 200) {
|
||||||
|
setModels(res?.data || []);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
message.error('加载型号失败');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -85,6 +99,26 @@ const SerialNumGenerate = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 加载国家
|
||||||
|
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('加载配置失败');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 生成序号
|
// 生成序号
|
||||||
const generateSerialSuffix = () => {
|
const generateSerialSuffix = () => {
|
||||||
const num = Math.floor(Math.random() * 100000000).toString(16).toUpperCase().padStart(8, '0');
|
const num = Math.floor(Math.random() * 100000000).toString(16).toUpperCase().padStart(8, '0');
|
||||||
@@ -185,54 +219,83 @@ const SerialNumGenerate = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ==================== 机器人类型:增删改查 ====================
|
// ==================== 类型 ====================
|
||||||
const handleAddType = async (values) => {
|
const handleAddType = async (values) => {
|
||||||
const params = {
|
return await addRobotTypeApi({
|
||||||
typeName: values.typeName,
|
|
||||||
storeValue: values.storeValue,
|
storeValue: values.storeValue,
|
||||||
|
displayName: values.displayName,
|
||||||
remark: values.remark || ''
|
remark: values.remark || ''
|
||||||
|
});
|
||||||
};
|
};
|
||||||
return await addRobotTypeApi(params);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleUpdateType = async (values) => {
|
const handleUpdateType = async (values) => {
|
||||||
const params = {
|
return await updateRobotTypeApi({
|
||||||
id: values.id,
|
id: values.id,
|
||||||
typeName: values.typeName,
|
|
||||||
storeValue: values.storeValue,
|
storeValue: values.storeValue,
|
||||||
|
displayName: values.displayName,
|
||||||
remark: values.remark || ''
|
remark: values.remark || ''
|
||||||
};
|
|
||||||
return await updateRobotTypeApi(params);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ==================== 机器人型号:增删改查 ====================
|
|
||||||
const handleAddModel = async (values) => {
|
|
||||||
const params = {
|
|
||||||
modelName: values.modelName,
|
|
||||||
storeValue: values.storeValue,
|
|
||||||
remark: values.remark || ''
|
|
||||||
};
|
|
||||||
return await addRebotModel(params)
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleUpdateModel = async (values) => {
|
|
||||||
const params = {
|
|
||||||
id: values.id,
|
|
||||||
modelName: values.modelName,
|
|
||||||
storeValue: values.storeValue,
|
|
||||||
remark: values.remark || ''
|
|
||||||
};
|
|
||||||
return await request({
|
|
||||||
url: '/system/robot/model',
|
|
||||||
method: 'put',
|
|
||||||
data: params
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteModel = async (id) => {
|
// ==================== 型号 ====================
|
||||||
return await request({
|
const handleAddModel = async (values) => {
|
||||||
url: `/system/robot/model/${id}`,
|
return await addRobotModelApi({
|
||||||
method: 'delete'
|
modelName: values.modelName,
|
||||||
|
storeValue: values.storeValue,
|
||||||
|
displayName: ''
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const handleUpdateModel = async (values) => {
|
||||||
|
return await updateRobotModelApi({
|
||||||
|
id: values.id,
|
||||||
|
modelName: values.modelName,
|
||||||
|
displayName: values.displayName
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// ==================== 省份 ====================
|
||||||
|
const handleAddProvince = async (values) => {
|
||||||
|
return await addRobotProvinceApi({
|
||||||
|
storeValue: values.storeValue,
|
||||||
|
displayName: values.displayName,
|
||||||
|
remark: values.remark || ''
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const handleUpdateProvince = async (values) => {
|
||||||
|
return await updateRobotProvinceApi({
|
||||||
|
id: values.id,
|
||||||
|
storeValue: values.storeValue,
|
||||||
|
displayName: values.displayName,
|
||||||
|
remark: values.remark || ''
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// ==================== 国家 ====================
|
||||||
|
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
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -249,35 +312,39 @@ const SerialNumGenerate = () => {
|
|||||||
<Form.Item name="model" label="型号" rules={[{ required: true }]}>
|
<Form.Item name="model" label="型号" rules={[{ required: true }]}>
|
||||||
<Select placeholder="选择型号">
|
<Select placeholder="选择型号">
|
||||||
{models.map(m => (
|
{models.map(m => (
|
||||||
<Select.Option key={m.id} value={m.storeValue}>{m.modelName}</Select.Option>
|
<Select.Option key={m.id} value={m.displayName}>{m.modelName}</Select.Option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item name="config" label="配置" rules={[{ required: true }]}>
|
<Form.Item name="config" label="配置" rules={[{ required: true }]}>
|
||||||
<Select placeholder="选择配置">
|
<Select placeholder="选择配置">
|
||||||
{configs.map(c => <Select.Option key={c.value} value={c.value}>{c.label}</Select.Option>)}
|
{configs.map(c => (
|
||||||
|
<Select.Option key={c.id} value={c.displayName}>{c.configName}</Select.Option>
|
||||||
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item name="type" label="类型" rules={[{ required: true }]}>
|
<Form.Item name="type" label="类型" rules={[{ required: true }]}>
|
||||||
<Select placeholder="选择类型">
|
<Select placeholder="选择类型">
|
||||||
{types.map(t => (
|
{types.map(t => (
|
||||||
<Select.Option key={t.id} value={t.storeValue}>{t.typeName}</Select.Option>
|
<Select.Option key={t.id} value={t.displayName}>{t.storeValue}</Select.Option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item name="country" label="国家" rules={[{ required: true }]}>
|
<Form.Item name="country" label="国家" rules={[{ required: true }]}>
|
||||||
<Select placeholder="选择国家">
|
<Select placeholder="选择国家">
|
||||||
{countries.map(c => <Select.Option key={c.value} value={c.value}>{c.label}</Select.Option>)}
|
{countries.map(c => (
|
||||||
|
<Select.Option key={c.id} value={c.displayName}>{c.countryName}</Select.Option>
|
||||||
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item name="province" label="省份" rules={[{ required: true }]}>
|
<Form.Item name="province" label="省份" rules={[{ required: true }]}>
|
||||||
<Select placeholder="选择省份">
|
<Select placeholder="选择省份">
|
||||||
{provinces.map(p => (
|
{provinces.map(p => (
|
||||||
<Select.Option key={p.id} value={p.storeValue}>{p.typeName}</Select.Option>
|
<Select.Option key={p.id} value={p.displayName}>{p.storeValue}</Select.Option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -293,7 +360,7 @@ const SerialNumGenerate = () => {
|
|||||||
<Space style={{ width: '100%' }}>
|
<Space style={{ width: '100%' }}>
|
||||||
<Input
|
<Input
|
||||||
value={queryCode}
|
value={queryCode}
|
||||||
onChange={(e) => setQueryCode(e.value)}
|
onChange={(e) => setQueryCode(e.target.value)}
|
||||||
placeholder="输入序列号查询"
|
placeholder="输入序列号查询"
|
||||||
style={{ width: '300px' }}
|
style={{ width: '300px' }}
|
||||||
/>
|
/>
|
||||||
@@ -343,8 +410,8 @@ const SerialNumGenerate = () => {
|
|||||||
title="机器人类型"
|
title="机器人类型"
|
||||||
data={types}
|
data={types}
|
||||||
fields={[
|
fields={[
|
||||||
{ name: 'typeName', label: '类型名称', required: true },
|
{ name: 'storeValue', label: '类型名称', required: true },
|
||||||
{ name: 'storeValue', label: '存储值', required: true },
|
{ name: 'displayName', label: '存储值', required: true },
|
||||||
{ name: 'remark', label: '备注', required: false }
|
{ name: 'remark', label: '备注', required: false }
|
||||||
]}
|
]}
|
||||||
onAdd={handleAddType}
|
onAdd={handleAddType}
|
||||||
@@ -363,24 +430,52 @@ const SerialNumGenerate = () => {
|
|||||||
]}
|
]}
|
||||||
onAdd={handleAddModel}
|
onAdd={handleAddModel}
|
||||||
onUpdate={handleUpdateModel}
|
onUpdate={handleUpdateModel}
|
||||||
onDelete={handleDeleteModel}
|
onDelete={deleteRobotModelApi}
|
||||||
refresh={loadModelList}
|
refresh={loadModelList}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* 国家 */}
|
||||||
|
<DictManager
|
||||||
|
title="国家"
|
||||||
|
data={countries}
|
||||||
|
fields={[
|
||||||
|
{ name: 'countryName', label: '国家名称', required: true },
|
||||||
|
{ name: 'displayName', label: '存储值', required: true },
|
||||||
|
]}
|
||||||
|
onAdd={handleAddCountry}
|
||||||
|
onUpdate={handleUpdateCountry}
|
||||||
|
onDelete={deleteRobotCountryApi}
|
||||||
|
refresh={loadCountryList}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* 省份 */}
|
{/* 省份 */}
|
||||||
<DictManager
|
<DictManager
|
||||||
title="省份"
|
title="省份"
|
||||||
data={provinces}
|
data={provinces}
|
||||||
fields={[
|
fields={[
|
||||||
{ name: 'typeName', label: '省份名称', required: true },
|
{ name: 'storeValue', label: '省份名称', required: true },
|
||||||
{ name: 'storeValue', label: '存储值', required: true },
|
{ name: 'displayName', label: '存储值', required: true },
|
||||||
{ name: 'remark', label: '备注', required: false }
|
{ name: 'remark', label: '备注', required: false }
|
||||||
]}
|
]}
|
||||||
onAdd={addRobotProvinceApi}
|
onAdd={handleAddProvince}
|
||||||
onUpdate={updateRobotProvinceApi}
|
onUpdate={handleUpdateProvince}
|
||||||
onDelete={deleteRobotProvinceApi}
|
onDelete={deleteRobotProvinceApi}
|
||||||
refresh={loadProvinceList}
|
refresh={loadProvinceList}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* 配置 */}
|
||||||
|
<DictManager
|
||||||
|
title="配置"
|
||||||
|
data={configs}
|
||||||
|
fields={[
|
||||||
|
{ name: 'configName', label: '配置名称', required: true },
|
||||||
|
{ name: 'displayName', label: '存储值', required: true },
|
||||||
|
]}
|
||||||
|
onAdd={handleAddConfig}
|
||||||
|
onUpdate={handleUpdateConfig}
|
||||||
|
onDelete={deleteRobotConfigApi}
|
||||||
|
refresh={loadConfigList}
|
||||||
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user