优化gps

hn2.0
fanluyan 2 years ago
parent b5e79c048d
commit de0bcfd8a0

@ -328,6 +328,7 @@ export default {
}, },
methods: { methods: {
imgOnload() { imgOnload() {
console.log("加载完成");
this.alarmLoading = false; this.alarmLoading = false;
this.canvasloading = false; this.canvasloading = false;
}, },
@ -450,7 +451,6 @@ export default {
this.ctx.strokeStyle = "#ff0000"; this.ctx.strokeStyle = "#ff0000";
// 线 // 线
this.ctx.lineWidth = 1; this.ctx.lineWidth = 1;
// //
var scaleX = this.canvas.width / data.photoWidth, //this.iw var scaleX = this.canvas.width / data.photoWidth, //this.iw
scaleY = this.canvas.height / data.photoHeight; //this.ih scaleY = this.canvas.height / data.photoHeight; //this.ih
@ -507,6 +507,7 @@ export default {
this.alarmLoading = true; this.alarmLoading = true;
console.log(row); console.log(row);
this.photoPic = row.path; this.photoPic = row.path;
console.log(this.photoPic);
this.selectRow = row; this.selectRow = row;
// //
if (row.isread == 0) { if (row.isread == 0) {
@ -524,6 +525,7 @@ export default {
}); });
}, 300); }, 300);
} }
this.$nextTick(() => { this.$nextTick(() => {
this.drawline(row); this.drawline(row);
}); });

@ -1,12 +1,12 @@
<template> <template>
<div class="thumb-example"> <div class="thumb-example">
<div class="picTop"> <div class="picTop">
<div class="bigimg" v-if="bigPicPath.indexOf('nopic') !== -1"> <div class="bigimg nopic" v-if="bigPicPath.indexOf('nopic') !== -1">
<img class="animImg" :src="bigPicPath" /> <img class="animImg" :src="bigPicPath" />
</div> </div>
<div <div
class="bigimg" class="bigimg"
v-if=" v-else-if="
bigPicPath.indexOf('nopic') == -1 && bigPicPath.indexOf('nopic') == -1 &&
bigPicPath.indexOf('videos') == -1 bigPicPath.indexOf('videos') == -1
" "

@ -0,0 +1,128 @@
<template>
<el-dialog
class="gpsPoisitiondialog"
title="GPS位置"
:visible.sync="isShow"
:close-on-click-modal="false"
width="662px"
@close="handleclose"
>
<div class="gpsbox" v-loading="loading">
<p>
<span>经度</span><span>{{ infornr.longitude }}</span>
</p>
<p>
<span>纬度</span><span>{{ infornr.latitude }}</span>
</p>
<p>
<span>半径</span><span>{{ infornr.radius }}</span>
</p>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="isShow = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getTermGPSJoggle, getTermGPSPosition } from "@/utils/api/index";
export default {
props: {
title: String,
},
data() {
return {
loading: true,
isShow: false,
timer: null,
infornr: {},
i: 0,
queryTime: "", //ID
zzcmdid: "",
zztermid: "",
};
},
mounted() {},
methods: {
//
getgpsData(zzcmdidval, zztermidval) {
this.zzcmdid = zzcmdidval;
this.zztermid = zztermidval;
console.log(this.zzcmdid);
console.log(this.zztermid);
this.loading = true;
getTermGPSPosition({
cmdId: zzcmdidval,
})
.then((res) => {
this.queryTime = res.data;
console.log(this.zztermid);
this.getNewgpsData(this.zztermid);
this.timer = window.setInterval(() => {
this.getNewgpsData(this.zztermid);
this.i++;
}, 5000);
})
.catch((err) => {});
},
//
getNewgpsData(val) {
getTermGPSJoggle({
queryTime: this.queryTime,
termid: val,
})
.then((res) => {
this.loading = true;
if (res.code == 200) {
this.infornr = res.data;
if (res.data.hasNew == true) {
this.loading = false;
this.i = 0;
this.$message({
duration: 1500,
showClose: true,
message: "gps信息已更新",
type: "success",
});
clearInterval(this.timer);
} else if (this.i > 9) {
this.loading = false;
this.i = 0;
this.$message({
duration: 1500,
showClose: true,
message: "暂未获取到GPS信息请稍后再试",
type: "warning",
});
clearInterval(this.timer);
}
} else {
this.$message.error(res.code.msg);
}
})
.catch((err) => {});
},
display() {
this.isShow = true;
},
hide() {
this.isShow = false;
},
handleclose() {
this.i = 0;
clearInterval(this.timer);
this.timer = null;
},
},
};
</script>
<style lang="less">
.gpsPoisitiondialog {
.gpsbox {
p {
line-height: 32px;
height: 32px;
font-size: 16px;
}
}
}
</style>

