Commit c99940fd authored by moonby's avatar moonby

240730

parent 53891155
...@@ -59,6 +59,7 @@ ...@@ -59,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">
...@@ -70,6 +71,7 @@ ...@@ -70,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">
...@@ -353,9 +355,9 @@ var exportUrl= isHisData.value ? '/api/tiger/TigerHeatUser/HisExport' : '/api/ti ...@@ -353,9 +355,9 @@ var exportUrl= isHisData.value ? '/api/tiger/TigerHeatUser/HisExport' : '/api/ti
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', "单元");
...@@ -466,13 +468,11 @@ async function getName() { ...@@ -466,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
...@@ -489,10 +489,10 @@ async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) { ...@@ -489,10 +489,10 @@ 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;
} }
...@@ -562,14 +562,24 @@ function setShowThisData(data) { ...@@ -562,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);
} }
} }
...@@ -664,7 +674,8 @@ function getFileName(name){ ...@@ -664,7 +674,8 @@ function getFileName(name){
//表格样式设置 //表格样式设置
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;
...@@ -677,7 +688,9 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -677,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;
} }
...@@ -697,6 +710,9 @@ function setCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -697,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;
} }
...@@ -707,6 +723,11 @@ function handleHeadAddClass({ column }) { ...@@ -707,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 }) {
// 触发的排序和缓存的排序相同时,取消该字段的排序 // 触发的排序和缓存的排序相同时,取消该字段的排序
......
...@@ -59,6 +59,7 @@ ...@@ -59,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">
...@@ -70,6 +71,7 @@ ...@@ -70,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">
...@@ -459,13 +461,11 @@ async function getName() { ...@@ -459,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
...@@ -484,10 +484,11 @@ async function getHisDataByInfo(name, start, end, startPage, pagesCount, sort) { ...@@ -484,10 +484,11 @@ 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){ function ExportHisDataByInfo(name, start, end, startPage, pagesCount, sort){
...@@ -552,19 +553,28 @@ function setshowData() { ...@@ -552,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);
} }
} }
...@@ -657,7 +667,8 @@ function getFileName(name){ ...@@ -657,7 +667,8 @@ function getFileName(name){
//表格样式设置 //表格样式设置
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;
...@@ -670,7 +681,9 @@ function setHeaderCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -670,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;
} }
...@@ -690,6 +703,9 @@ function setCellStyle({ row, column, rowIndex, columnIndex }) { ...@@ -690,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;
} }
...@@ -699,6 +715,10 @@ function handleHeadAddClass({ column }) { ...@@ -699,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 }) {
......
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