Explorar o código

完成串行动作。后端无法方法,未进行调试

yukai %!s(int64=2) %!d(string=hai) anos
pai
achega
6db68800fa

+ 14 - 13
src/views/iot/scene/manage/component/actionSerialItem.vue

@@ -18,11 +18,11 @@
           </el-select>
         </el-form-item>
         <DeviceOut :index="index" :sourceData="sourceData" v-if="item.actionType==='deviceOutput'" @SetSaveData="SetSaveData"></DeviceOut>
-        <SendNotice  v-if="item.actionType==='sendNotice'"  @saveData="saveData"></SendNotice>
-        <CallWebService  v-if="item.actionType==='callWebService'"  @saveData="saveData"></CallWebService>
-        <TriggerAlarm  v-if="item.actionType==='triggerAlarm'"  @saveData="saveData"></TriggerAlarm>
-        <DelayExecution  v-if="item.actionType==='delayExecution'"  @saveData="saveData"></DelayExecution>
-        <TriggerCustomEvent  v-if="item.actionType==='triggerCustomEvent'"  @saveData="saveData"></TriggerCustomEvent>
+        <SendNotice  :index="index" v-if="item.actionType==='sendNotice'"  @SetSaveData="SetSaveData"></SendNotice>
+        <CallWebService :index="index"  v-if="item.actionType==='callWebService'"  @SetSaveData="SetSaveData"></CallWebService>
+        <TriggerAlarm :index="index"  v-if="item.actionType==='triggerAlarm'"  @saveData="saveData"></TriggerAlarm>
+        <DelayExecution  :index="index" v-if="item.actionType==='delayExecution'"  @saveData="saveData"></DelayExecution>
+        <TriggerCustomEvent :index="index"  v-if="item.actionType==='triggerCustomEvent'"  @saveData="saveData"></TriggerCustomEvent>
       </div>
     </div>
     <div>
@@ -35,7 +35,7 @@
 </template>
 
 <script lang="ts" setup>
-import { PropType, ref } from 'vue'
+import { PropType, ref,watch  } from 'vue'
 import { DocumentAdd, CircleClose } from '@element-plus/icons-vue';
 import DeviceOut from './actionType/deviceOut.vue';
 import SendNotice from './actionType/sendNotice.vue';
@@ -93,14 +93,16 @@ const serialValue = ref(props.serial);
 const saveData=()=>{
   emit('saveData',props.serial);
 }
+watch(() => props.serial, (newSerial) => {
+  serialValue.value = newSerial;
+});
 
-const SetSaveData=(data:any,index:number)=>{
 
-  // serialValue.value[index]=data;  
-  console.log(serialValue.value,55555555555);
-  //  props.serial.push(data);
-  // emit('saveData',serialValue.value);
 
+
+const SetSaveData = (data:any) => {
+  serialValue.value[data.index] = data.data;
+  emit('saveData', serialValue.value);
 }
 const addScene = () => {
   props.serial.push({
@@ -135,8 +137,7 @@ const delScene = (index: number) => {
 
   .biankang {
 
-    border: 1px dashed #959596;
-    ;
+    border: 1px solid #d6d6d6;
     border-radius: 10px;
   }
 

+ 12 - 2
src/views/iot/scene/manage/component/actionType/callWebService.vue

@@ -24,7 +24,14 @@
 
 <script lang="ts" setup>
 import {  ref } from 'vue'
+const emit = defineEmits(['SetSaveData']);
 
+const props = defineProps({
+  index:{
+    type: Number,
+    default: () => 0
+  },
+})
 const fromData = ref({
   actionType: "callWebService",
   callWebService: {
@@ -37,10 +44,13 @@ const fromData = ref({
   }
 })
 
-const emit = defineEmits(['saveData']);
 
 const saveData = () => {
-  emit('saveData',fromData);
+  let newdata={
+    index:props.index,
+    data:fromData.value,
+  }
+  emit('SetSaveData',newdata);
 
 }
 

+ 14 - 3
src/views/iot/scene/manage/component/actionType/delayExecution.vue

@@ -8,16 +8,27 @@
 
 <script lang="ts" setup>
 import {  ref } from 'vue'
+const emit = defineEmits(['SetSaveData']);
+
+const props = defineProps({
+  index:{
+    type: Number,
+    default: () => 0
+  },
+})
 const fromData = ref({
   actionType: "delayExecution",
   delayTime:''
 })
 
-const emit = defineEmits(['saveData']);
 
-const saveData = () => {
-  emit('saveData',fromData);
 
+const saveData = () => {
+  let newdata={
+    index:props.index,
+    data:fromData.value,
+  }
+  emit('SetSaveData',newdata);
 }
 
 

+ 6 - 2
src/views/iot/scene/manage/component/actionType/deviceOut.vue

@@ -117,7 +117,7 @@ const propertyCallList=ref<testIValueType[]>([]);
 const productKey=ref();
 const setPropertiesItem=ref([]);
 const fromData=ref({
-  actionType: "deviceOut", 
+  actionType: "deviceOutput", 
   productKey: "",
   deviceKey: "",
   executeAction:"",
@@ -171,7 +171,11 @@ const setProperties=(val:any)=>{
 }
 
 const saveData = () => {
-  emit('SetSaveData',fromData.value,props.index);
+  let newdata={
+    index:props.index,
+    data:fromData.value,
+  }
+  emit('SetSaveData',newdata);
 }
 
 const getDeviceList = (_id: any) => {

+ 15 - 4
src/views/iot/scene/manage/component/actionType/sendNotice.vue

@@ -33,6 +33,7 @@
 import { PropType, ref, getCurrentInstance } from 'vue'
 import notice from '/@/api/notice';
 import { CirclePlus, Remove } from '@element-plus/icons-vue';
+const emit = defineEmits(['SetSaveData']);
 
 const { proxy } = getCurrentInstance() as any;
 const { notice_send_gateway } = proxy.useDict('notice_send_gateway');
@@ -48,9 +49,13 @@ const props = defineProps({
     type: Array as PropType<testIValueType[]>,
     default: () => []
   },
+  index:{
+    type: Number,
+    default: () => 0
+  },
 })
 const fromData = ref({
-  actionType: "notice",
+  actionType: "sendNotice",
   notice: {
     types: "",
     name: "",
@@ -61,6 +66,7 @@ const fromData = ref({
     }]
   }
 })
+
 const AddPhone = () => {
   fromData.value.notice.object_temp.push({
     info:'',
@@ -86,10 +92,15 @@ const saveData = () => {
   const result = fromData.value.notice.object_temp.map(item => item.info);
   fromData.value.notice.object = result;
 
-  console.log(fromData);
+  SetSaveData();
+}
+const SetSaveData = () => {
+  let newdata={
+    index:props.index,
+    data:fromData.value,
+  }
+  emit('SetSaveData',newdata);
 }
-saveData();
-
 
 </script>
 <style scoped lang="scss">

+ 14 - 2
src/views/iot/scene/manage/component/actionType/triggerAlarm.vue

@@ -10,6 +10,15 @@
 
 <script lang="ts" setup>
 import {  ref } from 'vue'
+
+const emit = defineEmits(['SetSaveData']);
+
+const props = defineProps({
+  index:{
+    type: Number,
+    default: () => 0
+  },
+})
 const fromData = ref({
   actionType: "triggerAlarm",
   alarm:{
@@ -20,9 +29,12 @@ const fromData = ref({
 
 
 const saveData = () => {
-  console.log(fromData);
+  let newdata={
+    index:props.index,
+    data:fromData.value,
+  }
+  emit('SetSaveData',newdata);
 }
-saveData();
 
 
 </script>

+ 13 - 2
src/views/iot/scene/manage/component/actionType/triggerCustomEvent.vue

@@ -9,7 +9,14 @@
 <script lang="ts" setup>
 import {ref} from 'vue';
 import api from '/@/api/scene';
+const emit = defineEmits(['SetSaveData']);
 
+const props = defineProps({
+  index:{
+    type: Number,
+    default: () => 0
+  },
+})
 const fromData = ref({
   actionType: "triggerCustomEvent",
   executeAction:''
@@ -35,8 +42,12 @@ const getsceneList=()=>{
 getsceneList();
 
 const saveData = () => {
-  console.log(fromData);
+  let newdata={
+    index:props.index,
+    data:fromData.value,
+  }
+  emit('SetSaveData',newdata);
 }
-saveData();
+
 </script>