改为时间戳且加上快捷时间选择

This commit is contained in:
lai
2024-11-07 14:09:26 +08:00
parent 6326f46bf2
commit 5ddf83d1fd
3 changed files with 29 additions and 11 deletions

View File

@@ -42,6 +42,7 @@ import saveAs from 'file-saver';
import { generateColorRGBA } from '@/utils/generate-utils';
import { OptionsType, WS } from '@/plugins/ws-websocket';
import { useRoute } from 'vue-router';
import dayjs, { Dayjs } from 'dayjs';
const neInfoStore = useNeInfoStore();
const route = useRoute();
const { t, currentLocale } = useI18n();
@@ -77,6 +78,19 @@ let neCascaderOptions = ref<Record<string, any>[]>([]);
/**记录开始结束时间 */
let queryRangePicker = ref<[string, string]>(['', '']);
/**时间选择 */
let ranges = ref<Record<string, [Dayjs, Dayjs]>>({
[t('views.perfManage.customTarget.sixHoursAgo')]: [
dayjs().subtract(6, 'hours'),
dayjs(),
],
[t('views.perfManage.customTarget.threeHoursAgo')]: [
dayjs().subtract(3, 'hours'),
dayjs(),
],
[t('views.monitor.monitor.today')]: [dayjs().startOf('day'), dayjs()],
});
/**表格字段列 */
let tableColumns = ref<any[]>([]);
@@ -260,12 +274,14 @@ function fnGetListTitle() {
tableColumns.value = [];
tableColumnsDnd.value = [];
fnRanderChartData();
return false;
return false;
}
tableColumns.value = [];
const columns: any[] = [];
for (const item of res.data) {
const kpiDisplay = item[`unit`]? item[`title`]+ `(${item['unit']})`:item[`title`];
const kpiDisplay = item[`unit`]
? item[`title`] + `(${item['unit']})`
: item[`title`];
const kpiValue = item[`kpiId`];
columns.push({
title: kpiDisplay,
@@ -626,9 +642,9 @@ onMounted(() => {
const now = new Date();
now.setMinutes(0, 0, 0);
queryRangePicker.value[0] = parseDateToStr(now.getTime());
queryRangePicker.value[0] = `${now.getTime()}`;
now.setMinutes(59, 59, 59);
queryRangePicker.value[1] = parseDateToStr(now.getTime());
queryRangePicker.value[1] = `${now.getTime()}`;
fnGetListTitle();
// 绘图
fnRanderChart();
@@ -658,10 +674,7 @@ onBeforeUnmount(() => {
<a-form :model="queryParams" name="queryParamsFrom" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item
name="neType"
:label="t('views.ne.common.neType')"
>
<a-form-item name="neType" :label="t('views.ne.common.neType')">
<a-cascader
v-model:value="state.neType"
:options="neCascaderOptions"
@@ -681,7 +694,8 @@ onBeforeUnmount(() => {
:allow-clear="false"
:show-time="{ format: 'HH:mm:ss' }"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
value-format="x"
:ranges="ranges"
style="width: 100%"
></a-range-picker>
</a-form-item>