|
@@ -33,16 +33,11 @@
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<div class="block" style="margin-top:5px;" align="right">
|
|
|
- <el-pagination
|
|
|
- @size-change="handleSizerealChange"
|
|
|
- @current-change="getPaginationCurrent"
|
|
|
- :current-page="currentPage"
|
|
|
- :page-sizes="[100, 200, 300, 400]"
|
|
|
- :page-size="pagesizereal"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total="currentPageTotal">
|
|
|
- </el-pagination>
|
|
|
- <!-- <el-pagination
|
|
|
+ <el-pagination @size-change="handleSizerealChange" @current-change="getPaginationCurrent" :current-page="currentPage"
|
|
|
+ :page-sizes="[100, 200, 300, 400]" :page-size="pagesizereal" layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="currentPageTotal">
|
|
|
+ </el-pagination>
|
|
|
+ <!-- <el-pagination
|
|
|
background
|
|
|
layout="prev, pager, next"
|
|
|
:page-size="pagesize"
|
|
@@ -50,8 +45,8 @@
|
|
|
@current-change="getPaginationCurrent"
|
|
|
:total="currentPageTotal">
|
|
|
</el-pagination> -->
|
|
|
- </div>
|
|
|
- <el-dialog title="查看详情" top="50px" :visible.sync="showDialog" width="95%" @closed="(res) =>{ this.form.dateArea=[];this.detailsTableData=[]; }">
|
|
|
+ </div>
|
|
|
+ <el-dialog title="查看详情" top="50px" :visible.sync="showDialog" width="95%" @closed="(res) =>{ this.form.dateArea=[this.fmtDate(new Date(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24))), this.fmtDate(new Date()) ];this.detailsTableData=[]; }">
|
|
|
<div class="searchBox">
|
|
|
<el-form ref="form" :model="form" inline label-width="80px">
|
|
|
<el-form-item label="点名:">
|
|
@@ -70,17 +65,19 @@
|
|
|
<div class="btnBox">
|
|
|
<el-button type="primary" size="middle" @click="getDetails">查询</el-button>
|
|
|
<el-button type="warning" size="middle" @click="exportExcel('detailsTableData')" v-if="detailsTableData.length">导出</el-button>
|
|
|
+ <el-button type="success" size="middle" @click="renderCharts" v-if="detailsTableData.length">查看折线图</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="tableBox" style="margin-top:0;">
|
|
|
<el-table :data="detailsTableData.slice((currentPage-1)*pagesize,currentPage*pagesize)" align="center"
|
|
|
header-align="center" style="width: 100%" max-height="450" height="450" :fit="true">
|
|
|
<el-table-column type="index" :index="indexMethod" label="序号" width="100"></el-table-column>
|
|
|
- <el-table-column prop="pointId" label="点名" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <!-- <el-table-column prop="pointId" label="点名" :show-overflow-tooltip="true"></el-table-column>
|
|
|
<el-table-column prop="pointName" label="描述" width="400" :show-overflow-tooltip="true"></el-table-column>
|
|
|
<el-table-column prop="timeDate" label="时间戳" width="260"></el-table-column>
|
|
|
- <el-table-column prop="value" label="值" width="300"></el-table-column>
|
|
|
-
|
|
|
+ <el-table-column prop="value" label="值" width="300"></el-table-column> -->
|
|
|
+ <el-table-column prop="timeDate" label="时间戳"></el-table-column>
|
|
|
+ <el-table-column prop="value" label="值"></el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<div class="block" style="margin-top:5px;">
|
|
@@ -89,11 +86,15 @@
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog title="查看折线图" top="100px" :visible.sync="chartDialogShow" width="60%">
|
|
|
+ <div id="lineChart" style="width:100%;height:500px;"></div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { Message } from 'element-ui';
|
|
|
+import * as echarts from "echarts";
|
|
|
|
|
|
export default {
|
|
|
data () {
|
|
@@ -104,10 +105,14 @@ export default {
|
|
|
pointId: "",
|
|
|
pointName: "",
|
|
|
autoReq: false,
|
|
|
- dateArea: [],
|
|
|
+ dateArea: [
|
|
|
+ this.fmtDate(new Date(new Date().setTime(new Date().getTime() - 3600 * 1000 * 24))),
|
|
|
+ this.fmtDate(new Date())
|
|
|
+ ],
|
|
|
interval: ""
|
|
|
},
|
|
|
showDialog: false,
|
|
|
+ chartDialogShow: false,
|
|
|
tableData: [],
|
|
|
detailsTableData: [],
|
|
|
autoReqTimmer: null,
|
|
@@ -167,7 +172,7 @@ export default {
|
|
|
this.autoReqTimmer = null;
|
|
|
},
|
|
|
|
|
|
- created(){
|
|
|
+ created () {
|
|
|
let that = this
|
|
|
that.tableid = "JSFW";
|
|
|
that.getTableData();
|
|
@@ -179,7 +184,7 @@ export default {
|
|
|
if (!skipLoading) {
|
|
|
this.$store.commit("loadingStore", true);
|
|
|
}
|
|
|
- this.API.get("datacenter/realtimeData?tableid=" + this.tableid + "&pointId=" + this.form.pointId + "&pointName=" + this.form.pointName+ "&pageNum=" + this.currentPage+ "&pageSize=" + this.pagesizereal).then((res) => {
|
|
|
+ this.API.get("datacenter/realtimeData?tableid=" + this.tableid + "&pointId=" + this.form.pointId + "&pointName=" + this.form.pointName + "&pageNum=" + this.currentPage + "&pageSize=" + this.pagesizereal).then((res) => {
|
|
|
res.data.forEach(ele => {
|
|
|
ele.timeDate = this.fmtDate(new Date(ele.time));
|
|
|
if (ele.value > 0) {
|
|
@@ -215,18 +220,22 @@ export default {
|
|
|
let end = (this.form.dateArea.length ? this.form.dateArea[1] : '');
|
|
|
|
|
|
this.API.get("datacenter/historyData?pointId=" + this.pointId + "&begin=" + begin + "&end=" + end + (this.form.interval ? ("&interval=" + this.form.interval) : '')).then((res) => {
|
|
|
- res.data.forEach(ele => {
|
|
|
- ele.timeDate = this.fmtDate(new Date(ele.time));
|
|
|
- if (ele.value > 0) {
|
|
|
- ele.value = parseFloat(ele.value).toFixed(4);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- this.detailsTableData = res.data || [];
|
|
|
+ if (res.data.length) {
|
|
|
+ res.data.forEach(ele => {
|
|
|
+ ele.timeDate = this.fmtDate(new Date(ele.time));
|
|
|
+ if (ele.value > 0) {
|
|
|
+ ele.value = parseFloat(ele.value).toFixed(4);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.detailsTableData = res.data || [];
|
|
|
+ } else {
|
|
|
+ Message.warning("所选日期区间之内暂无数据,请重试");
|
|
|
+ }
|
|
|
this.$store.commit("loadingStore", false);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
// 初始页currentPage、初始每页数据数pagesize和数据data
|
|
|
handleSizeChange: function (size) {
|
|
|
this.pagesize = size;
|
|
@@ -240,7 +249,6 @@ export default {
|
|
|
this.currentPage = currentPage;
|
|
|
},
|
|
|
|
|
|
-
|
|
|
// 导出excel
|
|
|
exportExcel (tableDataName) {
|
|
|
if (tableDataName === 'tableData') {
|
|
@@ -300,6 +308,49 @@ export default {
|
|
|
this.detailsTableData = [];
|
|
|
},
|
|
|
|
|
|
+ // 渲染折线图
|
|
|
+ renderCharts () {
|
|
|
+ this.chartDialogShow = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+
|
|
|
+ let xAxisData = [];
|
|
|
+ let seriesData = [];
|
|
|
+
|
|
|
+ this.detailsTableData.forEach(ele => {
|
|
|
+ xAxisData.push(ele.timeDate);
|
|
|
+ seriesData.push(ele.value);
|
|
|
+ });
|
|
|
+ document.getElementById("lineChart").removeAttribute("_echarts_instance_");
|
|
|
+ let chartDom = document.getElementById('lineChart');
|
|
|
+ let myChart = echarts.init(chartDom);
|
|
|
+
|
|
|
+ let option = {
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: xAxisData
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value'
|
|
|
+ },
|
|
|
+ series: [{
|
|
|
+ data: seriesData,
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ name: "值"
|
|
|
+ }],
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis',
|
|
|
+ axisPointer: {
|
|
|
+ type: 'cross',
|
|
|
+ label: {
|
|
|
+ backgroundColor: '#6a7985'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ option && myChart.setOption(option);
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
// 格式化日期
|
|
|
fmtDate (date) {
|