|
@ -41,10 +41,10 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup> |
|
|
<script setup> |
|
|
|
|
|
import { exportHistory } from 'apis'; |
|
|
|
|
|
import dayjs from 'dayjs'; |
|
|
import { computed, defineEmits, defineProps, reactive, ref, watch } from 'vue'; |
|
|
import { computed, defineEmits, defineProps, reactive, ref, watch } from 'vue'; |
|
|
import { useStore } from 'vuex'; |
|
|
import { useStore } from 'vuex'; |
|
|
import dayjs from 'dayjs'; |
|
|
|
|
|
import { exportHistory } from 'apis'; |
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['search']); |
|
|
const emit = defineEmits(['search']); |
|
|
const searchDevice = reactive({ |
|
|
const searchDevice = reactive({ |
|
@ -65,10 +65,11 @@ defineProps({ |
|
|
|
|
|
|
|
|
// 监听currentDeviceId |
|
|
// 监听currentDeviceId |
|
|
watch( |
|
|
watch( |
|
|
() => currentDeviceId.value, |
|
|
[searchDeviceForm, currentDeviceId], |
|
|
newValue => { |
|
|
([newForm, newDeviceId]) => { |
|
|
if (newValue) { |
|
|
if (newDeviceId && newForm) { |
|
|
searchDevice.deviceId !== newValue && (searchDevice.deviceId = newValue); |
|
|
searchDevice.deviceId !== newDeviceId && (searchDevice.deviceId = newDeviceId); |
|
|
|
|
|
onSubmit(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ immediate: true }, |
|
|
{ immediate: true }, |
|
@ -99,14 +100,14 @@ function generateParams() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 提交 |
|
|
// 提交 |
|
|
const onSubmit = () => { |
|
|
function onSubmit() { |
|
|
searchDeviceForm.value.validate(valid => { |
|
|
searchDeviceForm.value.validate(valid => { |
|
|
if (valid) { |
|
|
if (valid) { |
|
|
const params = generateParams(); |
|
|
const params = generateParams(); |
|
|
emit('search', params); |
|
|
emit('search', params); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
// 导出 |
|
|
// 导出 |
|
|
async function onExport() { |
|
|
async function onExport() { |
|
@ -115,7 +116,7 @@ async function onExport() { |
|
|
const params = generateParams(); |
|
|
const params = generateParams(); |
|
|
params.sort = [ |
|
|
params.sort = [ |
|
|
{ |
|
|
{ |
|
|
col: 'gathered_at', |
|
|
col: 'time', |
|
|
order: 'DESC', |
|
|
order: 'DESC', |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|