|
|
@@ -131,35 +131,35 @@ const ChangeRollingRangeRadio = (val: any) => {
|
|
|
// 选择fixed range默认值
|
|
|
const changeFixedRange = (val: any) => {
|
|
|
if (val == 'This Month') {
|
|
|
- startDate.value = dayjs().startOf('month').format('YYYY.MM.DD')
|
|
|
- endDate.value = dayjs().endOf('month').format('YYYY.MM.DD')
|
|
|
+ startDate.value = dayjs().startOf('month').format('MM/DD/YYYY')
|
|
|
+ endDate.value = dayjs().endOf('month').format('MM/DD/YYYY')
|
|
|
} else if (val == 'Last Month') {
|
|
|
- startDate.value = dayjs().subtract(1, 'month').startOf('month').format('YYYY.MM.DD')
|
|
|
- endDate.value = dayjs().subtract(1, 'month').endOf('month').format('YYYY.MM.DD')
|
|
|
+ startDate.value = dayjs().subtract(1, 'month').startOf('month').format('MM/DD/YYYY')
|
|
|
+ endDate.value = dayjs().subtract(1, 'month').endOf('month').format('MM/DD/YYYY')
|
|
|
} else if (val == 'This Quarter') {
|
|
|
startDate.value = dayjs()
|
|
|
.month(Math.floor(dayjs().month() / 3) * 3)
|
|
|
.startOf('month')
|
|
|
- .format('YYYY.MM.DD')
|
|
|
+ .format('MM/DD/YYYY')
|
|
|
endDate.value = dayjs()
|
|
|
.month(Math.floor(dayjs().month() / 3) * 3 + 2)
|
|
|
.endOf('month')
|
|
|
- .format('YYYY.MM.DD')
|
|
|
+ .format('MM/DD/YYYY')
|
|
|
} else if (val == 'Last Quarter') {
|
|
|
startDate.value = dayjs()
|
|
|
.month(Math.floor(dayjs().month() / 3) * 3 - 3)
|
|
|
.startOf('month')
|
|
|
- .format('YYYY.MM.DD')
|
|
|
+ .format('MM/DD/YYYY')
|
|
|
endDate.value = dayjs()
|
|
|
.month(Math.floor(dayjs().month() / 3) * 3 - 1)
|
|
|
.endOf('month')
|
|
|
- .format('YYYY.MM.DD')
|
|
|
+ .format('MM/DD/YYYY')
|
|
|
} else if (val == 'This Year') {
|
|
|
- startDate.value = dayjs().startOf('year').format('YYYY.MM.DD')
|
|
|
- endDate.value = dayjs().endOf('year').format('YYYY.MM.DD')
|
|
|
+ startDate.value = dayjs().startOf('year').format('MM/DD/YYYY')
|
|
|
+ endDate.value = dayjs().endOf('year').format('MM/DD/YYYY')
|
|
|
} else if (val == 'Last Year') {
|
|
|
- startDate.value = dayjs().subtract(1, 'year').startOf('year').format('YYYY.MM.DD')
|
|
|
- endDate.value = dayjs().subtract(1, 'year').endOf('year').format('YYYY.MM.DD')
|
|
|
+ startDate.value = dayjs().subtract(1, 'year').startOf('year').format('MM/DD/YYYY')
|
|
|
+ endDate.value = dayjs().subtract(1, 'year').endOf('year').format('MM/DD/YYYY')
|
|
|
}
|
|
|
emits('changeTimeRange', {
|
|
|
startDate: startDate.value,
|
|
|
@@ -171,6 +171,33 @@ const changeFixedRange = (val: any) => {
|
|
|
fixedRangeRadio.value = ''
|
|
|
}, 300)
|
|
|
}
|
|
|
+
|
|
|
+const getData = () => {
|
|
|
+ if (!fieldType.value || !type.value) {
|
|
|
+ ElMessage.error('Please select the Report Data Time Range')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ let startValue: any = ''
|
|
|
+ let endValue: any = ''
|
|
|
+ if (type.value === 'dynamic_rolling') {
|
|
|
+ startValue = clampedValueStart.value
|
|
|
+ endValue = clampedValueEnd.value
|
|
|
+ } else if (type.value === 'fixed') {
|
|
|
+ startValue = startDate.value
|
|
|
+ endValue = endDate.value
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ type: type.value,
|
|
|
+ fieldType: fieldType.value,
|
|
|
+ startValue,
|
|
|
+ endValue
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+defineExpose({
|
|
|
+ getData
|
|
|
+})
|
|
|
</script>
|
|
|
<template>
|
|
|
<div style="padding: 8px 16px 16px 16px">
|
|
|
@@ -178,7 +205,12 @@ const changeFixedRange = (val: any) => {
|
|
|
<span class="stars_red">*</span>
|
|
|
Data Time Reference Field Selection
|
|
|
</div>
|
|
|
- <el-select class="select_time" v-model="fieldType" placeholder="Please select...">
|
|
|
+ <el-select
|
|
|
+ class="select_time"
|
|
|
+ v-model="fieldType"
|
|
|
+ @change="changeTime(type)"
|
|
|
+ placeholder="Please select..."
|
|
|
+ >
|
|
|
<el-option
|
|
|
v-for="item in dataTimeoptions"
|
|
|
:key="item.value"
|
|
|
@@ -288,36 +320,30 @@ const changeFixedRange = (val: any) => {
|
|
|
<el-radio-button label="Customize" value="Customize" />
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
- <div style="display: flex">
|
|
|
+ <div style="display: flex; padding-bottom: 2px">
|
|
|
<div style="margin-right: 9px; width: 50%">
|
|
|
<div class="date_text">Start Date</div>
|
|
|
- <a-date-picker
|
|
|
+ <el-date-picker
|
|
|
+ v-model="startDate"
|
|
|
+ type="date"
|
|
|
+ class="date-picker"
|
|
|
+ placeholder="Pick a Date"
|
|
|
:format="userStore.dateFormat"
|
|
|
- valueFormat="YYYY.MM.DD"
|
|
|
- :showToday="false"
|
|
|
+ valueFormat="MM/DD/YYYY"
|
|
|
@change="changeTime('fixed')"
|
|
|
- style="width: 100%"
|
|
|
- v-model:value="startDate"
|
|
|
- >
|
|
|
- <template #suffixIcon>
|
|
|
- <span class="font_family icon-icon_date_b"></span>
|
|
|
- </template>
|
|
|
- </a-date-picker>
|
|
|
+ />
|
|
|
</div>
|
|
|
<div style="width: 50%">
|
|
|
<div class="date_text">End Date</div>
|
|
|
- <a-date-picker
|
|
|
+ <el-date-picker
|
|
|
+ v-model="endDate"
|
|
|
+ type="date"
|
|
|
+ class="date-picker"
|
|
|
+ placeholder="Pick a Date"
|
|
|
:format="userStore.dateFormat"
|
|
|
- valueFormat="YYYY.MM.DD"
|
|
|
- :showToday="false"
|
|
|
+ valueFormat="MM/DD/YYYY"
|
|
|
@change="changeTime('fixed')"
|
|
|
- style="width: 100%"
|
|
|
- v-model:value="endDate"
|
|
|
- >
|
|
|
- <template #suffixIcon>
|
|
|
- <span class="font_family icon-icon_date_b"></span>
|
|
|
- </template>
|
|
|
- </a-date-picker>
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -475,4 +501,10 @@ const changeFixedRange = (val: any) => {
|
|
|
.date_flex {
|
|
|
flex: 1;
|
|
|
}
|
|
|
+:deep(.date-picker) {
|
|
|
+ width: 100%;
|
|
|
+ .el-input__wrapper {
|
|
|
+ border-radius: 6px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|