Commit 21675b4f authored by 朱超's avatar 朱超
parents f996c99a d94ce2d1
...@@ -3,4 +3,14 @@ ...@@ -3,4 +3,14 @@
<el-table> <el-table>
</el-table> </el-table>
</template> </template>
\ No newline at end of file
<script lang="ts" setup>
import { ref, reactive, onMounted, onUnmounted } from 'vue';
import http from '../../api/http';
import store from "../../store/index";
const props = defineProps(['actionValue'
]);
// console.log(props.actionValue);
</script>
\ No newline at end of file
...@@ -3,4 +3,23 @@ ...@@ -3,4 +3,23 @@
<el-table> <el-table>
</el-table> </el-table>
</template> </template>
\ No newline at end of file <script lang="ts" setup>
import { ref, reactive, onMounted, onUnmounted, watch } from 'vue';
import http from '../../api/http';
import store from "../../store/index";
const props = defineProps(['activeRadio']);
console.log("1actionValue:"+props.activeRadio);
//监听修改actionValue状态
watch(() =>props.activeRadio, (oldValue, newValue) => {
//console.log("2actionValue:"+props.activeRadio);
initData();
},{deep:true});
function initData(){
}
initData();
</script>
\ No newline at end of file
...@@ -237,11 +237,18 @@ const routes = [ ...@@ -237,11 +237,18 @@ const routes = [
title: '面积统计' title: '面积统计'
} }
},{ },{
path: '/TransferPatrol', path: '/TodayPatrol',
name: 'PatrolPage', name: 'PatrolPage',
component: () => import('@/views/PatrolPage/TransferPatrolPage.vue'), component: () => import('@/views/PatrolPage/TodayPatrolPage.vue'),
meta: { meta: {
title: '换热站巡更' title: '今日巡更'
}
},{
path: '/HisPatrol',
name: 'HisPatrolPage',
component: () => import('@/views/PatrolPage/HisPatrolPage.vue'),
meta: {
title: '巡更历史'
} }
},{ },{
path: '/HeatUser', path: '/HeatUser',
......
...@@ -2,58 +2,52 @@ ...@@ -2,58 +2,52 @@
<el-card class="card-contianer" :body-style="{ 'padding': '0px 0px 0px 0px', 'height': '110px' }"> <el-card class="card-contianer" :body-style="{ 'padding': '0px 0px 0px 0px', 'height': '110px' }">
<div class="div-header"> <div class="div-header">
<el-row> <el-row>
<el-col :span="4">
<div class="div-button" style="display: flex;"> <div class="div-button" style="display: flex;">
<div class="div-autoRefresh"> <div class="div-autoRefresh">
<el-switch v-model="isHisData" class="switch-autoRefresh" active-text="历史数据" <el-switch v-model="isHisData" class="switch-autoRefresh" active-text="历史数据"
inactive-text="实时数据" inactive-text="实时数据"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: rgb(64, 158, 255)" style="--el-switch-on-color: #13ce66; --el-switch-off-color: rgb(64, 158, 255)"
@change="changeData" /> @change="changeData" />
</div> </div>
</div> </div>
</el-col>
<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: 280px;" /> clearable :show-all-levels="false" filterable placeholder="请选择" style="min-width: 280px;" />
</el-form-item>
</div> </div>
</el-col>
<el-col :span="11"> <el-col :span="10">
<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">
<el-date-picker v-model="startTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" <el-date-picker v-model="startTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择开始时间" @change="changeStartTime" style="min-width: 180px;" /> placeholder="选择开始时间" @change="changeStartTime" :disabled-date="disabledDate"/>
<!-- 日期时间格式 2024-1-1 00:00:00--> <!-- 日期时间格式 2024-1-1 00:00:00-->
</el-config-provider> </el-config-provider>
</el-form-item> </el-form-item>
<el-form-item label="结束时间:"> <el-form-item label="结束时间:">
<el-config-provider :locale="zhCn"> <el-config-provider :locale="zhCn">
<el-date-picker v-model="endTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" <el-date-picker v-model="endTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择结束时间" @change="changeEndTime" style="min-width: 180px;" /> placeholder="选择结束时间" @change="changeEndTime" :disabled-date="disabledDate"/>
</el-config-provider> </el-config-provider>
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="3">
<div class="div-button"> <div class="div-button">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="15"> <el-col :span="18">
<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"> 搜索</el-button>
&nbsp;&nbsp;</el-button>
</el-col>
<el-col :span="3">
</el-col>
<el-col :span="3">
</el-col>
<el-col :span="3">
</el-col> </el-col>
<el-col :span="6">
<el-button class="el-button-button" type="primary" :span="6" @click="ExportDataFile" >
导出</el-button>
</el-col>
</el-row> </el-row>
</div> </div>
</el-col> </el-col>
...@@ -65,6 +59,7 @@ ...@@ -65,6 +59,7 @@
<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"> :header-cell-class-name="handleHeadAddClass">
<el-table-column type="index" width="50" fixed />
<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" sortable fixed /> :width="item.width" sortable fixed />
<template v-for="(item, i) in tableInfo.title.otherList"> <template v-for="(item, i) in tableInfo.title.otherList">
...@@ -76,6 +71,7 @@ ...@@ -76,6 +71,7 @@
<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 type="index" width="50" fixed :index="indexMethod"/>
<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">
...@@ -127,6 +123,7 @@ ...@@ -127,6 +123,7 @@
.div-time-picker { .div-time-picker {
padding-top: 6px; padding-top: 6px;
margin-left: 30px;
display: flex; display: flex;
} }
...@@ -162,6 +159,8 @@ ...@@ -162,6 +159,8 @@
.el-button-button { .el-button-button {
margin-top: 5px; margin-top: 5px;
// margin-right: 5px;
// margin-left: 60px;
width: 80px; width: 80px;
} }
...@@ -172,7 +171,7 @@ ...@@ -172,7 +171,7 @@
display: flex; display: flex;
margin-top: 5px; margin-top: 5px;
border-radius: var(--el-border-radius-base); border-radius: var(--el-border-radius-base);
padding: 6px 15px; padding: 6px 0px;
font-size: 14px; font-size: 14px;
height: 20px; height: 20px;
overflow: hidden; overflow: hidden;
...@@ -191,18 +190,15 @@ ...@@ -191,18 +190,15 @@
} }
.div-dropdown { .div-dropdown {
//display: flex;
padding-top: 7px; padding-top: 7px;
height: 50px; height: 50px;
padding-left: 10px; padding-left: 10px;
.el-dropdown-link { .el-dropdown-link {
margin-top: 5px; margin-top: 5px;
color: white; color: white;
} }
} }
...@@ -345,17 +341,23 @@ function twoDigits(value) { ...@@ -345,17 +341,23 @@ function twoDigits(value) {
return value < 10 ? '0' + value : value; return value < 10 ? '0' + value : value;
} }
//日期范围控制,返回true说明需要被禁用
function disabledDate(thisdate){
var startDate=new Date(2023,7,1);
var endDate=new Date();
return thisdate > endDate || thisdate < startDate;
}
//数据控制,根据isHisData的值决定数据控制逻辑,false为实时数据,true为历史数据 //数据控制,根据isHisData的值决定数据控制逻辑,false为实时数据,true为历史数据
var dataUrl = isHisData.value ? '/api/tiger/TigerHeatUser/His' : '/api/tiger/TigerHeatUser/Real'; var dataUrl = isHisData.value ? '/api/tiger/TigerHeatUser/His' : '/api/tiger/TigerHeatUser/Real';
var exportUrl= isHisData.value ? '/api/tiger/TigerHeatUser/HisExport' : '/api/tiger/TigerHeatUser/RealExport';
function initTitle() { function initTitle() {
tableInfo.title.frozenList.length = 0; tableInfo.title.frozenList.length = 0;
pushFrozenList("gatherTime", "采集时间", true, 180, true) pushFrozenList("gatherTime", "采集时间", true, 180, true)
pushFrozenList("supplyName", "供热站", false, 180, true); pushFrozenList("supplyName", "供热站", false, 140, true);
pushFrozenList("name", "小区", true, 180, true); pushFrozenList("name", "小区", true, 140, true);
pushFrozenList("append", "设备名称", true, 180, true); pushFrozenList("append", "设备名称", true, 140, true);
tableInfo.title.otherList.length = 0; tableInfo.title.otherList.length = 0;
pushOtherList('building', "楼栋"); pushOtherList('building', "楼栋");
pushOtherList('unit', "单元"); pushOtherList('unit', "单元");
...@@ -400,18 +402,20 @@ function init() { ...@@ -400,18 +402,20 @@ function init() {
} else { } else {
initReal(); initReal();
} }
getName();
// setSelect(); // setSelect();
} }
//数据切换 //数据切换
async function changeData() { async function changeData() {
init(); init();
getName(); // getName();
} }
//实时数据初始化 //实时数据初始化
async function initReal() { async function initReal() {
dataUrl = '/api/tiger/TigerHeatUser/Real'; dataUrl = '/api/tiger/TigerHeatUser/Real';
exportUrl = '/api/tiger/TigerHeatUser/RealExport'
tableInfo.tableData.length = 0; tableInfo.tableData.length = 0;
tableInfo.realData.length = 0; tableInfo.realData.length = 0;
await getRealData(); await getRealData();
...@@ -420,8 +424,8 @@ async function initReal() { ...@@ -420,8 +424,8 @@ async function initReal() {
} }
//历史数据初始化 //历史数据初始化
async function initHis() { async function initHis() {
// dataUrl = '/api/tiger/TigerHeatUser/Real';
dataUrl = '/api/tiger/TigerHeatUser/His'; dataUrl = '/api/tiger/TigerHeatUser/His';
exportUrl = '/api/tiger/TigerHeatUser/HisExport';
tableInfo.tableData.length = 0; tableInfo.tableData.length = 0;
tableInfo.hisData.length = 0; tableInfo.hisData.length = 0;
await getHisData(); await getHisData();
...@@ -464,13 +468,11 @@ async function getName() { ...@@ -464,13 +468,11 @@ async function getName() {
if (result.status === 0) { if (result.status === 0) {
//处理返回数据 //处理返回数据
var list = []; var list = [];
//供热站--小区
result.data.forEach(data => { result.data.forEach(data => {
list.push(data.name); list.push({supplyName:data.supplyName,name:data.name});
}) })
var list2 = [...new Set(list)]; setSelect(list)
setSelect(list2)
} else {
// tableInfo.tableData.length = 0;
} }
}) })
loading.value = false loading.value = false
...@@ -487,10 +489,61 @@ async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) { ...@@ -487,10 +489,61 @@ async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) {
setshowData(); setshowData();
} else { } else {
tableInfo.tableData.length = 0; tableInfo.tableData.length = 0;
total.value=0;
} }
}) })
loading.value = false loading.value = false
total.value = tableInfo.tableData.length; }
function ExportHisDataByInfo(name, start, end, startPage, pagesCount, sort){
var fileName = getFileName("热用户历史数据");
http.post(exportUrl, { name: name, startTime: start, endTime: end, start: startPage, count: pagesCount, sort: sort }).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);
}
});
}
function ExportRealData(){
var fileName = getFileName("热用户实时数据");
http.post(exportUrl).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);
}
});
} }
function setshowData() { function setshowData() {
...@@ -509,14 +562,24 @@ function setShowThisData(data) { ...@@ -509,14 +562,24 @@ 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;
// children
var list2=[];
var tree=[];
list.forEach(area => { list.forEach(area => {
DataInfo.tree.push({ if(list2.includes(area.supplyName)){
value: area, tree.forEach(supply=>{
label: area if(supply.value == area.supplyName){
}) supply.children.push({value:area.name,label:area.name});
}
})
}else{
list2.push(area.supplyName);
tree.push({value:area.supplyName,label:area.supplyName,children:[{value:area.name,label:area.name}]});
}
}) })
DataInfo.tree=tree;
if (DataInfo.tree.length > 0) { if (DataInfo.tree.length > 0) {
DataInfo.name.push(DataInfo.tree[0].value); DataInfo.name.push(DataInfo.tree[0].children[0].value);
} }
} }
...@@ -551,6 +614,25 @@ function SearchHisData() { ...@@ -551,6 +614,25 @@ function SearchHisData() {
getHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort) getHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort)
} }
//导出数据
function ExportDataFile(){
if (isHisData.value) {
ExportHisDataFile();
} else {
ExportRealDataFile();
}
}
//实时数据导出
function ExportRealDataFile() {
ExportRealData();
}
//历史数据导出
function ExportHisDataFile() {
ExportHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort)
}
//分页 //分页
//控制分页 //控制分页
function changePage() { function changePage() {
...@@ -578,11 +660,22 @@ function changeHisPage() { ...@@ -578,11 +660,22 @@ function changeHisPage() {
getHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort) getHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort)
} }
function getFileName(name){
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
return name+`_${year}${month}${day}${hours}${minutes}${seconds}.xls`;
}
//表格样式设置 //表格样式设置
function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) { function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
let css_color; let css_color={};
css_color['background-color'] = '#' + 'b5e6ff';
tableInfo.title.frozenList.forEach(element => { tableInfo.title.frozenList.forEach(element => {
if (element.field === column.property) { if (element.field === column.property) {
var backcolor = (element.color == 'FFFFFF') ? 'd9f1ff' : element.color; var backcolor = (element.color == 'FFFFFF') ? 'd9f1ff' : element.color;
...@@ -595,7 +688,9 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -595,7 +688,9 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
css_color = { 'background-color': '#' + backcolor, 'padding-left': '0px', 'padding-right': '0px', 'borderColor': '#97d5fd', 'color': '#000', 'text-align': 'center', 'vertical-align': 'top' }; css_color = { 'background-color': '#' + backcolor, 'padding-left': '0px', 'padding-right': '0px', 'borderColor': '#97d5fd', 'color': '#000', 'text-align': 'center', 'vertical-align': 'top' };
} }
}) })
if(column.type=='index'){
css_color['background-color'] = '#' + 'b5e6ff';
}
return css_color; return css_color;
} }
...@@ -615,6 +710,9 @@ function setCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -615,6 +710,9 @@ function setCellStyle({ row, column, rowIndex, columnIndex }) {
css_color['background-color'] = '#' + element.backColor; css_color['background-color'] = '#' + element.backColor;
} }
}) })
if(column.type=='index'){
css_color['background-color'] = '#' + 'b5e6ff';
}
return css_color; return css_color;
} }
...@@ -625,6 +723,11 @@ function handleHeadAddClass({ column }) { ...@@ -625,6 +723,11 @@ function handleHeadAddClass({ column }) {
} }
//索引计算
function indexMethod(index){
return (currentPage.value - 1)*pageSize.value+index+1;
}
//获取排序的方法 //获取排序的方法
function sortMethod({ order, prop }) { function sortMethod({ order, prop }) {
// 触发的排序和缓存的排序相同时,取消该字段的排序 // 触发的排序和缓存的排序相同时,取消该字段的排序
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
<el-card class="card-contianer" :body-style="{ 'padding': '0px 0px 0px 0px', 'height': '110px' }"> <el-card class="card-contianer" :body-style="{ 'padding': '0px 0px 0px 0px', 'height': '110px' }">
<div class="div-header"> <div class="div-header">
<el-row> <el-row>
<el-col :span="4">
<div class="div-button" style="display: flex;"> <div class="div-button" style="display: flex;">
<div class="div-autoRefresh"> <div class="div-autoRefresh">
<el-switch v-model="isHisData" class="switch-autoRefresh" active-text="历史数据" <el-switch v-model="isHisData" class="switch-autoRefresh" active-text="历史数据"
...@@ -14,47 +12,42 @@ ...@@ -14,47 +12,42 @@
</div> </div>
</el-col>
<el-col :span="7">
<div class="div-dropdown text-center"> <div class="div-dropdown text-center">
<el-form-item label="小区名称:"> <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: 280px;" /> clearable :show-all-levels="false" filterable placeholder="请选择" style="min-width: 280px;" />
</el-form-item> </el-form-item>
</div> </div>
</el-col>
<el-col :span="11"> <el-col :span="10">
<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">
<el-date-picker v-model="startTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" <el-date-picker v-model="startTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择开始时间" @change="changeStartTime" style="min-width: 180px;" /> placeholder="选择开始时间" @change="changeStartTime" :disabled-date="disabledDate"/>
<!-- 日期时间格式 2024-1-1 00:00:00--> <!-- 日期时间格式 2024-1-1 00:00:00-->
</el-config-provider> </el-config-provider>
</el-form-item> </el-form-item>
<el-form-item label="结束时间:"> <el-form-item label="结束时间:">
<el-config-provider :locale="zhCn"> <el-config-provider :locale="zhCn">
<el-date-picker v-model="endTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" <el-date-picker v-model="endTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择结束时间" @change="changeEndTime" style="min-width: 180px;" /> placeholder="选择结束时间" @change="changeEndTime" :disabled-date="disabledDate"/>
</el-config-provider> </el-config-provider>
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="3">
<div class="div-button"> <div class="div-button">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="15"> <el-col :span="18">
<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"> 搜索</el-button>
&nbsp;&nbsp;</el-button>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="6">
<el-button class="el-button-button" type="primary" :span="6" @click="ExportDataFile" >
导出</el-button>
</el-col> </el-col>
<el-col :span="3">
</el-col>
<el-col :span="3">
</el-col>
</el-row> </el-row>
</div> </div>
</el-col> </el-col>
...@@ -66,6 +59,7 @@ ...@@ -66,6 +59,7 @@
<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"> :header-cell-class-name="handleHeadAddClass">
<el-table-column type="index" width="50" fixed />
<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" sortable fixed /> :width="item.width" sortable fixed />
<template v-for="(item, i) in tableInfo.title.otherList"> <template v-for="(item, i) in tableInfo.title.otherList">
...@@ -77,6 +71,7 @@ ...@@ -77,6 +71,7 @@
<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" sortable> :header-cell-class-name="handleHeadAddClass" @sort-change="sortMethod" sortable>
<el-table-column type="index" width="50" fixed :index="indexMethod" />
<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">
...@@ -128,6 +123,7 @@ ...@@ -128,6 +123,7 @@
.div-time-picker { .div-time-picker {
padding-top: 6px; padding-top: 6px;
margin-left: 30px;
display: flex; display: flex;
} }
...@@ -163,6 +159,8 @@ ...@@ -163,6 +159,8 @@
.el-button-button { .el-button-button {
margin-top: 5px; margin-top: 5px;
// margin-right: 5px;
// margin-left: 60px;
width: 80px; width: 80px;
} }
...@@ -173,7 +171,7 @@ ...@@ -173,7 +171,7 @@
display: flex; display: flex;
margin-top: 5px; margin-top: 5px;
border-radius: var(--el-border-radius-base); border-radius: var(--el-border-radius-base);
padding: 6px 15px; padding: 6px 0px;
font-size: 14px; font-size: 14px;
height: 20px; height: 20px;
overflow: hidden; overflow: hidden;
...@@ -225,18 +223,10 @@ ...@@ -225,18 +223,10 @@
<script setup> <script setup>
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 {
Search,
ArrowLeft,
ArrowRight,
Warning
} from '@element-plus/icons-vue'
import CfgSupply from '../../components/CfgSupply.vue';
// import { da } from 'element-plus/es/locale'; // import { da } from 'element-plus/es/locale';
// import { start } from 'repl'; // import { start } from 'repl';
// import { ca } from 'element-plus/es/locale'; // import { ca } from 'element-plus/es/locale';
...@@ -327,10 +317,32 @@ var tableInfo = reactive({ ...@@ -327,10 +317,32 @@ 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;
}
//日期范围控制,返回true说明需要被禁用
function disabledDate(thisdate){
var startDate=new Date(2023,7,1);
var endDate=new Date();
return thisdate > endDate || thisdate < startDate;
}
//数据控制,根据isHisData的值决定数据控制逻辑,false为实时数据,true为历史数据 //数据控制,根据isHisData的值决定数据控制逻辑,false为实时数据,true为历史数据
var dataUrl = isHisData.value ? '/api/tiger/TigerTapData/His' : '/api/tiger/TigerTapData/Real'; var dataUrl = isHisData.value ? '/api/tiger/TigerTapData/His' : '/api/tiger/TigerTapData/Real';
var exportUrl= isHisData.value ? '/api/tiger/TigerTapData/HisExport' : '/api/tiger/TigerTapData/RealExport';
function initTitle() { function initTitle() {
tableInfo.title.frozenList.length = 0; tableInfo.title.frozenList.length = 0;
...@@ -385,25 +397,27 @@ function init() { ...@@ -385,25 +397,27 @@ function init() {
} else { } else {
initReal(); initReal();
} }
getName();
} }
//数据切换 //数据切换
async function changeData() { async function changeData() {
init(); init();
getName(); // getName();
} }
//实时数据初始化 //实时数据初始化
async function initReal() { async function initReal() {
dataUrl = '/api/tiger/TigerTapData/Real'; dataUrl = '/api/tiger/TigerTapData/Real';
exportUrl = '/api/tiger/TigerTapData/RealExport'
tableInfo.tableData.length = 0; tableInfo.tableData.length = 0;
tableInfo.realData.length = 0; tableInfo.realData.length = 0;
await getRealData(); await getRealData();
} }
//历史数据初始化 //历史数据初始化
async function initHis() { async function initHis() {
// dataUrl = '/api/tiger/TigerHeatUser/Real';
dataUrl = '/api/tiger/TigerTapData/His'; dataUrl = '/api/tiger/TigerTapData/His';
exportUrl = '/api/tiger/TigerTapData/HisExport';
tableInfo.tableData.length = 0; tableInfo.tableData.length = 0;
tableInfo.hisData.length = 0; tableInfo.hisData.length = 0;
await getHisData(); await getHisData();
...@@ -447,13 +461,11 @@ async function getName() { ...@@ -447,13 +461,11 @@ async function getName() {
if (result.status === 0) { if (result.status === 0) {
//处理返回数据 //处理返回数据
var list = []; var list = [];
//供热站--小区
result.data.forEach(data => { result.data.forEach(data => {
list.push(data.name); list.push({supplyName:data.supplyName,name:data.name});
}) })
var list2 = [...new Set(list)]; setSelect(list)
setSelect(list2)
} else {
// tableInfo.tableData.length = 0;
} }
}) })
loading.value = false loading.value = false
...@@ -472,12 +484,64 @@ async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) { ...@@ -472,12 +484,64 @@ async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) {
// makeFormsData(result.data.realData); // makeFormsData(result.data.realData);
} else { } else {
tableInfo.tableData.length = 0; tableInfo.tableData.length = 0;
total.value=0;
} }
}) })
loading.value = false loading.value = false
total.value = tableInfo.tableData.length;
}
function ExportHisDataByInfo(name, start, end, startPage, pagesCount, sort){
var fileName = getFileName("阀门历史数据");
http.post(exportUrl, { name: name, startTime: start, endTime: end, start: startPage, count: pagesCount, sort: sort }).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);
}
});
}
function ExportRealData(){
var fileName = getFileName("阀门实时数据");
http.post(exportUrl).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);
}
});
} }
function setshowData() { function setshowData() {
if (isHisData.value) { if (isHisData.value) {
tableInfo.tableData = tableInfo.hisData; tableInfo.tableData = tableInfo.hisData;
...@@ -489,19 +553,28 @@ function setshowData() { ...@@ -489,19 +553,28 @@ function setshowData() {
function setShowThisData(data) { function setShowThisData(data) {
tableInfo.tableData = data; tableInfo.tableData = data;
} }
//设置搜索栏可选择项 //设置搜索栏可选择项
function setSelect(list) { function setSelect(list) {
DataInfo.tree.length = 0; DataInfo.tree.length = 0;
DataInfo.name.length=0; DataInfo.name.length = 0;
// children
var list2=[];
var tree=[];
list.forEach(area => { list.forEach(area => {
DataInfo.tree.push({ if(list2.includes(area.supplyName)){
value: area, tree.forEach(supply=>{
label: area if(supply.value == area.supplyName){
}) supply.children.push({value:area.name,label:area.name});
}
})
}else{
list2.push(area.supplyName);
tree.push({value:area.supplyName,label:area.supplyName,children:[{value:area.name,label:area.name}]});
}
}) })
if(DataInfo.tree.length>0){ DataInfo.tree=tree;
DataInfo.name.push(DataInfo.tree[0].value); if (DataInfo.tree.length > 0) {
DataInfo.name.push(DataInfo.tree[0].children[0].value);
} }
} }
...@@ -533,6 +606,25 @@ function SearchHisData() { ...@@ -533,6 +606,25 @@ function SearchHisData() {
getHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort) getHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort)
} }
//导出数据
function ExportDataFile(){
if (isHisData.value) {
ExportHisDataFile();
} else {
ExportRealDataFile();
}
}
//实时数据导出
function ExportRealDataFile() {
ExportRealData();
}
//历史数据导出
function ExportHisDataFile() {
ExportHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort)
}
//分页 //分页
//控制分页 //控制分页
function changePage() { function changePage() {
...@@ -560,11 +652,23 @@ function changeHisPage() { ...@@ -560,11 +652,23 @@ function changeHisPage() {
getHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort) getHisDataByInfo(DataInfo.name, startTime.value, endTime.value, currentPage.value - 1, pageSize.value, DataInfo.sort)
} }
function getFileName(name){
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
return name+`_${year}${month}${day}${hours}${minutes}${seconds}.xls`;
}
//表格样式设置 //表格样式设置
function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) { function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
let css_color; let css_color={};
css_color['background-color'] = '#' + 'b5e6ff';
tableInfo.title.frozenList.forEach(element => { tableInfo.title.frozenList.forEach(element => {
if (element.field === column.property) { if (element.field === column.property) {
var backcolor = (element.color == 'FFFFFF') ? 'd9f1ff' : element.color; var backcolor = (element.color == 'FFFFFF') ? 'd9f1ff' : element.color;
...@@ -577,7 +681,9 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -577,7 +681,9 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
css_color = { 'background-color': '#' + backcolor, 'padding-left': '0px', 'padding-right': '0px', 'borderColor': '#97d5fd', 'color': '#000', 'text-align': 'center', 'vertical-align': 'top' }; css_color = { 'background-color': '#' + backcolor, 'padding-left': '0px', 'padding-right': '0px', 'borderColor': '#97d5fd', 'color': '#000', 'text-align': 'center', 'vertical-align': 'top' };
} }
}) })
if(column.type=='index'){
css_color['background-color'] = '#' + 'b5e6ff';
}
return css_color; return css_color;
} }
...@@ -597,6 +703,9 @@ function setCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -597,6 +703,9 @@ function setCellStyle({ row, column, rowIndex, columnIndex }) {
css_color['background-color'] = '#' + element.backColor; css_color['background-color'] = '#' + element.backColor;
} }
}) })
if(column.type=='index'){
css_color['background-color'] = '#' + 'b5e6ff';
}
return css_color; return css_color;
} }
...@@ -606,6 +715,10 @@ function handleHeadAddClass({ column }) { ...@@ -606,6 +715,10 @@ function handleHeadAddClass({ column }) {
} }
} }
//索引计算
function indexMethod(index){
return (currentPage.value - 1)*pageSize.value+index+1;
}
//获取排序的方法 //获取排序的方法
function sortMethod({ order, prop }) { function sortMethod({ order, prop }) {
......
<template>
换热站巡更
</template>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<template> <template>
<el-card class="card-contianer"> <el-card class="card-contianer">
<label>{{radioTitle}}</label> <label>{{radioTitle}}</label>
<el-radio-group v-model="radioList" style="margin-left: 50px;"> <el-radio-group v-model="activeRadio" style="margin-left: 50px;">
<el-radio <el-radio
v-for="(option, index) in options" v-for="(option, index) in options"
:key="index" :key="index"
...@@ -13,47 +13,47 @@ ...@@ -13,47 +13,47 @@
</el-radio-group> </el-radio-group>
</el-card> </el-card>
<el-tabs :tab-position="tabPosition" style="height: 100%" class="demo-tabs"> <el-tabs :tab-position="tabPosition" style="height: 100%" class="demo-tabs">
<el-tab-pane label="换热站状态"> <el-tab-pane label="换热站状态" v-if="isTransferStatus">
<TransferStatusControl/> <TransferStatusControl :activeRadio="activeRadio"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="远程寄存器"> <el-tab-pane label="远程寄存器" v-if="isTransferRegControl">
<TransferRegControl/> <TransferRegControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="节假日参数组"> <el-tab-pane label="节假日参数组" v-if="isHolidayControl">
<HolidayControl/> <HolidayControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="夜间参数组"> <el-tab-pane label="夜间参数组" v-if="isNightControl">
<NightControl/> <NightControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="二次网供水温度"> <el-tab-pane label="二次网供水温度" v-if="isSecTempControl">
<SecTempControl/> <SecTempControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="曲线对应"> <el-tab-pane label="曲线对应" v-if="isCurveControl">
<CurveControl/> <CurveControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="气象仪"> <el-tab-pane label="气象仪" v-if="isWeatherControl">
<WeatherControl/> <WeatherControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="温度上下限"> <el-tab-pane label="温度上下限" v-if="isLimitControl">
<LimitControl/> <LimitControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="风向控制"> <el-tab-pane label="风向控制" v-if="isWinDirectionControl">
<WinDirectionControl/> <WinDirectionControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="热量"> <el-tab-pane label="热量" v-if="isHeatControl">
<HeatControl/> <HeatControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="室外温度控制"> <el-tab-pane label="室外温度控制" v-if="isOutdoorTempControl">
<OutdoorTempControl/> <OutdoorTempControl/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="循环泵夜间降频"> <el-tab-pane label="循环泵夜间降频" v-if="isNightFrequency">
<NightFrequency/> <NightFrequency/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, onMounted, onUnmounted } from 'vue'; import { ref, reactive, onMounted, onUnmounted, watch } from 'vue';
import http from '../../api/http'; import http from '../../api/http';
import store from "../../store/index"; import store from "../../store/index";
import TransferStatusControl from '../../components/Remote/TransferStatusControl.vue'; import TransferStatusControl from '../../components/Remote/TransferStatusControl.vue';
...@@ -73,8 +73,20 @@ ...@@ -73,8 +73,20 @@
const options = reactive([]); const options = reactive([]);
const enterpriseId = ref(null); const enterpriseId = ref(null);
const tabPosition = ref('left'); const tabPosition = ref('left');
const radioList = ref(null); const activeRadio = ref(null);
const isTransferStatus = ref(false);
const isTransferRegControl = ref(false);
const isHolidayControl = ref(false);
const isNightControl = ref(false);
const isSecTempControl = ref(false);
const isCurveControl = ref(false);
const isWeatherControl = ref(false);
const isLimitControl = ref(false);
const isWinDirectionControl = ref(false);
const isHeatControl = ref(false);
const isOutdoorTempControl = ref(false);
const isNightFrequency = ref(false);
//初始化页面 //初始化页面
function initPage(){ function initPage(){
initRadioList(); initRadioList();
...@@ -106,20 +118,64 @@ ...@@ -106,20 +118,64 @@
} }
} }
}); });
radioList.value = options[0].value; activeRadio.value = options[0].value;
console.log("activeRadio.value:"+activeRadio.value);
} }
} }
//根据权限初始化远程控制页列表 //根据权限初始化远程控制页列表
function initRomateList(){ function initRomateList(){
let userInfo = store.getters.getUserInfo; http.post("/api/module/RemoteModules", '').then((result) => {
if(userInfo.roleId >4){ if(result.data !== null){
//console.log(result.data);
} result.data.forEach(item =>{
if(item.moduleCode ==="RemoteTransferStatus"){
isTransferStatus.value = true;
}
if(item.moduleCode ==="RemoteTransferReg"){
isTransferRegControl.value = true;
}
if(item.moduleCode ==="HolidayControl"){
isHolidayControl.value = true;
}
if(item.moduleCode ==="NightControl"){
isNightControl.value = true;
}
if(item.moduleCode ==="SecTempControl"){
isSecTempControl.value = true;
}
if(item.moduleCode ==="CurveControl"){
isCurveControl.value = true;
}
if(item.moduleCode ==="WeatherControl"){
isWeatherControl.value = true;
}
if(item.moduleCode ==="LimitControl"){
isLimitControl.value = true;
}
if(item.moduleCode ==="WinDirectionControl"){
isWinDirectionControl.value = true;
}
if(item.moduleCode ==="HeatControl"){
isHeatControl.value = true;
}
if(item.moduleCode ==="OutdoorTempControl"){
isOutdoorTempControl.value = true;
}
if(item.moduleCode ==="NightFrequency"){
isNightFrequency.value = true;
}
})
}
});
} }
initPage(); initPage();
// 当选中项变化时,这里会打印新的值
watch(activeRadio, (newValue) => {
// console.log('Selected value changed:', newValue);
});
</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