fix: iot
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
import type { ProductVO } from '#/api/iot/product/product';
|
||||
|
||||
import { inject, onMounted, ref } from 'vue';
|
||||
|
||||
import hljs from 'highlight.js'; // 导入代码高亮文件
|
||||
import json from 'highlight.js/lib/languages/json';
|
||||
|
||||
import { ProductVO } from '#/api/iot/product/product';
|
||||
import { ThingModelApi } from '#/api/iot/thingmodel';
|
||||
import { getThingModelListByProductId } from '#/api/iot/thingmodel';
|
||||
import { IOT_PROVIDE_KEY } from '#/views/iot/utils/constants';
|
||||
|
||||
import 'highlight.js/styles/github.css'; // 导入代码高亮样式
|
||||
@@ -16,18 +21,18 @@ const product = inject<Ref<ProductVO>>(IOT_PROVIDE_KEY.PRODUCT); // 注入产品
|
||||
const viewMode = ref('code'); // 查看模式:code-代码视图,editor-编辑器视图
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = () => {
|
||||
function open() {
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
}
|
||||
defineExpose({ open });
|
||||
|
||||
/** 获取 TSL */
|
||||
const thingModelTSL = ref({});
|
||||
const getTsl = async () => {
|
||||
thingModelTSL.value = await ThingModelApi.getThingModelTSLByProductId(
|
||||
async function getTsl() {
|
||||
thingModelTSL.value = await getThingModelListByProductId(
|
||||
product?.value?.id || 0,
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
|
||||
Reference in New Issue
Block a user