|
@@ -223,10 +223,9 @@
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import Api from "../utils/api";
|
|
|
|
|
|
+import Api from "@/utils/api";
|
|
import { isEmpty, getDictDataList, getUrlKey } from "@/utils/index";
|
|
import { isEmpty, getDictDataList, getUrlKey } from "@/utils/index";
|
|
-import VCountUp from "./CountUp";
|
|
|
|
-import { Notify, Dialog } from "vant";
|
|
|
|
|
|
+import VCountUp from "../CountUp";
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
"v-count-up": VCountUp,
|
|
"v-count-up": VCountUp,
|
|
@@ -252,9 +251,10 @@ export default {
|
|
deviceType: "AirConditioner",
|
|
deviceType: "AirConditioner",
|
|
deviceStatus: "",
|
|
deviceStatus: "",
|
|
deviceTypeTitle: "空调",
|
|
deviceTypeTitle: "空调",
|
|
- deviceStatusTitle: "设备状态",
|
|
|
|
|
|
+ deviceStatusTitle: "全部",
|
|
deviceTypeList: [],
|
|
deviceTypeList: [],
|
|
deviceStatusList: [
|
|
deviceStatusList: [
|
|
|
|
+ { text: "全部", value: "" },
|
|
{ text: "开启", value: 1 },
|
|
{ text: "开启", value: 1 },
|
|
{ text: "关闭", value: 0 },
|
|
{ text: "关闭", value: 0 },
|
|
],
|
|
],
|
|
@@ -312,7 +312,9 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
getDeviceTypeList() {
|
|
getDeviceTypeList() {
|
|
- this.deviceTypeList = getDictDataList("DeviceCategory");
|
|
|
|
|
|
+ this.deviceTypeList = JSON.parse(
|
|
|
|
+ JSON.stringify(getDictDataList("DeviceCategory"))
|
|
|
|
+ );
|
|
this.deviceTypeList.forEach((item) => {
|
|
this.deviceTypeList.forEach((item) => {
|
|
item.text = item.dictLabel;
|
|
item.text = item.dictLabel;
|
|
item.value = item.dictValue;
|
|
item.value = item.dictValue;
|
|
@@ -476,10 +478,8 @@ export default {
|
|
this.$toast.loading({
|
|
this.$toast.loading({
|
|
message: "请稍后...",
|
|
message: "请稍后...",
|
|
forbidClick: true,
|
|
forbidClick: true,
|
|
- duration: 5000,
|
|
|
|
});
|
|
});
|
|
if (type == "AirConditioner") {
|
|
if (type == "AirConditioner") {
|
|
- this.dataList[index].attributeList[3].value = val;
|
|
|
|
Api.setControl({
|
|
Api.setControl({
|
|
keyword: "setPower",
|
|
keyword: "setPower",
|
|
param: val,
|
|
param: val,
|
|
@@ -487,6 +487,7 @@ export default {
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
this.$toast.clear();
|
|
this.$toast.clear();
|
|
if (res.code == 0) {
|
|
if (res.code == 0) {
|
|
|
|
+ this.dataList[index].attributeList[3].value = val;
|
|
this.$toast.success("操作成功");
|
|
this.$toast.success("操作成功");
|
|
} else {
|
|
} else {
|
|
this.$toast.fail("操作失败");
|
|
this.$toast.fail("操作失败");
|
|
@@ -501,6 +502,7 @@ export default {
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
this.$toast.clear();
|
|
this.$toast.clear();
|
|
if (res.code == 0) {
|
|
if (res.code == 0) {
|
|
|
|
+ this.dataList[index].status = val;
|
|
this.$toast.success("操作成功");
|
|
this.$toast.success("操作成功");
|
|
} else {
|
|
} else {
|
|
this.$toast.fail("操作失败");
|
|
this.$toast.fail("操作失败");
|
|
@@ -514,18 +516,14 @@ export default {
|
|
let deviceCommandDTO = {};
|
|
let deviceCommandDTO = {};
|
|
switch (this.module) {
|
|
switch (this.module) {
|
|
case "modeTypeList":
|
|
case "modeTypeList":
|
|
- this.checkedMode[0] = data.value;
|
|
|
|
- this.dataList[this.currModeIndex].attributeList[2].value = data.value;
|
|
|
|
this.showControl = false;
|
|
this.showControl = false;
|
|
deviceCommandDTO = {
|
|
deviceCommandDTO = {
|
|
keyword: "setMode",
|
|
keyword: "setMode",
|
|
- param: data.value,
|
|
|
|
|
|
+ param: data.dictValue,
|
|
deviceId: this.deviceId,
|
|
deviceId: this.deviceId,
|
|
};
|
|
};
|
|
break;
|
|
break;
|
|
case "temperatureList":
|
|
case "temperatureList":
|
|
- this.checkedMode[0] = data;
|
|
|
|
- this.dataList[this.currModeIndex].attributeList[5].value = data;
|
|
|
|
this.showControl = false;
|
|
this.showControl = false;
|
|
deviceCommandDTO = {
|
|
deviceCommandDTO = {
|
|
keyword: "setTemp",
|
|
keyword: "setTemp",
|
|
@@ -534,19 +532,36 @@ export default {
|
|
};
|
|
};
|
|
break;
|
|
break;
|
|
case "speedTypeList":
|
|
case "speedTypeList":
|
|
- this.checkedMode[0] = data.value;
|
|
|
|
- this.dataList[this.currModeIndex].attributeList[0].value = data.value;
|
|
|
|
this.showControl = false;
|
|
this.showControl = false;
|
|
deviceCommandDTO = {
|
|
deviceCommandDTO = {
|
|
keyword: "setFan",
|
|
keyword: "setFan",
|
|
- param: data.value,
|
|
|
|
|
|
+ param: data.dictValue,
|
|
deviceId: this.deviceId,
|
|
deviceId: this.deviceId,
|
|
};
|
|
};
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ this.$toast.loading({
|
|
|
|
+ message: "请稍后...",
|
|
|
|
+ forbidClick: true,
|
|
|
|
+ });
|
|
Api.setControl(deviceCommandDTO).then((res) => {
|
|
Api.setControl(deviceCommandDTO).then((res) => {
|
|
|
|
+ this.$toast.clear();
|
|
if (res.code == 0) {
|
|
if (res.code == 0) {
|
|
- Notify({ type: "success", message: "操作成功" });
|
|
|
|
|
|
+ this.$toast.success("操作成功");
|
|
|
|
+ if (this.module == "modeTypeList") {
|
|
|
|
+ this.checkedMode[0] = data.dictValue;
|
|
|
|
+ this.dataList[this.currModeIndex].attributeList[2].value =
|
|
|
|
+ data.dictValue;
|
|
|
|
+ }
|
|
|
|
+ if (this.module == "temperatureList") {
|
|
|
|
+ this.checkedMode[0] = data;
|
|
|
|
+ this.dataList[this.currModeIndex].attributeList[5].value = data;
|
|
|
|
+ }
|
|
|
|
+ if (this.module == "speedTypeList") {
|
|
|
|
+ this.checkedMode[0] = data.dictValue;
|
|
|
|
+ this.dataList[this.currModeIndex].attributeList[0].value =
|
|
|
|
+ data.dictValue;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -559,27 +574,6 @@ export default {
|
|
this.module = name;
|
|
this.module = name;
|
|
},
|
|
},
|
|
|
|
|
|
- elecControl(id, state) {
|
|
|
|
- Dialog.confirm({
|
|
|
|
- title: "标题",
|
|
|
|
- message: "确定执行该操作?",
|
|
|
|
- })
|
|
|
|
- .then(() => {
|
|
|
|
- Api.elecControl({
|
|
|
|
- keyword: "setRelay",
|
|
|
|
- deviceId: id,
|
|
|
|
- param: state ? "1" : "0",
|
|
|
|
- }).then((res) => {
|
|
|
|
- if (res.code == 0) {
|
|
|
|
- this.getElec();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- })
|
|
|
|
- .catch(() => {
|
|
|
|
- // on cancel
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
// change事件可以拿到的是value
|
|
// change事件可以拿到的是value
|
|
handelChange(type, val) {
|
|
handelChange(type, val) {
|
|
if (type == "deviceType") {
|
|
if (type == "deviceType") {
|