Commit 25eea47d authored by qjeslks's avatar qjeslks

7.27.2

parent 9853fbaa
......@@ -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)
......@@ -66,6 +67,7 @@ var pageSize = ref(30)
const disabled = ref(false)
const background = ref(false)
const total = ref()
const exporter = ref("TransExport")
const options = reactive([]);
const tableData = ref([]);
const tableHeight = ref(500);
......@@ -118,7 +120,6 @@ function sortMethod({ order, prop }){
}
AlarmInfo.sort = sortnames;
}
console.log(AlarmInfo.sort)
getdata() //调用后端查询接口
}
......@@ -180,10 +181,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();
}
......@@ -224,7 +228,7 @@ function getBoilers(){
//获取总管列表
function getPipes(){
loading.value = true;
tableData.value.length = 0;
tableData.length = 0;
AlarmInfo.Id.length = 0;
var result = store.getters.getEnterprise();
if (result) {
......@@ -331,37 +335,41 @@ 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;
// 导出表格 按钮点击后触发事件
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("报警信息历史数据");
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);
// }
// });
// }
console.log(AlarmInfo);
console.log(exporter.value);
await http.post("/api/alarm/" + exporter.value, 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);
}
});
}
}
onMounted(() => {
setContentHeight();
window.addEventListener('resize', setContentHeight);
......
......@@ -218,13 +218,6 @@
})
}
}
//获取用户信息
getuser()
function getuser(){
var user = store.getters.getUserInfo();
console.log(user);
}
//获取总管列表
function getPipes(){
......
......@@ -209,6 +209,7 @@ 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';
......@@ -633,6 +634,87 @@ export default defineComponent({
},
});
//报警弹窗
const enterpriseId = ref();
const userId = ref();
const roleId = ref();
const title = ref();
const msg = ref();
const id = ref();
const counttitle = ref();
const countmsg = ref();
const countid = ref();
const route = useRoute();
//获取用户信息
getuser()
function getuser(){
var user = store.getters.getUserInfo();
if(user){
enterpriseId.value = user.enterpriseId;
userId.value = user.userId;
roleId.value = user.roleId;
}
}
const AlarmInfo = reactive({
"enterpriseId": enterpriseId.value,
"UserId": userId.value,
"RoleId": roleId.value
});
function alarm(){
http.post("/api/alarm/GetAlarmMsg", AlarmInfo).then((result) => {
if(title.value !== result.data[0].title || msg.value !== result.data[0].msg){
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: 'warning',
duration: 0,
// onClick() {
// console.log(111111)
// const routePath = '/Home/Video'; // 要导航到的路由路径
// const routeQuery = { id: id.value }; // 如果需要,可以传递参数
// // 序列化查询参数
// const queryString = new URLSearchParams(routeQuery).toString();
// // 打开新窗口并导航到指定路由
// window.open(
// `${routePath}?${queryString}`,
// '_blank',
// 'toolbar=yes,location=yes,status=yes,menubar=yes,width=600,height=400,scrollbars=yes'
// );
// },
})
}
});
}
const router = useRouter()
function countalarm(){
http.post("/api/alarm/GetAlarmMsg", AlarmInfo).then((result) => {
if(counttitle.value !== result.data[1].title || countmsg.value !== result.data[1].msg){
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: 'warning',
duration: 0,
// onClick() {
// router.push({ path: '/GisHome'})
// },
})
}
});
}
setInterval(() => {
alarm();
countalarm();
}, 6 * 1000); // 每分钟执行一次
</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