调整代码
This commit is contained in:
@@ -399,7 +399,7 @@ const handleCurrentChange = (val: number) => {
|
||||
const exportEvent = () => {
|
||||
const allFilteredData = filteredData.value
|
||||
tableRef.value.exportData({
|
||||
filename: '场战级评估-污染值报告',
|
||||
filename: '场站级评估-污染值报告',
|
||||
sheetName: 'Sheet1',
|
||||
type: 'xlsx',
|
||||
useStyle: true,
|
||||
|
||||
@@ -652,7 +652,7 @@ const initRadioCharts = () => {
|
||||
echartsData1.value.options.series[i].center = ['50%', '50%']
|
||||
}
|
||||
}
|
||||
const initEcharts = (color: string, key: number) => {
|
||||
const initEcharts = (color: string, key: number, name: string) => {
|
||||
return {
|
||||
options: {
|
||||
tooltip: {},
|
||||
@@ -731,7 +731,7 @@ const initEcharts = (color: string, key: number) => {
|
||||
data: [
|
||||
{
|
||||
value: 0,
|
||||
name: 'A相',
|
||||
name: name,
|
||||
itemStyle: {
|
||||
color: color
|
||||
}
|
||||
@@ -744,14 +744,14 @@ const initEcharts = (color: string, key: number) => {
|
||||
}
|
||||
//渲染echarts
|
||||
const init = () => {
|
||||
const url = (localStorage.getItem('WebSocketUrl') || 'ws://192.168.1.68:10407/api/pushMessage/')
|
||||
echartsDataV1.value = initEcharts('#DAA520', 0)
|
||||
echartsDataV2.value = initEcharts('#2E8B57', 0)
|
||||
echartsDataV3.value = initEcharts('#A52a2a', 0)
|
||||
const url = localStorage.getItem('WebSocketUrl') || 'ws://192.168.1.68:10407/api/pushMessage/'
|
||||
echartsDataV1.value = initEcharts('#DAA520', 0, 'A相')
|
||||
echartsDataV2.value = initEcharts('#2E8B57', 0, 'B相')
|
||||
echartsDataV3.value = initEcharts('#A52a2a', 0, 'C相')
|
||||
|
||||
echartsDataA1.value = initEcharts('#DAA520', 1)
|
||||
echartsDataA2.value = initEcharts('#2E8B57', 1)
|
||||
echartsDataA3.value = initEcharts('#A52a2a', 1)
|
||||
echartsDataA1.value = initEcharts('#DAA520', 1, 'A相')
|
||||
echartsDataA2.value = initEcharts('#2E8B57', 1, 'B相')
|
||||
echartsDataA3.value = initEcharts('#A52a2a', 1, 'C相')
|
||||
|
||||
if (!dataSocket.socketServe) {
|
||||
console.error('WebSocket 客户端实例不存在')
|
||||
@@ -764,9 +764,7 @@ const url = (localStorage.getItem('WebSocketUrl') || 'ws://192.168.1.68:10407/ap
|
||||
})
|
||||
}
|
||||
let pids = monitoringPoint.state.pid.split(',')
|
||||
dataSocket.socketServe.connect(
|
||||
`${url}${adminInfo.id},${monitoringPoint.state.lineId},${pids[pids.length - 2]}`
|
||||
)
|
||||
dataSocket.socketServe.connect(`${url}${adminInfo.id},${monitoringPoint.state.lineId},${pids[pids.length - 2]}`)
|
||||
dataSocket.socketServe.registerCallBack('message', (res: any) => {
|
||||
txtContent.value = res.value
|
||||
let data = JSON.parse(res.value)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,170 +1,172 @@
|
||||
<template>
|
||||
<div class="default-main" :style="height">
|
||||
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
||||
<pane :size="size">
|
||||
<PointTree
|
||||
v-if="showTree"
|
||||
:default-expand-all="false"
|
||||
@node-click="handleNodeClick"
|
||||
@init="handleNodeClick"
|
||||
></PointTree>
|
||||
</pane>
|
||||
<pane style="background: #fff" :style="height">
|
||||
<TableHeader ref="TableHeaderRef" datePicker @selectChange="selectChange">
|
||||
<template v-slot:select>
|
||||
<el-form-item label="模板策略">
|
||||
<el-select v-model="Template" @change="changetype" placeholder="请选择模版" value-key="id">
|
||||
<el-option
|
||||
v-for="item in templatePolicy"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="报表类型">
|
||||
<el-input readonly type="text" value="分析报表"></el-input>
|
||||
<!-- <el-select-->
|
||||
<!-- :disabled="true"-->
|
||||
<!-- v-model="reportForm"-->
|
||||
<!-- :popper-append-to-body="false"-->
|
||||
<!-- placeholder="请选择报表类型"-->
|
||||
<!-- >-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="item in reportFormList"-->
|
||||
<!-- :key="item.value"-->
|
||||
<!-- :label="item.label"-->
|
||||
<!-- :value="item.value"-->
|
||||
<!-- ></el-option>-->
|
||||
<!-- </el-select>-->
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">导出excel</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<div class="box">
|
||||
<div id="luckysheet" :style="`height: calc(${tableStore.table.height} + 45px)`"></div>
|
||||
</div>
|
||||
</pane>
|
||||
</splitpanes>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, provide } from 'vue'
|
||||
import 'splitpanes/dist/splitpanes.css'
|
||||
import { Splitpanes, Pane } from 'splitpanes'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import PointTree from '@/components/tree/pqs/pointTree.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel'
|
||||
import { exportExcel } from '@/views/system/reportForms/export.js'
|
||||
|
||||
defineOptions({
|
||||
name: 'harmonic-boot/xieboReport'
|
||||
})
|
||||
const showTree = ref(false)
|
||||
const height = mainHeight(20)
|
||||
const size = ref(0)
|
||||
const dictData = useDictData()
|
||||
const TableHeaderRef = ref()
|
||||
const dotList: any = ref({})
|
||||
const Template: any = ref({})
|
||||
const reportForm: any = ref('')
|
||||
|
||||
const templatePolicy: any = ref([])
|
||||
const reportFormList: any = ref([
|
||||
{
|
||||
value: '1',
|
||||
label: '分析报表'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '统计报表'
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '自定义报表'
|
||||
}
|
||||
])
|
||||
const tableStore = new TableStore({
|
||||
url: '/harmonic-boot/customReport/getCustomReport',
|
||||
method: 'POST',
|
||||
column: [],
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.tempId = Template.value.id
|
||||
tableStore.table.params.lineId = dotList.value.id
|
||||
},
|
||||
loadCallback: () => {
|
||||
tableStore.table.data.forEach((item: any) => {
|
||||
item.data1 ? (item.data = JSON.parse(item.data1)) : ''
|
||||
item.celldata.forEach((k: any) => {
|
||||
item.data[k.r][k.c].v ? (item.data[k.r][k.c] = k.v) : ''
|
||||
})
|
||||
})
|
||||
console.log(tableStore.table.data)
|
||||
setTimeout(() => {
|
||||
luckysheet.create({
|
||||
container: 'luckysheet',
|
||||
title: '', // 表 头名
|
||||
lang: 'zh', // 中文
|
||||
showtoolbar: false, // 是否显示工具栏
|
||||
showinfobar: false, // 是否显示顶部信息栏
|
||||
showsheetbar: true, // 是否显示底部sheet按钮
|
||||
data: tableStore.table.data
|
||||
})
|
||||
}, 10)
|
||||
}
|
||||
})
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
onMounted(() => {
|
||||
const dom = document.getElementById('navigation-splitpanes')
|
||||
if (dom) {
|
||||
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
||||
}
|
||||
})
|
||||
getTemplateByDept({ id: dictData.state.area[0].id })
|
||||
.then((res: any) => {
|
||||
templatePolicy.value = res.data
|
||||
Template.value = res.data[0]
|
||||
reportForm.value = res.data[0]?.reportForm
|
||||
showTree.value = true
|
||||
})
|
||||
.catch((err: any) => {
|
||||
showTree.value = true
|
||||
})
|
||||
const changetype = (val: any) => {
|
||||
reportForm.value = val.reportForm
|
||||
}
|
||||
const selectChange = () => {
|
||||
console.log('🚀 ~ selectChange ~ tableStore.table.data.lnegth :', tableStore.table.data.length)
|
||||
if (tableStore.table.data.length != 0) {
|
||||
setTimeout(() => {
|
||||
luckysheet && luckysheet?.resize()
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
|
||||
const handleNodeClick = (data: any, node: any) => {
|
||||
if (data.level == 6) {
|
||||
dotList.value = data
|
||||
tableStore.index()
|
||||
}
|
||||
}
|
||||
|
||||
const exportEvent = () => {
|
||||
exportExcel(luckysheet.getAllSheets(), '统计报表下载')
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
background: #eaeef1;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="default-main" :style="height">
|
||||
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
|
||||
<pane :size="size">
|
||||
<PointTree
|
||||
v-if="showTree"
|
||||
:default-expand-all="false"
|
||||
@node-click="handleNodeClick"
|
||||
@init="handleNodeClick"
|
||||
></PointTree>
|
||||
</pane>
|
||||
<pane style="background: #fff" :style="height">
|
||||
<TableHeader ref="TableHeaderRef" datePicker @selectChange="selectChange">
|
||||
<template v-slot:select>
|
||||
<el-form-item label="模板策略">
|
||||
<el-select v-model="Template" @change="changetype" placeholder="请选择模版" value-key="id">
|
||||
<el-option
|
||||
v-for="item in templatePolicy"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="报表类型">
|
||||
<el-input readonly type="text" value="分析报表"></el-input>
|
||||
<!-- <el-select-->
|
||||
<!-- :disabled="true"-->
|
||||
<!-- v-model="reportForm"-->
|
||||
<!-- :popper-append-to-body="false"-->
|
||||
<!-- placeholder="请选择报表类型"-->
|
||||
<!-- >-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="item in reportFormList"-->
|
||||
<!-- :key="item.value"-->
|
||||
<!-- :label="item.label"-->
|
||||
<!-- :value="item.value"-->
|
||||
<!-- ></el-option>-->
|
||||
<!-- </el-select>-->
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">导出excel</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<div class="box">
|
||||
<div id="luckysheet" :style="`height: calc(${tableStore.table.height} + 45px)`"></div>
|
||||
</div>
|
||||
</pane>
|
||||
</splitpanes>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, provide } from 'vue'
|
||||
import 'splitpanes/dist/splitpanes.css'
|
||||
import { Splitpanes, Pane } from 'splitpanes'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import PointTree from '@/components/tree/pqs/pointTree.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { getTemplateByDept } from '@/api/harmonic-boot/luckyexcel'
|
||||
import { exportExcel } from '@/views/system/reportForms/export.js'
|
||||
|
||||
defineOptions({
|
||||
name: 'harmonic-boot/xieboReport'
|
||||
})
|
||||
const showTree = ref(false)
|
||||
const height = mainHeight(20)
|
||||
const size = ref(0)
|
||||
const dictData = useDictData()
|
||||
const TableHeaderRef = ref()
|
||||
const dotList: any = ref({})
|
||||
const Template: any = ref({})
|
||||
const reportForm: any = ref('')
|
||||
|
||||
const templatePolicy: any = ref([])
|
||||
const reportFormList: any = ref([
|
||||
{
|
||||
value: '1',
|
||||
label: '分析报表'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '统计报表'
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '自定义报表'
|
||||
}
|
||||
])
|
||||
const tableStore = new TableStore({
|
||||
url: '/harmonic-boot/customReport/getCustomReport',
|
||||
method: 'POST',
|
||||
column: [],
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.tempId = Template.value.id
|
||||
tableStore.table.params.lineId = dotList.value.id
|
||||
},
|
||||
loadCallback: () => {
|
||||
tableStore.table.data.forEach((item: any) => {
|
||||
item.data1 ? (item.data = JSON.parse(item.data1)) : ''
|
||||
item.celldata.forEach((k: any) => {
|
||||
item.data[k.r][k.c].v ? (item.data[k.r][k.c] = k.v) : ''
|
||||
})
|
||||
})
|
||||
console.log(tableStore.table.data)
|
||||
setTimeout(() => {
|
||||
luckysheet.create({
|
||||
container: 'luckysheet',
|
||||
title: '', // 表 头名
|
||||
lang: 'zh', // 中文
|
||||
showtoolbar: false, // 是否显示工具栏
|
||||
showinfobar: false, // 是否显示顶部信息栏
|
||||
showsheetbar: true, // 是否显示底部sheet按钮
|
||||
allowEdit: false, // 禁止所有编辑操作(必填)
|
||||
data: tableStore.table.data
|
||||
})
|
||||
}, 10)
|
||||
}
|
||||
})
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
onMounted(() => {
|
||||
const dom = document.getElementById('navigation-splitpanes')
|
||||
if (dom) {
|
||||
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
||||
}
|
||||
})
|
||||
getTemplateByDept({ id: dictData.state.area[0].id })
|
||||
.then((res: any) => {
|
||||
templatePolicy.value = res.data
|
||||
Template.value = res.data[0]
|
||||
reportForm.value = res.data[0]?.reportForm
|
||||
showTree.value = true
|
||||
})
|
||||
.catch((err: any) => {
|
||||
showTree.value = true
|
||||
})
|
||||
const changetype = (val: any) => {
|
||||
reportForm.value = val.reportForm
|
||||
}
|
||||
const selectChange = () => {
|
||||
console.log('🚀 ~ selectChange ~ tableStore.table.data.lnegth :', tableStore.table.data.length)
|
||||
if (tableStore.table.data.length != 0) {
|
||||
setTimeout(() => {
|
||||
luckysheet && luckysheet?.resize()
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
|
||||
const handleNodeClick = (data: any, node: any) => {
|
||||
if (data.level == 6) {
|
||||
dotList.value = data
|
||||
tableStore.index()
|
||||
}
|
||||
}
|
||||
|
||||
const exportEvent = () => {
|
||||
exportExcel(luckysheet.getAllSheets(), '统计报表下载')
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
background: #eaeef1;
|
||||
}
|
||||
|
||||
.box {
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user