【代码评审】IoT:数据桥梁的 review
This commit is contained in:
parent
966f1b8b7e
commit
7cb4c48d47
@ -19,23 +19,23 @@ defineOptions({ name: 'ThingModelTSL' })
|
|||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('物模型 TSL') // 弹窗的标题
|
const dialogTitle = ref('物模型 TSL') // 弹窗的标题
|
||||||
const product = inject<Ref<ProductVO>>(IOT_PROVIDE_KEY.PRODUCT) // 注入产品信息
|
const product = inject<Ref<ProductVO>>(IOT_PROVIDE_KEY.PRODUCT) // 注入产品信息
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = () => {
|
const open = () => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
defineExpose({ open })
|
defineExpose({ open })
|
||||||
|
|
||||||
const thingModelTSL = ref('')
|
|
||||||
/** 获取 TSL */
|
/** 获取 TSL */
|
||||||
|
const thingModelTSL = ref('')
|
||||||
const getTsl = async () => {
|
const getTsl = async () => {
|
||||||
const res = await ThingModelApi.getThingModelTSLByProductId(product?.value?.id || 0)
|
const res = await ThingModelApi.getThingModelTSLByProductId(product?.value?.id || 0)
|
||||||
thingModelTSL.value = JSON.stringify(res, null, 2)
|
thingModelTSL.value = JSON.stringify(res, null, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** 代码高亮 */
|
||||||
* 代码高亮
|
|
||||||
*/
|
|
||||||
const highlightedCode = () => {
|
const highlightedCode = () => {
|
||||||
|
// TODO @puhui999:可以考虑 highlight 的告警解决下;另外,可以考虑配置设置里面,有个 json editor 预览
|
||||||
const result = hljs.highlight('json', thingModelTSL.value, true)
|
const result = hljs.highlight('json', thingModelTSL.value, true)
|
||||||
return result.value || ' '
|
return result.value || ' '
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user