Commit 85cab6d8 authored by 朱超's avatar 朱超
parents 1d94c5fb 8e349143
......@@ -59,6 +59,7 @@ import { ref, reactive, onMounted, onUnmounted } from 'vue';
import http from '../../api/http';
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import store from "../../store/index";
import { getFileName } from '../../utils/utils';
//分页设置
const currentPage = ref(1)
......@@ -67,6 +68,7 @@ const disabled = ref(false)
const background = ref(false)
const total = ref()
const options = reactive([]);
const exporter = ref("TransExport")
const tableData = ref([]);
const tableHeight = ref(500);
const enterpriseId = ref();
......@@ -118,7 +120,6 @@ function sortMethod({ order, prop }){
}
AlarmInfo.sort = sortnames;
}
console.log(AlarmInfo.sort)
getdata() //调用后端查询接口
}
......@@ -149,12 +150,13 @@ if (day >= 1 && day <= 9) {
day = "0" + day;
}
var startTime = sessionStorage.getItem("DeviceQueryStart");
if(!startTime){
console.log(!!startTime);
if(!!startTime){
startTime = year + "-" + dateArr[0] + '-' + day + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryStart", startTime);
}
var endTime = sessionStorage.getItem("DeviceQueryEnd");
if(!endTime){
if(!!endTime){
endTime = year + "-" + dateArr[0] + "-" + dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryEnd", endTime);
}
......@@ -180,10 +182,13 @@ function getdata() {
function getoptions(){
if(type.value === "GetPipeAlarmData"){
getPipes();
exporter.value = "PipeExport";
}else if(type.value === "GetBoilerAlarmData"){
getBoilers();
exporter.value = "BoilerExport";
}else{
getSupplys();
exporter.value = "TransExport";
}
gettransfer();
}
......@@ -191,7 +196,7 @@ function getoptions(){
//获取锅炉列表
function getBoilers(){
loading.value = true;
tableData.value.length = 0;
tableData.length = 0;
AlarmInfo.Id.length = 0;
options.length = 0;
var result = store.getters.getEnterprise();
......@@ -331,37 +336,35 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
return css_color;
}
// // 导出表格 按钮点击后触发事件
// async function exportExcel () {
// sessionStorage.setItem("DeviceQueryStart", AlarmInfo.startTime);
// sessionStorage.setItem("DeviceQueryEnd", AlarmInfo.endTime);
// AlarmInfo.pageIndex = 0;
// AlarmInfo.pageCount = 100000;
// var fileName = getFileName("报警信息历史数据");
// await http.post("/api/transfer/hisExport", AlarmInfo, '正在导出数据....', { responseType: 'blob' }).then((content) => {
// try{
// const blob = new Blob([content]);
// if ('download' in document.createElement('a')) {
// // 非IE下载
// const elink = document.createElement('a');
// elink.download = fileName;
// elink.style.display = 'none';
// elink.href = URL.createObjectURL(blob);
// document.body.appendChild(elink);
// elink.click();
// URL.revokeObjectURL(elink.href);
// document.body.removeChild(elink);
// } else {
// // IE10+下载
// navigator.msSaveBlob(blob, fileName);
// }
// }catch(error){
// console.log(error);
// }
// });
// }
// 导出表格 按钮点击后触发事件
async function exportExcel () {
if(tableData.value !== null){
sessionStorage.setItem("DeviceQueryStart", AlarmInfo.startTime);
sessionStorage.setItem("DeviceQueryEnd", AlarmInfo.endTime);
AlarmInfo.pageIndex = 0;
AlarmInfo.pageCount = 100000;
var fileName = getFileName("报警信息历史数据");
await http.post("/api/alarm/" + exporter.value, AlarmInfo, '正在导出数据....', { responseType: 'blob' }).then((content) => {
try{
const blob = new Blob([content]);
if ('download' in document.createElement('a')) {
const elink = document.createElement('a');
elink.download = fileName;
elink.style.display = 'none';
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
URL.revokeObjectURL(elink.href);
document.body.removeChild(elink);
} else {
navigator.msSaveBlob(blob, fileName);
}
}catch(error){
console.log(error);
}
});
}
}
onMounted(() => {
setContentHeight();
window.addEventListener('resize', setContentHeight);
......
......@@ -11,7 +11,7 @@
</el-form-item>
<el-form-item label="设备:">
<el-cascader :options="options" v-model="AlarmInfo" :props="props" collapse-tags clearable :show-all-levels="false"
placeholder="请选择" style="min-width: 210px;" />
placeholder="请选择" style="min-width: 210px;" @change="getopt" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getdata" style="min-width: 70px;">查询</el-button>
......@@ -20,11 +20,11 @@
</el-card>
<el-card class="moduleCard" :height="tableHeight">
<el-table :data="tableData" :row-class-name="rowClassName" :height="tableHeight" v-loading="loading" :cell-style="setCellStyle" id="out-table"
border highlight-current-row :header-cell-style="setHeaderCellStyle" @sort-change="sortMethod" :header-cell-class-name="handleHeadAddClass" >
border highlight-current-row :header-cell-style="setHeaderCellStyle" :header-cell-class-name="handleHeadAddClass" >
<el-table-column prop="index" label="编号" :sortable="false" width="100px" fixed />
<el-table-column prop="name" label="设施名称" :sortable="true" width="250px" fixed />
<el-table-column prop="name" label="设施名称" :sortable="false" width="250px" fixed />
<el-table-column prop="cnName" label="报警类型" :sortable="false" fixed />
<el-table-column prop="gatherTime" label="报警时间" :sortable="true" width="200px" fixed />
<el-table-column prop="gatherTime" label="报警时间" :sortable="false" width="200px" fixed />
<el-table-column prop="topMost" label="上上限" :sortable="false" width="200px" fixed >
<template #default="scope">
<div class="div-form-img">
......@@ -92,41 +92,6 @@
tableHeight.value = window.innerHeight - 195;
}
//获取排序的方法
function sortMethod({ order, prop }){
// 触发的排序和缓存的排序相同时,取消该字段的排序
if (!order || sortField[prop] === order) {
sortField[prop] = null
} else {
sortField[prop] = order
}
// console.log(sortField)
let sortname = "";
let sortnames = "";
let direction = '';
for (const i in sortField) {
if (sortField[i] == 'ascending') {
direction = 'ASC'
} else if (sortField[i] == 'descending') {
direction = 'DESC'
}
if(i === "name"){
sortname = "name";
}else if(i === "alarmDate"){
sortname = "alarmDate";
}
// console.log(sortname)
if(sortnames===""){
sortnames = sortnames + sortname + " " + direction;
}else{
sortnames = sortnames + "," + sortname + " " + direction;
}
AlarmInfo.sort = sortnames;
}
console.log(AlarmInfo.sort)
getdata() //调用后端查询接口
}
function handleHeadAddClass({ column }) {
if (sortField[column.property]) {
column.order = sortField[column.property]
......@@ -164,7 +129,7 @@
sessionStorage.setItem("DeviceQueryEnd", endTime);
}
const AlarmInfo = reactive([])
const AlarmInfo = ref([])
getSupplys();
getdata();
......@@ -190,7 +155,7 @@
function getBoilers(){
loading.value = true;
tableData.length = 0;
AlarmInfo.length = 0;
AlarmInfo.value = [];
options.length = 0;
var result = store.getters.getEnterprise();
if (result) {
......@@ -214,23 +179,16 @@
}
});
options.forEach(element =>{
AlarmInfo.push(element.value);
AlarmInfo.value.push(element.value);
})
}
}
//获取用户信息
getuser()
function getuser(){
var user = store.getters.getUserInfo();
console.log(user);
}
//获取总管列表
function getPipes(){
loading.value = true;
tableData.length = 0;
AlarmInfo.length = 0;
AlarmInfo.value = [];
var result = store.getters.getEnterprise();
if (result) {
options.length = 0;
......@@ -250,7 +208,6 @@ function getuser(){
}
});
}
console.log(options);
options.forEach(element =>{
AlarmInfo.push(element.value);
})
......@@ -292,25 +249,17 @@ function getuser(){
}
});
}
AlarmInfo.push(options[0].children[0].children[0].value);
console.log(AlarmInfo)
AlarmInfo.value.push(options[0].children[0].children[0].value);
}
//获取数据列表
function gettransfer() {
loading.value = true;
if (currentPage.value == 1) {
AlarmInfo.start = 0;
AlarmInfo.count = pageSize.value;
} else {
AlarmInfo.start = ((currentPage.value - 1) * pageSize.value) + 1;
AlarmInfo.count = pageSize.value - 1;
}
http.post("/api/alarm/" + type.value, AlarmInfo).then((result) => {
http.post("/api/alarm/" + type.value, AlarmInfo.value).then((result) => {
console.log(result.data);
if(result.data !== null){
tableData.value = result.data;
}
if(result.data === null || AlarmInfo.length < 1){
if(result.data === null){
tableData.value = null;
}
loading.value = false;
......@@ -335,6 +284,10 @@ function getuser(){
return css_color;
}
function getopt(){
console.log(AlarmInfo.value);
}
function getImgUrl(scope,item) {
var url = null;
......
......@@ -3,26 +3,26 @@
<div class="div-header">
<el-row>
<el-col :span="4">
<div class="div-button" style="display: flex;">
<div class="div-autoRefresh">
<el-switch v-model="isHisData" class="switch-autoRefresh" active-text="历史数据"
inactive-text="实时数据"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: rgb(64, 158, 255)"
@change="changeData" />
</div>
</div>
<div class="div-autoRefresh">
<el-switch v-model="isHisData" class="switch-autoRefresh" active-text="历史数据"
inactive-text="实时数据"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: rgb(64, 158, 255)"
@change="changeData" />
</div>
</div>
</el-col>
<el-col :span="9">
<el-col :span="7">
<div class="div-dropdown text-center">
<span>小区名称&nbsp;:&nbsp;</span>
<el-cascader :options="DataInfo.tree" v-model="DataInfo.name" :props="props" collapse-tags
clearable :show-all-levels="false" filterable placeholder="请选择" style="min-width: 310px;" />
clearable :show-all-levels="false" filterable placeholder="请选择" style="min-width: 280px;" />
</div>
</el-col>
<el-col :span="9">
<el-col :span="11">
<div class="div-time-picker" v-show="isHisData">
<el-form-item label="开始时间:" style="margin-right: 20px;">
<el-config-provider :locale="zhCn">
......@@ -42,15 +42,13 @@
<el-col :span="2">
<div class="div-button">
<el-row :gutter="10">
<el-col :span="3">
</el-col>
<el-col :span="15">
<el-button class="el-button-button" type="primary" :span="6" @click="SearchData" icon="Search">
&nbsp;&nbsp;</el-button>
<el-button class="el-button-button" type="primary" :span="6" @click="SearchData"
icon="Search">
&nbsp;&nbsp;</el-button>
</el-col>
<el-col :span="3">
</el-col>
<el-col :span="3">
</el-col>
......@@ -77,9 +75,9 @@
<el-table v-show="isHisData" :data="tableInfo.tableData" :height="tableHeight" v-loading="loading"
:cell-style="setCellStyle" border highlight-current-row :header-cell-style="setHeaderCellStyle"
:header-cell-class-name="handleHeadAddClass" @sort-change="sortMethod" >
:header-cell-class-name="handleHeadAddClass" @sort-change="sortMethod">
<el-table-column v-for="(item, i) in tableInfo.title.frozenList" :prop="item.field" :label="item.title"
:width="item.width" fixed sortable/>
:width="item.width" fixed sortable />
<template v-for="(item, i) in tableInfo.title.otherList">
<el-table-column :prop="item.enName" :label="item.alias" :width="item.width">
</el-table-column>
......@@ -259,35 +257,35 @@ var date = new Date();
var year = date.getFullYear();
var day = 0;
var dateArr = [
date.getMonth() + 1, //月份从0~11,所以加一
date.getDate() -1,
date.getHours(),
date.getMinutes(),
date.getSeconds(),
date.getDate()
date.getMonth() + 1, //月份从0~11,所以加一
date.getDate() - 1,
date.getHours(),
date.getMinutes(),
date.getSeconds(),
date.getDate()
];
for (var i = 0; i < dateArr.length; i++) {
if (dateArr[i] >= 1 && dateArr[i] <= 9) {
dateArr[i] = "0" + dateArr[i];
}
if (dateArr[i] >= 1 && dateArr[i] <= 9) {
dateArr[i] = "0" + dateArr[i];
}
}
day = dateArr[1] - 1;
if (day >= 1 && day <= 9) {
day = "0" + day;
day = "0" + day;
}
// var endTime = year + "-" + dateArr[0] + "-" + dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
// var startTime = year + "-" + dateArr[0] + "-" + day + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
var startTimeValue = sessionStorage.getItem("DeviceQueryStart");
if(!startTimeValue){
startTimeValue = (year) + "-" + dateArr[0] + "-"+ dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryStart", startTimeValue);
if (!startTimeValue) {
startTimeValue = (year) + "-" + dateArr[0] + "-" + dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryStart", startTimeValue);
}
var endTimeValue = sessionStorage.getItem("DeviceQueryEnd");
if(!endTimeValue){
endTimeValue = (year) + "-" + dateArr[0] + "-" + dateArr[5] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryEnd", endTimeValue);
if (!endTimeValue) {
endTimeValue = (year) + "-" + dateArr[0] + "-" + dateArr[5] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryEnd", endTimeValue);
}
startTime.value = startTimeValue;
......@@ -295,14 +293,14 @@ endTime.value = endTimeValue;
console.log(endTime)
function changeStartTime(){
function changeStartTime() {
sessionStorage.setItem("DeviceQueryStart", startTime.value);
}
function changeEndTime(){
function changeEndTime() {
sessionStorage.setItem("DeviceQueryEnd", endTime.value);
}
const props = { multiple: true,emitPath: false }
const props = { multiple: true, emitPath: false }
const DataInfo = reactive({
"enterpriseId": enterpriseId.value,
tree: [],
......@@ -332,6 +330,21 @@ var tableInfo = reactive({
const loading = ref(false);
const value = ref(true);
//日期转换字符串
function formatDate(date) {
let year = date.getFullYear();
let month = twoDigits(date.getMonth() + 1); // 月份是从0开始的
let day = twoDigits(date.getDate());
let hour = twoDigits(date.getHours());
let minute = twoDigits(date.getMinutes());
let second = twoDigits(date.getSeconds());
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
}
function twoDigits(value) {
return value < 10 ? '0' + value : value;
}
//数据控制,根据isHisData的值决定数据控制逻辑,false为实时数据,true为历史数据
......@@ -391,8 +404,9 @@ function init() {
}
//数据切换
function changeData() {
async function changeData() {
init();
getName();
}
//实时数据初始化
......@@ -403,15 +417,6 @@ async function initReal() {
await getRealData();
//设置总页数
total.value = tableInfo.realData.length;
var list = [];
tableInfo.realData.forEach(data => {
list.push(data.name);
})
var list2 = [...new Set(list)];
// console.log(list);
setSelect(list2)
}
//历史数据初始化
async function initHis() {
......@@ -420,14 +425,6 @@ async function initHis() {
tableInfo.tableData.length = 0;
tableInfo.hisData.length = 0;
await getHisData();
//设置总页数
var list = [];
// console.log(tableInfo)
tableInfo.hisData.forEach(data => {
list.push(data.name);
})
var list2 = [...new Set(list)];
setSelect(list2)
}
//获得数据
......@@ -460,6 +457,25 @@ async function getHisData() {
loading.value = false
}
//获得小区数据
async function getName() {
loading.value = true
await http.post('/api/tiger/TigerHeatUser/GetName').then((result) => {
if (result.status === 0) {
//处理返回数据
var list = [];
result.data.forEach(data => {
list.push(data.name);
})
var list2 = [...new Set(list)];
setSelect(list2)
} else {
// tableInfo.tableData.length = 0;
}
})
loading.value = false
}
//根据参数获得数据
async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) {
loading.value = true
......@@ -492,14 +508,14 @@ function setShowThisData(data) {
//设置搜索栏可选择项
function setSelect(list) {
DataInfo.tree.length = 0;
DataInfo.name.length=0;
DataInfo.name.length = 0;
list.forEach(area => {
DataInfo.tree.push({
value: area,
label: area
})
})
if(DataInfo.tree.length>0){
if (DataInfo.tree.length > 0) {
DataInfo.name.push(DataInfo.tree[0].value);
}
}
......@@ -517,10 +533,10 @@ function SearchData() {
//实时数据,本地搜索
function SearchRealData() {
var data = tableInfo.realData.filter((current, index) => {
if(DataInfo.name.length==0){
if (DataInfo.name.length == 0) {
return true;
}
if(DataInfo.name.includes(current.name)){
if (DataInfo.name.includes(current.name)) {
return true;
}
return false;
......
......@@ -15,14 +15,15 @@
</el-col>
<el-col :span="9">
<el-col :span="7">
<div class="div-dropdown text-center">
<span>小区名称&nbsp;:&nbsp;</span>
<el-form-item label="小区名称:">
<el-cascader :options="DataInfo.tree" v-model="DataInfo.name" :props="props" collapse-tags
clearable :show-all-levels="false" filterable placeholder="请选择" style="min-width: 310px;" />
clearable :show-all-levels="false" filterable placeholder="请选择" style="min-width: 280px;" />
</el-form-item>
</div>
</el-col>
<el-col :span="9">
<el-col :span="11">
<div class="div-time-picker" v-show="isHisData">
<el-form-item label="开始时间:" style="margin-right: 20px;">
<el-config-provider :locale="zhCn">
......@@ -42,10 +43,6 @@
<el-col :span="2">
<div class="div-button">
<el-row :gutter="10">
<el-col :span="3">
</el-col>
<el-col :span="15">
<el-button class="el-button-button" type="primary" :span="6" @click="SearchData" icon="Search">
......@@ -53,6 +50,8 @@
</el-col>
<el-col :span="3">
</el-col>
<el-col :span="3">
</el-col>
<el-col :span="3">
</el-col>
......@@ -193,18 +192,15 @@
}
.div-dropdown {
//display: flex;
padding-top: 7px;
height: 50px;
padding-left: 10px;
.el-dropdown-link {
margin-top: 5px;
color: white;
}
height: 50px;
padding-left: 10px;
.el-dropdown-link {
margin-top: 5px;
color: white;
}
}
......@@ -389,12 +385,12 @@ function init() {
} else {
initReal();
}
// setSelect();
}
//数据切换
function changeData() {
async function changeData() {
init();
getName();
}
//实时数据初始化
......@@ -403,17 +399,6 @@ async function initReal() {
tableInfo.tableData.length = 0;
tableInfo.realData.length = 0;
await getRealData();
//设置总页数
total.value = tableInfo.realData.length;
var list = [];
tableInfo.realData.forEach(data => {
list.push(data.name);
})
var list2 = [...new Set(list)];
// console.log(list);
setSelect(list2)
}
//历史数据初始化
async function initHis() {
......@@ -422,15 +407,6 @@ async function initHis() {
tableInfo.tableData.length = 0;
tableInfo.hisData.length = 0;
await getHisData();
//设置总页数
var list = [];
// console.log(tableInfo)
tableInfo.hisData.forEach(data => {
list.push(data.name);
})
var list2 = [...new Set(list)];
setSelect(list2)
}
//获得数据
......@@ -464,6 +440,25 @@ async function getHisData() {
loading.value = false
}
//获得小区数据
async function getName() {
loading.value = true
await http.post('/api/tiger/TigerHeatUser/GetName').then((result) => {
if (result.status === 0) {
//处理返回数据
var list = [];
result.data.forEach(data => {
list.push(data.name);
})
var list2 = [...new Set(list)];
setSelect(list2)
} else {
// tableInfo.tableData.length = 0;
}
})
loading.value = false
}
//根据参数获得数据
async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) {
loading.value = true
......
......@@ -57,44 +57,43 @@
<script setup>
// ../OutputFile/VideoWebPlugin.zip
import { ref, reactive, onMounted, onUnmounted, provide, computed, handleError } from 'vue'
import DataForm from '../../components/DataForm.vue';
import { ref ,reactive, onMounted, onUnmounted, provide, computed, handleError } from 'vue'
import { useRoute } from 'vue-router'
import http from '../../api/http'
import store from "../../store/index";
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
// import '/jquery-1.12.4.min.js';
// import '/jsencrypt.min.js';
// import '/web-control_1.2.5.min.js'
//import {$} from '@/assets/script/video/jquery-1.12.4.min.js'
import { onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router'
import $ from 'jquery'
import { JSEncrypt } from 'jsencrypt'
import { WebControl } from '../../assets/script/video/web-control.esm.min.js'
// import { WebControl } from 'web-control';
// import {WebControl} from 'web-control';
import {
Search,
ArrowLeft,
ArrowRight,
Warning
} from '@element-plus/icons-vue'
import CfgSupply from '../../components/CfgSupply.vue';
// import { ca } from 'element-plus/es/locale';
import { onActivated, onDeactivated } from 'vue'
onActivated(()=>{
if(route.query.id){
VideoInfo.value=route.query.id;
getVideoFromVideoList(route.query.id);
}
showPlay();
})
onDeactivated(() => {
hidePlay();
})
const route = useRoute();
onBeforeRouteUpdate((to, from) => {
var r=useRoute();
console.log('update')
console.log(r.query.id);
if(r.query.id){
VideoInfo.value=r.query.id;
getVideoFromVideoList(r.query.id);
}
})
//声明公用变量
var initCount = 0;
var pubKey = '';
var playWnd_width = window.innerWidth - 200;
console.log(app)
var playWnd_height = window.innerHeight - 220;
var oWebControl;
var videoIp;
......@@ -202,6 +201,12 @@ function getVideoInfo() {
function initPage() {
getVideoInfo();//视频信息
getStats();//下拉列表
if(route.query.id){
//设置选择框
VideoInfo.value=route.query.id;
//播放视频
getVideoFromVideoList(route.query.id);
}
}
//从视频列表中找到当前被选中的换热站对应的所有视频id
......@@ -214,7 +219,6 @@ function getVideoFromVideoList(Id) {
VideoInfo.playVideoList.push(videoId);
}
})
console.log(VideoInfo);
if (oWebControl) {
playVideoByVideoList(VideoInfo.playVideoList)
}
......@@ -601,6 +605,15 @@ function playVideotest(cameraIndexCode) {
}
// watch(()=>route.params.id, watchEvent, { immediate: true })
// //监听回调函数
// function watchEvent(id){
// if(!VideoInfo.playVideoList){
// return;
// }
// getVideoFromVideoList(id);
// }
defineExpose({
hidePlay,
......
......@@ -212,11 +212,14 @@ import {
} from '@element-plus/icons-vue';
import DataMenu from '../components/DataMenu.vue';
import EventBus from '../utils/event-bus.js';
import { ElNotification } from 'element-plus'
//import {RoleEnum} from '../utils/enumData';
var $this;
var $interval;
const enterpriseId = ref();
const componentView = ref(null);
localStorage.setItem('tabWidth','');
......@@ -571,6 +574,105 @@ export default defineComponent({
// );
}
//报警弹窗
const userId = ref();
const roleIds = ref();
const title = ref();
const msg = ref();
const id = ref();
const counttitle = ref();
const countmsg = ref();
const countid = ref();
const sta = ref(0);
const consta = ref(0);
//获取用户信息
function getuser(){
var user = store.getters.getUserInfo();
if(user){
enterpriseId.value = user.enterpriseId;
userId.value = user.userId;
roleIds.value = user.roleId;
}
}
const AlarmInfo = ref({});
function getinfo(){
AlarmInfo.value = {
"enterpriseId": enterpriseId.value,
"UserId": userId.value,
"RoleId": roleIds.value
};
}
function alarm(){
http.post("/api/alarm/GetAlarmMsg", AlarmInfo.value).then((result) => {
if(result.data !== null && sta.value === 0){
sta.value = 1;
title.value = result.data[0].title;
msg.value = result.data[0].msg;
id.value = result.data[0].id;
ElNotification({
title: title.value,
message: msg.value,
position: 'bottom-right',
type: 'error',
duration: 0,
onClick() {
activeTable.value = '/Video'
localStorage.setItem("activeTab", '/Video');
//路由跳转
this.$router.push({ //如果要是用 name 传参 就直接 携带一个 query 对象中包含参数
path: "/Video",
query:{
id:id.value
}
});
},
onClose() {
sta.value = 0;
},
})
}
});
}
function countalarm(){
http.post("/api/alarm/GetAlarmMsg", AlarmInfo.value).then((result) => {
if(result.data !== null && consta.value === 0){
consta.value = 1;
counttitle.value = result.data[1].title;
countmsg.value = result.data[1].msg;
countid.value = result.data[1].id;
ElNotification({
title: counttitle.value,
message: countmsg.value,
position: 'bottom-right',
type: 'error',
duration: 0,
onClick() {
activeTable.value = '/Video'
localStorage.setItem("activeTab", '/Video');
//路由跳转
this.$router.push({ //如果要是用 name 传参 就直接 携带一个 query 对象中包含参数
path: "/Video",
query:{
id:countid.value
}
});
},
onClose() {
consta.value = 0;
},
})
}
});
}
setInterval(() => {
getuser()
getinfo();
alarm();
countalarm();
}, 10 * 1000); // 每分钟执行一次
return {
menuWidth,
mainHeight,
......@@ -636,6 +738,7 @@ export default defineComponent({
},
});
</script>
<style lang="less" scoped>
......
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