Explorar el Código

feat: 修复场景详情报错问题

yanglzh hace 1 año
padre
commit
e7aae7103c

+ 4 - 4
src/views/iot/scene/manage/component/actionItem.vue

@@ -38,14 +38,14 @@ import api from '/@/api/scene';
 
 const loading = ref(false)
 //初始化数据
-const actionList_temp = ref([{
+const actionList_temp = ref({
   serial: [{ actionType: '' }],
   parallel: [{ actionType: '' }],
-}]);
-const actionList = ref([{
+});
+const actionList = ref({
   serial: [{ actionType: '' }],
   parallel: [{ actionType: '' }],
-}]);
+});
 const originalSceneList = ref([{
   id: 0
 }]);

+ 33 - 30
src/views/iot/scene/manage/component/actionType/sendNotice.vue

@@ -1,36 +1,37 @@
 <template>
-  <el-form-item label="通知方式" prop="productKey" class="form-item" style="margin-left: 50px;">
-    <el-select v-model="fromData.notice.types" filterable clearable placeholder="请选择通知方式" @change="seletChange">
+  <el-form-item label="通知方式" prop="productKey" class="form-item">
+    <el-select v-model="fromData.notice.types" filterable clearable placeholder="请选择通知方式" @change="seletChange" style="width: 100%;">
       <el-option v-for="item in notice_send_gateway" :key="item.value" :label="item.label" :value="item.value" />
     </el-select>
   </el-form-item>
 
   <el-form-item label="通知配置:" prop="name" class="form-item">
-    <el-select v-model="fromData.notice.name" filterable clearable placeholder="请选择通知配置" @change="getTemplist">
+    <el-select v-model="fromData.notice.name" filterable clearable placeholder="请选择通知配置" @change="getTemplist" style="width: 100%;">
       <el-option v-for="item in sendGatewayData" :key="item.id" :label="item.title" :value="item.id" />
     </el-select>
   </el-form-item>
 
   <el-form-item label="通知模板:" prop="executeAction" class="form-item">
-    <el-select v-model="fromData.notice.template" filterable clearable placeholder="请选择触发类型">
+    <el-select v-model="fromData.notice.template" filterable clearable placeholder="请选择触发类型" style="width: 100%;">
       <el-option v-for="item in noticeConfigData" :key="item.id" :label="item.title" :value="item.id" />
     </el-select>
   </el-form-item>
 
-
-  <div class="form-item" v-for="(ph, phindex) in fromData.notice.object_temp" :key="phindex">
-    <el-input v-model="ph.info" placeholder="请输入接收人信息" style="width: 320px" @input="saveData" />
-    <el-icon style="width: 32px; height: 32px; font-size: 24px" v-if="phindex == 0" @click="AddPhone()">
-      <CirclePlus />
-    </el-icon>
-    <el-icon style="width: 32px; height: 32px; font-size: 24px" v-if="phindex > 0" @click="DelPhone( phindex)">
-      <Remove />
-    </el-icon>
-  </div>
+  <el-form-item label="" prop="executeAction" class="form-item" v-for="(ph, phindex) in fromData.notice.object_temp" :key="phindex">
+    <div class="flex-row" style="width: 100%;">
+      <el-input v-model="ph.info" placeholder="请输入接收人信息" style="width: 100%;margin-left: 83px" @input="saveData" />
+      <el-icon style="width: 32px; height: 32px; font-size: 24px;margin-left: 6px;" v-if="phindex == 0" @click="AddPhone()">
+        <CirclePlus />
+      </el-icon>
+      <el-icon style="width: 32px; height: 32px; font-size: 24px;margin-left: 6px;" v-if="phindex > 0" @click="DelPhone(phindex)">
+        <Remove />
+      </el-icon>
+    </div>
+  </el-form-item>
 </template>
 
 <script lang="ts" setup>
-import { PropType, ref, getCurrentInstance,onMounted } from 'vue'
+import { PropType, ref, getCurrentInstance, onMounted } from 'vue'
 import notice from '/@/api/notice';
 import { CirclePlus, Remove } from '@element-plus/icons-vue';
 const emit = defineEmits(['SetSaveData']);
@@ -54,7 +55,7 @@ const props = defineProps({
     type: Object,
     default: () => { }
   },
-  index:{
+  index: {
     type: Number,
     default: () => 0
   },
@@ -67,14 +68,14 @@ const fromData = ref({
     template: "",
     object: {},
     object_temp: [{
-      info:'',
+      info: '',
     }]
   }
 })
 
 const AddPhone = () => {
   fromData.value.notice.object_temp.push({
-    info:'',
+    info: '',
   });
 };
 
@@ -100,25 +101,27 @@ const saveData = () => {
   SetSaveData();
 }
 const SetSaveData = () => {
-  let newdata={
-    index:props.index,
-    data:fromData.value,
+  let newdata = {
+    index: props.index,
+    data: fromData.value,
   }
-  emit('SetSaveData',newdata);
+  emit('SetSaveData', newdata);
 }
 
 onMounted(() => {
-    if (props.data && props.data.notice) {
-      fromData.value.notice = { ...props.data.notice }
-      let infoc = props.data;
-      seletChange(infoc.notice.types);
-      getTemplist(infoc.notice.name);
-    }
+  if (props.data && props.data.notice) {
+    fromData.value.notice = { ...props.data.notice }
+    let infoc = props.data;
+    seletChange(infoc.notice.types);
+    getTemplist(infoc.notice.name);
+  }
 });
 </script>
 <style scoped lang="scss">
 .form-item {
-  flex: 0 0 25%;
-
+  width: 30%;
+  max-width: 30%;
+  min-width: 30%;
+  overflow: hidden;
 }
 </style>

+ 1 - 0
src/views/iot/scene/manage/detail.vue

@@ -154,6 +154,7 @@ export default defineComponent({
 			const id = route.params && route.params.id;
 			if (state.detail.sceneType == 'device') {
 				api.manage.getOneDetail({ "sceneId": id, 'group': 'definition' }).then((res: any) => {
+					console.log(res)
 					if (!res) {
 						addScenesDetail('definition');
 						// getOneDetail();