review:【iot 物联网】场景联动的 review

This commit is contained in:
YunaiV
2025-07-28 23:25:54 +08:00
parent 9b88826a17
commit 5021c711a7
15 changed files with 145 additions and 66 deletions

View File

@ -8,6 +8,7 @@
<span class="text-16px font-600 text-[var(--el-text-color-primary)]">基础信息</span>
</div>
<div class="flex items-center gap-8px">
<!-- TODO @puhui999dict-tag 可以哇 -->
<el-tag :type="formData.status === 0 ? 'success' : 'danger'" size="small">
{{ formData.status === 0 ? '启用' : '禁用' }}
</el-tag>
@ -65,6 +66,8 @@ import { RuleSceneFormData } from '@/api/iot/rule/scene/scene.types'
/** 基础信息配置组件 */
defineOptions({ name: 'BasicInfoSection' })
// TODO @puhui999下面的 Props、Emits 可以合并到变量那;
interface Props {
modelValue: RuleSceneFormData
rules?: any

View File

@ -1,6 +1,6 @@
<!-- 场景触发器配置组件 -->
<template>
<el-card class="border border-[var(--el-border-color-light)] rounded-8px" shadow="never">
<!-- TODO @puhui999触发器还是多个每个触发器里面有事件类型 + 附加条件组最好文案上和阿里 iot 保持相对一致 -->
<template #header>
<div class="flex items-center gap-8px">
<Icon icon="ep:lightning" class="text-[var(--el-color-primary)] text-18px" />
@ -36,6 +36,7 @@
/>
<!-- 定时触发配置 -->
<!-- TODO @puhui999这里要不 v-else 好了? -->
<TimerTriggerConfig
v-if="trigger.type === TriggerTypeEnum.TIMER"
:model-value="trigger.cronExpression"
@ -57,6 +58,7 @@ import {
/** 触发器配置组件 */
defineOptions({ name: 'TriggerSection' })
// TODO @puhui999下面的 Props、Emits 可以合并到变量那;
interface Props {
trigger: TriggerFormData
}
@ -71,6 +73,7 @@ const emit = defineEmits<Emits>()
const trigger = useVModel(props, 'trigger', emit)
// 触发器类型选项
// TODO @puhui999/Users/yunai/Java/yudao-ui-admin-vue3/src/views/iot/utils/constants.ts
const triggerTypeOptions = [
{
value: TriggerTypeEnum.DEVICE_STATE_UPDATE,
@ -95,6 +98,7 @@ const triggerTypeOptions = [
]
// 工具函数
// TODO @puhui999/Users/yunai/Java/yudao-ui-admin-vue3/src/views/iot/utils/constants.ts
const isDeviceTrigger = (type: number) => {
const deviceTriggerTypes = [
TriggerTypeEnum.DEVICE_STATE_UPDATE,
@ -111,10 +115,12 @@ const updateTriggerType = (type: number) => {
onTriggerTypeChange(type)
}
// TODO @puhui999updateTriggerDeviceConfig
const updateTrigger = (newTrigger: TriggerFormData) => {
trigger.value = newTrigger
}
// TODO @puhui999updateTriggerCronConfig
const updateTriggerCronExpression = (cronExpression?: string) => {
trigger.value.cronExpression = cronExpression
}