diff --git a/apps/web-antd/src/api/iot/alert/config/index.ts b/apps/web-antd/src/api/iot/alert/config/index.ts index 8281cf6c8..26e114c0c 100644 --- a/apps/web-antd/src/api/iot/alert/config/index.ts +++ b/apps/web-antd/src/api/iot/alert/config/index.ts @@ -92,5 +92,3 @@ export function getSimpleAlertConfigList() { '/iot/alert-config/simple-list', ); } - -export { AlertConfigApi }; diff --git a/apps/web-antd/src/api/iot/alert/record/index.ts b/apps/web-antd/src/api/iot/alert/record/index.ts index 7ca2b8df9..6d2afcfcf 100644 --- a/apps/web-antd/src/api/iot/alert/record/index.ts +++ b/apps/web-antd/src/api/iot/alert/record/index.ts @@ -80,5 +80,3 @@ export function deleteAlertRecordList(ids: number[]) { params: { ids: ids.join(',') }, }); } - -export { AlertRecordApi }; diff --git a/apps/web-antd/src/api/iot/device/device/index.ts b/apps/web-antd/src/api/iot/device/device/index.ts index b45f3b42a..650fe0875 100644 --- a/apps/web-antd/src/api/iot/device/device/index.ts +++ b/apps/web-antd/src/api/iot/device/device/index.ts @@ -194,30 +194,3 @@ export function getDeviceMessagePairPage(params: PageParam) { export function sendDeviceMessage(params: IotDeviceApi.DeviceMessageSendReq) { return requestClient.post('/iot/device/message/send', params); } - -// Export aliases for compatibility -export const DeviceApi = { - getDevicePage, - getDevice, - createDevice, - updateDevice, - updateDeviceGroup, - deleteDevice, - deleteDeviceList, - exportDeviceExcel, - getDeviceCount, - getSimpleDeviceList, - getDeviceListByProductId, - importDeviceTemplate, - getLatestDeviceProperties, - getHistoryDevicePropertyList, - getDeviceAuthInfo, - getDeviceMessagePage, - getDeviceMessagePairPage, - sendDeviceMessage, -}; - -export type DeviceVO = IotDeviceApi.Device; -export type IotDeviceAuthInfoVO = IotDeviceApi.DeviceAuthInfo; -export type IotDevicePropertyDetailRespVO = IotDeviceApi.DevicePropertyDetail; -export type IotDevicePropertyRespVO = IotDeviceApi.DeviceProperty; diff --git a/apps/web-antd/src/api/iot/ota/task/index.ts b/apps/web-antd/src/api/iot/ota/task/index.ts index bd003caf8..a854df86b 100644 --- a/apps/web-antd/src/api/iot/ota/task/index.ts +++ b/apps/web-antd/src/api/iot/ota/task/index.ts @@ -96,5 +96,3 @@ export function pauseOtaTask(id: number) { export function resumeOtaTask(id: number) { return requestClient.put(`/iot/ota-task/resume?id=${id}`); } - -export { IoTOtaTaskApi }; diff --git a/apps/web-antd/src/api/iot/ota/task/record/index.ts b/apps/web-antd/src/api/iot/ota/task/record/index.ts index 8ab8b0b1e..ff003c06a 100644 --- a/apps/web-antd/src/api/iot/ota/task/record/index.ts +++ b/apps/web-antd/src/api/iot/ota/task/record/index.ts @@ -99,5 +99,3 @@ export function getOtaTaskRecordStatusStatistics( { params: { firmwareId, taskId } }, ); } - -export { IoTOtaTaskRecordApi }; diff --git a/apps/web-antd/src/api/iot/product/product/index.ts b/apps/web-antd/src/api/iot/product/product/index.ts index 6eeba04cd..71bc3ade3 100644 --- a/apps/web-antd/src/api/iot/product/product/index.ts +++ b/apps/web-antd/src/api/iot/product/product/index.ts @@ -97,18 +97,3 @@ export function getProductByKey(productKey: string) { params: { productKey }, }); } - -// Export aliases for compatibility -export const ProductApi = { - getProductPage, - getProduct, - createProduct, - updateProduct, - deleteProduct, - exportProduct, - updateProductStatus, - getSimpleProductList, - getProductByKey, -}; - -export type ProductVO = IotProductApi.Product; diff --git a/apps/web-antd/src/api/iot/rule/data/sink/index.ts b/apps/web-antd/src/api/iot/rule/data/sink/index.ts index 59ffdbc3b..4614c2a6e 100644 --- a/apps/web-antd/src/api/iot/rule/data/sink/index.ts +++ b/apps/web-antd/src/api/iot/rule/data/sink/index.ts @@ -146,5 +146,3 @@ export function updateDataSinkStatus(id: number, status: number) { status, }); } - -export { DataSinkApi }; diff --git a/apps/web-antd/src/api/iot/rule/scene/index.ts b/apps/web-antd/src/api/iot/rule/scene/index.ts index 3746a4622..247b9a5f7 100644 --- a/apps/web-antd/src/api/iot/rule/scene/index.ts +++ b/apps/web-antd/src/api/iot/rule/scene/index.ts @@ -153,10 +153,3 @@ export function getSimpleRuleSceneList() { '/iot/scene-rule/simple-list', ); } - -// 别名导出(兼容旧代码) -export { - deleteSceneRule as deleteRuleScene, - getSceneRulePage as getRuleScenePage, - updateSceneRuleStatus as updateRuleSceneStatus, -}; diff --git a/apps/web-antd/src/api/iot/statistics/index.ts b/apps/web-antd/src/api/iot/statistics/index.ts index bd8bf037b..588eefcc4 100644 --- a/apps/web-antd/src/api/iot/statistics/index.ts +++ b/apps/web-antd/src/api/iot/statistics/index.ts @@ -67,18 +67,3 @@ export function getDeviceMessageSummary(statType: number) { { params: { statType } }, ); } - -// 导出 API 对象(兼容旧代码) -export const StatisticsApi = { - getStatisticsSummary, - getDeviceMessageSummaryByDate, - getDeviceMessageSummary, -}; - -// 导出类型别名(兼容旧代码) -export type IotStatisticsSummaryRespVO = IotStatisticsApi.StatisticsSummary; -export type IotStatisticsDeviceMessageSummaryRespVO = - IotStatisticsApi.DeviceMessageSummary; -export type IotStatisticsDeviceMessageSummaryByDateRespVO = - IotStatisticsApi.DeviceMessageSummaryByDate; -export type IotStatisticsDeviceMessageReqVO = IotStatisticsApi.DeviceMessageReq; diff --git a/apps/web-antd/src/api/iot/thingmodel/index.ts b/apps/web-antd/src/api/iot/thingmodel/index.ts index e4bb75767..d97704b7f 100644 --- a/apps/web-antd/src/api/iot/thingmodel/index.ts +++ b/apps/web-antd/src/api/iot/thingmodel/index.ts @@ -189,18 +189,3 @@ export function exportThingModelTSL(productId: number) { params: { productId }, }); } - -// Add a consolidated API object and getThingModelList alias -export const ThingModelApi = { - getThingModelPage, - getThingModel, - getThingModelList: getThingModelListByProductId, // alias for compatibility - getThingModelListByProductId, - getThingModelListByProductKey, - createThingModel, - updateThingModel, - deleteThingModel, - deleteThingModelList, - importThingModelTSL, - exportThingModelTSL, -}; diff --git a/apps/web-antd/src/views/iot/alert/config/index.vue b/apps/web-antd/src/views/iot/alert/config/index.vue index 9e47eaf1f..0e25afb69 100644 --- a/apps/web-antd/src/views/iot/alert/config/index.vue +++ b/apps/web-antd/src/views/iot/alert/config/index.vue @@ -4,7 +4,7 @@ import type { AlertConfigApi } from '#/api/iot/alert/config'; import { Page, useVbenModal } from '@vben/common-ui'; -import { message } from 'ant-design-vue'; +import { message, Tag } from 'ant-design-vue'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteAlertConfig, getAlertConfigPage } from '#/api/iot/alert/config'; @@ -26,7 +26,7 @@ function onRefresh() { } // 获取告警级别文本 -const getLevelText = (level?: number) => { +function getLevelText(level?: number) { const levelMap: Record = { 1: '提示', 2: '一般', @@ -35,10 +35,10 @@ const getLevelText = (level?: number) => { 5: '紧急', }; return level ? levelMap[level] || `级别${level}` : '-'; -}; +} // 获取告警级别颜色 -const getLevelColor = (level?: number) => { +function getLevelColor(level?: number) { const colorMap: Record = { 1: 'blue', 2: 'green', @@ -47,10 +47,10 @@ const getLevelColor = (level?: number) => { 5: 'purple', }; return level ? colorMap[level] || 'default' : 'default'; -}; +} // 获取接收类型文本 -const getReceiveTypeText = (type?: number) => { +function getReceiveTypeText(type?: number) { const typeMap: Record = { 1: '站内信', 2: '邮箱', @@ -59,7 +59,7 @@ const getReceiveTypeText = (type?: number) => { 5: '钉钉', }; return type ? typeMap[type] || `类型${type}` : '-'; -}; +} /** 创建告警配置 */ function handleCreate() { @@ -138,9 +138,9 @@ const [Grid, gridApi] = useVbenVxeGrid({ @@ -150,13 +150,13 @@ const [Grid, gridApi] = useVbenVxeGrid({ diff --git a/apps/web-antd/src/views/iot/alert/record/index.vue b/apps/web-antd/src/views/iot/alert/record/index.vue index 316053da3..4492483b0 100644 --- a/apps/web-antd/src/views/iot/alert/record/index.vue +++ b/apps/web-antd/src/views/iot/alert/record/index.vue @@ -5,8 +5,9 @@ import type { AlertRecord } from '#/api/iot/alert/record'; import { h, onMounted, ref } from 'vue'; import { Page } from '@vben/common-ui'; +import { IconifyIcon } from '@vben/icons'; -import { message, Modal } from 'ant-design-vue'; +import { Button, message, Modal, Popover, Tag } from 'ant-design-vue'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { getAlertRecordPage, processAlertRecord } from '#/api/iot/alert/record'; @@ -26,13 +27,13 @@ function onRefresh() { } // 加载产品和设备列表 -const loadData = async () => { +async function loadData() { productList.value = await getSimpleProductList(); deviceList.value = await getSimpleDeviceList(); -}; +} // 获取告警级别文本 -const getLevelText = (level?: number) => { +function getLevelText(level?: number) { const levelMap: Record = { 1: '提示', 2: '一般', @@ -41,10 +42,10 @@ const getLevelText = (level?: number) => { 5: '紧急', }; return level ? levelMap[level] || `级别${level}` : '-'; -}; +} // 获取告警级别颜色 -const getLevelColor = (level?: number) => { +function getLevelColor(level?: number) { const colorMap: Record = { 1: 'blue', 2: 'green', @@ -53,24 +54,24 @@ const getLevelColor = (level?: number) => { 5: 'purple', }; return level ? colorMap[level] || 'default' : 'default'; -}; +} // 获取产品名称 -const getProductName = (productId?: number) => { +function getProductName(productId?: number) { if (!productId) return '-'; const product = productList.value.find((p: any) => p.id === productId); return product?.name || '加载中...'; -}; +} // 获取设备名称 -const getDeviceName = (deviceId?: number) => { +function getDeviceName(deviceId?: number) { if (!deviceId) return '-'; const device = deviceList.value.find((d: any) => d.id === deviceId); return device?.deviceName || '加载中...'; -}; +} // 处理告警记录 -const handleProcess = async (row: AlertRecord) => { +async function handleProcess(row: AlertRecord) { Modal.confirm({ title: '处理告警记录', content: h('div', [ @@ -90,7 +91,7 @@ const handleProcess = async (row: AlertRecord) => { if (!processRemark) { message.warning('请输入处理原因'); - throw undefined; + throw new Error('请输入处理原因'); } const hideLoading = message.loading({ @@ -103,16 +104,16 @@ const handleProcess = async (row: AlertRecord) => { onRefresh(); } catch (error) { console.error('处理失败:', error); - return Promise.reject(); + throw error; } finally { hideLoading(); } }, }); -}; +} // 查看告警记录详情 -const handleView = (row: AlertRecord) => { +function handleView(row: AlertRecord) { Modal.info({ title: '告警记录详情', width: 600, @@ -148,7 +149,7 @@ const handleView = (row: AlertRecord) => { ]), ]), }); -}; +} const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { @@ -190,9 +191,9 @@ onMounted(() => { @@ -207,7 +208,7 @@ onMounted(() => { diff --git a/apps/web-antd/src/views/iot/device/device/modules/components/DeviceTableSelect.vue b/apps/web-antd/src/views/iot/device/device/modules/components/DeviceTableSelect.vue index 679553813..969d7c7a1 100644 --- a/apps/web-antd/src/views/iot/device/device/modules/components/DeviceTableSelect.vue +++ b/apps/web-antd/src/views/iot/device/device/modules/components/DeviceTableSelect.vue @@ -6,15 +6,29 @@ import type { IotProductApi } from '#/api/iot/product/product'; import { computed, onMounted, reactive, ref } from 'vue'; +import { ContentWrap } from '@vben/common-ui'; import { DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; +import { IconifyIcon } from '@vben/icons'; import { formatDate } from '@vben/utils'; -import { message } from 'ant-design-vue'; +import { + Button, + Form, + Input, + message, + Modal, + Pagination, + Radio, + Select, + Table, + Tag, +} from 'ant-design-vue'; import { getDevicePage } from '#/api/iot/device/device'; import { getSimpleDeviceGroupList } from '#/api/iot/device/group'; import { getSimpleProductList } from '#/api/iot/product/product'; +import { DictTag } from '#/components/dict-tag'; defineOptions({ name: 'IoTDeviceTableSelect' }); @@ -33,14 +47,14 @@ const props = defineProps({ const emit = defineEmits(['success']); // 获取字典选项 -const getIntDictOptions = (dictType: string) => { +function getIntDictOptions(dictType: string) { return getDictOptions(dictType, 'number'); -}; +} // 日期格式化 -const dateFormatter = (_row: any, _column: any, cellValue: any) => { +function dateFormatter(_row: any, _column: any, cellValue: any) { return cellValue ? formatDate(cellValue, 'YYYY-MM-DD HH:mm:ss') : ''; -}; +} const dialogVisible = ref(false); const dialogTitle = ref('设备选择器'); @@ -73,38 +87,31 @@ const columns = computed(() => { title: 'DeviceName', dataIndex: 'deviceName', key: 'deviceName', - align: 'center', }, { title: '备注名称', dataIndex: 'nickname', key: 'nickname', - align: 'center', }, { title: '所属产品', key: 'productId', - align: 'center', }, { title: '设备类型', key: 'deviceType', - align: 'center', }, { title: '所属分组', key: 'groupIds', - align: 'center', }, { title: '设备状态', key: 'status', - align: 'center', }, { title: '最后上线时间', key: 'onlineTime', - align: 'center', width: 180, }, ]; @@ -125,7 +132,7 @@ const columns = computed(() => { // 多选配置 const rowSelection = computed(() => ({ selectedRowKeys: selectedRowKeys.value, - onChange: (keys: number[], rows: IotDeviceApi.Device[]) => { + onChange: (keys: any[], rows: IotDeviceApi.Device[]) => { selectedRowKeys.value = keys; selectedDevices.value = rows; }, @@ -176,20 +183,20 @@ defineExpose({ open }); /** 处理行点击事件 */ const tableRef = ref(); -const handleRowClick = (row: IotDeviceApi.Device) => { +function handleRowClick(row: IotDeviceApi.Device) { if (!props.multiple) { selectedId.value = row.id; selectedDevices.value = [row]; } -}; +} /** 处理单选变更事件 */ -const handleRadioChange = (row: IotDeviceApi.Device) => { +function handleRadioChange(row: IotDeviceApi.Device) { selectedId.value = row.id; selectedDevices.value = [row]; -}; +} -const submitForm = async () => { +async function submitForm() { if (selectedDevices.value.length === 0) { message.warning({ content: props.multiple ? '请至少选择一个设备' : '请选择一个设备', @@ -201,7 +208,7 @@ const submitForm = async () => { props.multiple ? selectedDevices.value : selectedDevices.value[0], ); dialogVisible.value = false; -}; +} /** 初始化 */ onMounted(async () => { @@ -213,7 +220,7 @@ onMounted(async () => { diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailConfig.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailConfig.vue index ca73d8473..6dd12c0a6 100644 --- a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailConfig.vue +++ b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailConfig.vue @@ -1,18 +1,18 @@ diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsHeader.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsHeader.vue index b2859a058..15534eb63 100644 --- a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsHeader.vue +++ b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsHeader.vue @@ -1,18 +1,18 @@ - + - - - - - - + + + + + + - + { :device-id="device.id" /> - - + + diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModel.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModel.vue index 19c32ea30..7cac1c205 100644 --- a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModel.vue +++ b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModel.vue @@ -6,6 +6,8 @@ import { ref } from 'vue'; import { ContentWrap } from '@vben/common-ui'; +import { Tabs } from 'ant-design-vue'; + import DeviceDetailsThingModelEvent from './DeviceDetailsThingModelEvent.vue'; import DeviceDetailsThingModelProperty from './DeviceDetailsThingModelProperty.vue'; import DeviceDetailsThingModelService from './DeviceDetailsThingModelService.vue'; @@ -19,32 +21,22 @@ const activeTab = ref('property'); // 默认选中设备属性 - - diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModelEvent.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModelEvent.vue index 70097823b..a7a7c558b 100644 --- a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModelEvent.vue +++ b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModelEvent.vue @@ -8,9 +8,18 @@ import { ContentWrap } from '@vben/common-ui'; import { IconifyIcon } from '@vben/icons'; import { formatDate } from '@vben/utils'; -import { Pagination } from 'ant-design-vue'; +import { + Button, + Divider, + Form, + Pagination, + RangePicker, + Select, + Table, + Tag, +} from 'ant-design-vue'; -import { DeviceApi } from '#/api/iot/device/device'; +import { getDeviceMessagePairPage } from '#/api/iot/device/device'; import { getEventTypeLabel, IotDeviceMessageMethodEnum, @@ -29,7 +38,7 @@ const queryParams = reactive({ deviceId: props.deviceId, method: IotDeviceMessageMethodEnum.EVENT_POST.method, // 固定筛选事件消息 identifier: '', - times: [] as any[], + times: undefined, pageNo: 1, pageSize: 10, }); @@ -44,53 +53,53 @@ const eventThingModels = computed(() => { }); /** 查询列表 */ -const getList = async () => { +async function getList() { if (!props.deviceId) return; loading.value = true; try { - const data = await DeviceApi.getDeviceMessagePairPage(queryParams); + const data = await getDeviceMessagePairPage(queryParams); list.value = data.list || []; total.value = data.total || 0; } finally { loading.value = false; } -}; +} /** 搜索按钮操作 */ -const handleQuery = () => { +function handleQuery() { queryParams.pageNo = 1; getList(); -}; +} /** 重置按钮操作 */ -const resetQuery = () => { +function resetQuery() { queryFormRef.value?.resetFields(); queryParams.identifier = ''; - queryParams.times = []; + queryParams.times = undefined; handleQuery(); -}; +} /** 获取事件名称 */ -const getEventName = (identifier: string | undefined) => { +function getEventName(identifier: string | undefined) { if (!identifier) return '-'; const event = eventThingModels.value.find( (item: ThingModelData) => item.identifier === identifier, ); return event?.name || identifier; -}; +} /** 获取事件类型 */ -const getEventType = (identifier: string | undefined) => { +function getEventType(identifier: string | undefined) { if (!identifier) return '-'; const event = eventThingModels.value.find( (item: ThingModelData) => item.identifier === identifier, ); if (!event?.event?.type) return '-'; return getEventTypeLabel(event.event.type) || '-'; -}; +} /** 解析参数 */ -const parseParams = (params: string) => { +function parseParams(params: string) { try { const parsed = JSON.parse(params); if (parsed.params) { @@ -100,7 +109,7 @@ const parseParams = (params: string) => { } catch { return {}; } -}; +} /** 初始化 */ onMounted(() => { @@ -111,58 +120,58 @@ onMounted(() => { - - + - - + { - - + { - - + + - - + +