修复下面的问题 和其他页面中的类似问题

1.apps/web-antd/src/views/iot/device/device/modules/DeviceForm.vue
type 是和方法分离的

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
<script setup lang="ts">
文件结构是

4.apps/web-antd/src/views/iot/rule/data/rule/index.vue
handleRefresh 统一命名

Signed-off-by: Administrator <425053404@qq.com>
pull/232/head
Administrator 2025-10-17 18:06:58 +08:00
parent 1190121773
commit cec1cc7590
18 changed files with 232 additions and 233 deletions

View File

@ -21,7 +21,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@ -82,7 +82,7 @@ async function handleDelete(row: AlertConfigApi.AlertConfig) {
message.success({ message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]), content: $t('ui.actionMessage.deleteSuccess', [row.name]),
}); });
onRefresh(); handleRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@ -121,7 +121,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@ -22,7 +22,7 @@ const productList = ref<any[]>([]);
const deviceList = ref<any[]>([]); const deviceList = ref<any[]>([]);
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }

View File

@ -8,8 +8,8 @@ import {
createDevice, createDevice,
getDevice, getDevice,
updateDevice, updateDevice,
type IotDeviceApi
} from '#/api/iot/device/device'; } from '#/api/iot/device/device';
import type { IotDeviceApi } from '#/api/iot/device/device';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { useFormSchema } from '../data'; import { useFormSchema } from '../data';

View File

@ -111,14 +111,14 @@ const [Modal, modalApi] = useVbenModal({
}); });
/** 下载模板 */ /** 下载模板 */
const handleDownloadTemplate = async () => { async function handleDownloadTemplate() {
try { try {
const res = await importDeviceTemplate(); const res = await importDeviceTemplate();
downloadFileFromBlobPart({ fileName: '设备导入模版.xls', source: res }); downloadFileFromBlobPart({ fileName: '设备导入模版.xls', source: res });
} catch (error: any) { } catch (error: any) {
message.error(error.message || '下载失败'); message.error(error.message || '下载失败');
} }
}; }
</script> </script>
<template> <template>

View File

