|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="app-container home"> |
|
|
|
|
<el-button type="primary" :icon="Download" @click="drawerIshow = true">策略导入</el-button> |
|
|
|
|
<el-button type="primary" :icon="Download" @click="controlMsg">策略导入</el-button> |
|
|
|
|
<el-button :type=data.type plain>{{data.info}}:{{data.info1}}:{{data.result}}</el-button> |
|
|
|
|
<div class="dev_control_wrapper"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -86,7 +87,7 @@ |
|
|
|
|
<!-- </span>--> |
|
|
|
|
<!-- </div>--> |
|
|
|
|
<!-- </div>--> |
|
|
|
|
<el-button type="primary" @click="controlMsg">执行结果</el-button> |
|
|
|
|
<!-- <el-button type="primary" @click="controlMsg">执行结果</el-button>--> |
|
|
|
|
</el-radio> |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -115,14 +116,59 @@ |
|
|
|
|
import { Download } from '@element-plus/icons-vue' //element字体图标 |
|
|
|
|
import { ref,reactive,onMounted } from 'vue' |
|
|
|
|
import { ElMessageBox,ElMessage, ElLoading} from 'element-plus' |
|
|
|
|
import { getDevice,getControlLogList,getStrategyList,getStartAndStop,getSetTemperature,getSenceControl,getControlDeviceList,ControlInfo } from '@/api/control/manual' |
|
|
|
|
|
|
|
|
|
import { getDevice,getControlLogList,getStrategyList,getStartAndStop,getSetTemperature,getSenceControl,getControlDeviceList,ControlInfo ,ControlResult} from '@/api/control/manual' |
|
|
|
|
const data = reactive({ |
|
|
|
|
strategyCode:'', |
|
|
|
|
info:'', |
|
|
|
|
result:'', |
|
|
|
|
type:'' |
|
|
|
|
}) |
|
|
|
|
onMounted(()=>{ |
|
|
|
|
GetResult(); |
|
|
|
|
getDeviceFun(); |
|
|
|
|
getControlLogListFun(); |
|
|
|
|
getStrategyListFun() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
function GetResult(){ |
|
|
|
|
ControlResult().then((res)=>{ |
|
|
|
|
console.log(res) |
|
|
|
|
if(!res.data){ |
|
|
|
|
radio.value='' |
|
|
|
|
data.strategyCode='' |
|
|
|
|
data.info='暂无执行策略' |
|
|
|
|
data.info1='' |
|
|
|
|
data.result='' |
|
|
|
|
data.type='info' |
|
|
|
|
} |
|
|
|
|
else if(res.data){ |
|
|
|
|
var a = res.data.strategyRunRes.substring(res.data.strategyRunRes.length-1) |
|
|
|
|
if(a==0){ |
|
|
|
|
radio.value=res.data.strategyName |
|
|
|
|
data.strategyCode=res.data.strategyCode |
|
|
|
|
data.info=res.data.strategyName |
|
|
|
|
data.info1=res.data.runSceneName |
|
|
|
|
data.result='执行失败' |
|
|
|
|
data.type='danger' |
|
|
|
|
} |
|
|
|
|
else if (a==1){ |
|
|
|
|
radio.value=res.data.strategyName |
|
|
|
|
data.strategyCode=res.data.strategyCode |
|
|
|
|
data.info=res.data.strategyName |
|
|
|
|
data.info1=res.data.runSceneName |
|
|
|
|
data.result='执行成功' |
|
|
|
|
data.type='success' |
|
|
|
|
} |
|
|
|
|
else if(a==2){ |
|
|
|
|
radio.value=res.data.strategyName |
|
|
|
|
data.strategyCode=res.data.strategyCode |
|
|
|
|
data.info=res.data.strategyName |
|
|
|
|
data.info1=res.data.runSceneName |
|
|
|
|
data.result='执行中' |
|
|
|
|
data.type='warning' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
/** 获取所有设备*/ |
|
|
|
|
const deviceArr = ref([]) |
|
|
|
|
function getDeviceFun(){ |
|
|
|
@ -472,35 +518,40 @@ function confirmClick() { |
|
|
|
|
} |
|
|
|
|
//执行结果 |
|
|
|
|
function controlMsg() { |
|
|
|
|
ControlInfo(celueItem.strategyCode).then((res)=>{ |
|
|
|
|
console.log('执行结果',res) |
|
|
|
|
if(res.data){ |
|
|
|
|
//执行过程 |
|
|
|
|
function setFlowItem(i) { |
|
|
|
|
if (i >= res.data.length) { |
|
|
|
|
return; //递归终止条件 |
|
|
|
|
} |
|
|
|
|
if(res.data[i]==1){ |
|
|
|
|
celueItem.scenesList[i].type = 'success'; |
|
|
|
|
celueItem.scenesList[i].icon = 'Check'; |
|
|
|
|
} |
|
|
|
|
else if(res.data[i]==0){ |
|
|
|
|
celueItem.scenesList[i].type = 'danger'; |
|
|
|
|
celueItem.scenesList[i].icon = 'Close'; |
|
|
|
|
}else if(res.data[i]==2){ |
|
|
|
|
celueItem.scenesList[i].type = 'warning'; |
|
|
|
|
celueItem.scenesList[i].icon = 'loading'; |
|
|
|
|
drawerIshow.value = true |
|
|
|
|
if(data.strategyCode!=null){ |
|
|
|
|
var a = data.strategyCode-1 |
|
|
|
|
celueItem = celueList.value[a] |
|
|
|
|
ControlInfo(data.strategyCode).then((res)=>{ |
|
|
|
|
console.log('执行结果',res) |
|
|
|
|
if(res.data){ |
|
|
|
|
//执行过程 |
|
|
|
|
function setFlowItem(i) { |
|
|
|
|
if (i >= res.data.length) { |
|
|
|
|
return; //递归终止条件 |
|
|
|
|
} |
|
|
|
|
if(res.data[i]==1){ |
|
|
|
|
celueItem.scenesList[i].type = 'success'; |
|
|
|
|
celueItem.scenesList[i].icon = 'Check'; |
|
|
|
|
} |
|
|
|
|
else if(res.data[i]==0){ |
|
|
|
|
celueItem.scenesList[i].type = 'danger'; |
|
|
|
|
celueItem.scenesList[i].icon = 'Close'; |
|
|
|
|
}else if(res.data[i]==2){ |
|
|
|
|
celueItem.scenesList[i].type = 'warning'; |
|
|
|
|
celueItem.scenesList[i].icon = 'loading'; |
|
|
|
|
} |
|
|
|
|
setTimeout(function() { |
|
|
|
|
setFlowItem(i + 1); //递归调用 |
|
|
|
|
}, 1000); |
|
|
|
|
} |
|
|
|
|
setTimeout(function() { |
|
|
|
|
setFlowItem(i + 1); //递归调用 |
|
|
|
|
}, 1000); |
|
|
|
|
setFlowItem(0); //调用递归函数,从数组第一个元素开始赋值 |
|
|
|
|
getControlLogListFun() |
|
|
|
|
}else{ |
|
|
|
|
getControlLogListFun() |
|
|
|
|
} |
|
|
|
|
setFlowItem(0); //调用递归函数,从数组第一个元素开始赋值 |
|
|
|
|
getControlLogListFun() |
|
|
|
|
}else{ |
|
|
|
|
getControlLogListFun() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** 控制设备启停*/ |
|
|
|
|
const loading = ref(false) |
|
|
|
|