Commit dc73e957 authored by qjeslks's avatar qjeslks

7.29.2

parent ed247d4d
......@@ -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() //调用后端查询接口
}
......@@ -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();
}
......@@ -191,7 +195,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 +335,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;
......
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