This commit is contained in:
lai
2023-11-10 15:02:53 +08:00
17 changed files with 441 additions and 171 deletions

View File

@@ -17,6 +17,7 @@ const { t } = useI18n();
/**开始结束时间类型 */
type RangePickerType = {
placeholder: [string, string];
ranges: Record<string, [Dayjs, Dayjs]>;
/**全局时间 */
all: [string, string];
@@ -34,14 +35,24 @@ type RangePickerType = {
/**开始结束时间 */
let rangePicker = reactive<RangePickerType>({
placeholder: [
t('views.monitor.monitor.startTime'),
t('views.monitor.monitor.endTime'),
],
ranges: {
昨天: [
[t('views.monitor.monitor.today')]: [
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')],
[t('views.monitor.monitor.yesterday')]: [dayjs().startOf('day'), dayjs()],
[t('views.monitor.monitor.week')]: [
dayjs().startOf('week'),
dayjs().endOf('week'),
],
[t('views.monitor.monitor.month')]: [
dayjs().startOf('month'),
dayjs().endOf('month'),
],
},
all: ['', ''],
load: ['', ''],
@@ -427,7 +438,10 @@ onMounted(() => {
<a-form name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="10" :md="10" :xs="24">
<a-form-item label="全局过滤" name="neTypeSelect">
<a-form-item
:label="t('views.monitor.monitor.filter')"
name="neTypeSelect"
>
<a-range-picker
v-model:value="rangePicker.all"
:allow-clear="false"
@@ -435,7 +449,7 @@ onMounted(() => {
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm:ss"
show-time
:placeholder="['开始时间', '结束时间']"
:placeholder="rangePicker.placeholder"
:ranges="rangePicker.ranges"
style="width: 100%"
></a-range-picker>
@@ -469,7 +483,7 @@ onMounted(() => {
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm:ss"
show-time
:placeholder="['开始时间', '结束时间']"
:placeholder="rangePicker.placeholder"
style="width: 100%"
@change="(_:any, d:[string,string]) => fnGetQuery('load', d)"
></a-range-picker>
@@ -499,7 +513,7 @@ onMounted(() => {
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm:ss"
show-time
:placeholder="['开始时间', '结束时间']"
:placeholder="rangePicker.placeholder"
style="width: 100%"
@change="(_:any, d:[string,string]) => fnGetQuery('cpu', d)"
></a-range-picker>
@@ -527,7 +541,7 @@ onMounted(() => {
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm:ss"
show-time
:placeholder="['开始时间', '结束时间']"
:placeholder="rangePicker.placeholder"
style="width: 100%"
@change="(_:any, d:[string,string]) => fnGetQuery('memory', d)"
></a-range-picker>
@@ -557,7 +571,7 @@ onMounted(() => {
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm:ss"
show-time
:placeholder="['开始时间', '结束时间']"
:placeholder="rangePicker.placeholder"
style="width: 100%"
@change="fnGetQueryIO"
></a-range-picker>
@@ -585,7 +599,7 @@ onMounted(() => {
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm:ss"
show-time
:placeholder="['开始时间', '结束时间']"
:placeholder="rangePicker.placeholder"
style="width: 100%"
@change="fnGetQueryNetwork"
></a-range-picker>