Commit 889ff121 authored by yangkaiyi's avatar yangkaiyi

存档

parent 7eb1fa4a
......@@ -123,12 +123,12 @@ export default {
] +
"]"
: ""),
messages[store.state.common.system.lang].map.popupMileage +
":" +
(attributes.todaytrip ? attributes.todaytrip : 0) +
"/" +
(attributes.trip ? attributes.trip : 0) +
" km",
// messages[store.state.common.system.lang].map.popupMileage +
// ":" +
// (attributes.todaytrip ? attributes.todaytrip : 0) +
// "/" +
// (attributes.trip ? attributes.trip : 0) +
// " km",
messages[store.state.common.system.lang].common.time +
":" +
this.dateFormat(device.position.time, "YYYY-MM-DD HH:mm:ss"),
......
import { Message } from "element-ui";
import { Message, Notification } from "element-ui";
import util from "./util";
let token = "";
if (localStorage.user) {
......@@ -31,18 +32,56 @@ const ws = {
}
};
this.websocket.onmessage = function (evt) {
console.log("evt", JSON.parse(evt.data));
if (evt.data) {
let socketMsg = JSON.parse(evt.data);
if (socketMsg.positions) {
self.$store.dispatch("updateDevicePosition", socketMsg.positions);
} else if (socketMsg.devices) {
self.$store.dispatch("updateDeviceStatus", socketMsg.devices);
const name =
self.$store.state.user.devices.list[
self.$store.state.user.devices.index[
socketMsg.devices[0].deviceId
]
].name;
let type;
try {
type = JSON.parse(socketMsg.devices[0].attributes).alarm;
} catch (e) {
type = socketMsg.devices[0].attributes.alarm;
}
const txt = {
sos: "求救报警",
idle: "静默报警",
vibration: "vibration",
powerOff: "断电,请及时查看",
powerCut: "断电,请及时查看",
lowBattery: "低电报警",
removing: "拆除报警",
fault: "fault",
};
Notification({
title: `${name} ${txt[type]}`,
message: util.dateFormat(
socketMsg.devices[0].time,
"YYYY-MM-DD HH:mm:ss"
),
duration: 0,
type: "warning",
});
} else if (socketMsg.commands) {
self.$store.dispatch("responseCommand", socketMsg.commands);
}
}
};
this.websocket.onerror = function (evt) {};
// test代码
// let str = {
// data:
// '{"devices":[{"attributes":"{\\"alarm\\":\\"powerCut\\"}","deviceId":45,"id":45,"status":9,"time":1621495646355}]}',
// };
// this.websocket.onmessage(str);
},
reconnection: function (val) {
ws.connection = false;
......
This diff is collapsed.
......@@ -8,8 +8,8 @@
>
<el-option :key="-1" label="全部" :value="-1" />
<el-option
v-for="item in $store.state.user.devices.list"
:key="item.id"
v-for="(item, i) in $store.state.user.devices.list"
:key="i"
:label="item.name"
:value="item.id"
>
......@@ -18,8 +18,8 @@
<el-select size="mini" v-model="typeId" placeholder="请类型" @change="init">
<el-option label="全部" :value="-1" />
<el-option
v-for="item in eventTypes"
:key="item.id"
v-for="(item, i) in eventTypes"
:key="i"
:label="item.name"
:value="item.id"
>
......
......@@ -155,71 +155,80 @@
:devices="selectDevices"
@visible="closeDialog"
></TransferDevice>
<!-- 编辑 -->
<!-- 新增、编辑弹窗 -->
<el-dialog
:title="`${isEdit ? '编辑' : '添加'}重要有害植物`"
:visible.sync="editDialogVisible"
width="40%"
width="50%"
>
<el-form
:model="editForm"
ref="editFormRef"
label-width="100px"
class="demo-ruleForm"
>
<!-- 新增、编辑弹窗 -->
<el-form-item
label="名称"
prop="name"
:rules="[
{
required: true,
message: '请输入有害植物名称',
trigger: ['blur', 'change'],
},
]"
>
<el-input
v-model="editForm.name"
auto-complete="off"
:disabled="isEdit"
></el-input>
</el-form-item>
<el-form-item
label="IMEI"
prop="imei"
:rules="[
{
required: true,
message: '请输入IMEI',
trigger: ['blur', 'change'],
},
]"
>
<el-input v-model="editForm.imei" auto-complete="off"></el-input>
</el-form-item>
<el-form-item label="报关号" prop="clearanceID">
<el-input
v-model="editForm.clearanceID"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item label="来源国" prop="countryOfOrigin">
<el-input
v-model="editForm.countryOfOrigin"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item label="携带有害生物" prop="carryPestName">
<el-input
v-model="editForm.carryPestName"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="editForm.remarks"></el-input>
</el-form-item>
</el-form>
<el-row :gutter="20">
<el-col :span="12">
<el-form
:model="editForm"
ref="editFormRef"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item
label="名称"
prop="name"
:rules="[
{
required: true,
message: '请输入有害植物名称',
trigger: ['blur', 'change'],
},
]"
>
<el-input
v-model="editForm.name"
auto-complete="off"
:disabled="isEdit"
></el-input>
</el-form-item>
<el-form-item
label="IMEI"
prop="imei"
:rules="[
{
required: true,
message: '请输入IMEI',
trigger: ['blur', 'change'],
},
]"
>
<el-input v-model="editForm.imei" auto-complete="off"></el-input>
</el-form-item>
<el-form-item label="报关号" prop="clearanceID">
<el-input
v-model="editForm.clearanceID"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item label="来源国" prop="countryOfOrigin">
<el-input
v-model="editForm.countryOfOrigin"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item label="携带有害生物" prop="carryPestName">
<el-input
v-model="editForm.carryPestName"
auto-complete="off"
></el-input>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="editForm.remarks"></el-input>
</el-form-item>
</el-form>
</el-col>
<el-col :span="12">
<GroupTree
@handleNodeClick="handleNodeClick"
:currentKey="editForm.groupId"
></GroupTree>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="editDialogVisible = false">取 消</el-button>
......@@ -234,6 +243,7 @@ import moment from "moment";
import util from "@/utils/util";
import InDevice from "./components/InDevice";
import TransferDevice from "./components/TransferDevice";
import GroupTree from "../map/components/menu/GroupTree";
import {
getAllDevices,
getDevices,
......@@ -307,6 +317,9 @@ export default {
this.data = data;
});
},
handleNodeClick(node) {
this.editForm.groupId = node.id;
},
// 弹窗提交
handlerSubmit() {
this.$refs["editFormRef"].validate((valid) => {
......@@ -478,6 +491,7 @@ export default {
components: {
InDevice,
TransferDevice,
GroupTree,
},
};
</script>
......
......@@ -77,12 +77,12 @@ export const moduleUser = {
enable: false,
},
status: {
0: "eventOffline",
1: "eventOnline",
2: "eventFenceEnter",
3: "eventFenceExit",
4: "eventOverSpeed",
9: "eventAlarm",
0: "eventOffline", //上线
1: "eventOnline", //下线
2: "eventFenceEnter", //进围栏
3: "eventFenceExit", //出围栏
4: "eventOverSpeed", //超速
9: "eventAlarm", //重要有害植物报警
}, //事件状态字典
alarms: {
sos: "求救报警",
......@@ -185,8 +185,8 @@ export const moduleUser = {
userConfig: {
events: {
0: false,
1: true,
2: true,
1: false,
2: false,
3: true,
4: true,
5: false,
......
......@@ -120,6 +120,7 @@ export default {
);
}
if (state.user.userConfig.events[devstatus.status]) {
// TODO:需不需要提示?devstatus.status是配置什么
Notification({
title:
state.user.devices.list[index].name +
......@@ -129,8 +130,7 @@ export default {
],
message: util.dateFormat(devstatus.time, "YYYY-MM-DD HH:mm:ss"),
type: devstatus.status == 1 ? "success" : "warning",
duration: 60000,
offset: 60,
duration: 0,
});
state.user.playAlarmSound = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment