|
@ -1,5 +1,5 @@ |
|
|
<template> |
|
|
<template> |
|
|
<DataSearchBar @search="getDate" /> |
|
|
<DataSearchBar @search="onSearch" /> |
|
|
<IntegralElectric ref="child1" class="mt-4" /> |
|
|
<IntegralElectric ref="child1" class="mt-4" /> |
|
|
<TotalCorrosion ref="child2" class="mt-4" /> |
|
|
<TotalCorrosion ref="child2" class="mt-4" /> |
|
|
<MoistTime ref="child3" class="mt-4" /> |
|
|
<MoistTime ref="child3" class="mt-4" /> |
|
@ -17,6 +17,8 @@ const child1 = ref(null); |
|
|
const child2 = ref(null); |
|
|
const child2 = ref(null); |
|
|
const child3 = ref(null); |
|
|
const child3 = ref(null); |
|
|
|
|
|
|
|
|
|
|
|
const search = ref({}); |
|
|
|
|
|
const page = ref({ page: 2, size: 10 }); |
|
|
let timer = null; |
|
|
let timer = null; |
|
|
const store = useStore(); |
|
|
const store = useStore(); |
|
|
const token = computed(() => store.getters['user/token']); |
|
|
const token = computed(() => store.getters['user/token']); |
|
@ -25,21 +27,22 @@ const corrosionData = computed(() => store.state.statistics.corrosionData); |
|
|
const moistTimeData = computed(() => store.state.statistics.moistTimeData); |
|
|
const moistTimeData = computed(() => store.state.statistics.moistTimeData); |
|
|
const currentDeviceId = computed(() => store.state.device.currentDeviceId); // 正在操作的设备的id |
|
|
const currentDeviceId = computed(() => store.state.device.currentDeviceId); // 正在操作的设备的id |
|
|
|
|
|
|
|
|
// 获取月累计数据 |
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取月累计数据 |
|
|
* 获取月累计数据 |
|
|
* @param {*} deviceId // 站点 设备id |
|
|
* @param {*} deviceId // 站点 设备id |
|
|
* @param {*} date // 年月时间段 |
|
|
* @param {*} date // 年月时间段 |
|
|
* @param {*} sort // 1 -> 按时间正序 -1->按时间倒序 |
|
|
* @param {*} sort // 1 -> 按时间正序 -1->按时间倒序 |
|
|
*/ |
|
|
*/ |
|
|
const getDate = async options => { |
|
|
const getDate = async () => { |
|
|
try { |
|
|
try { |
|
|
if (token) { |
|
|
if (token) { |
|
|
|
|
|
const options = { ...search.value }; |
|
|
|
|
|
const date = options && options.date ? options.date : []; |
|
|
const params = { |
|
|
const params = { |
|
|
deviceId: currentDeviceId.value, |
|
|
search: { deviceId: currentDeviceId.value, date }, |
|
|
date: options && options.date && options.date.length ? options.date : [], |
|
|
page: { page: page.value.page, size: page.value.size }, |
|
|
sort: 1, |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
await store.dispatch('statistics/getMonthsDate', params); |
|
|
await store.dispatch('statistics/getMonthsDate', params); |
|
|
timer && clearTimeout(timer); |
|
|
timer && clearTimeout(timer); |
|
|
timer = null; |
|
|
timer = null; |
|
@ -58,4 +61,13 @@ const getDate = async options => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
getDate(); |
|
|
getDate(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 监听search信息 |
|
|
|
|
|
* @param {object} payload search组件emit的数据 |
|
|
|
|
|
*/ |
|
|
|
|
|
const onSearch = payload => { |
|
|
|
|
|
search.value = { ...payload }; |
|
|
|
|
|
getDate(); |
|
|
|
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|