全局添加导出表格配置

This commit is contained in:
GGJ
2024-12-27 08:47:47 +08:00
parent 1f94ac5267
commit 0994a52699
28 changed files with 3264 additions and 200 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div class="default-main">
<div v-show="view">
<TableHeader datePicker area>
<TableHeader datePicker area showExport>
<template #select>
<el-form-item label="筛选">
<el-input v-model="tableStore.table.params.searchValue" placeholder="输入关键字筛选" />

View File

@@ -1,7 +1,7 @@
<template>
<div class="default-main online">
<div class="online_header">
<TableHeader date-picker ref="tableHeaderRef">
<TableHeader date-picker ref="tableHeaderRef" >
<template #select>
<el-form-item label="统计类型:">
<el-select

View File

@@ -1,7 +1,7 @@
<template>
<div class="default-main">
<TableHeader date-picker area>
<TableHeader date-picker area showExport>
<template #select>
<!-- <el-form-item label="统计类型:">
<el-select v-model="tableStore.table.params.statisticalType" placeholder="请选择统计类型" value-key="id">

View File

@@ -1,7 +1,7 @@
<template>
<div class="default-main">
<TableHeader datePicker area>
<TableHeader datePicker area showExport>
<template #select>
<el-form-item label="统计类型:">
<el-select v-model="tableStore.table.params.statisticalType" placeholder="请选择统计类型" value-key="id">

View File

@@ -1,7 +1,7 @@
<template>
<div class="default-main">
<TableHeader datePicker area>
<TableHeader datePicker area showExport>
<template #select>
<el-form-item label="统计类型:">
<el-select v-model="tableStore.table.params.statisticalType" placeholder="请选择统计类型" value-key="id">

View File

