|
@@ -57,6 +57,7 @@
|
|
|
@click="openCurtainOpening(curtainData)"
|
|
|
>
|
|
|
<img
|
|
|
+ class="curtain-opening-icon"
|
|
|
:src="parseImgUrl('page-officehome', 'curtain_opening.svg')"
|
|
|
alt=""
|
|
|
/>
|
|
@@ -126,7 +127,7 @@
|
|
|
<div class="child-item" :key="item.id" v-for="item in curtainData">
|
|
|
<div class="curtain-name">
|
|
|
<div class="name">{{ item.name }}</div>
|
|
|
- <span>开度{{ item.openValue }}%</span>
|
|
|
+ <span v-if="item.isOpenSet">开度{{ item.openValue }}%</span>
|
|
|
</div>
|
|
|
<div class="curtain-control top-control">
|
|
|
<div
|
|
@@ -215,7 +216,7 @@ import {
|
|
|
setEquipeHttp,
|
|
|
setSpaceCondtioners,
|
|
|
} from "@/apis/envmonitor";
|
|
|
-import { parseImgUrl } from "@/utils";
|
|
|
+import { formatDate, parseImgUrl } from "@/utils";
|
|
|
import { Toast } from "vant";
|
|
|
|
|
|
export default defineComponent({
|
|
@@ -239,6 +240,7 @@ export default defineComponent({
|
|
|
let projectId: any = props.projectId;
|
|
|
let type: any = "all";
|
|
|
let interval: any = {};
|
|
|
+ let oldTime: any = null;
|
|
|
const proxyData = reactive({
|
|
|
curtainData: curtainData,
|
|
|
userIsControl: props.userIsControl,
|
|
@@ -250,7 +252,6 @@ export default defineComponent({
|
|
|
curtainOpen: false,
|
|
|
curtainClose: false,
|
|
|
parseImgUrl: parseImgUrl,
|
|
|
- timer: timer,
|
|
|
// 开度弹窗
|
|
|
activeIndex: 0,
|
|
|
// 打开开度弹窗
|
|
@@ -339,7 +340,7 @@ export default defineComponent({
|
|
|
let value: any = proxyData.formateValue(type);
|
|
|
proxyData.curtainData.map((item: any) => {
|
|
|
let obj: any = {
|
|
|
- id: item.id,
|
|
|
+ id: item.equipId,
|
|
|
code: "EquipSwitchSet",
|
|
|
value: value,
|
|
|
};
|
|
@@ -350,7 +351,12 @@ export default defineComponent({
|
|
|
// 修改窗帘的状态
|
|
|
changeCurtainStatus(data: any) {
|
|
|
console.log("窗帘==", data);
|
|
|
- setSpaceCondtioners(data).then((res) => {});
|
|
|
+ setSpaceCondtioners(data).then((res) => {
|
|
|
+ proxyData.oldTime = formatDate("YYYY.MM.DD HH:mm:ss");
|
|
|
+ if (!proxyData.timer) {
|
|
|
+ proxyData.updateGroupPeing();
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
// 单个窗帘操作
|
|
|
openCurtainClid(item: any, type: any) {
|
|
@@ -360,7 +366,8 @@ export default defineComponent({
|
|
|
item.activeIndex = type;
|
|
|
let data: any = [];
|
|
|
let obj: any = {
|
|
|
- id: item.id,
|
|
|
+ id: item.equipId,
|
|
|
+ // id: "Eq110108025995ec5bdc23fc47a0a9d8debb150d18eb",
|
|
|
code: "EquipSwitchSet",
|
|
|
value: proxyData.formateValue(type),
|
|
|
};
|
|
@@ -369,6 +376,43 @@ export default defineComponent({
|
|
|
proxyData.countChildInterval(item);
|
|
|
proxyData.changeCurtainStatus(data);
|
|
|
},
|
|
|
+ oldTime: oldTime,
|
|
|
+ timer: timer,
|
|
|
+ clearTimer() {
|
|
|
+ clearInterval(proxyData.timer);
|
|
|
+ proxyData.timer = null;
|
|
|
+ },
|
|
|
+ // 更新窗帘的开度
|
|
|
+ updateGroupPeing() {
|
|
|
+ // debugger
|
|
|
+ proxyData.timer = setInterval(() => {
|
|
|
+ let nowTime: any = formatDate("YYYY.MM.DD HH:mm:ss");
|
|
|
+ if (proxyData.oldTime) {
|
|
|
+ let secondTimeDiff: any = proxyData.getTimeDifference(
|
|
|
+ proxyData.oldTime,
|
|
|
+ nowTime
|
|
|
+ );
|
|
|
+ // console.log("secondTimeDiff==",secondTimeDiff)
|
|
|
+ if (secondTimeDiff > 60) {
|
|
|
+ proxyData.getEqpGroup();
|
|
|
+ proxyData.clearTimer();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ proxyData.oldTime = formatDate("YYYY.MM.DD HH:mm:ss");
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ //计算时间差-分钟
|
|
|
+ getTimeDifference(Stime: any, Ttime: any) {
|
|
|
+ // debugger
|
|
|
+ let startDate: any = new Date(Stime);
|
|
|
+ let stopDate: any = new Date(Ttime);
|
|
|
+ let startTime: any = startDate.getTime();
|
|
|
+ let stopTime: any = stopDate.getTime();
|
|
|
+ let cTime: any = Number(stopTime) - Number(startTime);
|
|
|
+ let secondTime: any = cTime / 1000;
|
|
|
+ return parseInt(secondTime);
|
|
|
+ },
|
|
|
});
|
|
|
|
|
|
watch(props, (newProps: any) => {
|
|
@@ -378,7 +422,10 @@ export default defineComponent({
|
|
|
proxyData.userIsControl = newProps.userIsControl;
|
|
|
}
|
|
|
});
|
|
|
- onBeforeUnmount(() => {});
|
|
|
+ onBeforeUnmount(() => {
|
|
|
+ proxyData.clearTimer();
|
|
|
+ clearInterval(proxyData.interval);
|
|
|
+ });
|
|
|
onMounted(() => {
|
|
|
// 获取窗帘信息
|
|
|
proxyData.getEqpGroup();
|
|
@@ -485,12 +532,16 @@ export default defineComponent({
|
|
|
}
|
|
|
img {
|
|
|
position: absolute;
|
|
|
- // width: 16px;
|
|
|
- // height: 16px;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
left: 50%;
|
|
|
top: 50%;
|
|
|
transform: translate(-50%, -50%);
|
|
|
}
|
|
|
+ .curtain-opening-icon {
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.control-item-active {
|