@ -139,7 +139,7 @@ const rowSelection = computed(() => ({
})); }));
/** 查询列表 */ /** 查询列表 */
const getList = async () => { async function getList() {
loading.value = true; loading.value = true;
try { try {
if (props.productId) { if (props.productId) {
@ -151,22 +151,22 @@ const getList = async () => {
} finally { } finally {
loading.value = false; loading.value = false;
} }
}; }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { function handleQuery() {
queryParams.pageNo = 1; queryParams.pageNo = 1;
getList(); getList();
}; }
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { function resetQuery() {
queryFormRef.value.resetFields(); queryFormRef.value.resetFields();
handleQuery(); handleQuery();
}; }
/** 打开弹窗 */ /** 打开弹窗 */
const open = async () => { async function open() {
dialogVisible.value = true; dialogVisible.value = true;
// //
selectedDevices.value = []; selectedDevices.value = [];
@ -178,7 +178,7 @@ const open = async () => {
} }
// //
await getList(); await getList();
}; }
defineExpose({ open }); defineExpose({ open });
/** 处理行点击事件 */ /** 处理行点击事件 */

View File

@ -1,4 +1,164 @@
<!-- 设备消息列表 --> <script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
import { ContentWrap } from '@vben/common-ui';
import { DICT_TYPE } from '@vben/constants';
import { IconifyIcon } from '@vben/icons';
import { formatDate } from '@vben/utils';
import { Button, Form, Pagination, Select, Switch, Table, Tag } from 'ant-design-vue';
import { getDeviceMessagePage } from '#/api/iot/device/device';
import { DictTag } from '#/components/dict-tag';
import { IotDeviceMessageMethodEnum } from '#/views/iot/utils/constants';
const props = defineProps<{
deviceId: number;
}>();
//
const queryParams = reactive({
deviceId: props.deviceId,
method: undefined,
upstream: undefined,
pageNo: 1,
pageSize: 10,
});
//
const loading = ref(false);
const total = ref(0);
const list = ref<any[]>([]);
const autoRefresh = ref(false); //
let autoRefreshTimer: any = null; //
//
const methodOptions = computed(() => {
return Object.values(IotDeviceMessageMethodEnum).map((item) => ({
label: item.name,
value: item.method,
}));
});
//
const columns = [
{
title: '时间',
dataIndex: 'ts',
key: 'ts',
align: 'center' as const,
width: 180,
},
{
title: '上行/下行',
dataIndex: 'upstream',
key: 'upstream',
align: 'center' as const,
width: 140,
},
{
title: '是否回复',
dataIndex: 'reply',
key: 'reply',
align: 'center' as const,
width: 140,
},
{
title: '请求编号',
dataIndex: 'requestId',
key: 'requestId',
align: 'center' as const,
width: 300,
},
{
title: '请求方法',
dataIndex: 'method',
key: 'method',
align: 'center' as const,
width: 140,
},
{
title: '请求/响应数据',
dataIndex: 'params',
key: 'params',
align: 'center' as const,
ellipsis: true,
},
];
/** 查询消息列表 */
async function getMessageList() {
if (!props.deviceId) return;
loading.value = true;
try {
const data = await getDeviceMessagePage(queryParams);
total.value = data.total;
list.value = data.list;
} finally {
loading.value = false;
}
}
/** 搜索操作 */
function handleQuery() {
queryParams.pageNo = 1;
getMessageList();
}
/** 监听自动刷新 */
watch(autoRefresh, (newValue) => {
if (newValue) {
autoRefreshTimer = setInterval(() => {
getMessageList();
}, 5000);
} else {
clearInterval(autoRefreshTimer);
autoRefreshTimer = null;
}
});
/** 监听设备标识变化 */
watch(
() => props.deviceId,
(newValue) => {
if (newValue) {
handleQuery();
}
},
);
/** 组件卸载时清除定时器 */
onBeforeUnmount(() => {
if (autoRefreshTimer) {
clearInterval(autoRefreshTimer);
autoRefreshTimer = null;
}
});
/** 初始化 */
onMounted(() => {
if (props.deviceId) {
getMessageList();
}
});
/** 刷新消息列表 */
function refresh(delay = 0) {
if (delay > 0) {
setTimeout(() => {
handleQuery();
}, delay);
} else {
handleQuery();
}
}
/** 暴露方法给父组件 */
defineExpose({
refresh,
});
</script>
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索区域 --> <!-- 搜索区域 -->
@ -94,164 +254,3 @@
</div> </div>
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
import { ContentWrap } from '@vben/common-ui';
import { DICT_TYPE } from '@vben/constants';
import { IconifyIcon } from '@vben/icons';
import { formatDate } from '@vben/utils';
import { Button, Form, Pagination, Select, Switch, Table, Tag } from 'ant-design-vue';
import { getDeviceMessagePage } from '#/api/iot/device/device';
import { DictTag } from '#/components/dict-tag';
import { IotDeviceMessageMethodEnum } from '#/views/iot/utils/constants';
const props = defineProps<{
deviceId: number;
}>();
//
const queryParams = reactive({
deviceId: props.deviceId,
method: undefined,
upstream: undefined,
pageNo: 1,
pageSize: 10,
});
//
const loading = ref(false);
const total = ref(0);
const list = ref<any[]>([]);
const autoRefresh = ref(false); //
let autoRefreshTimer: any = null; //
//
const methodOptions = computed(() => {
return Object.values(IotDeviceMessageMethodEnum).map((item) => ({
label: item.name,
value: item.method,
}));
});
//
const columns = [
{
title: '时间',
dataIndex: 'ts',
key: 'ts',
align: 'center' as const,
width: 180,
},
{
title: '上行/下行',
dataIndex: 'upstream',
key: 'upstream',
align: 'center' as const,
width: 140,
},
{
title: '是否回复',
dataIndex: 'reply',
key: 'reply',
align: 'center' as const,
width: 140,
},
{
title: '请求编号',
dataIndex: 'requestId',
key: 'requestId',
align: 'center' as const,
width: 300,
},
{
title: '请求方法',
dataIndex: 'method',
key: 'method',
align: 'center' as const,
width: 140,
},
{
title: '请求/响应数据',
dataIndex: 'params',
key: 'params',
align: 'center' as const,
ellipsis: true,
},
];
/** 查询消息列表 */
const getMessageList = async () => {
if (!props.deviceId) return;
loading.value = true;
try {
const data = await getDeviceMessagePage(queryParams);
total.value = data.total;
list.value = data.list;
} finally {
loading.value = false;
}
};
/** 搜索操作 */
const handleQuery = () => {
queryParams.pageNo = 1;
getMessageList();
};
/** 监听自动刷新 */
watch(autoRefresh, (newValue) => {
if (newValue) {
autoRefreshTimer = setInterval(() => {
getMessageList();
}, 5000);
} else {
clearInterval(autoRefreshTimer);
autoRefreshTimer = null;
}
});
/** 监听设备标识变化 */
watch(
() => props.deviceId,
(newValue) => {
if (newValue) {
handleQuery();
}
},
);
/** 组件卸载时清除定时器 */
onBeforeUnmount(() => {
if (autoRefreshTimer) {
clearInterval(autoRefreshTimer);
autoRefreshTimer = null;
}
});
/** 初始化 */
onMounted(() => {
if (props.deviceId) {
getMessageList();
}
});
/** 刷新消息列表 */
const refresh = (delay = 0) => {
if (delay > 0) {
setTimeout(() => {
handleQuery();
}, delay);
} else {
handleQuery();
}
};
/** 暴露方法给父组件 */
defineExpose({
refresh,
});
</script>

View File

@ -52,7 +52,7 @@ const serviceThingModels = computed(() => {
}); });
/** 查询列表 */ /** 查询列表 */
const getList = async () => { async function getList() {
if (!props.deviceId) return; if (!props.deviceId) return;
loading.value = true; loading.value = true;
try { try {
@ -62,43 +62,43 @@ const getList = async () => {
} finally { } finally {
loading.value = false; loading.value = false;
} }
}; }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { function handleQuery() {
queryParams.pageNo = 1; queryParams.pageNo = 1;
getList(); getList();
}; }
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { function resetQuery() {
queryFormRef.value?.resetFields(); queryFormRef.value?.resetFields();
queryParams.identifier = ''; queryParams.identifier = '';
queryParams.times = []; queryParams.times = [];
handleQuery(); handleQuery();
}; }
/** 获取服务名称 */ /** 获取服务名称 */
const getServiceName = (identifier: string | undefined) => { function getServiceName(identifier: string | undefined) {
if (!identifier) return '-'; if (!identifier) return '-';
const service = serviceThingModels.value.find( const service = serviceThingModels.value.find(
(item: ThingModelData) => item.identifier === identifier, (item: ThingModelData) => item.identifier === identifier,
); );
return service?.name || identifier; return service?.name || identifier;
}; }
/** 获取调用方式 */ /** 获取调用方式 */
const getCallType = (identifier: string | undefined) => { function getCallType(identifier: string | undefined) {
if (!identifier) return '-'; if (!identifier) return '-';
const service = serviceThingModels.value.find( const service = serviceThingModels.value.find(
(item: ThingModelData) => item.identifier === identifier, (item: ThingModelData) => item.identifier === identifier,
); );
if (!service?.service?.callType) return '-'; if (!service?.service?.callType) return '-';
return getThingModelServiceCallTypeLabel(service.service.callType) || '-'; return getThingModelServiceCallTypeLabel(service.service.callType) || '-';
}; }
/** 解析参数 */ /** 解析参数 */
const parseParams = (params: string) => { function parseParams(params: string) {
if (!params) return '-'; if (!params) return '-';
try { try {
const parsed = JSON.parse(params); const parsed = JSON.parse(params);
@ -109,7 +109,7 @@ const parseParams = (params: string) => {
} catch { } catch {
return params; return params;
} }
}; }
/** 初始化 */ /** 初始化 */
onMounted(() => { onMounted(() => {

View File

@ -22,7 +22,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@ -47,7 +47,7 @@ async function handleDelete(row: IotDeviceGroupApi.DeviceGroup) {
message.success({ message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]), content: $t('ui.actionMessage.deleteSuccess', [row.name]),
}); });
onRefresh(); handleRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@ -97,7 +97,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@ -22,7 +22,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@ -52,7 +52,7 @@ async function handleDelete(row: IoTOtaFirmwareApi.Firmware) {
message.success({ message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]), content: $t('ui.actionMessage.deleteSuccess', [row.name]),
}); });
onRefresh(); handleRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@ -91,7 +91,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@ -21,7 +21,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@ -46,7 +46,7 @@ async function handleDelete(row: IoTOtaFirmwareApi.Firmware) {
message.success({ message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]), content: $t('ui.actionMessage.deleteSuccess', [row.name]),
}); });
onRefresh(); handleRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@ -85,7 +85,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title="OTA "> <Grid table-title="OTA ">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@ -21,7 +21,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@ -46,7 +46,7 @@ async function handleDelete(row: any) {
message.success({ message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]), content: $t('ui.actionMessage.deleteSuccess', [row.name]),
}); });
onRefresh(); handleRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@ -85,7 +85,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@ -21,7 +21,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@ -46,7 +46,7 @@ async function handleDelete(row: any) {
message.success({ message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]), content: $t('ui.actionMessage.deleteSuccess', [row.name]),
}); });
onRefresh(); handleRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@ -85,7 +85,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@ -21,7 +21,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@ -46,7 +46,7 @@ async function handleDelete(row: any) {
message.success({ message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]), content: $t('ui.actionMessage.deleteSuccess', [row.name]),
}); });
onRefresh(); handleRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@ -85,7 +85,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@ -33,7 +33,7 @@ const subGroup = useVModel(props, 'modelValue', emit);
const maxConditions = computed(() => props.maxConditions || 3); // const maxConditions = computed(() => props.maxConditions || 3); //
/** 添加条件 */ /** 添加条件 */
const addCondition = async () => { async function addCondition() {
// subGroup.value // subGroup.value
if (!subGroup.value) { if (!subGroup.value) {
subGroup.value = []; subGroup.value = [];
@ -58,7 +58,7 @@ const addCondition = async () => {
if (subGroup.value) { if (subGroup.value) {
subGroup.value.push(newCondition); subGroup.value.push(newCondition);
} }
}; }
/** /**
* 移除条件 * 移除条件

View File

@ -25,7 +25,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@ -51,7 +51,7 @@ async function handleToggleStatus(row: RuleSceneApi.SceneRule) {
message.success({ message.success({
content: newStatus === 0 ? '启用成功' : '停用成功', content: newStatus === 0 ? '启用成功' : '停用成功',
}); });
onRefresh(); handleRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@ -68,7 +68,7 @@ async function handleDelete(row: RuleSceneApi.SceneRule) {
message.success({ message.success({
content: $t('ui.actionMessage.deleteSuccess', [row.name]), content: $t('ui.actionMessage.deleteSuccess', [row.name]),
}); });
onRefresh(); handleRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@ -107,7 +107,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title=""> <Grid table-title="">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@ -63,17 +63,17 @@ const [Grid, gridApi] = useVbenVxeGrid({
}); });
// //
const handleCreate = () => { function handleCreate() {
thingModelFormRef.value?.open('create'); thingModelFormRef.value?.open('create');
}; }
// //
const handleEdit = (row: any) => { function handleEdit(row: any) {
thingModelFormRef.value?.open('update', row.id); thingModelFormRef.value?.open('update', row.id);
}; }
// //
const handleDelete = async (row: any) => { async function handleDelete(row: any) {
try { try {
await deleteThingModel(row.id); await deleteThingModel(row.id);
message.success('删除成功'); message.success('删除成功');
@ -81,31 +81,31 @@ const handleDelete = async (row: any) => {
} catch (error) { } catch (error) {
console.error('删除失败:', error); console.error('删除失败:', error);
} }
}; }
// TSL // TSL
const handleOpenTSL = () => { function handleOpenTSL() {
thingModelTSLRef.value?.open(); thingModelTSLRef.value?.open();
}; }
// //
const getDataTypeLabel = (row: any) => { function getDataTypeLabel(row: any) {
return getDataTypeOptionsLabel(row.property?.dataType) || '-'; return getDataTypeOptionsLabel(row.property?.dataType) || '-';
}; }
// //
const handleRefresh = () => { function handleRefresh() {
gridApi.reload(); gridApi.reload();
}; }
// //
const getProductData = async () => { async function getProductData() {
try { try {
product.value = await getProduct(props.productId); product.value = await getProduct(props.productId);
} catch (error) { } catch (error) {
console.error('获取产品信息失败:', error); console.error('获取产品信息失败:', error);
} }
}; }
// //
onMounted(async () => { onMounted(async () => {

View File

@ -61,7 +61,7 @@ const formData = ref<any>({
const formRef = ref(); // Ref const formRef = ref(); // Ref
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number) => { async function open(type: string, id?: number) {
dialogVisible.value = true; dialogVisible.value = true;
// create -> update -> // create -> update ->
dialogTitle.value = type === 'create' ? $t('page.action.add') : $t('page.action.edit'); 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; formLoading.value = false;
} }
} }
}; }
defineExpose({ open, close: () => (dialogVisible.value = false) }); defineExpose({ open, close: () => (dialogVisible.value = false) });
async function submitForm() { async function submitForm() {

View File

@ -18,17 +18,17 @@ const product = inject<Ref<IotProductApi.Product>>(IOT_PROVIDE_KEY.PRODUCT); //
const viewMode = ref('view'); // view-editor- const viewMode = ref('view'); // view-editor-
/** 打开弹窗 */ /** 打开弹窗 */
const open = async () => { async function open() {
dialogVisible.value = true; dialogVisible.value = true;
await getTsl(); await getTsl();
}; }
defineExpose({ open }); defineExpose({ open });
/** 获取 TSL */ /** 获取 TSL */
const thingModelTSL = ref<any>({}); const thingModelTSL = ref<any>({});
const tslString = ref(''); // const tslString = ref(''); //
const getTsl = async () => { async function getTsl() {
try { try {
thingModelTSL.value = await getThingModelTSL(product?.value?.id || 0); thingModelTSL.value = await getThingModelTSL(product?.value?.id || 0);
// JSON // JSON
@ -38,7 +38,7 @@ const getTsl = async () => {
thingModelTSL.value = {}; thingModelTSL.value = {};
tslString.value = '{}'; tslString.value = '{}';
} }
}; }
/** 格式化的 TSL 用于只读展示 */ /** 格式化的 TSL 用于只读展示 */
const formattedTSL = computed(() => { const formattedTSL = computed(() => {