Commit 85cab6d8 authored by 朱超's avatar 朱超
parents 1d94c5fb 8e349143
...@@ -59,6 +59,7 @@ import { ref, reactive, onMounted, onUnmounted } from 'vue'; ...@@ -59,6 +59,7 @@ import { ref, reactive, onMounted, onUnmounted } from 'vue';
import http from '../../api/http'; import http from '../../api/http';
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import store from "../../store/index"; import store from "../../store/index";
import { getFileName } from '../../utils/utils';
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -67,6 +68,7 @@ const disabled = ref(false) ...@@ -67,6 +68,7 @@ const disabled = ref(false)
const background = ref(false) const background = ref(false)
const total = ref() const total = ref()
const options = reactive([]); const options = reactive([]);
const exporter = ref("TransExport")
const tableData = ref([]); const tableData = ref([]);
const tableHeight = ref(500); const tableHeight = ref(500);
const enterpriseId = ref(); const enterpriseId = ref();
...@@ -118,7 +120,6 @@ function sortMethod({ order, prop }){ ...@@ -118,7 +120,6 @@ function sortMethod({ order, prop }){
} }
AlarmInfo.sort = sortnames; AlarmInfo.sort = sortnames;
} }
console.log(AlarmInfo.sort)
getdata() //调用后端查询接口 getdata() //调用后端查询接口
} }
...@@ -149,12 +150,13 @@ if (day >= 1 && day <= 9) { ...@@ -149,12 +150,13 @@ if (day >= 1 && day <= 9) {
day = "0" + day; day = "0" + day;
} }
var startTime = sessionStorage.getItem("DeviceQueryStart"); var startTime = sessionStorage.getItem("DeviceQueryStart");
if(!startTime){ console.log(!!startTime);
if(!!startTime){
startTime = year + "-" + dateArr[0] + '-' + day + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4]; startTime = year + "-" + dateArr[0] + '-' + day + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryStart", startTime); sessionStorage.setItem("DeviceQueryStart", startTime);
} }
var endTime = sessionStorage.getItem("DeviceQueryEnd"); var endTime = sessionStorage.getItem("DeviceQueryEnd");
if(!endTime){ if(!!endTime){
endTime = year + "-" + dateArr[0] + "-" + dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4]; endTime = year + "-" + dateArr[0] + "-" + dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryEnd", endTime); sessionStorage.setItem("DeviceQueryEnd", endTime);
} }
...@@ -180,10 +182,13 @@ function getdata() { ...@@ -180,10 +182,13 @@ function getdata() {
function getoptions(){ function getoptions(){
if(type.value === "GetPipeAlarmData"){ if(type.value === "GetPipeAlarmData"){
getPipes(); getPipes();
exporter.value = "PipeExport";
}else if(type.value === "GetBoilerAlarmData"){ }else if(type.value === "GetBoilerAlarmData"){
getBoilers(); getBoilers();
exporter.value = "BoilerExport";
}else{ }else{
getSupplys(); getSupplys();
exporter.value = "TransExport";
} }
gettransfer(); gettransfer();
} }
...@@ -191,7 +196,7 @@ function getoptions(){ ...@@ -191,7 +196,7 @@ function getoptions(){
//获取锅炉列表 //获取锅炉列表
function getBoilers(){ function getBoilers(){
loading.value = true; loading.value = true;
tableData.value.length = 0; tableData.length = 0;
AlarmInfo.Id.length = 0; AlarmInfo.Id.length = 0;
options.length = 0; options.length = 0;
var result = store.getters.getEnterprise(); var result = store.getters.getEnterprise();
...@@ -331,37 +336,35 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -331,37 +336,35 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
return css_color; return css_color;
} }
// // 导出表格 按钮点击后触发事件 // 导出表格 按钮点击后触发事件
// async function exportExcel () { async function exportExcel () {
// sessionStorage.setItem("DeviceQueryStart", AlarmInfo.startTime); if(tableData.value !== null){
// sessionStorage.setItem("DeviceQueryEnd", AlarmInfo.endTime); sessionStorage.setItem("DeviceQueryStart", AlarmInfo.startTime);
// AlarmInfo.pageIndex = 0; sessionStorage.setItem("DeviceQueryEnd", AlarmInfo.endTime);
// AlarmInfo.pageCount = 100000; AlarmInfo.pageIndex = 0;
AlarmInfo.pageCount = 100000;
// var fileName = getFileName("报警信息历史数据"); var fileName = getFileName("报警信息历史数据");
await http.post("/api/alarm/" + exporter.value, AlarmInfo, '正在导出数据....', { responseType: 'blob' }).then((content) => {
// await http.post("/api/transfer/hisExport", AlarmInfo, '正在导出数据....', { responseType: 'blob' }).then((content) => { try{
// try{ const blob = new Blob([content]);
// const blob = new Blob([content]); if ('download' in document.createElement('a')) {
// if ('download' in document.createElement('a')) { const elink = document.createElement('a');
// // 非IE下载 elink.download = fileName;
// const elink = document.createElement('a'); elink.style.display = 'none';
// elink.download = fileName; elink.href = URL.createObjectURL(blob);
// elink.style.display = 'none'; document.body.appendChild(elink);
// elink.href = URL.createObjectURL(blob); elink.click();
// document.body.appendChild(elink); URL.revokeObjectURL(elink.href);
// elink.click(); document.body.removeChild(elink);
// URL.revokeObjectURL(elink.href); } else {
// document.body.removeChild(elink); navigator.msSaveBlob(blob, fileName);
// } else { }
// // IE10+下载 }catch(error){
// navigator.msSaveBlob(blob, fileName); console.log(error);
// } }
// }catch(error){ });
// console.log(error); }
// } }
// });
// }
onMounted(() => { onMounted(() => {
setContentHeight(); setContentHeight();
window.addEventListener('resize', setContentHeight); window.addEventListener('resize', setContentHeight);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</el-form-item> </el-form-item>
<el-form-item label="设备:"> <el-form-item label="设备:">
<el-cascader :options="options" v-model="AlarmInfo" :props="props" collapse-tags clearable :show-all-levels="false" <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-form-item> <el-form-item>
<el-button type="primary" @click="getdata" style="min-width: 70px;">查询</el-button> <el-button type="primary" @click="getdata" style="min-width: 70px;">查询</el-button>
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
</el-card> </el-card>
<el-card class="moduleCard" :height="tableHeight"> <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" <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="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="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 > <el-table-column prop="topMost" label="上上限" :sortable="false" width="200px" fixed >
<template #default="scope"> <template #default="scope">
<div class="div-form-img"> <div class="div-form-img">
...@@ -92,41 +92,6 @@ ...@@ -92,41 +92,6 @@
tableHeight.value = window.innerHeight - 195; 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 }) { function handleHeadAddClass({ column }) {
if (sortField[column.property]) { if (sortField[column.property]) {
column.order = sortField[column.property] column.order = sortField[column.property]
...@@ -164,7 +129,7 @@ ...@@ -164,7 +129,7 @@
sessionStorage.setItem("DeviceQueryEnd", endTime); sessionStorage.setItem("DeviceQueryEnd", endTime);
} }
const AlarmInfo = reactive([]) const AlarmInfo = ref([])
getSupplys(); getSupplys();
getdata(); getdata();
...@@ -190,7 +155,7 @@ ...@@ -190,7 +155,7 @@
function getBoilers(){ function getBoilers(){
loading.value = true; loading.value = true;
tableData.length = 0; tableData.length = 0;
AlarmInfo.length = 0; AlarmInfo.value = [];
options.length = 0; options.length = 0;
var result = store.getters.getEnterprise(); var result = store.getters.getEnterprise();
if (result) { if (result) {
...@@ -214,23 +179,16 @@ ...@@ -214,23 +179,16 @@
} }
}); });
options.forEach(element =>{ 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(){ function getPipes(){
loading.value = true; loading.value = true;
tableData.length = 0; tableData.length = 0;
AlarmInfo.length = 0; AlarmInfo.value = [];
var result = store.getters.getEnterprise(); var result = store.getters.getEnterprise();
if (result) { if (result) {
options.length = 0; options.length = 0;
...@@ -250,7 +208,6 @@ function getuser(){ ...@@ -250,7 +208,6 @@ function getuser(){
} }
}); });
} }
console.log(options);
options.forEach(element =>{ options.forEach(element =>{
AlarmInfo.push(element.value); AlarmInfo.push(element.value);
}) })
...@@ -292,25 +249,17 @@ function getuser(){ ...@@ -292,25 +249,17 @@ function getuser(){
} }
}); });
} }
AlarmInfo.push(options[0].children[0].children[0].value); AlarmInfo.value.push(options[0].children[0].children[0].value);
console.log(AlarmInfo)
} }
//获取数据列表 //获取数据列表
function gettransfer() { function gettransfer() {
loading.value = true; loading.value = true;
if (currentPage.value == 1) { http.post("/api/alarm/" + type.value, AlarmInfo.value).then((result) => {
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) => {
console.log(result.data); console.log(result.data);
if(result.data !== null){ if(result.data !== null){
tableData.value = result.data; tableData.value = result.data;
} }
if(result.data === null || AlarmInfo.length < 1){ if(result.data === null){
tableData.value = null; tableData.value = null;
} }
loading.value = false; loading.value = false;
...@@ -336,6 +285,10 @@ function getuser(){ ...@@ -336,6 +285,10 @@ function getuser(){
return css_color; return css_color;
} }
function getopt(){
console.log(AlarmInfo.value);
}
function getImgUrl(scope,item) { function getImgUrl(scope,item) {
var url = null; var url = null;
switch (scope.row[item]) { switch (scope.row[item]) {
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
</el-col> </el-col>
<el-col :span="9"> <el-col :span="7">
<div class="div-dropdown text-center"> <div class="div-dropdown text-center">
<span>小区名称&nbsp;:&nbsp;</span> <span>小区名称&nbsp;:&nbsp;</span>
<el-cascader :options="DataInfo.tree" v-model="DataInfo.name" :props="props" collapse-tags <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> </div>
</el-col> </el-col>
<el-col :span="9"> <el-col :span="11">
<div class="div-time-picker" v-show="isHisData"> <div class="div-time-picker" v-show="isHisData">
<el-form-item label="开始时间:" style="margin-right: 20px;"> <el-form-item label="开始时间:" style="margin-right: 20px;">
<el-config-provider :locale="zhCn"> <el-config-provider :locale="zhCn">
...@@ -42,13 +42,9 @@ ...@@ -42,13 +42,9 @@
<el-col :span="2"> <el-col :span="2">
<div class="div-button"> <div class="div-button">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="3">
</el-col>
<el-col :span="15"> <el-col :span="15">
<el-button class="el-button-button" type="primary" :span="6" @click="SearchData"
<el-button class="el-button-button" type="primary" :span="6" @click="SearchData" icon="Search"> icon="Search">
&nbsp;&nbsp;</el-button> &nbsp;&nbsp;</el-button>
</el-col> </el-col>
...@@ -56,6 +52,8 @@ ...@@ -56,6 +52,8 @@
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
</el-col> </el-col>
<el-col :span="3">
</el-col>
</el-row> </el-row>
</div> </div>
</el-col> </el-col>
...@@ -77,9 +75,9 @@ ...@@ -77,9 +75,9 @@
<el-table v-show="isHisData" :data="tableInfo.tableData" :height="tableHeight" v-loading="loading" <el-table v-show="isHisData" :data="tableInfo.tableData" :height="tableHeight" v-loading="loading"
:cell-style="setCellStyle" border highlight-current-row :header-cell-style="setHeaderCellStyle" :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" <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"> <template v-for="(item, i) in tableInfo.title.otherList">
<el-table-column :prop="item.enName" :label="item.alias" :width="item.width"> <el-table-column :prop="item.enName" :label="item.alias" :width="item.width">
</el-table-column> </el-table-column>
...@@ -260,7 +258,7 @@ var year = date.getFullYear(); ...@@ -260,7 +258,7 @@ var year = date.getFullYear();
var day = 0; var day = 0;
var dateArr = [ var dateArr = [
date.getMonth() + 1, //月份从0~11,所以加一 date.getMonth() + 1, //月份从0~11,所以加一
date.getDate() -1, date.getDate() - 1,
date.getHours(), date.getHours(),
date.getMinutes(), date.getMinutes(),
date.getSeconds(), date.getSeconds(),
...@@ -280,12 +278,12 @@ if (day >= 1 && day <= 9) { ...@@ -280,12 +278,12 @@ if (day >= 1 && day <= 9) {
// var endTime = year + "-" + dateArr[0] + "-" + dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4]; // 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 startTime = year + "-" + dateArr[0] + "-" + day + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
var startTimeValue = sessionStorage.getItem("DeviceQueryStart"); var startTimeValue = sessionStorage.getItem("DeviceQueryStart");
if(!startTimeValue){ if (!startTimeValue) {
startTimeValue = (year) + "-" + dateArr[0] + "-"+ dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4]; startTimeValue = (year) + "-" + dateArr[0] + "-" + dateArr[1] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryStart", startTimeValue); sessionStorage.setItem("DeviceQueryStart", startTimeValue);
} }
var endTimeValue = sessionStorage.getItem("DeviceQueryEnd"); var endTimeValue = sessionStorage.getItem("DeviceQueryEnd");
if(!endTimeValue){ if (!endTimeValue) {
endTimeValue = (year) + "-" + dateArr[0] + "-" + dateArr[5] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4]; endTimeValue = (year) + "-" + dateArr[0] + "-" + dateArr[5] + " " + dateArr[2] + ":" + dateArr[3] + ":" + dateArr[4];
sessionStorage.setItem("DeviceQueryEnd", endTimeValue); sessionStorage.setItem("DeviceQueryEnd", endTimeValue);
} }
...@@ -295,14 +293,14 @@ endTime.value = endTimeValue; ...@@ -295,14 +293,14 @@ endTime.value = endTimeValue;
console.log(endTime) console.log(endTime)
function changeStartTime(){ function changeStartTime() {
sessionStorage.setItem("DeviceQueryStart", startTime.value); sessionStorage.setItem("DeviceQueryStart", startTime.value);
} }
function changeEndTime(){ function changeEndTime() {
sessionStorage.setItem("DeviceQueryEnd", endTime.value); sessionStorage.setItem("DeviceQueryEnd", endTime.value);
} }
const props = { multiple: true,emitPath: false } const props = { multiple: true, emitPath: false }
const DataInfo = reactive({ const DataInfo = reactive({
"enterpriseId": enterpriseId.value, "enterpriseId": enterpriseId.value,
tree: [], tree: [],
...@@ -332,6 +330,21 @@ var tableInfo = reactive({ ...@@ -332,6 +330,21 @@ var tableInfo = reactive({
const loading = ref(false); const loading = ref(false);
const value = ref(true); 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为历史数据 //数据控制,根据isHisData的值决定数据控制逻辑,false为实时数据,true为历史数据
...@@ -391,8 +404,9 @@ function init() { ...@@ -391,8 +404,9 @@ function init() {
} }
//数据切换 //数据切换
function changeData() { async function changeData() {
init(); init();
getName();
} }
//实时数据初始化 //实时数据初始化
...@@ -403,15 +417,6 @@ async function initReal() { ...@@ -403,15 +417,6 @@ async function initReal() {
await getRealData(); await getRealData();
//设置总页数 //设置总页数
total.value = tableInfo.realData.length; 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() { async function initHis() {
...@@ -420,14 +425,6 @@ async function initHis() { ...@@ -420,14 +425,6 @@ async function initHis() {
tableInfo.tableData.length = 0; tableInfo.tableData.length = 0;
tableInfo.hisData.length = 0; tableInfo.hisData.length = 0;
await getHisData(); 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() { ...@@ -460,6 +457,25 @@ async function getHisData() {
loading.value = false 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) { async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) {
loading.value = true loading.value = true
...@@ -492,14 +508,14 @@ function setShowThisData(data) { ...@@ -492,14 +508,14 @@ function setShowThisData(data) {
//设置搜索栏可选择项 //设置搜索栏可选择项
function setSelect(list) { function setSelect(list) {
DataInfo.tree.length = 0; DataInfo.tree.length = 0;
DataInfo.name.length=0; DataInfo.name.length = 0;
list.forEach(area => { list.forEach(area => {
DataInfo.tree.push({ DataInfo.tree.push({
value: area, value: area,
label: area label: area
}) })
}) })
if(DataInfo.tree.length>0){ if (DataInfo.tree.length > 0) {
DataInfo.name.push(DataInfo.tree[0].value); DataInfo.name.push(DataInfo.tree[0].value);
} }
} }
...@@ -517,10 +533,10 @@ function SearchData() { ...@@ -517,10 +533,10 @@ function SearchData() {
//实时数据,本地搜索 //实时数据,本地搜索
function SearchRealData() { function SearchRealData() {
var data = tableInfo.realData.filter((current, index) => { var data = tableInfo.realData.filter((current, index) => {
if(DataInfo.name.length==0){ if (DataInfo.name.length == 0) {
return true; return true;
} }
if(DataInfo.name.includes(current.name)){ if (DataInfo.name.includes(current.name)) {
return true; return true;
} }
return false; return false;
......
...@@ -15,14 +15,15 @@ ...@@ -15,14 +15,15 @@
</el-col> </el-col>
<el-col :span="9"> <el-col :span="7">
<div class="div-dropdown text-center"> <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 <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> </div>
</el-col> </el-col>
<el-col :span="9"> <el-col :span="11">
<div class="div-time-picker" v-show="isHisData"> <div class="div-time-picker" v-show="isHisData">
<el-form-item label="开始时间:" style="margin-right: 20px;"> <el-form-item label="开始时间:" style="margin-right: 20px;">
<el-config-provider :locale="zhCn"> <el-config-provider :locale="zhCn">
...@@ -42,10 +43,6 @@ ...@@ -42,10 +43,6 @@
<el-col :span="2"> <el-col :span="2">
<div class="div-button"> <div class="div-button">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="3">
</el-col>
<el-col :span="15"> <el-col :span="15">
<el-button class="el-button-button" type="primary" :span="6" @click="SearchData" icon="Search"> <el-button class="el-button-button" type="primary" :span="6" @click="SearchData" icon="Search">
...@@ -56,6 +53,8 @@ ...@@ -56,6 +53,8 @@
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
</el-col> </el-col>
<el-col :span="3">
</el-col>
</el-row> </el-row>
</div> </div>
</el-col> </el-col>
...@@ -193,9 +192,6 @@ ...@@ -193,9 +192,6 @@
} }
.div-dropdown { .div-dropdown {
//display: flex;
padding-top: 7px; padding-top: 7px;
height: 50px; height: 50px;
padding-left: 10px; padding-left: 10px;
...@@ -389,12 +385,12 @@ function init() { ...@@ -389,12 +385,12 @@ function init() {
} else { } else {
initReal(); initReal();
} }
// setSelect();
} }
//数据切换 //数据切换
function changeData() { async function changeData() {
init(); init();
getName();
} }
//实时数据初始化 //实时数据初始化
...@@ -403,17 +399,6 @@ async function initReal() { ...@@ -403,17 +399,6 @@ async function initReal() {
tableInfo.tableData.length = 0; tableInfo.tableData.length = 0;
tableInfo.realData.length = 0; tableInfo.realData.length = 0;
await getRealData(); 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() { async function initHis() {
...@@ -422,15 +407,6 @@ async function initHis() { ...@@ -422,15 +407,6 @@ async function initHis() {
tableInfo.tableData.length = 0; tableInfo.tableData.length = 0;
tableInfo.hisData.length = 0; tableInfo.hisData.length = 0;
await getHisData(); 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() { ...@@ -464,6 +440,25 @@ async function getHisData() {
loading.value = false 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) { async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) {
loading.value = true loading.value = true
......
...@@ -57,44 +57,43 @@ ...@@ -57,44 +57,43 @@
<script setup> <script setup>
// ../OutputFile/VideoWebPlugin.zip // ../OutputFile/VideoWebPlugin.zip
import { ref, reactive, onMounted, onUnmounted, provide, computed, handleError } from 'vue' import { ref ,reactive, onMounted, onUnmounted, provide, computed, handleError } from 'vue'
import DataForm from '../../components/DataForm.vue';
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import http from '../../api/http' import http from '../../api/http'
import store from "../../store/index"; import store from "../../store/index";
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
// import '/jquery-1.12.4.min.js'; import { onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router'
// import '/jsencrypt.min.js';
// import '/web-control_1.2.5.min.js'
//import {$} from '@/assets/script/video/jquery-1.12.4.min.js'
import $ from 'jquery' import $ from 'jquery'
import { JSEncrypt } from 'jsencrypt' import { JSEncrypt } from 'jsencrypt'
import { WebControl } from '../../assets/script/video/web-control.esm.min.js' 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' import { onActivated, onDeactivated } from 'vue'
onActivated(()=>{ onActivated(()=>{
if(route.query.id){
VideoInfo.value=route.query.id;
getVideoFromVideoList(route.query.id);
}
showPlay(); showPlay();
}) })
onDeactivated(() => { onDeactivated(() => {
hidePlay(); 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 initCount = 0;
var pubKey = ''; var pubKey = '';
var playWnd_width = window.innerWidth - 200; var playWnd_width = window.innerWidth - 200;
console.log(app)
var playWnd_height = window.innerHeight - 220; var playWnd_height = window.innerHeight - 220;
var oWebControl; var oWebControl;
var videoIp; var videoIp;
...@@ -202,6 +201,12 @@ function getVideoInfo() { ...@@ -202,6 +201,12 @@ function getVideoInfo() {
function initPage() { function initPage() {
getVideoInfo();//视频信息 getVideoInfo();//视频信息
getStats();//下拉列表 getStats();//下拉列表
if(route.query.id){
//设置选择框
VideoInfo.value=route.query.id;
//播放视频
getVideoFromVideoList(route.query.id);
}
} }
//从视频列表中找到当前被选中的换热站对应的所有视频id //从视频列表中找到当前被选中的换热站对应的所有视频id
...@@ -214,7 +219,6 @@ function getVideoFromVideoList(Id) { ...@@ -214,7 +219,6 @@ function getVideoFromVideoList(Id) {
VideoInfo.playVideoList.push(videoId); VideoInfo.playVideoList.push(videoId);
} }
}) })
console.log(VideoInfo);
if (oWebControl) { if (oWebControl) {
playVideoByVideoList(VideoInfo.playVideoList) playVideoByVideoList(VideoInfo.playVideoList)
} }
...@@ -601,6 +605,15 @@ function playVideotest(cameraIndexCode) { ...@@ -601,6 +605,15 @@ function playVideotest(cameraIndexCode) {
} }
// watch(()=>route.params.id, watchEvent, { immediate: true })
// //监听回调函数
// function watchEvent(id){
// if(!VideoInfo.playVideoList){
// return;
// }
// getVideoFromVideoList(id);
// }
defineExpose({ defineExpose({
hidePlay, hidePlay,
......
...@@ -212,11 +212,14 @@ import { ...@@ -212,11 +212,14 @@ import {
} from '@element-plus/icons-vue'; } from '@element-plus/icons-vue';
import DataMenu from '../components/DataMenu.vue'; import DataMenu from '../components/DataMenu.vue';
import EventBus from '../utils/event-bus.js'; import EventBus from '../utils/event-bus.js';
import { ElNotification } from 'element-plus'
//import {RoleEnum} from '../utils/enumData'; //import {RoleEnum} from '../utils/enumData';
var $this; var $this;
var $interval; var $interval;
const enterpriseId = ref();
const componentView = ref(null); const componentView = ref(null);
localStorage.setItem('tabWidth',''); localStorage.setItem('tabWidth','');
...@@ -571,6 +574,105 @@ export default defineComponent({ ...@@ -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 { return {
menuWidth, menuWidth,
mainHeight, mainHeight,
...@@ -636,6 +738,7 @@ export default defineComponent({ ...@@ -636,6 +738,7 @@ export default defineComponent({
}, },
}); });
</script> </script>
<style lang="less" scoped> <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