gps,装置信息

hn2.0
fanluyan 2 years ago
parent a1154885c8
commit 46dfe4b127

@ -62,6 +62,17 @@ export function getDeviceList(data) {
}, },
}); });
} }
//获取最新装置信息aaa
export function getinfoStatus(data) {
return request({
url: "/api/getLastTermInfo",
method: "post",
data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//获取最新装置信息 //获取最新装置信息
export function getNewDeviceList(data) { export function getNewDeviceList(data) {
return request({ return request({
@ -459,6 +470,17 @@ export function getTermGPSPosition(data) {
} }
// 获取GPS位置 // 获取GPS位置
export function getTermLastGPSPosition(data) {
return request({
url: "/api/getTermLastGPSPosition",
method: "post",
data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
// 获取GPS位置
export function getTermGPSJoggle(data) { export function getTermGPSJoggle(data) {
return request({ return request({
url: "/api/getTermGPS", url: "/api/getTermGPS",

@ -49,7 +49,7 @@
<el-form-item label="SIM卡" prop="sim"> <el-form-item label="SIM卡" prop="sim">
<el-input v-model="formInfo.sim" auto-complete="on"></el-input> <el-input v-model="formInfo.sim" auto-complete="on"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="网络类型:" prop="networkId"> <!-- <el-form-item label="网络类型:" prop="networkId">
<el-select v-model="formInfo.networkId" placeholder="请选择"> <el-select v-model="formInfo.networkId" placeholder="请选择">
<el-option v-for="item in networkOptions" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in networkOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
@ -70,7 +70,7 @@
</el-form-item> </el-form-item>
<el-form-item label="投运日期:" prop="putdate"> <el-form-item label="投运日期:" prop="putdate">
<el-date-picker v-model="formInfo.putdate" type="date" placeholder="选择日期" value-format="timestamp"></el-date-picker> <el-date-picker v-model="formInfo.putdate" type="date" placeholder="选择日期" value-format="timestamp"></el-date-picker>
</el-form-item> </el-form-item> -->
<el-divider></el-divider> <el-divider></el-divider>
<h4>添加通道</h4> <h4>添加通道</h4>
<div class="addchannel" ref="channelBoxref"> <div class="addchannel" ref="channelBoxref">
@ -175,30 +175,30 @@ export default {
networkOptions: [ networkOptions: [
{ {
id: 1, id: 1,
name:'移动' name: "移动",
}, },
{ {
id: 2, id: 2,
name:'联通' name: "联通",
}, },
{ {
id: 3, id: 3,
name:'电信' name: "电信",
} },
], // ], //
statusOptions: [ statusOptions: [
{ {
id: 1, id: 1,
name:'在运' name: "在运",
}, },
{ {
id: 2, id: 2,
name:'停运' name: "停运",
}, },
{ {
id: 3, id: 3,
name:'调试' name: "调试",
} },
], // ], //
rules: { rules: {
cmdId: [ cmdId: [

@ -7,7 +7,7 @@
width="662px" width="662px"
@close="handleclose" @close="handleclose"
> >
<div class="gpsbox" v-loading="loading"> <!-- <div class="gpsbox" v-loading="loading">
<p> <p>
<span>经度</span><span>{{ infornr.longitude }}</span> <span>经度</span><span>{{ infornr.longitude }}</span>
</p> </p>
@ -17,6 +17,26 @@
<p> <p>
<span>半径</span><span>{{ infornr.radius }}</span> <span>半径</span><span>{{ infornr.radius }}</span>
</p> </p>
</div> -->
<div class="gpsbox" v-loading="loading">
<el-descriptions :column="1" border>
<el-descriptions-item>
<template slot="label"> 采集时间 </template
>{{ $moment(infornr.updatetime).format("YYYY-MM-DD HH:mm:ss") }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 经度 </template>{{ infornr.longitude }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 纬度 </template>{{ infornr.latitude }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 半径 </template>{{ infornr.radius }}
</el-descriptions-item>
</el-descriptions>
<el-button type="text" class="newBtn" @click="getgpsData()"
>获取最新GPS位置</el-button
>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="isShow = false"> </el-button> <el-button type="primary" @click="isShow = false"> </el-button>
@ -24,37 +44,59 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getTermGPSJoggle, getTermGPSPosition } from "@/utils/api/index"; import {
getTermLastGPSPosition,
getTermGPSJoggle,
getTermGPSPosition,
} from "@/utils/api/index";
export default { export default {
props: { props: {
title: String, title: String,
}, },
data() { data() {
return { return {
loading: true, loading: false,
isShow: false, isShow: false,
timer: null, timer: null,
infornr: {}, infornr: {},
i: 0, i: 0,
queryTime: "", //ID queryTime: "", //ID
cmdid: "", zzcmdid: "",
zztermid: "",
}; };
}, },
mounted() {}, mounted() {},
methods: { methods: {
//
getgpssql() {
getTermLastGPSPosition({
termId: this.zztermid,
})
.then((res) => {
this.infornr = res.data;
// this.$message({
// duration: 1500,
// showClose: true,
// message: "gps",
// type: "success",
// });
})
.catch((err) => {});
},
// //
getgpsData(val) { getgpsData() {
console.log(val); console.log(this.zzcmdid);
console.log(this.zztermid);
this.loading = true; this.loading = true;
//this.cmdid = cmdid;
getTermGPSPosition({ getTermGPSPosition({
cmdId: val.cmdid, cmdId: this.zzcmdid,
}) })
.then((res) => { .then((res) => {
this.queryTime = res.data; this.queryTime = res.data;
this.getNewgpsData(val); console.log(this.zztermid);
this.getNewgpsData(this.zztermid);
this.timer = window.setInterval(() => { this.timer = window.setInterval(() => {
this.getNewgpsData(val); this.getNewgpsData(this.zztermid);
this.i++; this.i++;
}, 5000); }, 5000);
}) })
@ -64,7 +106,7 @@ export default {
getNewgpsData(val) { getNewgpsData(val) {
getTermGPSJoggle({ getTermGPSJoggle({
queryTime: this.queryTime, queryTime: this.queryTime,
termid: val.id, termid: val,
}) })
.then((res) => { .then((res) => {
this.loading = true; this.loading = true;
@ -97,8 +139,11 @@ export default {
}) })
.catch((err) => {}); .catch((err) => {});
}, },
display() { display(data) {
console.log(data);
this.isShow = true; this.isShow = true;
this.zzcmdid = data.cmdId;
this.zztermid = data.id;
}, },
hide() { hide() {
this.isShow = false; this.isShow = false;
@ -107,6 +152,7 @@ export default {
this.i = 0; this.i = 0;
clearInterval(this.timer); clearInterval(this.timer);
this.timer = null; this.timer = null;
this.loading = false;
}, },
}, },
}; };
@ -119,6 +165,9 @@ export default {
height: 32px; height: 32px;
font-size: 16px; font-size: 16px;
} }
.newBtn {
margin-top: 14px;
}
} }
} }
</style> </style>

@ -233,38 +233,10 @@
<el-table-column <el-table-column
fixed="right" fixed="right"
label="操作" label="操作"
width="340" width="580"
v-if="roleUser != 2" v-if="roleUser != 2"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-dropdown
class="dropgps"
trigger="click"
@command="
(command) => {
handleSearchCommand(command, scope.row);
}
"
>
<span class="el-dropdown-link">
数据查询<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="info">基本信息</el-dropdown-item>
<el-dropdown-item command="workStatus"
>工作状态</el-dropdown-item
>
<el-dropdown-item command="runStatus"
>运行状态</el-dropdown-item
>
<el-dropdown-item command="GPS">GPS位置</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button
@click.native.stop="handleParameterSet(scope.row)"
type="text"
>参数配置</el-button
>
<el-button <el-button
@click.native.stop="handleRevisePhoto(scope.row)" @click.native.stop="handleRevisePhoto(scope.row)"
type="text" type="text"
@ -275,7 +247,7 @@
@click.native.stop="handlepicture(scope.row)" @click.native.stop="handlepicture(scope.row)"
>图片标记</el-button >图片标记</el-button
> >
<!-- <el-button <el-button
type="text" type="text"
@click.native.stop="handleDeviceReset(scope.row)" @click.native.stop="handleDeviceReset(scope.row)"
>装置复位</el-button >装置复位</el-button
@ -294,7 +266,7 @@
type="text" type="text"
@click.native.stop="handleShowGPS(scope.row)" @click.native.stop="handleShowGPS(scope.row)"
>获取GPS位置</el-button >获取GPS位置</el-button
> --> >
<!-- <el-select <!-- <el-select
class="dropgps" class="dropgps"
v-model="gpsvalue" v-model="gpsvalue"
@ -310,7 +282,7 @@
> >
</el-option> </el-option>
</el-select> --> </el-select> -->
<!-- <el-dropdown <el-dropdown
class="dropgps" class="dropgps"
trigger="click" trigger="click"
@command=" @command="
@ -326,7 +298,7 @@
<el-dropdown-item command="open">开启GPS</el-dropdown-item> <el-dropdown-item command="open">开启GPS</el-dropdown-item>
<el-dropdown-item command="close">关闭GPS</el-dropdown-item> <el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> --> </el-dropdown>
<el-button <el-button
type="text" type="text"
class="deleteText" class="deleteText"
@ -335,7 +307,7 @@
> >
</template> </template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" width="180" v-else> <el-table-column fixed="right" label="操作" width="380" v-else>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@click.native.stop="handleRevisePhoto(scope.row)" @click.native.stop="handleRevisePhoto(scope.row)"
@ -348,7 +320,7 @@
>图片标记</el-button >图片标记</el-button
> >
<!-- <el-button <el-button
type="text" type="text"
@click.native.stop="handleShowGPS(scope.row)" @click.native.stop="handleShowGPS(scope.row)"
>获取GPS位置</el-button >获取GPS位置</el-button
@ -370,7 +342,7 @@
<el-dropdown-item command="open">开启GPS</el-dropdown-item> <el-dropdown-item command="open">开启GPS</el-dropdown-item>
<el-dropdown-item command="close">关闭GPS</el-dropdown-item> <el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> --> </el-dropdown>
<el-button <el-button
type="text" type="text"
class="deleteText" class="deleteText"
@ -527,7 +499,6 @@ export default {
this.getSearchdy(); this.getSearchdy();
this.page = 1; this.page = 1;
this.pageSize = 20; this.pageSize = 20;
this.terminalList(); this.terminalList();
}, },
//// ////
@ -575,6 +546,105 @@ export default {
this.$refs.addPhotoDialogref.getdataform(data); this.$refs.addPhotoDialogref.getdataform(data);
console.log(data); console.log(data);
}, },
//
handleDeviceReset(data) {
this.$confirm("此操作将复位装置, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
resetTerminalApi({ cmId: data.cmdId })
.then((res) => {
if (res.code == 200) {
this.$message({
duration: 1500,
showClose: true,
message: "装置已复位",
type: "success",
});
} else {
this.$message({
duration: 1500,
showClose: true,
message: res.msg,
type: "error",
});
}
})
.catch((err) => {});
})
.catch(() => {
// this.$message({
// duration: 1500,
// showClose: true,
// type: "info",
// message: "",
// });
});
},
//GPS
handleShowGPS(data) {
// this.$refs.gpsdialog_ref.display();
// this.$refs.gpsdialog_ref.getgpsData(data);
this.$refs.gpsdialog_ref.display(data);
this.$refs.gpsdialog_ref.getgpssql();
console.log(data);
},
//gps
changeGPS(val, row) {
console.log(val, row);
setTermGPSJoggle({ gpsstatus: val, cmdId: row.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); //
});
},
handleCommand(command, row) {
console.log(command, row);
switch (command) {
case "open": //
this.changeGPS(1, row);
break;
case "close": //
this.changeGPS(0, row);
break;
}
},
//
// gpsChange(val) {
// console.log(val);
// },
//
handleImageCapture(data) {
this.$refs.imageCaptureref.display();
this.$refs.imageCaptureref.getSingleAccess(data);
this.$refs.imageCaptureref.getRatio();
},
//
handleVideoCapture(data) {
this.$refs.videoCaptureref.display();
this.$refs.videoCaptureref.getSingleAccess(data);
this.$refs.videoCaptureref.getRatio();
},
//线 //线
handlepicture(data) { handlepicture(data) {
@ -709,7 +779,7 @@ export default {
} }
.dropgps { .dropgps {
color: @color-primary; color: @color-primary;
// margin-left: 16px; margin-left: 16px;
// margin-right: 16px; // margin-right: 16px;
cursor: pointer; cursor: pointer;
font-size: 12px; font-size: 12px;

@ -7,7 +7,7 @@
width="662px" width="662px"
@close="handleclose" @close="handleclose"
> >
<div class="gpsbox" v-loading="loading"> <!-- <div class="gpsbox" v-loading="loading">
<p> <p>
<span>经度</span><span>{{ infornr.longitude }}</span> <span>经度</span><span>{{ infornr.longitude }}</span>
</p> </p>
@ -17,6 +17,26 @@
<p> <p>
<span>半径</span><span>{{ infornr.radius }}</span> <span>半径</span><span>{{ infornr.radius }}</span>
</p> </p>
</div> -->
<div class="gpsbox" v-loading="loading">
<el-descriptions :column="1" border>
<el-descriptions-item>
<template slot="label"> 采集时间 </template
>{{ $moment(infornr.updatetime).format("YYYY-MM-DD HH:mm:ss") }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 经度 </template>{{ infornr.longitude }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 纬度 </template>{{ infornr.latitude }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 半径 </template>{{ infornr.radius }}
</el-descriptions-item>
</el-descriptions>
<el-button type="text" class="newBtn" @click="getgpsData()"
>获取最新GPS位置</el-button
>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="isShow = false"> </el-button> <el-button type="primary" @click="isShow = false"> </el-button>
@ -24,14 +44,18 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getTermGPSJoggle, getTermGPSPosition } from "@/utils/api/index"; import {
getTermLastGPSPosition,
getTermGPSJoggle,
getTermGPSPosition,
} from "@/utils/api/index";
export default { export default {
props: { props: {
title: String, title: String,
}, },
data() { data() {
return { return {
loading: true, loading: false,
isShow: false, isShow: false,
timer: null, timer: null,
infornr: {}, infornr: {},
@ -43,15 +67,29 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
//
getgpssql() {
getTermLastGPSPosition({
termId: this.zztermid,
})
.then((res) => {
this.infornr = res.data;
// this.$message({
// duration: 1500,
// showClose: true,
// message: "gps",
// type: "success",
// });
})
.catch((err) => {});
},
// //
getgpsData(zzcmdidval, zztermidval) { getgpsData() {
this.zzcmdid = zzcmdidval;
this.zztermid = zztermidval;
console.log(this.zzcmdid); console.log(this.zzcmdid);
console.log(this.zztermid); console.log(this.zztermid);
this.loading = true; this.loading = true;
getTermGPSPosition({ getTermGPSPosition({
cmdId: zzcmdidval, cmdId: this.zzcmdid,
}) })
.then((res) => { .then((res) => {
this.queryTime = res.data; this.queryTime = res.data;
@ -101,8 +139,10 @@ export default {
}) })
.catch((err) => {}); .catch((err) => {});
}, },
display() { display(cmdid, newTermId) {
this.isShow = true; this.isShow = true;
this.zzcmdid = cmdid;
this.zztermid = newTermId;
}, },
hide() { hide() {
this.isShow = false; this.isShow = false;
@ -123,6 +163,9 @@ export default {
height: 32px; height: 32px;
font-size: 16px; font-size: 16px;
} }
.newBtn {
margin-top: 14px;
}
} }
} }
</style> </style>

@ -8,7 +8,7 @@
@close="handleclose" @close="handleclose"
> >
<div class="infoTable" v-loading="loading"> <div class="infoTable" v-loading="loading">
<el-descriptions class="margin-top" :column="1" border> <el-descriptions :column="1" border>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> 装置编号 </template>{{ cmdid }} <template slot="label"> 装置编号 </template>{{ cmdid }}
</el-descriptions-item> </el-descriptions-item>
@ -46,6 +46,9 @@
}} }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-button type="text" class="newBtn" @click="getListData()"
>获取最新装置信息</el-button
>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<!-- <el-button @click="isShow = false"> </el-button> --> <!-- <el-button @click="isShow = false"> </el-button> -->
@ -54,36 +57,50 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getDeviceList, getNewDeviceList } from "@/utils/api/index"; import {
getDeviceList,
getNewDeviceList,
getinfoStatus,
} from "@/utils/api/index";
export default { export default {
props: { props: {
title: String, title: String,
}, },
data() { data() {
return { return {
loading: true, loading: false,
isShow: false, isShow: false,
infornr: {}, // infornr: {}, //
timer: null, timer: null,
i: 0, i: 0,
queryTime: "", //ID queryTime: "", //ID
cmdid: "", cmdid: "",
zztermid: "",
}; };
}, },
mounted() {}, mounted() {},
methods: { methods: {
//
getinfo() {
getinfoStatus({
termId: this.zztermid,
})
.then((res) => {
this.infornr = res.data;
})
.catch((err) => {});
},
// //
getListData(val, cmdid) { getListData() {
this.loading = true; this.loading = true;
this.cmdid = cmdid;
getDeviceList({ getDeviceList({
termId: val, termId: this.zztermid,
}) })
.then((res) => { .then((res) => {
this.queryTime = res.data.queryTime; this.queryTime = res.data.queryTime;
this.getNewListData(val); this.getNewListData(this.zztermid);
this.timer = window.setInterval(() => { this.timer = window.setInterval(() => {
this.getNewListData(val); this.getNewListData(this.zztermid);
this.i++; this.i++;
}, 10000); }, 10000);
}) })
@ -96,17 +113,19 @@ export default {
termId: val, termId: val,
}) })
.then((res) => { .then((res) => {
this.loading = false;
if (res.code == 200) { if (res.code == 200) {
this.infornr = res.data; this.infornr = res.data;
if (res.data.isNew == true) { if (res.data.isNew == true) {
this.i = 0; this.i = 0;
this.$message.success("装置信息已更新"); this.$message.success("装置信息已更新");
clearInterval(this.timer); clearInterval(this.timer);
this.loading = false;
} else if (this.i > 9) { } else if (this.i > 9) {
this.i = 0; this.i = 0;
this.$message.warning("暂无响应,请稍后再试!"); this.$message.warning("暂无响应,请稍后再试!");
clearInterval(this.timer); clearInterval(this.timer);
this.loading = false;
} }
} else { } else {
this.$message.error(res.code.msg); this.$message.error(res.code.msg);
@ -114,8 +133,15 @@ export default {
}) })
.catch((err) => {}); .catch((err) => {});
}, },
display() { // display() {
// this.isShow = true;
// },
display(newTermId, cmdid) {
console.log(newTermId, cmdid);
this.isShow = true; this.isShow = true;
this.zztermid = newTermId;
this.cmdid = cmdid;
}, },
hide() { hide() {
this.isShow = false; this.isShow = false;
@ -130,5 +156,8 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
.infoDialog { .infoDialog {
.newBtn {
margin-top: 14px;
}
} }
</style> </style>

@ -740,8 +740,9 @@ export default {
getTermStatus({ termId: this.newTermId }).then((res) => { getTermStatus({ termId: this.newTermId }).then((res) => {
console.log(res); console.log(res);
if (res.data.isonline) { if (res.data.isonline) {
this.$refs.infodialog_ref.display(); this.$refs.infodialog_ref.display(this.channelId, this.cmdid);
this.$refs.infodialog_ref.getListData(this.channelId, this.cmdid); this.$refs.infodialog_ref.getinfo();
//this.$refs.infodialog_ref.getListData(this.channelId, this.cmdid);
} else { } else {
this.$message({ this.$message({
duration: 1500, duration: 1500,
@ -755,9 +756,8 @@ export default {
//GPS //GPS
handleShowGPS() { handleShowGPS() {
this.$refs.gpsdialog_ref.display(); this.$refs.gpsdialog_ref.display(this.cmdid, this.newTermId);
this.$refs.gpsdialog_ref.getgpsData(this.cmdid, this.newTermId); this.$refs.gpsdialog_ref.getgpssql();
console.log(this.cmdid, this.newTermId);
}, },
//gps //gps

Loading…
Cancel
Save