Compare commits
3 Commits
fabab0a577
...
84af6f5cfe
| Author | SHA1 | Date | |
|---|---|---|---|
| 84af6f5cfe | |||
| c7a05f2118 | |||
| 7445e789a4 |
@ -2,7 +2,7 @@
|
||||
<div class="device-page p-2">
|
||||
<!-- 头部信息栏 -->
|
||||
<div class="header-bar">
|
||||
<div>设备名称:{{ deviceDetail.deviceName }},IMEI:{{deviceDetail.deviceImei }}</div>
|
||||
<div>设备名称:{{ deviceDetail.deviceName }},IMEI:{{ deviceDetail.deviceImei }}</div>
|
||||
<div>设备型号:{{ deviceDetail.typeName }}</div>
|
||||
<div class="device-status">
|
||||
设备状态:
|
||||
@ -19,8 +19,8 @@
|
||||
<el-row :gutter="20" class="content-row" :class="deviceDetail.sta_ShakeBit == 1 || deviceDetail.staSOSGrade == 1 ? '' : 'displayNone'">
|
||||
<el-col :lg="24" :xs="24">
|
||||
<div class="staticRwo" :class="deviceDetail.sta_ShakeBit == 1 ? '' : 'displayNone'">设备静止报警中!</div>
|
||||
<div class="staticRwo" :class="(deviceDetail.staSOSGrade == 1 && Status.timeOut>0) ? '' : 'displayNone'" @click="showClose()">
|
||||
设备强制报警中<span v-show="Status.timeOut>0">,{{ Status.timeOut }}S</span>!
|
||||
<div class="staticRwo" :class="deviceDetail.staSOSGrade == 1 && Status.timeOut > 0 ? '' : 'displayNone'" @click="showClose()">
|
||||
设备强制报警中<span v-show="Status.timeOut > 0">,{{ Status.timeOut }}S</span>!
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -209,7 +209,6 @@ import strongLightActive from '@/assets/images/strong-light_HL.png';
|
||||
import floodLightDefault from '@/assets/images/flood-light.png';
|
||||
import floodLightActive from '@/assets/images/flood-light_HL.png';
|
||||
|
||||
|
||||
import di from '@/assets/images/di.png';
|
||||
import diAc from '@/assets/images/diAc.png';
|
||||
import high from '@/assets/images/high.png';
|
||||
@ -314,7 +313,7 @@ const staticModes = ref<any[]>([
|
||||
id: '2',
|
||||
name: '中档',
|
||||
icon: zhong, // 直接使用导入的变量
|
||||
activeIcon:zhongAc,
|
||||
activeIcon: zhongAc,
|
||||
|
||||
active: false
|
||||
},
|
||||
@ -385,7 +384,7 @@ const deviceDetail = ref<any>({
|
||||
});
|
||||
|
||||
//模式设置
|
||||
const handleModeClick = async (id: string, type: string) => {
|
||||
const handleModeClick = async (id: string, type: string) => {
|
||||
if (Status[type] == id) {
|
||||
return;
|
||||
}
|
||||
@ -394,7 +393,7 @@ const handleModeClick = async (id: string, type: string) => {
|
||||
|
||||
let dic = { promise: null, callback: null, key: '' };
|
||||
|
||||
//测试环境假装成功
|
||||
//测试环境假装成功
|
||||
dic.promise = Promise.resolve({ code: 200, msg: '操作成功' });
|
||||
|
||||
let arr = [];
|
||||
@ -418,7 +417,7 @@ const handleModeClick = async (id: string, type: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
dic.promise.then((res) => {
|
||||
dic.promise.then((res) => {
|
||||
if (res.code === 200) {
|
||||
Status[type] = id;
|
||||
ElMessage.closeAll();
|
||||
@ -427,39 +426,35 @@ const handleModeClick = async (id: string, type: string) => {
|
||||
dic.callback();
|
||||
}
|
||||
if (callback) {
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
} else {
|
||||
proxy?.$modal.msgError(res.msg);
|
||||
}
|
||||
});
|
||||
};
|
||||
if(type == 'sosMode' && Status.sosMode=== '1' && id==='0' && timer){
|
||||
if (type == 'sosMode' && Status.sosMode === '1' && id === '0' && timer) {
|
||||
showClose();
|
||||
return;
|
||||
}
|
||||
else if (type == 'sosMode' && id === '1' && timer==null) {
|
||||
} else if (type == 'sosMode' && id === '1' && timer == null) {
|
||||
ShowConfirm({
|
||||
title: '提示',
|
||||
text: '您确认开启180秒强制报警',
|
||||
cancelCallback: ()=>{
|
||||
timer=null;
|
||||
cancelCallback: () => {
|
||||
timer = null;
|
||||
},
|
||||
OkCallback: () => {
|
||||
sendCmd(function () {
|
||||
|
||||
Status.confirm.Visible = false;
|
||||
deviceDetail.value.staSOSGrade="1";
|
||||
deviceDetail.value.staSOSGrade = '1';
|
||||
Status.timeOut = 180;
|
||||
timer = setInterval(() => {
|
||||
if (Status.timeOut === 0) {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
hideConfirm();
|
||||
handleModeClick('1','sosMode');
|
||||
deviceDetail.value.staSOSGrade="0";
|
||||
handleModeClick('1', 'sosMode');
|
||||
deviceDetail.value.staSOSGrade = '0';
|
||||
return;
|
||||
}
|
||||
|
||||
@ -478,26 +473,32 @@ const handleModeClick = async (id: string, type: string) => {
|
||||
};
|
||||
|
||||
const getList = () => {
|
||||
api.deviceRealTimeStatus(route.params.deviceId).then((res) => {
|
||||
if (res && res.code == 200) {
|
||||
let keys = Object.keys(res.data);
|
||||
keys.forEach((key) => {
|
||||
deviceDetail.value[key] = res.data[key];
|
||||
});
|
||||
Status.sosMode = res.data.staSOSGrade;
|
||||
Status.staticPower = res.data.staDetectGrade;
|
||||
Status.lightMode = res.data.staLightGrade;
|
||||
if(!deviceDetail.value.personnelInfo){
|
||||
deviceDetail.value.personnelInfo={
|
||||
'id': null,
|
||||
'deviceId': null,
|
||||
'name': null,
|
||||
'position': null,
|
||||
'unitName': null,
|
||||
'code': null
|
||||
return new Promise((resolve, reject) => {
|
||||
api
|
||||
.deviceRealTimeStatus(route.params.deviceId)
|
||||
.then((res) => {
|
||||
if (res && res.code == 200) {
|
||||
|
||||
let keys = Object.keys(res.data);
|
||||
keys.forEach((key) => {
|
||||
deviceDetail.value[key] = res.data[key];
|
||||
});
|
||||
Status.sosMode = res.data.staSOSGrade;
|
||||
Status.staticPower = res.data.staDetectGrade;
|
||||
Status.lightMode = res.data.staLightGrade;
|
||||
if (!deviceDetail.value.personnelInfo) {
|
||||
deviceDetail.value.personnelInfo = {
|
||||
'id': null,
|
||||
'deviceId': null,
|
||||
'name': null,
|
||||
'position': null,
|
||||
'unitName': null,
|
||||
'code': null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(resolve);
|
||||
});
|
||||
};
|
||||
|
||||
@ -563,8 +564,6 @@ const sendTextMessage = async () => {
|
||||
batchId: ''
|
||||
};
|
||||
|
||||
|
||||
|
||||
api.SendMessage(json).then((res) => {
|
||||
if (res.code === 200) {
|
||||
ElMessage.closeAll();
|
||||
@ -588,52 +587,63 @@ const lookMap = (row: any) => {
|
||||
function showClose() {
|
||||
Status.confirm.Visible = true;
|
||||
Status.confirm.OkTxt = '关闭';
|
||||
Status.confirm.OkCallback=()=>{
|
||||
clearInterval(timer);
|
||||
timer=null;
|
||||
handleModeClick('0','sosMode');
|
||||
deviceDetail.value.staSOSGrade="0";
|
||||
|
||||
Status.timeOut=0;
|
||||
|
||||
Status.confirm.OkCallback = () => {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
handleModeClick('0', 'sosMode');
|
||||
deviceDetail.value.staSOSGrade = '0';
|
||||
|
||||
Status.timeOut = 0;
|
||||
|
||||
hideConfirm();
|
||||
}
|
||||
};
|
||||
}
|
||||
// 处理设备消息
|
||||
const handleDeviceMessage = (payload: any) => {
|
||||
let json = JSON.parse(payload);
|
||||
let json = null;
|
||||
try {
|
||||
json = JSON.parse(payload);
|
||||
} catch (ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
let keys = Object.keys(json);
|
||||
|
||||
function parseDataMQ(json) {
|
||||
deviceDetail.value.staDetectGrade = json.sta_DetectGrade;
|
||||
deviceDetail.value.staLightGrade = json.sta_LightGrade;
|
||||
deviceDetail.value.staDetectResult = json.sta_DetectResult;
|
||||
deviceDetail.value.staSOSGrade = json.sta_SOSGrade;
|
||||
deviceDetail.value.sta_ShakeBit = json.sta_ShakeBit;
|
||||
deviceDetail.value.staPowerTime = json.sta_PowerTime;
|
||||
deviceDetail.value.staPowerPercent = json.sta_PowerPercent;
|
||||
deviceDetail.value.longitude = json.sta_longitude;
|
||||
deviceDetail.value.latitude = json.sta_latitude;
|
||||
deviceDetail.value.onlineStatus = 1;
|
||||
try {
|
||||
debugger;
|
||||
deviceDetail.value.staDetectGrade = json.sta_DetectGrade;
|
||||
deviceDetail.value.staLightGrade = json.sta_LightGrade;
|
||||
deviceDetail.value.staDetectResult = json.sta_DetectResult;
|
||||
deviceDetail.value.staSOSGrade = json.sta_SOSGrade;
|
||||
deviceDetail.value.sta_ShakeBit = json.sta_ShakeBit;
|
||||
deviceDetail.value.staPowerTime = json.sta_PowerTime;
|
||||
deviceDetail.value.staPowerPercent = json.sta_PowerPercent;
|
||||
deviceDetail.value.longitude = json.sta_longitude;
|
||||
deviceDetail.value.latitude = json.sta_latitude;
|
||||
deviceDetail.value.onlineStatus = 1;
|
||||
|
||||
Status.sosMode = json.sta_SOSGrade;
|
||||
Status.staticPower = json.sta_DetectGrade;
|
||||
Status.lightMode = json.sta_LightGrade;
|
||||
Status.sosMode = json.sta_SOSGrade;
|
||||
Status.staticPower = json.sta_DetectGrade;
|
||||
Status.lightMode = json.sta_LightGrade;
|
||||
console.log('Status=', Status);
|
||||
console.log('sosModes=', sosModes.value);
|
||||
console.log('sta_SOSGrade=', json.sta_SOSGrade);
|
||||
if (json.sta_PowerPercent < 20) {
|
||||
centerDialogVisible.value = true;
|
||||
}
|
||||
|
||||
if (json.sta_PowerPercent < 20) {
|
||||
centerDialogVisible.value = true;
|
||||
}
|
||||
|
||||
if (json.sta_SOSGrade == 1 && json.sta_ShakeBit == 1) {
|
||||
confirm('设备SOS报警、静止预警中');
|
||||
return;
|
||||
}
|
||||
if (json.sta_SOSGrade == 1) {
|
||||
confirm('设备SOS报警中');
|
||||
}
|
||||
if (json.sta_ShakeBit == 1) {
|
||||
confirm('设备静止报警中');
|
||||
}
|
||||
if (json.sta_SOSGrade == 1 && json.sta_ShakeBit == 1) {
|
||||
confirm('设备SOS报警、静止预警中');
|
||||
return;
|
||||
}
|
||||
if (json.sta_SOSGrade == 1) {
|
||||
confirm('设备SOS报警中');
|
||||
}
|
||||
if (json.sta_ShakeBit == 1) {
|
||||
confirm('设备静止报警中');
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
if (keys.indexOf('sta_DetectGrade') > -1) {
|
||||
@ -646,6 +656,7 @@ onMounted(async () => {
|
||||
await getList(); // 先获取设备信息
|
||||
// 连接mqtt
|
||||
onConnect(async () => {
|
||||
|
||||
const deviceImei = deviceDetail.value.deviceImei;
|
||||
if (!deviceImei) {
|
||||
return;
|
||||
@ -659,6 +670,7 @@ onMounted(async () => {
|
||||
});
|
||||
// 2. 注册消息接收回调(核心:处理设备发送的消息)
|
||||
onMessage((msg) => {
|
||||
|
||||
console.log('收到新消息:', {
|
||||
主题: msg.topic,
|
||||
内容: msg.payload,
|
||||
@ -666,7 +678,7 @@ onMounted(async () => {
|
||||
QoS: msg.qos
|
||||
});
|
||||
// 在这里处理消息(根据实际业务逻辑)
|
||||
handleDeviceMessage(msg);
|
||||
handleDeviceMessage(msg.payload);
|
||||
});
|
||||
onError((err) => {
|
||||
console.error('MQTT连接失败原因:', err.message); // 关键:打印连接失败的具体原因
|
||||
@ -747,7 +759,7 @@ window.hideConfirm = function () {
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.p-2{
|
||||
.p-2 {
|
||||
background: rgba(247, 248, 252, 1);
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
</div>
|
||||
|
||||
<div class="treeContent">
|
||||
<el-tree :data="treeData" :props="defaultProps" accordion @node-click="handleNodeClick" :highlight-current="true">
|
||||
<el-tree :default-expand-all="true" :data="treeData" :props="defaultProps" accordion @node-click="handleNodeClick" :highlight-current="true">
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node">
|
||||
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
||||
@ -171,13 +171,18 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加节点的弹出框 -->
|
||||
<el-dialog :width="350" :draggable="true" v-model="Status.dialogEditNode" :title="cEdit.id ? '修改分组' :(cEdit.pNode?'新增子节点': '新增根节点')" center>
|
||||
<el-dialog
|
||||
:width="350"
|
||||
:draggable="true"
|
||||
v-model="Status.dialogEditNode"
|
||||
:title="cEdit.id ? '修改分组' : cEdit.pNode ? '新增子节点' : '新增根节点'"
|
||||
center
|
||||
>
|
||||
<div>
|
||||
<el-form class="demo-form-inline" :inline="true" :model="cEdit" label-width="auto" style="width: 100%">
|
||||
<el-form-item label="分组名称"> <el-input v-model="cEdit.groupName" placeholder="请输入" /> </el-form-item
|
||||
>
|
||||
<div style="text-indent: 68px;color: #f56c6c;margin-top: -15px;">{{ cEdit.groupName?'':'请输入分组名称' }}</div>
|
||||
</el-form>
|
||||
<el-form-item label="分组名称"> <el-input v-model="cEdit.groupName" placeholder="请输入" /> </el-form-item>
|
||||
<div style="text-indent: 68px; color: #f56c6c; margin-top: -15px">{{ cEdit.groupName ? '' : '请输入分组名称' }}</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@ -337,18 +342,21 @@ var getDeviceList = () => {
|
||||
deviceName: GjSearchForm.deviceName
|
||||
};
|
||||
showloading();
|
||||
api
|
||||
.getNodeDevice(para)
|
||||
.then((res) => {
|
||||
deviceList.value = res.rows;
|
||||
pagin.total = res.total;
|
||||
})
|
||||
.catch((ex) => {
|
||||
console.log('出现了异常', ex);
|
||||
})
|
||||
.finally(() => {
|
||||
hideloading();
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
api
|
||||
.getNodeDevice(para)
|
||||
.then((res) => {
|
||||
deviceList.value = res.rows;
|
||||
pagin.total = res.total;
|
||||
})
|
||||
.catch((ex) => {
|
||||
console.log('出现了异常', ex);
|
||||
})
|
||||
.finally(() => {
|
||||
hideloading();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
//树控件节点点击事件
|
||||
var handleNodeClick = (node) => {
|
||||
@ -363,6 +371,12 @@ var handleNodeClick = (node) => {
|
||||
//树控件筛选后显示的数据源
|
||||
var treeData = computed(() => {
|
||||
let arr = api.treeNodeSearch(treeDataOrin.value, searchTxt.value, 'groupName', 'children');
|
||||
if (arr.length && !checkNode.val) {
|
||||
checkNode.val = arr[0].id;
|
||||
getDeviceList().finally(() => {
|
||||
checkNode.val = '';
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
});
|
||||
|
||||
@ -379,7 +393,7 @@ var editNode = (node) => {
|
||||
Status.isEditTreeNode = true;
|
||||
cEdit.value.editNode = node;
|
||||
cEdit.value.pNode = null;
|
||||
Status.dialogEditNode=true;
|
||||
Status.dialogEditNode = true;
|
||||
//
|
||||
};
|
||||
|
||||
@ -413,7 +427,7 @@ var completeEdit = (node) => {
|
||||
if (res.code == 200) {
|
||||
alert('操作成功');
|
||||
RefreshTree();
|
||||
Status.dialogEditNode=false;
|
||||
Status.dialogEditNode = false;
|
||||
} else {
|
||||
alert(res.msg);
|
||||
}
|
||||
@ -477,7 +491,7 @@ var addNode = (node) => {
|
||||
};
|
||||
|
||||
var saveNode = () => {
|
||||
if(!cEdit.value.groupName){
|
||||
if (!cEdit.value.groupName) {
|
||||
return;
|
||||
}
|
||||
let val = new Date().getTime();
|
||||
@ -917,8 +931,8 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.custom-tree-node .iconContent .icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
||||
@ -1,83 +1,6 @@
|
||||
<template>
|
||||
<el-form :model="user" label-width="80px">
|
||||
<div v-for="item in user">
|
||||
<el-form-item :label="item.dictLabel" prop="dictLabel">
|
||||
<el-input v-model="item.dictLabel" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="版本号" prop="dictValue">
|
||||
<el-input v-model="item.dictValue" placeholder="请输入版本号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="下载地址" prop="remark">
|
||||
<el-input v-model="item.remark" placeholder="请输入wgt下载地址" clearable />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submit">保存</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div>敬请期待</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import request from '@/utils/request';
|
||||
const user = ref([
|
||||
{
|
||||
'dictValue': '',
|
||||
'dictLabel': 'ios',
|
||||
'remark': ''
|
||||
},
|
||||
{
|
||||
'dictValue': '',
|
||||
'dictLabel': 'android',
|
||||
'remark': ''
|
||||
}
|
||||
]);
|
||||
|
||||
function getCfg() {
|
||||
request({
|
||||
url: '/app/auth/version',
|
||||
method: 'get'
|
||||
}).then((res) => {
|
||||
if (res && res.code === 200) {
|
||||
user.value.forEach((v) => {
|
||||
let f = res.data.find((item) => {
|
||||
return item.dictLabel === v.dictLabel;
|
||||
});
|
||||
if (f) {
|
||||
v.dictValue = f.dictValue;
|
||||
v.remark = f.remark;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submit() {
|
||||
let flag = [];
|
||||
user.value.forEach((v) => {
|
||||
let keys = Object.keys(v);
|
||||
keys.forEach((k) => {
|
||||
if (!v[k]) {
|
||||
flag.push(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
if (flag.length > 0) {
|
||||
ElMessageBox.alert('所有项都是必填');
|
||||
return;
|
||||
}
|
||||
request({
|
||||
url: '/api/xinghan/device/UpVersion',
|
||||
method: 'post',
|
||||
data: user.value
|
||||
}).then((res) => {
|
||||
if (res && res.code === 200) {
|
||||
ElMessageBox.alert('操作成功');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getCfg();
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -61,9 +61,7 @@
|
||||
<el-tab-pane label="在线设备" name="onlineDevice">
|
||||
<onlineDevice :devices="state.devices" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="App版本" name="appVer">
|
||||
<appVer />
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
Reference in New Issue
Block a user