Commit 2e31fbc3 by 潘建波

fix🐛 1.修改标定设置有原来的实时绘制改为800毫秒绘制1次从而减标定消失次数

1 parent f2aebd67
No preview for this file type
No preview for this file type
<template> <template>
<div> <div>
<el-tabs v-model="activeName2" @tab-click="handleClick"> <el-tabs v-model="activeName2" @tab-click="handleClick">
<el-tab-pane label="全卡口" name="first"> <el-tab-pane label="全卡口" name="first">
<Allalarm @showDitail="showDitail" :itemData="resultData" ref="allalarm"></Allalarm> <Allalarm
@showDitail="showDitail"
:itemData="resultData"
ref="allalarm"
></Allalarm>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="机动车" name="second"> <el-tab-pane label="机动车" name="second">
<CarAlarm @showDitail="showDitail" :itemData="resultData" ref="caralarm"></CarAlarm> <CarAlarm
@showDitail="showDitail"
:itemData="resultData"
ref="caralarm"
></CarAlarm>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="违法" name="third"> <el-tab-pane label="违法" name="third">
<IllegalAlarm @showDitail="showDitail" :itemData="resultData" ref="illegalalarm"></IllegalAlarm> <IllegalAlarm
@showDitail="showDitail"
:itemData="resultData"
ref="illegalalarm"
></IllegalAlarm>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="事件" name="fourth"> <el-tab-pane label="事件" name="fourth">
<Eventalarm @showDitail="showDitail" :itemData="resultData" ref="eventalarm"></Eventalarm> <Eventalarm
@showDitail="showDitail"
:itemData="resultData"
ref="eventalarm"
></Eventalarm>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div> <div>
<EventDetail ref="detail" @closeDetailModal="closeDetailModal" :curData="curdata"></EventDetail> <EventDetail
ref="detail"
@closeDetailModal="closeDetailModal"
:curData="curdata"
></EventDetail>
</div> </div>
</div> </div>
</template> </template>
...@@ -38,8 +58,8 @@ export default { ...@@ -38,8 +58,8 @@ export default {
curentId: "", curentId: "",
cws: "", cws: "",
keepAlive: "", keepAlive: "",
curType:'', curType: "",
quitws:false quitws: false
}; };
}, },
components: { components: {
...@@ -103,6 +123,7 @@ export default { ...@@ -103,6 +123,7 @@ export default {
this.cws.onmessage = evt => { this.cws.onmessage = evt => {
let data = JSON.parse(evt.data); let data = JSON.parse(evt.data);
if (data.command) { if (data.command) {
console.log("");
} else if (data.type == "response") { } else if (data.type == "response") {
console.log("请求任务推送成功"); console.log("请求任务推送成功");
} else if (data.event_cate) { } else if (data.event_cate) {
...@@ -119,7 +140,6 @@ export default { ...@@ -119,7 +140,6 @@ export default {
"data:image/jpeg;base64," + data.pics[0].pic_base64; "data:image/jpeg;base64," + data.pics[0].pic_base64;
let img = new Image(); let img = new Image();
let picOffset = data.pics[0].object_rect; let picOffset = data.pics[0].object_rect;
canvas.width = canvas.width =
data.pics[0].width * (picOffset.right - picOffset.left) || data.pics[0].width * (picOffset.right - picOffset.left) ||
189; 189;
...@@ -164,7 +184,7 @@ export default { ...@@ -164,7 +184,7 @@ export default {
that.$buildCode.init(data); that.$buildCode.init(data);
setTimeout(() => { setTimeout(() => {
that.resultData = data that.resultData = data;
}, 500); }, 500);
} catch (err) { } catch (err) {
console.log(err); console.log(err);
...@@ -205,20 +225,20 @@ export default { ...@@ -205,20 +225,20 @@ export default {
}; };
//监听断开 //监听断开
this.cws.onclose = ()=> { this.cws.onclose = () => {
if(this.quitws) return if (this.quitws) return;
window.clearInterval(this.keepAlive); window.clearInterval(this.keepAlive);
this.connectwebsocket(1); this.connectwebsocket(1);
}; };
}, },
beforeDestroy() { beforeDestroy() {
this.cws.close(); this.cws.close();
this.quitws = true this.quitws = true;
try { try {
window.clearTimeout(this.keepAlive); window.clearTimeout(this.keepAlive);
} catch (error) { } catch (error) {
console.log(error) console.log(error);
} }
} }
}; };
</script> </script>
...@@ -137,7 +137,10 @@ export default { ...@@ -137,7 +137,10 @@ export default {
modelnum: 0, //标记模型编号 modelnum: 0, //标记模型编号
bgUrl: "", bgUrl: "",
taskData: "", taskData: "",
mtaskdata: "" mtaskdata: "",
startTimer: null,
valid: true,
ModelData: []
}; };
}, },
// props: ['bgUrl'], // props: ['bgUrl'],
...@@ -289,7 +292,7 @@ export default { ...@@ -289,7 +292,7 @@ export default {
changeModelData("car"); changeModelData("car");
this.initModel(); this.initModel();
}, },
initModel(){ initModel() {
//初始化一个模型 //初始化一个模型
let po = [354, 313, 360, 244]; let po = [354, 313, 360, 244];
this.getModelData(po); this.getModelData(po);
...@@ -502,13 +505,18 @@ export default { ...@@ -502,13 +505,18 @@ export default {
//测试验证 //测试验证
let data = CalcCarOutline(P1, P2, [{}, {}, {}, {}, {}, {}, {}, {}]); let data = CalcCarOutline(P1, P2, [{}, {}, {}, {}, {}, {}, {}, {}]);
this.drawModel(data);
this.drawArrows(P1, P2); this.drawArrows(P1, P2);
if (this.startTimer == null) {
this.startTimer = setTimeout(() => {
this.startTimer = null;
this.drawModel(data);
}, 800);
}
}, },
//绘制模型线 //绘制模型线
drawModel(data) { drawModel(data) {
console.log(data);
if (this.editIndex != "") { if (this.editIndex != "") {
this.modelnum = this.editIndex; this.modelnum = this.editIndex;
} }
...@@ -580,7 +588,7 @@ export default { ...@@ -580,7 +588,7 @@ export default {
topY = headlen * Math.sin(angle1), topY = headlen * Math.sin(angle1),
botX = headlen * Math.cos(angle2), botX = headlen * Math.cos(angle2),
botY = headlen * Math.sin(angle2); botY = headlen * Math.sin(angle2);
var arrowX = c1.x * 800 - topX , var arrowX = c1.x * 800 - topX,
arrowY = c1.y * 500 - topY; arrowY = c1.y * 500 - topY;
arrowX = c2.x * 800 + topX; arrowX = c2.x * 800 + topX;
arrowY = c2.y * 500 + topY; arrowY = c2.y * 500 + topY;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!