【功能新增】IoT: 场景联动增加定时触发配置
parent
aed4ff0718
commit
0961df37dd
|
|
@ -44,8 +44,9 @@
|
||||||
<Icon icon="ep:delete" />
|
<Icon icon="ep:delete" />
|
||||||
</el-button>
|
</el-button>
|
||||||
</device-listener>
|
</device-listener>
|
||||||
<!-- TODO @puhui999:可以使用 el-button,然后选个合适的样式哇 -->
|
<el-button class="ml-10px!" type="primary" size="small" @click="addTrigger">
|
||||||
<el-text class="ml-10px!" type="primary" @click="addTrigger">添加触发器</el-text>
|
添加触发器
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-divider content-position="left">执行动作配置</el-divider>
|
<el-divider content-position="left">执行动作配置</el-divider>
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,19 @@
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center mr-60px">
|
<div
|
||||||
|
v-if="triggerConfig.type === IotRuleSceneTriggerTypeEnum.DEVICE"
|
||||||
|
class="flex items-center mr-60px"
|
||||||
|
>
|
||||||
<span class="mr-10px">产品</span>
|
<span class="mr-10px">产品</span>
|
||||||
<el-button type="primary" @click="productTableSelectRef?.open()" size="small" plain>
|
<el-button type="primary" @click="productTableSelectRef?.open()" size="small" plain>
|
||||||
{{ product ? product.name : '选择产品' }}
|
{{ product ? product.name : '选择产品' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center mr-60px">
|
<div
|
||||||
|
v-if="triggerConfig.type === IotRuleSceneTriggerTypeEnum.DEVICE"
|
||||||
|
class="flex items-center mr-60px"
|
||||||
|
>
|
||||||
<span class="mr-10px">设备</span>
|
<span class="mr-10px">设备</span>
|
||||||
<el-button type="primary" @click="openDeviceSelect" size="small" plain>
|
<el-button type="primary" @click="openDeviceSelect" size="small" plain>
|
||||||
{{ isEmpty(deviceList) ? '选择设备' : triggerConfig.deviceNames.join(',') }}
|
{{ isEmpty(deviceList) ? '选择设备' : triggerConfig.deviceNames.join(',') }}
|
||||||
|
|
@ -36,71 +42,89 @@
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 触发器条件 -->
|
<!-- 设备触发器条件 -->
|
||||||
<div
|
<template v-if="triggerConfig.type === IotRuleSceneTriggerTypeEnum.DEVICE">
|
||||||
class="bg-[#dbe5f6] flex p-10px"
|
<div
|
||||||
v-for="(condition, index) in triggerConfig.conditions"
|
class="bg-[#dbe5f6] flex p-10px"
|
||||||
:key="index"
|
v-for="(condition, index) in triggerConfig.conditions"
|
||||||
>
|
:key="index"
|
||||||
<div class="flex flex-col items-center justify-center mr-10px h-a">
|
>
|
||||||
<el-select
|
<div class="flex flex-col items-center justify-center mr-10px h-a">
|
||||||
v-model="condition.type"
|
<el-select
|
||||||
@change="condition.parameters = []"
|
v-model="condition.type"
|
||||||
class="!w-160px"
|
@change="condition.parameters = []"
|
||||||
clearable
|
class="!w-160px"
|
||||||
placeholder=""
|
clearable
|
||||||
>
|
placeholder=""
|
||||||
<el-option label="属性" :value="IotDeviceMessageTypeEnum.PROPERTY" />
|
>
|
||||||
<el-option label="服务" :value="IotDeviceMessageTypeEnum.SERVICE" />
|
<el-option label="属性" :value="IotDeviceMessageTypeEnum.PROPERTY" />
|
||||||
<el-option label="事件" :value="IotDeviceMessageTypeEnum.EVENT" />
|
<el-option label="服务" :value="IotDeviceMessageTypeEnum.SERVICE" />
|
||||||
</el-select>
|
<el-option label="事件" :value="IotDeviceMessageTypeEnum.EVENT" />
|
||||||
</div>
|
</el-select>
|
||||||
<div class="">
|
</div>
|
||||||
<DeviceListenerCondition
|
<div class="">
|
||||||
v-for="(parameter, index2) in condition.parameters"
|
<DeviceListenerCondition
|
||||||
:key="index2"
|
v-for="(parameter, index2) in condition.parameters"
|
||||||
:model-value="parameter"
|
:key="index2"
|
||||||
:thingModels="thingModels(condition)"
|
:model-value="parameter"
|
||||||
@update:model-value="(val) => (condition.parameters[index2] = val)"
|
:thingModels="thingModels(condition)"
|
||||||
class="mb-10px last:mb-0"
|
@update:model-value="(val) => (condition.parameters[index2] = val)"
|
||||||
>
|
class="mb-10px last:mb-0"
|
||||||
<el-tooltip content="删除参数" placement="top">
|
>
|
||||||
|
<el-tooltip content="删除参数" placement="top">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
circle
|
||||||
|
size="small"
|
||||||
|
@click="removeConditionParameter(condition.parameters, index2)"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:delete" />
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
</DeviceListenerCondition>
|
||||||
|
</div>
|
||||||
|
<!-- 添加参数 -->
|
||||||
|
<div class="flex flex-1 flex-col items-center justify-center w-60px h-a">
|
||||||
|
<el-tooltip content="添加参数" placement="top">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="primary"
|
||||||
circle
|
circle
|
||||||
size="small"
|
size="small"
|
||||||
@click="removeConditionParameter(condition.parameters, index2)"
|
@click="addConditionParameter(condition.parameters)"
|
||||||
>
|
>
|
||||||
|
<Icon icon="ep:plus" />
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
<!-- 删除条件 -->
|
||||||
|
<div
|
||||||
|
class="device-listener-condition flex flex-1 flex-col items-center justify-center w-a h-a"
|
||||||
|
>
|
||||||
|
<el-tooltip content="删除条件" placement="top">
|
||||||
|
<el-button type="danger" size="small" @click="removeCondition(index)">
|
||||||
<Icon icon="ep:delete" />
|
<Icon icon="ep:delete" />
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</DeviceListenerCondition>
|
</div>
|
||||||
</div>
|
|
||||||
<!-- 添加参数 -->
|
|
||||||
<div class="flex flex-1 flex-col items-center justify-center w-60px h-a">
|
|
||||||
<el-tooltip content="添加参数" placement="top">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
circle
|
|
||||||
size="small"
|
|
||||||
@click="addConditionParameter(condition.parameters)"
|
|
||||||
>
|
|
||||||
<Icon icon="ep:plus" />
|
|
||||||
</el-button>
|
|
||||||
</el-tooltip>
|
|
||||||
</div>
|
|
||||||
<!-- 删除条件 -->
|
|
||||||
<div
|
|
||||||
class="device-listener-condition flex flex-1 flex-col items-center justify-center w-a h-a"
|
|
||||||
>
|
|
||||||
<el-tooltip content="删除条件" placement="top">
|
|
||||||
<el-button type="danger" size="small" @click="removeCondition(index)">
|
|
||||||
<Icon icon="ep:delete" />
|
|
||||||
</el-button>
|
|
||||||
</el-tooltip>
|
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
<!-- 定时触发 -->
|
||||||
|
<div
|
||||||
|
v-if="triggerConfig.type === IotRuleSceneTriggerTypeEnum.TIMER"
|
||||||
|
class="bg-[#dbe5f6] flex items-center justify-between p-10px"
|
||||||
|
>
|
||||||
|
<span class="w-120px">CRON 表达式</span>
|
||||||
|
<crontab v-model="triggerConfig.cronExpression" />
|
||||||
</div>
|
</div>
|
||||||
<el-text class="ml-10px!" type="primary" @click="addCondition">添加触发条件</el-text>
|
<!-- 设备触发才可以设置多个触发条件 -->
|
||||||
|
<el-text
|
||||||
|
v-if="triggerConfig.type === IotRuleSceneTriggerTypeEnum.DEVICE"
|
||||||
|
class="ml-10px!"
|
||||||
|
type="primary"
|
||||||
|
@click="addCondition"
|
||||||
|
>
|
||||||
|
添加触发条件
|
||||||
|
</el-text>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 产品、设备的选择 -->
|
<!-- 产品、设备的选择 -->
|
||||||
|
|
@ -126,6 +150,7 @@ import { ThingModelApi } from '@/api/iot/thingmodel'
|
||||||
import {
|
import {
|
||||||
IotDeviceMessageIdentifierEnum,
|
IotDeviceMessageIdentifierEnum,
|
||||||
IotDeviceMessageTypeEnum,
|
IotDeviceMessageTypeEnum,
|
||||||
|
IotRuleSceneTriggerTypeEnum,
|
||||||
TriggerCondition,
|
TriggerCondition,
|
||||||
TriggerConditionParameter,
|
TriggerConditionParameter,
|
||||||
TriggerConfig
|
TriggerConfig
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue