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

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

@@ -1065,6 +1065,8 @@ export default {
expression:'Expression',
description:' Description',
kpiSet:' Statistical Settings',
sixHoursAgo:'Six hours ago',
threeHoursAgo:'Three hours ago.',
delCustomTip:'Confirm deletion of data item with record number {num}?',
delCustom:' Successfully delete record number {num} custom indicator',
addCustom:' Add custom indicator',

View File

@@ -1065,6 +1065,8 @@ export default {
expression:'计算公式',
description:'描述',
kpiSet:'统计设置',
sixHoursAgo:'6小时前',
threeHoursAgo:'3小时前',
delCustomTip:'确认删除记录编号为 {num} 的数据项?',
delCustom:'成功删除记录编号为 {num} 自定义指标',
addCustom:'添加自定义指标',
@@ -1337,8 +1339,8 @@ export default {
filter: "全局过滤",
startTime: '开始时间',
endTime: '结束时间',
today: '天',
yesterday: '天',
today: '天',
yesterday: '天',
week: '本周',
month: '本月',
avgLoad: '平均负载',

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>