Commit dc73e957 authored by qjeslks's avatar qjeslks

7.29.2

parent ed247d4d
...@@ -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() //调用后端查询接口
} }
...@@ -180,10 +181,13 @@ function getdata() { ...@@ -180,10 +181,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 +195,7 @@ function getoptions(){ ...@@ -191,7 +195,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 +335,35 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -331,37 +335,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;
...@@ -335,6 +284,10 @@ function getuser(){ ...@@ -335,6 +284,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;
......
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