2025-06-18 01:01:17 +08:00
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="ssyx-ems-dashboard-editor-container">
|
|
|
|
|
<!-- 6个方块-->
|
2026-02-16 13:41:41 +08:00
|
|
|
<real-time-base-info :display-data="runningDisplayData" :loading="runningHeadLoading" @field-click="handleHeadFieldClick"/>
|
2025-11-25 17:56:12 +08:00
|
|
|
<!-- 时间选择 -->
|
|
|
|
|
<date-range-select ref="dateRangeSelect" @updateDate="updateDate" style="margin-top:20px;"/>
|
2025-06-18 01:01:17 +08:00
|
|
|
<!-- echart图表-->
|
|
|
|
|
<el-row :gutter="32" style="background:#fff;margin:30px 0;">
|
|
|
|
|
<el-col :xs="24" :sm="12" :lg="12">
|
2026-02-15 16:24:29 +08:00
|
|
|
<cnglqx-chart ref='cnglqx' :display-data="runningDisplayData"/>
|
2025-06-18 01:01:17 +08:00
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :lg="12">
|
2026-02-15 16:24:29 +08:00
|
|
|
<pocpjwd-chart ref='pocpjwd' :display-data="runningDisplayData"/>
|
2025-06-18 01:01:17 +08:00
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="32" style="margin:30px 0;">
|
|
|
|
|
<el-col :xs="24" :sm="12" :lg="12">
|
2026-02-15 16:24:29 +08:00
|
|
|
<dcpjsoc-chart ref="dcpjsoc" :display-data="runningDisplayData"/>
|
2025-06-18 01:01:17 +08:00
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :lg="12">
|
2026-02-15 16:24:29 +08:00
|
|
|
<dcpjwd-chart ref="dcpjwd" :display-data="runningDisplayData"/>
|
2025-06-18 01:01:17 +08:00
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
2026-02-16 13:41:41 +08:00
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
:visible.sync="curveDialogVisible"
|
|
|
|
|
:title="curveDialogTitle"
|
|
|
|
|
width="1000px"
|
|
|
|
|
append-to-body
|
|
|
|
|
class="ems-dialog"
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
destroy-on-close
|
|
|
|
|
@opened="handleCurveDialogOpened"
|
|
|
|
|
@closed="handleCurveDialogClosed"
|
|
|
|
|
>
|
|
|
|
|
<div class="curve-tools">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="curveCustomRange"
|
|
|
|
|
type="datetimerange"
|
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
range-separator="至"
|
|
|
|
|
start-placeholder="开始时间"
|
|
|
|
|
end-placeholder="结束时间"
|
|
|
|
|
style="width: 440px"
|
|
|
|
|
/>
|
|
|
|
|
<el-button type="primary" size="mini" :loading="curveLoading" @click="loadCurveData">查询</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-loading="curveLoading" ref="curveChartRef" style="height: 380px;"></div>
|
|
|
|
|
</el-dialog>
|
2025-06-18 01:01:17 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2026-02-16 13:41:41 +08:00
|
|
|
.curve-tools {
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
}
|
2025-06-18 01:01:17 +08:00
|
|
|
</style>
|
|
|
|
|
<script>
|
2026-02-16 13:41:41 +08:00
|
|
|
import * as echarts from "echarts";
|
2025-11-25 17:56:12 +08:00
|
|
|
import DateRangeSelect from '@/components/Ems/DateRangeSelect/index.vue'
|
2025-06-21 23:59:01 +08:00
|
|
|
import RealTimeBaseInfo from "./../RealTimeBaseInfo.vue";
|
2025-06-18 01:01:17 +08:00
|
|
|
import CnglqxChart from './CnglqxChart.vue'
|
|
|
|
|
import PocpjwdChart from './PocpjwdChart.vue'
|
|
|
|
|
import DcpjwdChart from './DcpjwdChart.vue'
|
|
|
|
|
import DcpjsocChart from './DcpjsocChart.vue'
|
2025-07-07 22:10:25 +08:00
|
|
|
import getQuerySiteId from "@/mixins/ems/getQuerySiteId";
|
2026-02-15 16:24:29 +08:00
|
|
|
import {getProjectDisplayData} from '@/api/ems/dzjk'
|
2026-02-16 13:41:41 +08:00
|
|
|
import {getPointConfigCurve} from "@/api/ems/site";
|
2025-09-09 17:51:52 +08:00
|
|
|
import intervalUpdate from "@/mixins/ems/intervalUpdate";
|
2025-06-18 01:01:17 +08:00
|
|
|
|
|
|
|
|
export default {
|
2025-06-25 12:55:58 +08:00
|
|
|
name:'DzjkSbjkSsyx',
|
2025-11-25 17:56:12 +08:00
|
|
|
components:{RealTimeBaseInfo,CnglqxChart,PocpjwdChart,DcpjwdChart,DcpjsocChart,DateRangeSelect},
|
2025-09-09 17:51:52 +08:00
|
|
|
mixins:[getQuerySiteId,intervalUpdate],
|
2025-06-18 01:01:17 +08:00
|
|
|
data() {
|
|
|
|
|
return {
|
2026-02-15 16:24:29 +08:00
|
|
|
runningDisplayData: [], //单站监控项目配置展示数据
|
2025-11-25 17:56:12 +08:00
|
|
|
timeRange:[],
|
2026-02-15 16:24:29 +08:00
|
|
|
isInit:true,
|
|
|
|
|
runningHeadLoading: false,
|
2026-02-16 13:41:41 +08:00
|
|
|
curveDialogVisible: false,
|
|
|
|
|
curveDialogTitle: "点位曲线",
|
|
|
|
|
curveChart: null,
|
|
|
|
|
curveLoading: false,
|
|
|
|
|
curveCustomRange: [],
|
|
|
|
|
curveQuery: {
|
|
|
|
|
siteId: "",
|
|
|
|
|
pointId: "",
|
|
|
|
|
pointType: "data",
|
|
|
|
|
rangeType: "custom",
|
|
|
|
|
startTime: "",
|
|
|
|
|
endTime: "",
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
if (this.curveChart) {
|
|
|
|
|
this.curveChart.dispose();
|
|
|
|
|
this.curveChart = null;
|
2025-06-18 01:01:17 +08:00
|
|
|
}
|
|
|
|
|
},
|
2025-07-07 22:10:25 +08:00
|
|
|
methods:{
|
2026-02-16 13:41:41 +08:00
|
|
|
handleHeadFieldClick(item) {
|
|
|
|
|
const pointId = String(item?.pointId || item?.raw?.dataPoint || "").trim();
|
|
|
|
|
if (!pointId) {
|
|
|
|
|
this.$message.warning("该字段未配置点位,无法查询曲线");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.openCurveDialog({
|
|
|
|
|
pointId,
|
|
|
|
|
title: item?.title || item?.raw?.fieldName || pointId,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
openCurveDialog({pointId, title}) {
|
|
|
|
|
const range = this.getDefaultCurveRange();
|
|
|
|
|
this.curveCustomRange = range;
|
|
|
|
|
this.curveDialogTitle = `点位曲线 - ${title || pointId}`;
|
|
|
|
|
this.curveQuery = {
|
|
|
|
|
siteId: this.siteId,
|
|
|
|
|
pointId,
|
|
|
|
|
pointType: "data",
|
|
|
|
|
rangeType: "custom",
|
|
|
|
|
startTime: range[0],
|
|
|
|
|
endTime: range[1],
|
|
|
|
|
};
|
|
|
|
|
this.curveDialogVisible = true;
|
|
|
|
|
},
|
|
|
|
|
handleCurveDialogOpened() {
|
|
|
|
|
if (!this.curveChart && this.$refs.curveChartRef) {
|
|
|
|
|
this.curveChart = echarts.init(this.$refs.curveChartRef);
|
|
|
|
|
}
|
|
|
|
|
this.loadCurveData();
|
|
|
|
|
},
|
|
|
|
|
handleCurveDialogClosed() {
|
|
|
|
|
if (this.curveChart) {
|
|
|
|
|
this.curveChart.dispose();
|
|
|
|
|
this.curveChart = null;
|
|
|
|
|
}
|
|
|
|
|
this.curveLoading = false;
|
|
|
|
|
},
|
|
|
|
|
getDefaultCurveRange() {
|
|
|
|
|
const end = new Date();
|
|
|
|
|
const start = new Date(end.getTime() - 24 * 60 * 60 * 1000);
|
|
|
|
|
return [this.formatDateTime(start), this.formatDateTime(end)];
|
|
|
|
|
},
|
|
|
|
|
formatDateTime(date) {
|
|
|
|
|
const d = new Date(date);
|
|
|
|
|
const pad = (num) => String(num).padStart(2, "0");
|
|
|
|
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
|
|
|
},
|
|
|
|
|
formatCurveTime(value) {
|
|
|
|
|
if (value === undefined || value === null || value === "") {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
const raw = String(value).trim();
|
|
|
|
|
const normalized = raw
|
|
|
|
|
.replace("T", " ")
|
|
|
|
|
.replace(/\.\d+/, "")
|
|
|
|
|
.replace(/Z$/, "")
|
|
|
|
|
.replace(/([+-]\d{2}:?\d{2})$/, "")
|
|
|
|
|
.trim();
|
|
|
|
|
const matched = normalized.match(/^(\d{4}-\d{2}-\d{2})\s+(\d{2}:\d{2})/);
|
|
|
|
|
if (matched) {
|
|
|
|
|
return `${matched[1]} ${matched[2]}`;
|
|
|
|
|
}
|
|
|
|
|
return normalized.slice(0, 16);
|
|
|
|
|
},
|
|
|
|
|
loadCurveData() {
|
|
|
|
|
if (!this.curveQuery.siteId || !this.curveQuery.pointId) {
|
|
|
|
|
this.$message.warning("点位信息不完整,无法查询曲线");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!this.curveCustomRange || this.curveCustomRange.length !== 2) {
|
|
|
|
|
this.$message.warning("请选择查询时间范围");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.curveQuery.startTime = this.curveCustomRange[0];
|
|
|
|
|
this.curveQuery.endTime = this.curveCustomRange[1];
|
|
|
|
|
const query = {
|
|
|
|
|
siteId: this.curveQuery.siteId,
|
|
|
|
|
pointId: this.curveQuery.pointId,
|
|
|
|
|
pointType: "data",
|
|
|
|
|
rangeType: "custom",
|
|
|
|
|
startTime: this.curveQuery.startTime,
|
|
|
|
|
endTime: this.curveQuery.endTime,
|
|
|
|
|
};
|
|
|
|
|
this.curveLoading = true;
|
|
|
|
|
getPointConfigCurve(query).then((response) => {
|
|
|
|
|
const rows = response?.data || [];
|
|
|
|
|
this.renderCurveChart(rows);
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.renderCurveChart([]);
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
this.curveLoading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
renderCurveChart(rows = []) {
|
|
|
|
|
if (!this.curveChart) return;
|
|
|
|
|
const xData = rows.map(item => this.formatCurveTime(item.dataTime));
|
|
|
|
|
const yData = rows.map(item => item.pointValue);
|
|
|
|
|
this.curveChart.clear();
|
|
|
|
|
this.curveChart.setOption({
|
|
|
|
|
legend: {},
|
|
|
|
|
grid: {
|
|
|
|
|
containLabel: true,
|
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: "axis",
|
|
|
|
|
axisPointer: {
|
|
|
|
|
type: "cross",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
textStyle: {
|
|
|
|
|
color: "#333333",
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: "category",
|
|
|
|
|
data: xData,
|
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
|
|
|
|
type: "value",
|
|
|
|
|
},
|
|
|
|
|
dataZoom: [
|
|
|
|
|
{
|
|
|
|
|
type: "inside",
|
|
|
|
|
start: 0,
|
|
|
|
|
end: 100,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
start: 0,
|
|
|
|
|
end: 100,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
name: this.curveDialogTitle,
|
|
|
|
|
type: "line",
|
|
|
|
|
data: yData,
|
|
|
|
|
connectNulls: true,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
if (!rows.length) {
|
|
|
|
|
this.$message.warning("当前时间范围暂无曲线数据");
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-07-07 22:10:25 +08:00
|
|
|
//6个方块数据
|
|
|
|
|
getRunningHeadData(){
|
2026-02-15 16:24:29 +08:00
|
|
|
this.runningHeadLoading = true
|
|
|
|
|
return getProjectDisplayData(this.siteId).then((displayResponse) => {
|
|
|
|
|
this.runningDisplayData = displayResponse?.data || []
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
this.runningHeadLoading = false
|
2025-07-07 22:10:25 +08:00
|
|
|
})
|
|
|
|
|
},
|
2025-11-25 17:56:12 +08:00
|
|
|
// 更新时间范围 重置图表
|
|
|
|
|
updateDate(data){
|
|
|
|
|
this.timeRange=data
|
|
|
|
|
!this.isInit && this.updateChart()
|
|
|
|
|
this.isInit = false
|
|
|
|
|
},
|
|
|
|
|
updateChart(){
|
|
|
|
|
this.$refs.cnglqx.init(this.siteId,this.timeRange||[])
|
|
|
|
|
this.$refs.pocpjwd.init(this.siteId,this.timeRange||[])
|
|
|
|
|
this.$refs.dcpjsoc.init(this.siteId,this.timeRange||[])
|
|
|
|
|
this.$refs.dcpjwd.init(this.siteId,this.timeRange||[])
|
|
|
|
|
this.updateInterval(this.updateData)
|
|
|
|
|
},
|
2025-09-09 17:51:52 +08:00
|
|
|
updateData(){
|
2026-02-15 16:24:29 +08:00
|
|
|
this.getRunningHeadData().finally(() => {
|
|
|
|
|
this.updateChart()
|
|
|
|
|
})
|
2025-09-09 17:51:52 +08:00
|
|
|
},
|
2025-07-07 22:10:25 +08:00
|
|
|
init(){
|
2025-11-25 17:56:12 +08:00
|
|
|
this.$refs.dateRangeSelect.init(true)
|
2025-07-07 22:10:25 +08:00
|
|
|
this.$nextTick(()=>{
|
2025-09-09 17:51:52 +08:00
|
|
|
this.updateData()
|
2025-07-07 22:10:25 +08:00
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-06-18 01:01:17 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</script>
|