From 4eeced60bf81bab62ec004c5b4877cf90765f8f1 Mon Sep 17 00:00:00 2001
From: wally <18603454788@163.com>
Date: Mon, 15 Nov 2021 22:19:02 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9C=AC=E5=9C=B0=E6=95=B0?=
=?UTF-8?q?=E6=8D=AE=E7=9A=84=E4=B8=8B=E5=8F=91=E5=91=BD=E4=BB=A4=E7=A7=BB?=
=?UTF-8?q?=E5=88=B0=E8=AE=BE=E5=A4=87=E6=95=B0=E6=8D=AE=E4=B8=AD,?=
=?UTF-8?q?=E5=8F=AA=E6=98=AF=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
功能还没改
---
.../history/{data-report.vue => device.vue} | 43 ++++++++-------
.../history/{data-history.vue => local.vue} | 55 +++++--------------
src/components/history/search-bar-data.vue | 49 +++++++++++------
src/components/statistical/search-bar.vue | 4 --
src/views/history.vue | 4 +-
5 files changed, 71 insertions(+), 84 deletions(-)
rename src/components/history/{data-report.vue => device.vue} (82%)
rename src/components/history/{data-history.vue => local.vue} (80%)
diff --git a/src/components/history/data-report.vue b/src/components/history/device.vue
similarity index 82%
rename from src/components/history/data-report.vue
rename to src/components/history/device.vue
index 56a0521..a881511 100644
--- a/src/components/history/data-report.vue
+++ b/src/components/history/device.vue
@@ -1,10 +1,10 @@
-
+
-
-
-
-
-
-
{{ formatTime(+scope.row.time) }}
@@ -135,22 +129,29 @@ function formatTime(time) {
{{ formatTime(+scope.row.createdAt) }}
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{
getData();
};
-/**
- * 发送查询指令
- * @param {string} dataType ('data', 'event')
- */
-async function onSend(dataType) {
- try {
- const { date, deviceId } = search.value;
- const params = {
- deviceId,
- type: dataType,
- };
- // eslint-disable-next-line prefer-destructuring
- date && date[0] && (params.startTime = date[0]);
- // eslint-disable-next-line prefer-destructuring
- date && date[1] && (params.endTime = date[1]);
- await sendCommand(params);
- ElMessage.success('指令发送成功');
- } catch (e) {
- ElMessage.error('指令发送失败');
- }
-}
-
/**
* 格式化时间
* @param {number} time 时间戳
@@ -134,27 +112,9 @@ function formatTime(time) {
-
- 发送查询指令(历史数据)
- 发送查询指令(历史事件)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ formatTime(+scope.row.time) }}
@@ -165,6 +125,19 @@ function formatTime(time) {
{{ formatTime(+scope.row.createdAt) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
@@ -21,9 +14,13 @@
-
+
-
+
+ 查询历史数据
+ 查询历史事件
+
+
查询
@@ -43,12 +40,12 @@ import { computed, defineEmits, defineProps, reactive, ref, watch } from 'vue';
import { useStore } from 'vuex';
import dayjs from 'dayjs';
import { exportHistory } from 'apis';
+import { ElMessage } from 'element-plus';
const emit = defineEmits(['search']);
const searchDevice = reactive({
deviceId: '',
date: ['', new Date()],
- dataType: 'ReportHistoryData',
});
const searchDeviceForm = ref(null); // form
const store = useStore();
@@ -58,8 +55,8 @@ const loadingExport = ref(false);
defineProps({
showExport: Boolean,
- showTypeSelect: Boolean,
loadingSearch: Boolean,
+ showCommand: Boolean,
});
// 监听currentDeviceId
@@ -79,21 +76,18 @@ const change = e => {
// 生成查询参数
function generateParams() {
- const { deviceId, date, dataType } = searchDevice;
+ const { deviceId, date } = searchDevice;
let params = {
deviceId,
date,
- dataType,
};
if (date) {
const start = +dayjs(date[0]).format('x');
const end = +dayjs(date[1]).format('x');
- const daterange = [start, end];
params = {
deviceId,
- date: daterange,
- dataType,
+ date: [start, end],
};
}
@@ -123,4 +117,27 @@ async function onExport() {
throw new Error(error);
}
}
+
+/**
+ * 发送查询指令
+ * @param {string} dataType ('data', 'event')
+ */
+async function onSend(dataType) {
+ try {
+ console.log(dataType);
+ // const { date, deviceId } = props.search.value;
+ // const params = {
+ // deviceId,
+ // type: dataType,
+ // };
+ // // eslint-disable-next-line prefer-destructuring
+ // date && date[0] && (params.startTime = date[0]);
+ // // eslint-disable-next-line prefer-destructuring
+ // date && date[1] && (params.endTime = date[1]);
+ // await sendCommand(params);
+ // ElMessage.success('指令发送成功');
+ } catch (e) {
+ ElMessage.error('指令发送失败');
+ }
+}
diff --git a/src/components/statistical/search-bar.vue b/src/components/statistical/search-bar.vue
index 49977ff..3523ab6 100644
--- a/src/components/statistical/search-bar.vue
+++ b/src/components/statistical/search-bar.vue
@@ -38,16 +38,12 @@
-
-