diff --git a/psdc-ui/src/views/control/manual/index.vue b/psdc-ui/src/views/control/manual/index.vue
index 17088c7..6d28824 100644
--- a/psdc-ui/src/views/control/manual/index.vue
+++ b/psdc-ui/src/views/control/manual/index.vue
@@ -24,9 +24,8 @@
-
-
-
+
+
确定
@@ -64,14 +63,14 @@
策略导入
-
+
{{ item.sceneName }}
@@ -102,7 +101,14 @@ onMounted(()=>{
const deviceArr = ref([])
function getDeviceFun(){
getDevice().then((res)=>{
- deviceArr.value = res.data
+ deviceArr.value = res.data;
+ //拼接温度单位
+ for(let i = 0;i < res.data.length;i++){
+ for(let j = 0;j < res.data[i].control_elements.length;j++){
+ console.log(res.data[i].control_elements[j].tempValue)
+ res.data[i].control_elements[j].tempValue = res.data[i].control_elements[j].tempValue + '℃'
+ }
+ }
})
}
/** 设备控制处理*/
@@ -167,9 +173,41 @@ function getStrategyListFun(){
celueList.value = res.data
})
}
+//选择策略
+function selectCeLue(item){
+ //拼数组对象
+ //1、
+ let dataArr = [];
+ for(let i = 0;i < item.data.length;i++){
+ //2、
+ let dataObject = {};
+ // deviceId = item.data[i].device_id;
+ dataObject.deviceId = item.data[i].device_id;
+
+ //3、
+ let tempArr = [];
+ for(let j = 0;j < item.data[i].value.length;j++){
+ //4、
+ let tempObject = {};
+ tempObject.controlKey = item.data[i].value[j].sceneKey
+ tempObject.controlValue = item.data[i].value[j].sceneValue
+
+ //5、
+ tempArr.push(tempObject)
+ dataObject.data = tempArr
+ }
+ //6、
+ dataArr.push(dataObject);
+ }
+
+ //最终要传参的格式
+ console.log(JSON.stringify(dataArr, null, 4));
+}
+//执行
function confirmClick() {
ElMessageBox.confirm(`确定执行 ${radio.value} ?`).then(() => {
drawerIshow.value = false;
+
})
}
@@ -206,21 +244,23 @@ function handleDevChangeFun(id,sta){
/** 设置温度*/
function getSetTemperatureFun(item){
- // console.log(item)
- // getSetTemperature({
- // "deviceId":100,
- // "data":[
- // {
- // "controlKey":"intemp",
- // "controlValue":"28"
- // },
- // {
- // "controlKey":"outtemp",
- // "controlValue":"90"
- // }]
- // }).then((res)=>{
- // console.log(res)
- // })
+ let dataArr = [];
+ for(let i = 0;i < item.control_elements.length;i++){
+ let dataObject = {
+ "controlKey": item.control_elements[i].controlElement,
+ "controlValue": item.control_elements[i].tempValue
+ };
+ dataArr.push(dataObject)
+ }
+ getSetTemperature({
+ "deviceId":item.deviceId,
+ "data": dataArr
+ }).then((res)=>{
+ if(res.code == 200){
+ ElMessage.success('设置温度成功!')
+ }
+ })
+
}
@@ -370,7 +410,17 @@ function getSetTemperatureFun(item){
.failure {
color: red;
}
-
+.tempInput{
+ width: 100%;
+ line-height: 28px;
+ padding: 0 5px;
+ color: #F5901A;
+ font-weight: bold;
+ &:focus{
+ border: 0px;
+ outline: none;
+ }
+}
::v-deep .el-button{
border-radius: 2px;
margin-bottom: 12px;
@@ -384,7 +434,8 @@ function getSetTemperatureFun(item){
margin-bottom: 3px;
}
::v-deep .el-input__inner{
- color: #606266;
+ //color: #F5901A;
+ //font-weight: bold;
}
::v-deep .el-pagination{
position: absolute;