手动控制

master
wj 2 years ago
parent 9be6249cad
commit 736329ca1a
  1. 59
      psdc-ui/src/views/control/manual/index.vue

@ -2,11 +2,12 @@
<div class="app-container home">
<el-button type="primary" :icon="Download" @click="drawerIshow = true">策略导入</el-button>
<div class="dev_control_wrapper">
<div class="dev_control_item" v-for="item in deviceArr" :key="item.deviceId">
<div class="item_header">
<span>{{ item.deviceName}}</span>
<!-- <el-switch v-model="item.deviceId" class="switch" @change="handleChange(item)" style="&#45;&#45;el-switch-on-color: #13ce66; &#45;&#45;el-switch-off-color: #dddddd"/>-->
<el-switch v-model="item.deviceId" class="switch" style="--el-switch-on-color: #13ce66; --el-switch-off-color: #dddddd"/>
<el-switch v-model="item.deviceRunstatus" @change="handleDevChangeFun(item.deviceId,item.deviceRunstatus)" class="switch" style="--el-switch-on-color: #13ce66; --el-switch-off-color: #dddddd"/>
</div>
<div class="item_bottom">
<div class="item_bottom_img">
@ -14,15 +15,23 @@
</div>
<div class="item_bottom_form">
<el-form :model="form1">
<el-form-item label="当前状态:"><span :class="{'green':item.deviceRunstatus === '开启','red':item.deviceRunstatus === '关闭'}">{{ item.deviceRunstatus }}</span></el-form-item>
<el-form-item v-show="isShow1" label="进水温度:"><el-input v-model="form1.intemp" /></el-form-item>
<el-form-item v-show="isShow1" label="出水温度:"><el-input v-model="form1.outtemp" /></el-form-item>
<!-- <el-form-item label="当前温度:"><el-input v-model="form1.now" /></el-form-item>-->
<el-form-item label="当前状态:">
<span :class="{'green':item.deviceRunstatus === true,'red':item.deviceRunstatus === false}">
{{ item.deviceRunstatus === true ? '开启' : '关闭'}}
</span>
</el-form-item>
<el-form-item label="进水温度:"><el-input v-model="form1.intemp" /></el-form-item>
<el-form-item label="出水温度:"><el-input v-model="form1.outtemp" /></el-form-item>
<!-- <el-form-item label="温度:" ><el-input v-model="form1.temp" /></el-form-item>-->
<div class="submit" @click="getSetTemperatureFun(item)">确定</div>
</el-form>
</div>
</div>
</div>
</div>
<div class="dev_control_table">
<div class="control_header"><span>调控日志</span></div>
@ -77,7 +86,7 @@
<script setup name="Index">
import { Download } from '@element-plus/icons-vue' //element
import { ref,reactive,onMounted } from 'vue'
import { ElMessageBox } from 'element-plus'
import { ElMessageBox,ElMessage } from 'element-plus'
import { getDevice,getControlLogList,getStrategyList,getStartAndStop,getSetTemperature } from '@/api/control/manual'
onMounted(()=>{
@ -88,20 +97,16 @@ onMounted(()=>{
/** 获取所有设备*/
const deviceArr = ref([])
const isShow1 = ref(true)
// const isShow1 = ref(true)
// const isShow2 = ref(true)
function getDeviceFun(){
getDevice().then((res)=>{
console.log(res.data)
deviceArr.value = res.data
for(let i = 0;i < res.data.length;i++){
if(res.data[i].deviceRunstatus == 1){
res.data[i].deviceRunstatus = '开启'
}else{
res.data[i].deviceRunstatus = '关闭'
}
// if(res.data[i].deviceModel == ''){
// isShow1.value = false
// isShow2.value = true
// }
}
})
@ -174,15 +179,23 @@ function confirmClick() {
}
/** 控制设备启停*/
// function handleChange(item){
// console.log(item)
// // getStartAndStop({
// // "deviceId": 100,
// // "runStatus": 2
// // }).then((res)=>{
// // console.log(res.data)
// // })
// }
function handleDevChangeFun(id,sta){
console.log(id,sta)
//12
sta = sta === true ? 1 : 2
getStartAndStop({
"deviceId": id,
"runStatus": sta
}).then((res)=>{
console.log(res.data)
if(res.code == 200){
ElMessage({
type:'success',
message:'控制成功!'
})
}
})
}
/** 设置温度*/
function getSetTemperatureFun(item){

Loading…
Cancel
Save