|
@@ -415,6 +415,7 @@ export default {
|
|
|
},
|
|
|
//查询历史数据 getDeviceHistory
|
|
|
checkHistory() {
|
|
|
+ this.historyData = []; // 清空历史数据
|
|
|
if (this.stationType !== "redis") {
|
|
|
this.getHistoryData();
|
|
|
} else {
|
|
@@ -432,7 +433,6 @@ export default {
|
|
|
pageSize: 10,
|
|
|
strtype: this.TabCur,
|
|
|
};
|
|
|
- console.log(params, "params");
|
|
|
new Promise((resolve, reject) => {
|
|
|
api
|
|
|
.getDeviceHistory(params)
|
|
@@ -465,34 +465,33 @@ export default {
|
|
|
pageSize: 10,
|
|
|
strtype: this.TabCur + "*",
|
|
|
};
|
|
|
- new Promise((resolve, reject) => {
|
|
|
- api
|
|
|
- .getDeviceHistory2(params)
|
|
|
- .then((response) => {
|
|
|
- if (response.data.code == 200) {
|
|
|
- const result = response.data?.result || {};
|
|
|
- this.historyData = Array.isArray(result.records)
|
|
|
- ? result.records
|
|
|
- : [];
|
|
|
- // this.pageNo = response.data.result.datalist.current;
|
|
|
- uni.showModal({
|
|
|
- title: "数据提示",
|
|
|
- content: this.historyData.length
|
|
|
- ? `共${
|
|
|
- this.historyData.length
|
|
|
- }条数据:\n${this.historyData.join("\n\n")}`
|
|
|
- : "暂无历史数据",
|
|
|
- showCancel: false,
|
|
|
- confirmText: "知道了",
|
|
|
- });
|
|
|
- } else {
|
|
|
- resolve(response);
|
|
|
+ api
|
|
|
+ .getDeviceHistory2(params)
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.code === 200) {
|
|
|
+ const result1 = response.data.result;
|
|
|
+ if (result1.records.length != 0) {
|
|
|
+ this.historyData = result1.records;
|
|
|
}
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- reject(error);
|
|
|
- });
|
|
|
- });
|
|
|
+ // this.pageNo = response1.data.result.datalist.current;
|
|
|
+ uni.showModal({
|
|
|
+ title: "数据提示",
|
|
|
+ content: this.historyData.length
|
|
|
+ ? `共${
|
|
|
+ this.historyData.length
|
|
|
+ }条数据:\n${this.historyData.join("\n\n")}`
|
|
|
+ : "暂无历史数据",
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: "知道了",
|
|
|
+ });
|
|
|
+ return this.historyData;
|
|
|
+ } else {
|
|
|
+ reject(new Error(`请求失败,错误码:${response.data.code}`));
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ reject(error);
|
|
|
+ });
|
|
|
},
|
|
|
async loadMoreData() {
|
|
|
if (this.loading || !this.hasMoreData) return;
|