@@ -38,7 +38,7 @@
<el-button type="primary" @click="init" icon="el-icon-Search">查询</el-button>
</el-form-item>
</el-form>
<div style="flex: 1; overflow-y: scroll" class="mt10" v-loading="loading">
<div style="flex: 1; overflow-y: scroll" class="mt10">
<my-echart :options="item.option" v-for="item in list" :style="height" />
</div>
</div>
@@ -52,7 +52,6 @@ import { useMonitoringPoint } from '@/stores/monitoringPoint'
import { indexOptions, harmonicOptions, inharmonicOptions } from '@/utils/dictionary'
import { getHistoryResult } from '@/api/harmonic-boot/harmonic'
import { mainHeight } from '@/utils/layout'
import { yMethod } from '@/utils/echartMethod'
const datePickerRef = ref()
const monitoringPoint = useMonitoringPoint()
const checked = ref(monitoringPoint.state.showCheckBox)
@@ -76,7 +75,6 @@ const formData = reactive<{
inHarmonic: 1,
ptType: 0
})
const height: any = ref(mainHeight(200, 1))
const options = ref({})
const traceability = ref<any>([])
const list = ref<any>([])
@@ -89,9 +87,9 @@ const typeOptions = ref([
{ label: 'cp95值', value: 4 }
])
onMounted(() => {
datePickerRef.value.setTheDate(5)
init()
})
const height: any = ref(mainHeight(200, 1))
const checkChange = () => {
if (checked.value) {
monitoringPoint.setShowCheckBox(true)
@@ -120,15 +118,13 @@ const init = () => {
}
list.value = []
shujuchuli(res)
loading.value = false
}).catch(() => { loading.value = false })
})
}
const shujuchuli = (res: any) => {
let shujuData = res.data
shujuData.forEach((item: any, i: number) => {
let [min, max] = yMethod([ ...(item.value.map(arr => arr.slice(1)).flat()),item.topLimit,,item.lowerLimit])
//判断是否存在暂降点
if (item.eventDetail !== null || item.eventDetail.length === 0) {
//向项别中添加暂降点
let chufa = []
@@ -147,8 +143,8 @@ const shujuchuli = (res: any) => {
let cvalue = []
let topLimit = []
let lowerLimit = []
item.maxValue = max
item.minValue = min
item.maxValue = item.topLimit
item.minValue = item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -213,8 +209,8 @@ const shujuchuli = (res: any) => {
let gvalue = []
let topLimit = []
let lowerLimit = []
item.maxValue = max
item.minValue = min
item.maxValue = item.topLimit
item.minValue = item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -287,7 +283,7 @@ const shujuchuli = (res: any) => {
let bvalue = []
let cvalue = []
let topLimit = []
item.maxValue = max
item.maxValue = item.topLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -349,7 +345,7 @@ const shujuchuli = (res: any) => {
if (item.phaiscType.length == 3) {
let gvalue = []
let topLimit = []
item.maxValue = max
item.maxValue = item.topLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -415,7 +411,7 @@ const shujuchuli = (res: any) => {
let bvalue = []
let cvalue = []
let lowerLimit = []
item.minValue = min
item.minValue = item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -472,7 +468,7 @@ const shujuchuli = (res: any) => {
if (item.phaiscType.length == 3) {
let gvalue = []
let lowerLimit = []
item.minValue = min
item.minValue = item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -663,8 +659,8 @@ const shujuchuli = (res: any) => {
let cvalue = []
let topLimit = []
let lowerLimit = []
item.maxValue = max
item.minValue = min
item.maxValue = item.topLimit
item.minValue = item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -717,8 +713,8 @@ const shujuchuli = (res: any) => {
let gvalue = []
let topLimit = []
let lowerLimit = []
item.maxValue = max
item.minValue = min
item.maxValue = item.topLimit
item.minValue = item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -780,7 +776,7 @@ const shujuchuli = (res: any) => {
let bvalue = []
let cvalue = []
let topLimit = []
item.maxValue = max
item.maxValue = item.topLimit
// item.minValue=item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
@@ -831,7 +827,7 @@ const shujuchuli = (res: any) => {
if (item.phaiscType.length == 2) {
let gvalue = []
let topLimit = []
item.maxValue = max
item.maxValue = item.topLimit
// item.minValue=item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
@@ -892,7 +888,7 @@ const shujuchuli = (res: any) => {
let cvalue = []
let lowerLimit = []
// item.maxValue=item.topLimit
item.minValue = min
item.minValue = item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -943,7 +939,7 @@ const shujuchuli = (res: any) => {
let gvalue = []
let lowerLimit = []
// item.maxValue=item.topLimit
item.minValue = min
item.minValue = item.lowerLimit
//判断数据是否存在
if (item.value !== null) {
for (let j = 0; j < item.value.length; j++) {
@@ -1096,7 +1092,6 @@ const shujuchuli = (res: any) => {
}
const rendering = () => {
height.value = mainHeight(200, list.value.length > 1 ? 2 : 1)
list.value.forEach((item: any) => {
let opitonserise: any[] = []
item.legend.forEach((item2: any) => {
@@ -1125,7 +1120,7 @@ const rendering = () => {
smooth: true,
itemStyle: {
normal: {
color: '#009900'
color: '#339900'
}
},
@@ -1142,7 +1137,7 @@ const rendering = () => {
barWidth: 22,
itemStyle: {
normal: {
color: '#CC0000'
color: '#FF3300'
}
},
data: item.cvalue
@@ -1300,8 +1295,6 @@ const rendering = () => {
getEcharts()
}
const getEcharts = () => {
console.log("🚀 ~ list.value.forEach ~ list.value:", list.value)
list.value.forEach((item: any, i: number) => {
item.option = {
backgroundColor: '#fff',
@@ -1325,7 +1318,7 @@ const getEcharts = () => {
opacity: 0.35,
fontSize: 14
},
backgroundColor: 'rgba(0,0,0,0.55)',
backgroundColor: 'rgba(0,0,0,0.35)',
formatter: function (params: any) {
let tips = ''
@@ -1398,7 +1391,8 @@ const getEcharts = () => {
}
},
legend: {
left: '140px',
left: '50px',
top: '25px',
verticalAlign: 'top',
enabled: true,
itemDistance: 5,
@@ -1412,6 +1406,9 @@ const getEcharts = () => {
padding: [0, 0, 0, 0] //[上、右、下、左]
}
},
grid: {
top: '70px',
},
xAxis: [
{
type: 'time',
@@ -1426,42 +1423,42 @@ const getEcharts = () => {
}
}
],
toolbox: {
show: true,
feature: {
dataZoom: {
// bottom: '10px',
yAxisIndex: 'none'
}
}
},
// toolbox: {
// show: true,
// feature: {
// dataZoom: {
// // bottom: '10px',
// yAxisIndex: 'none'
// }
// }
// },
yAxis: [
{
type: 'value',
min: item.minValue,
max: item.maxValue,
// min: item.minValue,
name: item.valueName,
axisLabel: {
interval: 0,
formatter: function (value: any) {
return value.toFixed(3)
},
left: '20px'
},
minInterval: 1,
// axisLabel: {
// interval: 0,
// // formatter: function (value: any) {
// // return value.toFixed(0)
// // },
// left: '20px'
// },
axisLine: {
show: true,
onZero: false, //-----------重点
lineStyle: {}
},
splitLine: {
lineStyle: {
// 使用深浅的间隔色
type: 'dashed',
opacity: 0.5
}
}
// splitLine: {
// lineStyle: {
// // 使用深浅的间隔色
// type: 'dashed',
// opacity: 0.5
// }
// }
}
],
series: item.serise
@@ -1555,7 +1552,7 @@ const getEcharts = () => {
symbolSize: 0,
itemStyle: {
normal: {
color: '#CC0000'
color: '#FF3300'
}
}
},

View File

@@ -1,14 +1,14 @@
<!--业务用户管理界面-->
<template>
<div class="default-main">
<TableHeader datePicker area>
<TableHeader datePicker area showExport>
<template v-slot:select>
<el-form-item label="筛选数据">
<el-input v-model="tableStore.table.params.searchValue" clearable maxlength="32" show-word-limit placeholder="筛选数据" />
</el-form-item>
</template>
<template v-slot:operation>
<el-button type="primary" @click="exportEvent" class="ml10" icon="el-icon-Download">导出</el-button>
<!-- <el-button type="primary" @click="exportEvent" class="ml10" icon="el-icon-Download">导出</el-button> -->
</template>
</TableHeader>
<!--表格-->

View File

@@ -1,7 +1,7 @@
<template>
<div class="default-main">
<TableHeader area>
<TableHeader area showExport>
<template #select>
<!-- <el-form-item label="统计类型:">
<el-select v-model="tableStore.table.params.statisticalType" placeholder="请选择统计类型" value-key="id">
@@ -99,8 +99,8 @@ const tableStore = new TableStore({
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{ field: 'areaName', title: '区域' },
{ field: 'gdName', title: '地级区' },
{ field: 'areaName', title: '区域',minWidth: 100 },
{ field: 'gdName', title: '地级区' ,minWidth: 100},
{
field: 'bdName',
title: '供电公司',
@@ -114,7 +114,19 @@ const tableStore = new TableStore({
{ field: 'devName', title: '终端名称', minWidth: 80 },
{ field: 'ip', title: '网络参数' , minWidth: 100},
{ field: 'lineName', title: '监测点名称' , minWidth: 100},
{ field: 'comFlag', title: '通讯状态' , minWidth: 100},
// { field: 'comFlag', title: '通讯状态' , minWidth: 100},
{
field: 'comFlag',
title: '通讯状态',
render: 'tag',
effect: 'dark',
custom: {
'正常': 'success',
'中断': 'danger',
},
},
{ field: 'loadType', title: '干扰源类型' , minWidth: 100},

View File

@@ -3,8 +3,8 @@
<TableHeader area>
<template #select>
<el-form-item label="监测点性质:">
<el-select v-model="tableStore.table.params.powerFlag" filterable multiple collapse-tags clearable
<el-form-item label="监测点性质:">
<el-select v-model="tableStore.table.params.powerFlag" filterable collapse-tags
placeholder="请选择监测点性质">
<el-option v-for="item in terminalstatus" :key="item.value" :label="item.label"
:value="item.value">
@@ -18,7 +18,7 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="终端厂家:">
<el-select v-model="tableStore.table.params.manufacturer" filterable multiple collapse-tags
clearable placeholder="请选择终端厂家" value-key="id">
@@ -38,7 +38,7 @@
<el-form-item label="上报类型:">
<el-select v-model="tableStore.table.params.monitorFlag" filterable multiple collapse-tags clearable
<el-select v-model="tableStore.table.params.monitorFlag"
placeholder="请选择上报类型">
<el-option v-for="item in communicationstatus" :key="item.value" :label="item.label"
:value="item.value">
@@ -50,7 +50,36 @@
</template>
</TableHeader>
<Table ref="tableRef" />
<div :style="{ height: tableStore.table.height }" v-loading="tableStore.table.loading">
<vxe-table height="auto" auto-resize v-bind="defaultAttribute" :stripe='false' :scroll-y="{ enabled: false }"
:span-method="rowspanMethod" :data="tableData">
<vxe-column field="name1" title="区域">
</vxe-column>
<vxe-column field="name2" title="类型">
</vxe-column>
<vxe-column field="name3" title="分类型">
<template #default="{ row }">
<span>{{ Number.isFinite(row.name3-0)? row.name3+'kV':row.name3}}</span>
</template>
</vxe-column>
<vxe-column field="subCount" title="变电站个数(个)">
<template #default="{ row }">
<span style="color: blue">{{ row.subCount }}</span>
</template>
</vxe-column>
<vxe-column field="devCount" title="终端个数(个)">
<template #default="{ row }">
<span style="color: #006699">{{ row.devCount }}</span>
</template>
</vxe-column>
<vxe-column field="lineCount" title="监测点个数(个)">
<template #default="{ row }">
<span style="color: green">{{ row.lineCount }}</span>
</template>
</vxe-column>
</vxe-table>
</div>
@@ -62,17 +91,23 @@ import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import { useDictData } from '@/stores/dictData'
import TableHeader from '@/components/table/header/index.vue'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import type { VxeTablePropTypes } from 'vxe-table'
import XEUtils from 'xe-utils'
const dictData = useDictData()
defineOptions({
name: 'harmonic-boot/run/devicemessage'
name: 'harmonic-boot/run/terminalconts'
})
const view = ref(true)
const treeData: any = ref([])
const treeDataCopy: any = ref([])
const classificationData = dictData.getBasicData('Statistical_Type', ["Report_Type"])
const voltageleveloption = dictData.getBasicData('Dev_Voltage_Stand')
const terminaloption = dictData.getBasicData('Dev_Manufacturers')
const interfereoption = dictData.getBasicData('Interference_Source')
//上报类型
const communicationstatus = [
{ value: 2, label: "全部" },
{ value: 1, label: "灿能上报" },
{ value: 0, label: "非灿能上报" },
@@ -88,7 +123,7 @@ const terminalstatus = [
const tableStore = new TableStore({
url: '/device-boot/runManage/getTerminalLedger',
method: 'POST',
isWebPaging: true,
showPage: false,
column: [
{
field: 'index',
@@ -99,42 +134,108 @@ const tableStore = new TableStore({
}
},
{ field: 'areaName', title: '区域' },
{ field: 'gdName', title: '地级区' },
{
field: 'bdName',
title: '供电公司',
minWidth: 100
},
{ field: 'objName', title: '监测点对象名称', minWidth: 240 },
{ field: 'manufacturer', title: '厂家', minWidth: 100 },
{ field: 'scale', title: '电压等级', minWidth: 100 },
{ field: 'businessType', title: '行业类型', minWidth: 100 },
{ field: 'devName', title: '终端名称', minWidth: 80 },
{ field: 'ip', title: '网络参数', minWidth: 100 },
{ field: 'lineName', title: '监测点名称', minWidth: 100 },
{ field: 'loadType', title: '干扰源类型', minWidth: 100 },
{ field: 'gdName', title: '类型' },
{ field: 'flx', title: '分类型' },
{ field: 'gdName', title: '变电站个数(个)' },
{ field: 'gdName', title: '终端个数(个)' },
{ field: 'gdName', title: '监测点个数(个)' },
],
loadCallback: () => {
tableStore.table.data.map((item: any) => {
item.onlineEvaluate == 3.14159 ? item.onlineEvaluate = '/' : item.onlineEvaluate <= 0.6 ? item.onlineEvaluate = '差' : item.onlineEvaluate <= 0.9 ? item.onlineEvaluate = '良' : item.onlineEvaluate <= 1 ? item.onlineEvaluate = '优' : '/'
})
treeData.value = tree2List(tableStore.table.data, Math.random() * 1000)
toColTreeData(XEUtils.toArrayTree(JSON.parse(JSON.stringify(treeData.value))))
}
})
tableStore.table.params.statisticalType = classificationData[0]
tableStore.table.params.serverName = "harmonic-boot"
tableStore.table.params.monitorFlag = 2
tableStore.table.params.powerFlag = '2'
tableStore.table.params.evaluate = ''
tableStore.table.params.powerFlag = 2
tableStore.table.params.evaluate = ''
tableStore.table.params.scale = voltageleveloption
tableStore.table.params.manufacturer = terminaloption
tableStore.table.params.loadType = interfereoption
// 处理大数据卡顿
const tree2List = (list: any, id: any) => {
//存储结果的数组
let arr: any = []
// 遍历 tree 数组
list.forEach((item: any) => {
item.parentId = id
item.id = (Math.random() * 1000)
// 判断item是否存在children
if (!item.list) return arr.push(item)
// 函数递归对list数组进行tree2List的转换
const list = tree2List(item.list, item.id)
// 删除item的list属性
delete item.list
// 把item和list数组添加至结果数组
//..list: 意思是把list数组展开
arr.push(item, ...list)
})
// 返回结果数组
return arr
}
const toColTreeData = (treeData: any[]) => {
const options = { children: 'children' }
const list: any[] = []
const keyMap: any = {}
XEUtils.eachTree(treeData, (item, index, result, paths, parent) => {
keyMap[item.id] = item
item.keys = parent ? parent.keys.concat([item.id]) : [item.id]
if (!item.children || !item.children.length) {
const row: any = {}
// console.log("🚀 ~ item.keys.forEach ~ item:", item)
item.keys.forEach((key: any, index: number) => {
const level = index + 1
const obj = keyMap[key]
row[`id${level}`] = obj.id
row[`name${level}`] = obj.areaName || obj.name || obj.dicName
row[`subCount`] = obj.subCount
row[`devCount`] = obj.devCount
row[`lineCount`] = obj.lineCount
})
list.push(row)
}
}, options)
tableData.value = list
}
const tableData: any = ref([])
// 通用行合并函数(将相同多列数据合并为一行)
const rowspanMethod: VxeTablePropTypes.SpanMethod = ({ row, _rowIndex, column, visibleData }) => {
// console.log("🚀 ~ row:", row)
const fields = ['name1', 'name2', 'name3', 'name4', 'name5', 'name6']
const cellValue = row[column.field]
// console.log("🚀 ~ cellValue:", cellValue)
if (cellValue && fields.includes(column.field)) {
const prevRow = visibleData[_rowIndex - 1]
let nextRow = visibleData[_rowIndex + 1]
if (prevRow && prevRow[column.field] === cellValue) {
return { rowspan: 0, colspan: 0 }
} else {
let countRowspan = 1
while (nextRow && nextRow[column.field] === cellValue) {
nextRow = visibleData[++countRowspan + _rowIndex]
}
if (countRowspan > 1) {
return { rowspan: countRowspan, colspan: 1 }
}
}
}
}
tableStore.table.params.scale = []
tableStore.table.params.manufacturer = []
tableStore.table.params.loadType = []
const wp = ref({})
provide('tableStore', tableStore)
onMounted(() => {

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
<template>
<div class="default-main">
<TableHeader area>
<TableHeader area showExport>
<template #select>
<!-- <el-form-item label="统计类型:">
<el-select v-model="tableStore.table.params.statisticalType" placeholder="请选择统计类型" value-key="id">
@@ -100,8 +100,8 @@ const tableStore = new TableStore({
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{ field: 'areaName', title: '区域' },
{ field: 'gdName', title: '地级区' },
{ field: 'areaName', title: '区域', minWidth: 100},
{ field: 'gdName', title: '地级区' ,minWidth: 100},
{
field: 'bdName',
title: '供电公司',