mirror of
https://github.com/yudaocode/yudao-ui-admin-vue3.git
synced 2026-03-29 23:25:52 +00:00
feat(iot): refactor TimerConditionGroupConfig and PropertySelector for improved readability
This commit is contained in:
@@ -15,9 +15,7 @@
|
||||
<span>附加条件组</span>
|
||||
</div>
|
||||
<el-tag size="small" type="info">定时触发时需满足以下条件</el-tag>
|
||||
<el-tag size="small" type="warning">
|
||||
{{ conditionGroups?.length || 0 }} 个子条件组
|
||||
</el-tag>
|
||||
<el-tag size="small" type="warning"> {{ conditionGroups?.length || 0 }} 个子条件组 </el-tag>
|
||||
</div>
|
||||
<el-button
|
||||
type="primary"
|
||||
@@ -138,12 +136,10 @@ const addConditionGroup = async () => {
|
||||
if (!conditionGroups.value) {
|
||||
conditionGroups.value = []
|
||||
}
|
||||
|
||||
// 检查是否达到最大条件组数量限制
|
||||
if (conditionGroups.value.length >= maxGroups) {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用 nextTick 确保响应式更新完成后再添加新的条件组
|
||||
await nextTick()
|
||||
if (conditionGroups.value) {
|
||||
@@ -151,21 +147,14 @@ const addConditionGroup = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除条件组
|
||||
* @param index 条件组索引
|
||||
*/
|
||||
/** 移除条件组 */
|
||||
const removeConditionGroup = (index: number) => {
|
||||
if (conditionGroups.value) {
|
||||
conditionGroups.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新条件组
|
||||
* @param index 条件组索引
|
||||
* @param group 条件组数据
|
||||
*/
|
||||
/** 更新条件组 */
|
||||
const updateConditionGroup = (index: number, group: TriggerCondition[]) => {
|
||||
if (conditionGroups.value) {
|
||||
conditionGroups.value[index] = group
|
||||
|
||||
@@ -219,13 +219,13 @@ const thingModelTSL = ref<IotThingModelTSLResp | null>(null) // 物模型TSL数
|
||||
const propertyGroups = computed(() => {
|
||||
const groups: { label: string; options: any[] }[] = []
|
||||
|
||||
// 设备属性上报触发器 或 定时触发器(条件组中的设备属性条件)
|
||||
// 设备属性上报触发器、定时触发器(条件组中的设备属性条件)
|
||||
if (
|
||||
props.triggerType === IotRuleSceneTriggerTypeEnum.DEVICE_PROPERTY_POST ||
|
||||
props.triggerType === IotRuleSceneTriggerTypeEnum.TIMER
|
||||
) {
|
||||
const propertyOptions = propertyList.value.filter(
|
||||
(p) => p.type === IoTThingModelTypeEnum.PROPERTY
|
||||
(property) => property.type === IoTThingModelTypeEnum.PROPERTY
|
||||
)
|
||||
if (propertyOptions.length > 0) {
|
||||
groups.push({
|
||||
|
||||
Reference in New Issue
Block a user