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 @@
-
-