style: 时间范围预设可选值
This commit is contained in:
@@ -12,10 +12,12 @@ import {
|
|||||||
parseStrToDate,
|
parseStrToDate,
|
||||||
} from '@/utils/date-utils';
|
} from '@/utils/date-utils';
|
||||||
import { parseSizeFromKBs } from '@/utils/parse-utils';
|
import { parseSizeFromKBs } from '@/utils/parse-utils';
|
||||||
|
import dayjs, { Dayjs } from 'dayjs';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
/**开始结束时间类型 */
|
/**开始结束时间类型 */
|
||||||
type RangePickerType = {
|
type RangePickerType = {
|
||||||
|
ranges: Record<string, [Dayjs, Dayjs]>;
|
||||||
/**全局时间 */
|
/**全局时间 */
|
||||||
all: [string, string];
|
all: [string, string];
|
||||||
/**平均负载 */
|
/**平均负载 */
|
||||||
@@ -32,6 +34,15 @@ type RangePickerType = {
|
|||||||
|
|
||||||
/**开始结束时间 */
|
/**开始结束时间 */
|
||||||
let rangePicker = reactive<RangePickerType>({
|
let rangePicker = reactive<RangePickerType>({
|
||||||
|
ranges: {
|
||||||
|
昨天: [
|
||||||
|
dayjs().subtract(1, 'day').startOf('day'),
|
||||||
|
dayjs().subtract(1, 'day').endOf('day'),
|
||||||
|
],
|
||||||
|
今天: [dayjs().startOf('day'), dayjs()],
|
||||||
|
本周: [dayjs().startOf('week'), dayjs().endOf('week')],
|
||||||
|
本月: [dayjs().startOf('month'), dayjs().endOf('month')],
|
||||||
|
},
|
||||||
all: ['', ''],
|
all: ['', ''],
|
||||||
load: ['', ''],
|
load: ['', ''],
|
||||||
cpu: ['', ''],
|
cpu: ['', ''],
|
||||||
@@ -425,6 +436,7 @@ onMounted(() => {
|
|||||||
format="YYYY-MM-DD HH:mm:ss"
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
show-time
|
show-time
|
||||||
:placeholder="['开始时间', '结束时间']"
|
:placeholder="['开始时间', '结束时间']"
|
||||||
|
:ranges="rangePicker.ranges"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
></a-range-picker>
|
></a-range-picker>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|||||||
Reference in New Issue
Block a user