From cec1cc7590cd0535f9352c5d7b64480a6f96568d Mon Sep 17 00:00:00 2001
From: Administrator <425053404@qq.com>
Date: Fri, 17 Oct 2025 18:06:58 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8B=E9=9D=A2=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=20=E5=92=8C=E5=85=B6=E4=BB=96=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E4=B8=AD=E7=9A=84=E7=B1=BB=E4=BC=BC=E9=97=AE=E9=A2=98?=
=?UTF-8?q?=201.apps/web-antd/src/views/iot/device/device/modules/DeviceFo?=
=?UTF-8?q?rm.vue=20type=20=E6=98=AF=E5=92=8C=E6=96=B9=E6=B3=95=E5=88=86?=
=?UTF-8?q?=E7=A6=BB=E7=9A=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
2.apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsMessage.vue
const getMessageList = async () => {
方法使用function 不要用const,保持一致
3.apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsMessage.vue
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 969d7c7a1..efaad5976 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
@@ -139,7 +139,7 @@ const rowSelection = computed(() => ({
}));
/** 查询列表 */
-const getList = async () => {
+async function getList() {
loading.value = true;
try {
if (props.productId) {
@@ -151,22 +151,22 @@ const getList = async () => {
} finally {
loading.value = false;
}
-};
+}
/** 搜索按钮操作 */
-const handleQuery = () => {
+function handleQuery() {
queryParams.pageNo = 1;
getList();
-};
+}
/** 重置按钮操作 */
-const resetQuery = () => {
+function resetQuery() {
queryFormRef.value.resetFields();
handleQuery();
-};
+}
/** 打开弹窗 */
-const open = async () => {
+async function open() {
dialogVisible.value = true;
// 重置选择状态
selectedDevices.value = [];
@@ -178,7 +178,7 @@ const open = async () => {
}
// 获取设备列表
await getList();
-};
+}
defineExpose({ open });
/** 处理行点击事件 */
diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsMessage.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsMessage.vue
index 6a3760e76..515a425dd 100644
--- a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsMessage.vue
+++ b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsMessage.vue
@@ -1,4 +1,164 @@
-
+
+
@@ -94,164 +254,3 @@
-
-
diff --git a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModelService.vue b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModelService.vue
index 982735319..c9732317e 100644
--- a/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModelService.vue
+++ b/apps/web-antd/src/views/iot/device/device/modules/detail/DeviceDetailsThingModelService.vue
@@ -52,7 +52,7 @@ const serviceThingModels = computed(() => {
});
/** 查询列表 */
-const getList = async () => {
+async function getList() {
if (!props.deviceId) return;
loading.value = true;
try {
@@ -62,43 +62,43 @@ const getList = async () => {
} finally {
loading.value = false;
}
-};
+}
/** 搜索按钮操作 */
-const handleQuery = () => {
+function handleQuery() {
queryParams.pageNo = 1;
getList();
-};
+}
/** 重置按钮操作 */
-const resetQuery = () => {
+function resetQuery() {
queryFormRef.value?.resetFields();
queryParams.identifier = '';
queryParams.times = [];
handleQuery();
-};
+}
/** 获取服务名称 */
-const getServiceName = (identifier: string | undefined) => {
+function getServiceName(identifier: string | undefined) {
if (!identifier) return '-';
const service = serviceThingModels.value.find(
(item: ThingModelData) => item.identifier === identifier,
);
return service?.name || identifier;
-};
+}
/** 获取调用方式 */
-const getCallType = (identifier: string | undefined) => {
+function getCallType(identifier: string | undefined) {
if (!identifier) return '-';
const service = serviceThingModels.value.find(
(item: ThingModelData) => item.identifier === identifier,
);
if (!service?.service?.callType) return '-';
return getThingModelServiceCallTypeLabel(service.service.callType) || '-';
-};
+}
/** 解析参数 */
-const parseParams = (params: string) => {
+function parseParams(params: string) {
if (!params) return '-';
try {
const parsed = JSON.parse(params);
@@ -109,7 +109,7 @@ const parseParams = (params: string) => {
} catch {
return params;
}
-};
+}
/** 初始化 */
onMounted(() => {
diff --git a/apps/web-antd/src/views/iot/device/group/index.vue b/apps/web-antd/src/views/iot/device/group/index.vue
index 7bbb32e4c..f6a0992f8 100644
--- a/apps/web-antd/src/views/iot/device/group/index.vue
+++ b/apps/web-antd/src/views/iot/device/group/index.vue
@@ -22,7 +22,7 @@ const [FormModal, formModalApi] = useVbenModal({
});
/** 刷新表格 */
-function onRefresh() {
+function handleRefresh() {
gridApi.query();
}
@@ -47,7 +47,7 @@ async function handleDelete(row: IotDeviceGroupApi.DeviceGroup) {
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
});
- onRefresh();
+ handleRefresh();
} finally {
hideLoading();
}
@@ -97,7 +97,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
-
+
-
+
-
+
-
+
-
+
props.maxConditions || 3); // 最大条件数量
/** 添加条件 */
-const addCondition = async () => {
+async function addCondition() {
// 确保 subGroup.value 是一个数组
if (!subGroup.value) {
subGroup.value = [];
@@ -58,7 +58,7 @@ const addCondition = async () => {
if (subGroup.value) {
subGroup.value.push(newCondition);
}
-};
+}
/**
* 移除条件
diff --git a/apps/web-antd/src/views/iot/rule/scene/index.vue b/apps/web-antd/src/views/iot/rule/scene/index.vue
index 752784b2d..a81ba6d55 100644
--- a/apps/web-antd/src/views/iot/rule/scene/index.vue
+++ b/apps/web-antd/src/views/iot/rule/scene/index.vue
@@ -25,7 +25,7 @@ const [FormModal, formModalApi] = useVbenModal({
});
/** 刷新表格 */
-function onRefresh() {
+function handleRefresh() {
gridApi.query();
}
@@ -51,7 +51,7 @@ async function handleToggleStatus(row: RuleSceneApi.SceneRule) {
message.success({
content: newStatus === 0 ? '启用成功' : '停用成功',
});
- onRefresh();
+ handleRefresh();
} finally {
hideLoading();
}
@@ -68,7 +68,7 @@ async function handleDelete(row: RuleSceneApi.SceneRule) {
message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
});
- onRefresh();
+ handleRefresh();
} finally {
hideLoading();
}
@@ -107,7 +107,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{
+function handleCreate() {
thingModelFormRef.value?.open('create');
-};
+}
// 编辑功能
-const handleEdit = (row: any) => {
+function handleEdit(row: any) {
thingModelFormRef.value?.open('update', row.id);
-};
+}
// 删除功能
-const handleDelete = async (row: any) => {
+async function handleDelete(row: any) {
try {
await deleteThingModel(row.id);
message.success('删除成功');
@@ -81,31 +81,31 @@ const handleDelete = async (row: any) => {
} catch (error) {
console.error('删除失败:', error);
}
-};
+}
// 打开 TSL
-const handleOpenTSL = () => {
+function handleOpenTSL() {
thingModelTSLRef.value?.open();
-};
+}
// 获取数据类型标签
-const getDataTypeLabel = (row: any) => {
+function getDataTypeLabel(row: any) {
return getDataTypeOptionsLabel(row.property?.dataType) || '-';
-};
+}
// 刷新表格
-const handleRefresh = () => {
+function handleRefresh() {
gridApi.reload();
-};
+}
// 获取产品信息
-const getProductData = async () => {
+async function getProductData() {
try {
product.value = await getProduct(props.productId);
} catch (error) {
console.error('获取产品信息失败:', error);
}
-};
+}
// 初始化
onMounted(async () => {
diff --git a/apps/web-antd/src/views/iot/thingmodel/modules/ThingModelForm.vue b/apps/web-antd/src/views/iot/thingmodel/modules/ThingModelForm.vue
index 5ffc24f4d..36625b022 100644
--- a/apps/web-antd/src/views/iot/thingmodel/modules/ThingModelForm.vue
+++ b/apps/web-antd/src/views/iot/thingmodel/modules/ThingModelForm.vue
@@ -61,7 +61,7 @@ const formData = ref({
const formRef = ref(); // 表单 Ref
/** 打开弹窗 */
-const open = async (type: string, id?: number) => {
+async function open(type: string, id?: number) {
dialogVisible.value = true;
// 设置标题:create -> 新增,update -> 编辑
dialogTitle.value = type === 'create' ? $t('page.action.add') : $t('page.action.edit');
@@ -137,7 +137,7 @@ const open = async (type: string, id?: number) => {
formLoading.value = false;
}
}
-};
+}
defineExpose({ open, close: () => (dialogVisible.value = false) });
async function submitForm() {
diff --git a/apps/web-antd/src/views/iot/thingmodel/modules/ThingModelTSL.vue b/apps/web-antd/src/views/iot/thingmodel/modules/ThingModelTSL.vue
index 4af4ecb5c..d89849302 100644
--- a/apps/web-antd/src/views/iot/thingmodel/modules/ThingModelTSL.vue
+++ b/apps/web-antd/src/views/iot/thingmodel/modules/ThingModelTSL.vue
@@ -18,17 +18,17 @@ const product = inject[>(IOT_PROVIDE_KEY.PRODUCT); //
const viewMode = ref('view'); // 查看模式:view-代码视图,editor-编辑器视图
/** 打开弹窗 */
-const open = async () => {
+async function open() {
dialogVisible.value = true;
await getTsl();
-};
+}
defineExpose({ open });
/** 获取 TSL */
const thingModelTSL = ref({});
const tslString = ref(''); // 用于编辑器的字符串格式
-const getTsl = async () => {
+async function getTsl() {
try {
thingModelTSL.value = await getThingModelTSL(product?.value?.id || 0);
// 将对象转换为格式化的 JSON 字符串
@@ -38,7 +38,7 @@ const getTsl = async () => {
thingModelTSL.value = {};
tslString.value = '{}';
}
-};
+}
/** 格式化的 TSL 用于只读展示 */
const formattedTSL = computed(() => {
]