|
@@ -46,7 +46,7 @@
|
|
|
:total="currentPageTotal">
|
|
|
</el-pagination> -->
|
|
|
</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=[]; }">
|
|
|
+ <el-dialog title="查看详情" top="50px" :modal-append-to-body="false" :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="点名:">
|
|
@@ -180,21 +180,29 @@ export default {
|
|
|
|
|
|
methods: {
|
|
|
// 获取表格数据
|
|
|
- getTableData (skipLoading) {
|
|
|
- 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) => {
|
|
|
- res.data.forEach(ele => {
|
|
|
- ele.timeDate = this.fmtDate(new Date(ele.time));
|
|
|
- if (ele.value > 0) {
|
|
|
- ele.value = parseFloat(ele.value).toFixed(4);
|
|
|
- }
|
|
|
- });
|
|
|
- this.tableData = res.data || [];
|
|
|
- this.currentPageTotal = res.count || [];
|
|
|
- if (!skipLoading) {
|
|
|
- this.$store.commit("loadingStore", false);
|
|
|
+ getTableData (showLoading) {
|
|
|
+ let that = this;
|
|
|
+ that.API.requestData({
|
|
|
+ showLoading, // 请求是否显示加载中遮罩层,默认 false ,可缺省
|
|
|
+ baseURL: "http://10.155.32.4:8031/",
|
|
|
+ subUrl: "datacenter/realtimeData", // 请求接口地址,必传项
|
|
|
+ timeout: 10000, // 请求超时时间,默认 3s ,可缺省
|
|
|
+ data: {
|
|
|
+ tableid: that.tableid || "JSFW",
|
|
|
+ pointId: that.form.pointId,
|
|
|
+ pointName: that.form.pointName,
|
|
|
+ pageNum: that.currentPage,
|
|
|
+ pageSize: that.pagesizereal
|
|
|
+ },
|
|
|
+ success (res) {
|
|
|
+ res.data.forEach(ele => {
|
|
|
+ ele.timeDate = that.fmtDate(new Date(ele.time));
|
|
|
+ if (ele.value > 0) {
|
|
|
+ ele.value = parseFloat(ele.value).toFixed(4);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ that.tableData = res.data || [];
|
|
|
+ that.currentPageTotal = res.count || [];
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -212,26 +220,38 @@ export default {
|
|
|
|
|
|
// 获取详情
|
|
|
getDetails () {
|
|
|
- if (!this.form.dateArea || !this.form.dateArea.length) {
|
|
|
+ let that = this;
|
|
|
+ if (!that.form.dateArea || !that.form.dateArea.length) {
|
|
|
Message.error("请先选择要查询的日期区间后再试");
|
|
|
} else {
|
|
|
- this.$store.commit("loadingStore", true);
|
|
|
- let begin = (this.form.dateArea.length ? this.form.dateArea[0] : '');
|
|
|
- let end = (this.form.dateArea.length ? this.form.dateArea[1] : '');
|
|
|
+ let begin = (that.form.dateArea.length ? that.form.dateArea[0] : '');
|
|
|
+ let end = (that.form.dateArea.length ? that.form.dateArea[1] : '');
|
|
|
|
|
|
- this.API.get("datacenter/historyData?pointId=" + this.pointId + "&begin=" + begin + "&end=" + end + (this.form.interval ? ("&interval=" + this.form.interval) : '')).then((res) => {
|
|
|
- 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("所选日期区间之内暂无数据,请重试");
|
|
|
+ let data = {};
|
|
|
+ data.pointId = that.pointId;
|
|
|
+ data.begin = begin;
|
|
|
+ data.end = end;
|
|
|
+ if (that.form.interval) data.interval = that.form.interval;
|
|
|
+
|
|
|
+ that.API.requestData({
|
|
|
+ showLoading: true, // 请求是否显示加载中遮罩层,默认 false ,可缺省
|
|
|
+ baseURL: "http://10.155.32.4:8031/",
|
|
|
+ subUrl: "datacenter/historyData", // 请求接口地址,必传项
|
|
|
+ timeout: 10000, // 请求超时时间,默认 3s ,可缺省
|
|
|
+ data,
|
|
|
+ success (res) {
|
|
|
+ if (res.data.length) {
|
|
|
+ res.data.forEach(ele => {
|
|
|
+ ele.timeDate = that.fmtDate(new Date(ele.time));
|
|
|
+ if (ele.value > 0) {
|
|
|
+ ele.value = parseFloat(ele.value).toFixed(4);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ that.detailsTableData = res.data || [];
|
|
|
+ } else {
|
|
|
+ Message.warning("所选日期区间之内暂无数据,请重试");
|
|
|
+ }
|
|
|
}
|
|
|
- this.$store.commit("loadingStore", false);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -255,13 +275,26 @@ export default {
|
|
|
let tableid = this.tableid;
|
|
|
let pointId = this.form.pointId || '';
|
|
|
let pointName = this.form.pointName || '';
|
|
|
- this.API.get("datacenter/realtimeExport?tableid=" + tableid + "&pointId=" + pointId + "&pointName=" + pointName).then(res => {
|
|
|
- const { export_json_to_excel } = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径
|
|
|
- const tHeader = ['点名', '描述']; // 上面设置Excel的表格第一行的标题
|
|
|
- const filterVal = ['id', 'name']; // 上面的index、nickName、name是tableData里对象的属性key值
|
|
|
- const list = res.data; //把要导出的数据tableData存到list
|
|
|
- const data = this.formatJson(filterVal, list);
|
|
|
- export_json_to_excel(tHeader, data, '导出的Excel'); // 最后一个是表名字
|
|
|
+
|
|
|
+ let that = this;
|
|
|
+ that.API.requestData({
|
|
|
+ showLoading, // 请求是否显示加载中遮罩层,默认 false ,可缺省
|
|
|
+ baseURL: "http://10.155.32.4:8031/",
|
|
|
+ subUrl: "datacenter/realtimeExport", // 请求接口地址,必传项
|
|
|
+ timeout: 10000, // 请求超时时间,默认 3s ,可缺省
|
|
|
+ data: {
|
|
|
+ tableid,
|
|
|
+ pointId,
|
|
|
+ pointName,
|
|
|
+ },
|
|
|
+ success (res) {
|
|
|
+ const { export_json_to_excel } = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径
|
|
|
+ const tHeader = ['点名', '描述']; // 上面设置Excel的表格第一行的标题
|
|
|
+ const filterVal = ['id', 'name']; // 上面的index、nickName、name是tableData里对象的属性key值
|
|
|
+ const list = res.data; //把要导出的数据tableData存到list
|
|
|
+ const data = that.formatJson(filterVal, list);
|
|
|
+ export_json_to_excel(tHeader, data, '导出的Excel'); // 最后一个是表名字
|
|
|
+ }
|
|
|
});
|
|
|
} else {
|
|
|
const { export_json_to_excel } = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径
|