|
@@ -1,14 +1,12 @@
|
|
|
-
|
|
|
<template>
|
|
|
<div class="type-item">
|
|
|
<div v-for="(item, index) in parallel" :key="index" class="item " :class="index > 0 ? 'biankang' : ''">
|
|
|
- <div class="conicon" style="width: 100%; text-align: right; position: relative; right: -8px; top: -8px; color: red"
|
|
|
- v-if="index > 0">
|
|
|
+ <div class="conicon" style="width: 100%; text-align: right; position: relative; right: -8px; top: -8px; color: red" v-if="index > 0">
|
|
|
<el-icon @click="delScene(index)">
|
|
|
<CircleClose />
|
|
|
</el-icon>
|
|
|
</div>
|
|
|
- <div class="product flex flex-warp">
|
|
|
+ <div class="product flex flex-warp" v-if="item?.actionType">
|
|
|
<el-form-item label="动作类型:" prop="actionType">
|
|
|
<el-select v-model="item.actionType" filterable clearable placeholder="请选择动作类型" @change="saveData">
|
|
|
<el-option v-for="it in sence_action_type" :key="it.value" :label="it.label" :value="it.value">
|
|
@@ -17,25 +15,24 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <DeviceOut :index="index" :data="parallel[index]" :sourceData="sourceData" v-if="item.actionType==='deviceOutput' && parallel[index] && sourceData.length>0" @SetSaveData="SetSaveData"></DeviceOut>
|
|
|
- <SendNotice :index="index" :data="parallel[index]" v-if="item.actionType==='sendNotice' && parallel[index]" @SetSaveData="SetSaveData"></SendNotice>
|
|
|
- <CallWebService :index="index" :data="parallel[index]" v-if="item.actionType==='callWebService' && parallel[index]" @SetSaveData="SetSaveData"></CallWebService>
|
|
|
- <TriggerAlarm :index="index" :data="parallel[index]" v-if="item.actionType==='triggerAlarm' && parallel[index]" @SetSaveData="SetSaveData"></TriggerAlarm>
|
|
|
- <DelayExecution :index="index" :data="parallel[index]" v-if="item.actionType==='delayExecution' && parallel[index]" @SetSaveData="SetSaveData"></DelayExecution>
|
|
|
- <TriggerCustomEvent :index="index" :data="parallel[index]" v-if="item.actionType==='triggerCustomEvent' && parallel[index]" @SetSaveData="SetSaveData"></TriggerCustomEvent>
|
|
|
+ <DeviceOut :index="index" :data="parallel[index]" :sourceData="sourceData" v-if="item.actionType === 'deviceOutput' && parallel[index] && sourceData.length > 0" @SetSaveData="SetSaveData"></DeviceOut>
|
|
|
+ <SendNotice :index="index" :data="parallel[index]" v-else-if="item.actionType === 'sendNotice' && parallel[index]" @SetSaveData="SetSaveData"></SendNotice>
|
|
|
+ <CallWebService :index="index" :data="parallel[index]" v-else-if="item.actionType === 'callWebService' && parallel[index]" @SetSaveData="SetSaveData"></CallWebService>
|
|
|
+ <TriggerAlarm :index="index" :data="parallel[index]" v-else-if="item.actionType === 'triggerAlarm' && parallel[index]" @SetSaveData="SetSaveData"></TriggerAlarm>
|
|
|
+ <DelayExecution :index="index" :data="parallel[index]" v-else-if="item.actionType === 'delayExecution' && parallel[index]" @SetSaveData="SetSaveData"></DelayExecution>
|
|
|
+ <TriggerCustomEvent :index="index" :data="parallel[index]" v-else-if="item.actionType === 'triggerCustomEvent' && parallel[index]" @SetSaveData="SetSaveData"></TriggerCustomEvent>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div class=" flex-center">
|
|
|
- <el-button :icon="DocumentAdd" @click="addScene()"
|
|
|
- style="border: 1px solid #409eff;color: #409eff;">新增串行动作</el-button>
|
|
|
+ <el-button :icon="DocumentAdd" @click="addScene()" style="border: 1px solid #409eff;color: #409eff;">新增串行动作</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { PropType, ref, watch, getCurrentInstance } from 'vue'
|
|
|
+import { PropType, ref, watch, getCurrentInstance } from 'vue'
|
|
|
import { DocumentAdd, CircleClose } from '@element-plus/icons-vue';
|
|
|
import DeviceOut from './actionType/deviceOut.vue';
|
|
|
import SendNotice from './actionType/sendNotice.vue';
|
|
@@ -49,7 +46,7 @@ const { proxy } = getCurrentInstance() as any;
|
|
|
const { sence_action_type } = proxy.useDict('sence_action_type');
|
|
|
|
|
|
interface IValueType {
|
|
|
- actionType?:string;
|
|
|
+ actionType?: string;
|
|
|
}
|
|
|
interface testIValueType {
|
|
|
key?: string;
|
|
@@ -67,18 +64,18 @@ const props = defineProps({
|
|
|
default: () => []
|
|
|
},
|
|
|
index: {
|
|
|
- type: Number ,
|
|
|
+ type: Number,
|
|
|
default: () => []
|
|
|
}
|
|
|
})
|
|
|
const parallelValue = ref(props.parallel);
|
|
|
|
|
|
-const saveData=()=>{
|
|
|
- let newData={
|
|
|
- index:props.index,
|
|
|
- data:props.parallel,
|
|
|
+const saveData = () => {
|
|
|
+ let newData = {
|
|
|
+ index: props.index,
|
|
|
+ data: props.parallel,
|
|
|
}
|
|
|
- emit('saveData',newData);
|
|
|
+ emit('saveData', newData);
|
|
|
}
|
|
|
watch(() => props.parallel, (newSerial) => {
|
|
|
parallelValue.value = newSerial;
|
|
@@ -87,11 +84,11 @@ watch(() => props.parallel, (newSerial) => {
|
|
|
|
|
|
|
|
|
|
|
|
-const SetSaveData = (data:any) => {
|
|
|
+const SetSaveData = (data: any) => {
|
|
|
parallelValue.value[data.index] = data.data;
|
|
|
- let newData={
|
|
|
- index:props.index,
|
|
|
- data:parallelValue.value,
|
|
|
+ let newData = {
|
|
|
+ index: props.index,
|
|
|
+ data: parallelValue.value,
|
|
|
}
|
|
|
emit('saveData', newData);
|
|
|
}
|
|
@@ -102,11 +99,11 @@ const addScene = () => {
|
|
|
};
|
|
|
const delScene = (index: number) => {
|
|
|
props.parallel.splice(index, 1);
|
|
|
- let newData={
|
|
|
- index:props.index,
|
|
|
- data:props.parallel,
|
|
|
+ let newData = {
|
|
|
+ index: props.index,
|
|
|
+ data: props.parallel,
|
|
|
}
|
|
|
- emit('saveData',newData);
|
|
|
+ emit('saveData', newData);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -164,4 +161,3 @@ const delScene = (index: number) => {
|
|
|
|
|
|
}
|
|
|
</style>
|
|
|
-
|