@ -61,9 +61,6 @@
:terminalPhoto="terminalPhoto" :terminalPhoto="terminalPhoto"
v-if="terminalPhoto.length > 0" v-if="terminalPhoto.length > 0"
></carouselChart> ></carouselChart>
<!-- <div class="totalPic" v-if="totalPic !== 0">
图片总数{{ totalPic }}
</div> -->
</div> </div>
<div class="parameterArea"> <div class="parameterArea">
<div class="zzbox"> <div class="zzbox">
@ -182,12 +179,31 @@
<el-dropdown-item command="close">关闭</el-dropdown-item> <el-dropdown-item command="close">关闭</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<!-- 获取gps位置 -->
<el-button type="primary" @click.native.stop="handleShowGPS()"
>获取GPS位置</el-button
>
<!-- gps开关 -->
<el-dropdown
class="dropgps"
trigger="click"
@command="handleCommandGps"
>
<el-button type="primary">
GPS开关<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown" class="gpsdropStyle">
<el-dropdown-item command="open">开启GPS</el-dropdown-item>
<el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<setschedule ref="setschedule_ref"></setschedule> <setschedule ref="setschedule_ref"></setschedule>
<info-dialog ref="infodialog_ref"></info-dialog> <info-dialog ref="infodialog_ref"></info-dialog>
<gps-position ref="gpsdialog_ref"></gps-position>
</div> </div>
</div> </div>
</template> </template>
@ -201,18 +217,21 @@ import {
getReturnedPhotoJoggle, getReturnedPhotoJoggle,
alarmMarkJoggle, alarmMarkJoggle,
getTermStatus, getTermStatus,
setTermGPSJoggle,
} from "@/utils/api/index"; } from "@/utils/api/index";
import { mapState } from "vuex"; import { mapState } from "vuex";
import carouselChart from "../components/carouselChart.vue"; import carouselChart from "../components/carouselChart.vue";
import setschedule from "./components/setschedule.vue"; import setschedule from "./components/setschedule.vue";
import deviceUpgrade from "./components/deviceUpgrade.vue"; import deviceUpgrade from "./components/deviceUpgrade.vue";
import infoDialog from "./components/infoDialog.vue"; import infoDialog from "./components/infoDialog.vue";
import gpsPosition from "./components/gpsPosition.vue";
export default { export default {
components: { components: {
carouselChart, carouselChart,
setschedule, setschedule,
deviceUpgrade, deviceUpgrade,
infoDialog, infoDialog,
gpsPosition,
}, },
data() { data() {
return { return {
@ -493,6 +512,7 @@ export default {
this.$refs.setschedule_ref.getSingleAccess(this.channelId, this.cmdid); this.$refs.setschedule_ref.getSingleAccess(this.channelId, this.cmdid);
this.$refs.setschedule_ref.deviceList(); this.$refs.setschedule_ref.deviceList();
}, },
//
handleCommandWarn(command) { handleCommandWarn(command) {
switch (command) { switch (command) {
case "open": // case "open": //
@ -731,6 +751,51 @@ export default {
} }
}); });
}, },
//GPS
handleShowGPS() {
this.$refs.gpsdialog_ref.display();
this.$refs.gpsdialog_ref.getgpsData(this.cmdid, this.newTermId);
console.log(this.cmdid, this.newTermId);
},
//gps
handleCommandGps(command) {
switch (command) {
case "open": //
this.changeGPS(1, this.cmdid);
break;
case "close": //
this.changeGPS(0, this.cmdid);
break;
}
},
changeGPS(val, cmdid) {
console.log(val, cmdid);
setTermGPSJoggle({ gpsstatus: val, cmdId: cmdid })
.then((res) => {
console.log(res);
if (val == 0) {
this.$message({
duration: 1500,
message: "关闭GPS",
type: "success",
showClose: true,
});
} else {
this.$message({
duration: 1500,
message: "成功开启GPS",
type: "success",
showClose: true,
});
}
})
.catch((err) => {
console.log(err); //
});
},
// //
// handlehistoryPic() { // handlehistoryPic() {
// this.$router.push({ path: "/realTimeSearch" }); // this.$router.push({ path: "/realTimeSearch" });

Loading…
Cancel
Save