|
@@ -7,14 +7,11 @@
|
|
<view class="radar-box">
|
|
<view class="radar-box">
|
|
<view
|
|
<view
|
|
:style="{
|
|
:style="{
|
|
- width: `${length}rpx`,
|
|
|
|
- height: `${width}rpx`,
|
|
|
|
|
|
+ width: `${rotatedRect.width}rpx`,
|
|
|
|
+ height: `${rotatedRect.height}rpx`,
|
|
position: 'absolute',
|
|
position: 'absolute',
|
|
- top: '50%',
|
|
|
|
- left: '50%',
|
|
|
|
- transform: `translate(calc(-50% + ${
|
|
|
|
- xOffset / 2
|
|
|
|
- }rpx), calc(-50% + ${yOffset / 2}rpx))`,
|
|
|
|
|
|
+ top: `${rotatedRect.top}rpx`,
|
|
|
|
+ left: `${rotatedRect.left}rpx`,
|
|
border: `9rpx solid #333333`,
|
|
border: `9rpx solid #333333`,
|
|
}"
|
|
}"
|
|
class="tranStyle"
|
|
class="tranStyle"
|
|
@@ -35,7 +32,7 @@
|
|
left: `${item.left}rpx`,
|
|
left: `${item.left}rpx`,
|
|
transform: `rotate(${item.rotate}deg)`,
|
|
transform: `rotate(${item.rotate}deg)`,
|
|
'transform-origin': 'center center',
|
|
'transform-origin': 'center center',
|
|
- zIndex: 4444,
|
|
|
|
|
|
+ zIndex: 444,
|
|
}"
|
|
}"
|
|
>
|
|
>
|
|
<image
|
|
<image
|
|
@@ -320,6 +317,11 @@
|
|
<script>
|
|
<script>
|
|
import * as echarts from "../../uni_modules/lime-echart/static/echarts.min";
|
|
import * as echarts from "../../uni_modules/lime-echart/static/echarts.min";
|
|
import MqttService from "../../utils/globalMqtt.js";
|
|
import MqttService from "../../utils/globalMqtt.js";
|
|
|
|
+import {
|
|
|
|
+ convert_region_r2c,
|
|
|
|
+ rotateRect,
|
|
|
|
+ convert_furniture_r2c,
|
|
|
|
+} from "../../utils/changezb.js";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
@@ -327,8 +329,6 @@ export default {
|
|
clientId: "",
|
|
clientId: "",
|
|
width: 0, //检测区域宽度
|
|
width: 0, //检测区域宽度
|
|
length: 0, //检测区域长度
|
|
length: 0, //检测区域长度
|
|
- xOffset: 0,
|
|
|
|
- yOffset: 0,
|
|
|
|
devInfo: "",
|
|
devInfo: "",
|
|
actionName: "",
|
|
actionName: "",
|
|
startDate: "",
|
|
startDate: "",
|
|
@@ -424,8 +424,10 @@ export default {
|
|
setIntervalVal: null,
|
|
setIntervalVal: null,
|
|
|
|
|
|
// 重新计算雷达坐标位置
|
|
// 重新计算雷达坐标位置
|
|
- x_radar: 200,
|
|
|
|
- y_radar: 200,
|
|
|
|
|
|
+ x_radar: 250,
|
|
|
|
+ y_radar: 250,
|
|
|
|
+ //检测区域计算
|
|
|
|
+ rotatedRect: {},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
@@ -449,8 +451,8 @@ export default {
|
|
this.devInfo.xxEnd - this.devInfo.xxStart
|
|
this.devInfo.xxEnd - this.devInfo.xxStart
|
|
);
|
|
);
|
|
this.statusLight = this.devInfo.statusLight;
|
|
this.statusLight = this.devInfo.statusLight;
|
|
- this.calculate(this.width, this.length);
|
|
|
|
- this.calculateOffest();
|
|
|
|
|
|
+ // this.calculate(this.width, this.length);
|
|
|
|
+ this.calculateRegion();
|
|
// 设备分享权限判断
|
|
// 设备分享权限判断
|
|
this.shareJudge =
|
|
this.shareJudge =
|
|
this.devInfo.userId == uni.getStorageSync("userId")
|
|
this.devInfo.userId == uni.getStorageSync("userId")
|
|
@@ -467,14 +469,32 @@ export default {
|
|
devId: devId,
|
|
devId: devId,
|
|
})
|
|
})
|
|
.then((res) => {
|
|
.then((res) => {
|
|
- if (res.data.data) {
|
|
|
|
- res.data.data.furnitures.forEach((item) => {
|
|
|
|
- item.left = this.x_radar + item.x;
|
|
|
|
- item.top = this.y_radar - item.y;
|
|
|
|
- });
|
|
|
|
|
|
+ const pRadar = {
|
|
|
|
+ x: this.x_radar,
|
|
|
|
+ y: this.y_radar,
|
|
|
|
+ angle: uni.getStorageSync("northAngle"),
|
|
|
|
+ mountPlain: this.devInfo.mountPlain,
|
|
|
|
+ };
|
|
|
|
|
|
|
|
+ if (res.data.data) {
|
|
this.modules = res.data.data.furnitures;
|
|
this.modules = res.data.data.furnitures;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ console.log(this.modules, 88888);
|
|
|
|
+ this.modules.forEach((item) => {
|
|
|
|
+ const rect = convert_furniture_r2c(item, pRadar);
|
|
|
|
+ const rotatedRect = rotateRect(
|
|
|
|
+ rect,
|
|
|
|
+ pRadar,
|
|
|
|
+ pRadar.angle
|
|
|
|
+ );
|
|
|
|
+ // console.log(rotatedRect, 999999);
|
|
|
|
+ item.top = rotatedRect.top;
|
|
|
|
+ item.left = rotatedRect.left;
|
|
|
|
+ item.width = rotatedRect.width;
|
|
|
|
+ item.height = rotatedRect.height;
|
|
|
|
+ });
|
|
|
|
+ console.log(this.modules, 99999);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
// 处理设备状态灯
|
|
// 处理设备状态灯
|
|
@@ -877,46 +897,21 @@ export default {
|
|
...this.targetPoints,
|
|
...this.targetPoints,
|
|
...newTargetPoints,
|
|
...newTargetPoints,
|
|
};
|
|
};
|
|
|
|
+ const northAngle = uni.getStorageSync("northAngle");
|
|
|
|
+ const radar = [this.x_radar, this.y_radar];
|
|
|
|
+ let points = [];
|
|
if (Array.isArray(this.targetPoints)) {
|
|
if (Array.isArray(this.targetPoints)) {
|
|
- this.targetPoints = this.targetPoints.filter(
|
|
|
|
- (item) => item !== null && item !== undefined
|
|
|
|
- );
|
|
|
|
|
|
+ points = this.targetPoints;
|
|
|
|
+ } else if (
|
|
|
|
+ this.targetPoints &&
|
|
|
|
+ typeof this.targetPoints === "object"
|
|
|
|
+ ) {
|
|
|
|
+ points = Object.values(this.targetPoints);
|
|
}
|
|
}
|
|
- // console.log(
|
|
|
|
- // this.targetPoints,
|
|
|
|
- // this.devInfo,
|
|
|
|
- // "更新后的点位数据111"
|
|
|
|
- // );
|
|
|
|
- // this.targetPoints = this.targetPoints.map((point) => {
|
|
|
|
- // return this.rotatePoint(
|
|
|
|
- // point,
|
|
|
|
- // [this.x_radar, this.y_radar],
|
|
|
|
- // this.devInfo.northAngle
|
|
|
|
- // );
|
|
|
|
- // });
|
|
|
|
-
|
|
|
|
- // if (Array.isArray(this.targetPoints)) {
|
|
|
|
- // // 多个点
|
|
|
|
- // this.targetPoints = this.targetPoints.map((p) => {
|
|
|
|
- // return this.rotatePoint(
|
|
|
|
- // p,
|
|
|
|
- // [this.x_radar, this.y_radar],
|
|
|
|
- // uni.getStorageSync("northAngle")
|
|
|
|
- // );
|
|
|
|
- // });
|
|
|
|
- // } else if (
|
|
|
|
- // this.targetPoints &&
|
|
|
|
- // typeof this.targetPoints === "object"
|
|
|
|
- // ) {
|
|
|
|
- // // 单个点
|
|
|
|
- // this.targetPoints = this.rotatePoint(
|
|
|
|
- // this.targetPoints,
|
|
|
|
- // [this.x_radar, this.y_radar],
|
|
|
|
- // uni.getStorageSync("northAngle")
|
|
|
|
- // );
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // console.log(this.targetPoints, "更新后的点位数据333");
|
|
|
|
|
|
+ this.targetPoints = points.map((p) => {
|
|
|
|
+ return this.rotatePoint(p, radar, northAngle);
|
|
|
|
+ });
|
|
|
|
+ console.log(this.targetPoints, "更新后的点位数据333");
|
|
}
|
|
}
|
|
},
|
|
},
|
|
createNewTargetPoint(x, y, z, id) {
|
|
createNewTargetPoint(x, y, z, id) {
|
|
@@ -925,8 +920,8 @@ export default {
|
|
y,
|
|
y,
|
|
z,
|
|
z,
|
|
id,
|
|
id,
|
|
- displayX: this.x_radar + x,
|
|
|
|
- displayY: this.y_radar - y,
|
|
|
|
|
|
+ displayX: x,
|
|
|
|
+ displayY: y,
|
|
lastX: x,
|
|
lastX: x,
|
|
lastY: y,
|
|
lastY: y,
|
|
};
|
|
};
|
|
@@ -944,45 +939,25 @@ export default {
|
|
z,
|
|
z,
|
|
lastX: x,
|
|
lastX: x,
|
|
lastY: y,
|
|
lastY: y,
|
|
- displayX: this.x_radar + x,
|
|
|
|
- displayY: this.y_radar - y,
|
|
|
|
|
|
+ displayX: x,
|
|
|
|
+ displayY: y,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
return existingPoint;
|
|
return existingPoint;
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ // 计算点位问题
|
|
rotatePoint(point, radar, angle) {
|
|
rotatePoint(point, radar, angle) {
|
|
- console.log(point, radar, angle, "rotatePoint");
|
|
|
|
- const [cx, cy] = radar;
|
|
|
|
- const dx = point.displayX - cx;
|
|
|
|
- const dy = point.displayY - cy;
|
|
|
|
- let nx, ny;
|
|
|
|
-
|
|
|
|
- switch (angle) {
|
|
|
|
- case 0:
|
|
|
|
- nx = dx;
|
|
|
|
- ny = dy;
|
|
|
|
- break;
|
|
|
|
- case 90:
|
|
|
|
- nx = dy;
|
|
|
|
- ny = -dx;
|
|
|
|
- break;
|
|
|
|
- case 180:
|
|
|
|
- nx = -dx;
|
|
|
|
- ny = -dy;
|
|
|
|
- break;
|
|
|
|
- case 270:
|
|
|
|
- nx = -dy;
|
|
|
|
- ny = dx;
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- throw new Error("angle must be 0, 90, 180, 270");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // ✅ 更新点坐标
|
|
|
|
- point.displayX = cx + nx;
|
|
|
|
- point.displayY = cy + ny;
|
|
|
|
|
|
+ const cx = this.x_radar;
|
|
|
|
+ const cy = this.y_radar;
|
|
|
|
+ const rad = (angle * Math.PI) / 180;
|
|
|
|
+ const cosA = Math.cos(rad);
|
|
|
|
+ const sinA = Math.sin(rad);
|
|
|
|
+ const xRot = point.x * cosA + point.y * sinA;
|
|
|
|
+ const yRot = -point.x * sinA + point.y * cosA;
|
|
|
|
+
|
|
|
|
+ point.displayX = cx + xRot;
|
|
|
|
+ point.displayY = cy - yRot;
|
|
return point;
|
|
return point;
|
|
},
|
|
},
|
|
|
|
|
|
@@ -996,38 +971,28 @@ export default {
|
|
console.log(this.xOffset, this.yOffset, this.zoomTimes, "偏移量");
|
|
console.log(this.xOffset, this.yOffset, this.zoomTimes, "偏移量");
|
|
this.lnbActionJudean = true;
|
|
this.lnbActionJudean = true;
|
|
},
|
|
},
|
|
- calculateOffest() {
|
|
|
|
- let xxStart = "";
|
|
|
|
- let xxEnd = "";
|
|
|
|
- let yyStart = "";
|
|
|
|
- let yyEnd = "";
|
|
|
|
-
|
|
|
|
- if (this.devInfo.northAngle == 0) {
|
|
|
|
- xxStart = this.devInfo.xxStart;
|
|
|
|
- xxEnd = this.devInfo.xxEnd;
|
|
|
|
- yyStart = this.devInfo.yyStart;
|
|
|
|
- yyEnd = this.devInfo.yyEnd;
|
|
|
|
- }
|
|
|
|
- if (this.devInfo.northAngle == 90) {
|
|
|
|
- xxStart = this.devInfo.xxStart;
|
|
|
|
- xxEnd = this.devInfo.xxEnd;
|
|
|
|
- yyStart = -this.devInfo.yyEnd;
|
|
|
|
- yyEnd = -this.devInfo.yyStart;
|
|
|
|
- }
|
|
|
|
- if (this.devInfo.northAngle == 180) {
|
|
|
|
- xxStart = -this.devInfo.xxEnd;
|
|
|
|
- xxEnd = -this.devInfo.xxStart;
|
|
|
|
- yyStart = -this.devInfo.yyEnd;
|
|
|
|
- yyEnd = -this.devInfo.yyStart;
|
|
|
|
- }
|
|
|
|
- if (this.devInfo.northAngle == 270) {
|
|
|
|
- xxStart = -this.devInfo.xxEnd;
|
|
|
|
- xxEnd = -this.devInfo.xxStart;
|
|
|
|
- yyStart = this.devInfo.yyStart;
|
|
|
|
- yyEnd = this.devInfo.yyEnd;
|
|
|
|
- }
|
|
|
|
- this.xOffset = xxStart + xxEnd;
|
|
|
|
- this.yOffset = -(yyStart + yyEnd);
|
|
|
|
|
|
+ calculateRegion() {
|
|
|
|
+ let x_cm_start = this.devInfo.xxStart;
|
|
|
|
+ let y_cm_start = this.devInfo.yyStart;
|
|
|
|
+ let x_cm_stop = this.devInfo.xxEnd;
|
|
|
|
+ let y_cm_stop = this.devInfo.yyEnd;
|
|
|
|
+
|
|
|
|
+ const trackingRegion = {
|
|
|
|
+ x_cm_start,
|
|
|
|
+ y_cm_start,
|
|
|
|
+ x_cm_stop,
|
|
|
|
+ y_cm_stop,
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const pRadar = {
|
|
|
|
+ x: this.x_radar,
|
|
|
|
+ y: this.y_radar,
|
|
|
|
+ angle: uni.getStorageSync("northAngle"),
|
|
|
|
+ mountPlain: this.devInfo.mountPlain,
|
|
|
|
+ };
|
|
|
|
+ const rect = convert_region_r2c(trackingRegion, pRadar);
|
|
|
|
+ this.rotatedRect = rotateRect(rect, pRadar, pRadar.angle);
|
|
|
|
+ console.log(this.rotatedRect, "rotatedRect");
|
|
},
|
|
},
|
|
|
|
|
|
formatTime(time) {
|
|
formatTime(time) {
|
|
@@ -1208,8 +1173,8 @@ export default {
|
|
// display: flex;
|
|
// display: flex;
|
|
// align-items: center;
|
|
// align-items: center;
|
|
// justify-content: center;
|
|
// justify-content: center;
|
|
- width: 400rpx;
|
|
|
|
- height: 400rpx;
|
|
|
|
|
|
+ width: 500rpx;
|
|
|
|
+ height: 500rpx;
|
|
background: #ffffff;
|
|
background: #ffffff;
|
|
border-radius: 37.5rpx;
|
|
border-radius: 37.5rpx;
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
@@ -1551,7 +1516,7 @@ export default {
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: center;
|
|
justify-content: center;
|
|
align-items: center;
|
|
align-items: center;
|
|
- z-index: 333;
|
|
|
|
|
|
+ z-index: 555;
|
|
|
|
|
|
.modal-container {
|
|
.modal-container {
|
|
width: 80%;
|
|
width: 80%;
|
|
@@ -1632,7 +1597,7 @@ export default {
|
|
position: fixed;
|
|
position: fixed;
|
|
top: 10rpx;
|
|
top: 10rpx;
|
|
right: 10rpx;
|
|
right: 10rpx;
|
|
- z-index: 333;
|
|
|
|
|
|
+ z-index: 555;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|