|
@@ -1,8 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="type-item">
|
|
<div class="type-item">
|
|
<div v-for="(item, index) in sceneList" :key="index" class="item " :class="index > 0 ? 'biankang' : ''">
|
|
<div v-for="(item, index) in sceneList" :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)">
|
|
<el-icon @click="delScene(index)">
|
|
<CircleClose />
|
|
<CircleClose />
|
|
</el-icon>
|
|
</el-icon>
|
|
@@ -12,8 +11,7 @@
|
|
</div>
|
|
</div>
|
|
<div class="product flex flex-warp">
|
|
<div class="product flex flex-warp">
|
|
<el-form-item label="产品:" prop="productKey">
|
|
<el-form-item label="产品:" prop="productKey">
|
|
- <el-select v-model="item.productKey" filterable clearable placeholder="请选择产品"
|
|
|
|
- @change="seletChange(index, item.productKey!)">
|
|
|
|
|
|
+ <el-select v-model="item.productKey" filterable clearable placeholder="请选择产品" @change="seletChange(index, item.productKey!)">
|
|
<el-option v-for="it in sourceData" :key="it.key" :label="it.name" :value="it.key">
|
|
<el-option v-for="it in sourceData" :key="it.key" :label="it.name" :value="it.key">
|
|
<span style="float: left">{{ it.name }}</span>
|
|
<span style="float: left">{{ it.name }}</span>
|
|
<span style="float: right; font-size: 13px">{{ it.key }}</span>
|
|
<span style="float: right; font-size: 13px">{{ it.key }}</span>
|
|
@@ -29,16 +27,14 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="触发类型:" prop="triggerType">
|
|
<el-form-item label="触发类型:" prop="triggerType">
|
|
- <el-select v-model="item.triggerType" clearable filterable placeholder="请选择触发类型"
|
|
|
|
- @change="getSelectcolumns(index, item.triggerType!)">
|
|
|
|
- <el-option v-for="it in sourceTypeData" :key="it.key" :label="it.name" :value="it.key">
|
|
|
|
- <span style="float: left">{{ it.name }}</span>
|
|
|
|
- <span style="float: right; font-size: 13px">{{ it.key }}</span>
|
|
|
|
|
|
+ <el-select v-model="item.triggerType" clearable filterable placeholder="请选择触发类型" @change="getSelectcolumns(index, item.triggerType!)">
|
|
|
|
+ <el-option v-for="it in sence_source_type" :key="it.value" :label="it.label" :value="it.value">
|
|
|
|
+ <span style="float: left">{{ it.label }}</span>
|
|
|
|
+ <span style="float: right; font-size: 13px">{{ it.value }}</span>
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="定时请求"
|
|
|
|
- v-if="item.triggerType && ['readAttribute', 'functionCall'].includes(item.triggerType)">
|
|
|
|
|
|
+ <el-form-item label="定时请求" v-if="item.triggerType && ['readAttribute', 'functionCall'].includes(item.triggerType)">
|
|
<div style="display:flex">
|
|
<div style="display:flex">
|
|
<el-input v-model="item.timer" placeholder="请输入cron表达式" />
|
|
<el-input v-model="item.timer" placeholder="请输入cron表达式" />
|
|
<el-dialog v-model="dialogVisible" title="选择Cron规则" width="60%">
|
|
<el-dialog v-model="dialogVisible" title="选择Cron规则" width="60%">
|
|
@@ -50,10 +46,10 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
<div class="title flex">
|
|
<div class="title flex">
|
|
- <div class="icon"></div> 触发条件 <div class="ml10"> <el-switch v-model="item.triggerSwitch" @change="EditPen(index)"/>
|
|
|
|
|
|
+ <div class="icon"></div> 触发条件 <div class="ml10"> <el-switch v-model="item.triggerSwitch" @change="EditPen(index)" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <Condition :condition="item.condition" :operate_index="index" :columnList="columnList" v-if="item.triggerSwitch && columnList.length>0" @EditPen="EditPen">
|
|
|
|
|
|
+ <Condition :condition="item.condition" :operate_index="index" :columnList="columnList" v-if="item.triggerSwitch && columnList.length > 0" @EditPen="EditPen">
|
|
</Condition>
|
|
</Condition>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
@@ -75,7 +71,10 @@ import datahub from '/@/api/datahub';
|
|
import Condition from './condition.vue';
|
|
import Condition from './condition.vue';
|
|
const { proxy } = getCurrentInstance() as any;
|
|
const { proxy } = getCurrentInstance() as any;
|
|
const scene_type = proxy.useDict('scene_type');
|
|
const scene_type = proxy.useDict('scene_type');
|
|
-const emit = defineEmits(['addScenesDetail','delScenesDetail','editScenesDetail']);
|
|
|
|
|
|
+
|
|
|
|
+const { sence_source_type } = proxy.useDict('sence_source_type');
|
|
|
|
+
|
|
|
|
+const emit = defineEmits(['addScenesDetail', 'delScenesDetail', 'editScenesDetail']);
|
|
const dialogVisible = ref();
|
|
const dialogVisible = ref();
|
|
const deviceListData = ref<testIValueType[]>([]);
|
|
const deviceListData = ref<testIValueType[]>([]);
|
|
const functionCallList = ref<testIValueType[]>([]);
|
|
const functionCallList = ref<testIValueType[]>([]);
|
|
@@ -109,40 +108,10 @@ const props = defineProps({
|
|
type: String,
|
|
type: String,
|
|
default: () => '',
|
|
default: () => '',
|
|
},
|
|
},
|
|
- sourceData:{
|
|
|
|
|
|
+ sourceData: {
|
|
type: Array as PropType<testIValueType[]>,
|
|
type: Array as PropType<testIValueType[]>,
|
|
default: () => []
|
|
default: () => []
|
|
},
|
|
},
|
|
- sourceTypeData: {
|
|
|
|
- type: Array as PropType<testIValueType[]>,
|
|
|
|
- default: () => [{
|
|
|
|
- 'key': 'onLine',
|
|
|
|
- 'name': '设备上线',
|
|
|
|
- }, {
|
|
|
|
- 'key': 'offLine',
|
|
|
|
- 'name': '设备离线',
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- {
|
|
|
|
- 'key': 'readAttribute',
|
|
|
|
- 'name': '读取属性',
|
|
|
|
- }, {
|
|
|
|
- 'key': 'modifyAttribute',
|
|
|
|
- 'name': '修改属性',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- 'key': 'reportAttribute',
|
|
|
|
- 'name': '属性上报',
|
|
|
|
- }, {
|
|
|
|
- 'key': 'reportEvent',
|
|
|
|
- 'name': '事件上报',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- 'key': 'functionCall',
|
|
|
|
- 'name': '功能调用',
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- }
|
|
|
|
})
|
|
})
|
|
|
|
|
|
const seletChange = (index: number, val: string) => {
|
|
const seletChange = (index: number, val: string) => {
|
|
@@ -168,11 +137,11 @@ const getDeviceList = (productKey: any) => {
|
|
deviceListData.value = res.device || []
|
|
deviceListData.value = res.device || []
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-const getSelectcolumns=(index: number, val: string) => {
|
|
|
|
|
|
+const getSelectcolumns = (index: number, val: string) => {
|
|
EditPen(index);
|
|
EditPen(index);
|
|
- getcolumns(index,val);
|
|
|
|
- // 重置当前项的 condition 值
|
|
|
|
- props.sceneList[index].condition = [[{
|
|
|
|
|
|
+ getcolumns(index, val);
|
|
|
|
+ // 重置当前项的 condition 值
|
|
|
|
+ props.sceneList[index].condition = [[{
|
|
'parameter': '',
|
|
'parameter': '',
|
|
'operator': '',
|
|
'operator': '',
|
|
'value': ''
|
|
'value': ''
|
|
@@ -217,7 +186,7 @@ const getcolumns = (index: number, val: string) => {
|
|
}
|
|
}
|
|
const getcolumnsList = (where: any) => {
|
|
const getcolumnsList = (where: any) => {
|
|
api.manage.getColumns(where).then((res: any) => {
|
|
api.manage.getColumns(where).then((res: any) => {
|
|
- if(res){
|
|
|
|
|
|
+ if (res) {
|
|
columnList.value = res;
|
|
columnList.value = res;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -239,8 +208,8 @@ const addScene = () => {
|
|
emit('addScenesDetail', 'definition');
|
|
emit('addScenesDetail', 'definition');
|
|
};
|
|
};
|
|
|
|
|
|
-const EditPen=(index: number)=>{
|
|
|
|
- emit('editScenesDetail',index);
|
|
|
|
|
|
+const EditPen = (index: number) => {
|
|
|
|
+ emit('editScenesDetail', index);
|
|
}
|
|
}
|
|
const delScene = (index: number) => {
|
|
const delScene = (index: number) => {
|
|
emit('delScenesDetail', index);
|
|
emit('delScenesDetail', index);
|
|
@@ -260,20 +229,19 @@ const cronclose = () => {
|
|
dialogVisible.value = false;
|
|
dialogVisible.value = false;
|
|
}
|
|
}
|
|
//初始化
|
|
//初始化
|
|
-const intScenel=()=>{
|
|
|
|
- let array_data=props.sceneList;
|
|
|
|
- array_data.map((val:any,index) => {
|
|
|
|
- if(val.productKey){
|
|
|
|
- product_key = val.productKey;
|
|
|
|
- let info = props.sourceData?.find((pro: { key: any; }) => pro.key === val.productKey);
|
|
|
|
-
|
|
|
|
- if (info) {
|
|
|
|
- getDeviceList(info.key)
|
|
|
|
- }
|
|
|
|
|
|
+const intScenel = () => {
|
|
|
|
+ let array_data = props.sceneList;
|
|
|
|
+ array_data.map((val: any, index) => {
|
|
|
|
+ if (val.productKey) {
|
|
|
|
+ product_key = val.productKey;
|
|
|
|
+ let info = props.sourceData?.find((pro: { key: any; }) => pro.key === val.productKey);
|
|
|
|
+ if (info) {
|
|
|
|
+ getDeviceList(info.id)
|
|
}
|
|
}
|
|
- if(val.triggerType){
|
|
|
|
- getcolumns(index,val.triggerType)
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ if (val.triggerType) {
|
|
|
|
+ getcolumns(index, val.triggerType)
|
|
|
|
+ }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
intScenel();
|
|
intScenel();
|
|
@@ -300,13 +268,15 @@ intScenel();
|
|
.item {
|
|
.item {
|
|
padding: 10px;
|
|
padding: 10px;
|
|
}
|
|
}
|
|
|
|
+
|
|
.biankang {
|
|
.biankang {
|
|
border: 1px solid #e8e2e2;
|
|
border: 1px solid #e8e2e2;
|
|
border-radius: 10px;
|
|
border-radius: 10px;
|
|
padding: 10px;
|
|
padding: 10px;
|
|
margin-top: 10px;
|
|
margin-top: 10px;
|
|
}
|
|
}
|
|
- .title {
|
|
|
|
|
|
+
|
|
|
|
+ .title {
|
|
height: 40px;
|
|
height: 40px;
|
|
|
|
|
|
.icon {
|
|
.icon {
|
|
@@ -317,6 +287,7 @@ intScenel();
|
|
background-color: #315efb;
|
|
background-color: #315efb;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
.product {
|
|
.product {
|
|
.el-form-item {
|
|
.el-form-item {
|
|
margin-left: 30px;
|
|
margin-left: 30px;
|