CN-1658 fix: 根据现有时区调整report所选时间

This commit is contained in:
刘洪洪
2024-05-11 09:41:55 +08:00
parent 881151e50b
commit 530589f47e
2 changed files with 23 additions and 6 deletions

View File

@@ -179,6 +179,7 @@
:format="dateFormat"
prefix-icon=""
type="datetime"
@change="onChangeSchedulerStart"
placeholder=" "
/>
</div>
@@ -193,6 +194,7 @@
:format="dateFormat"
prefix-icon=""
type="datetime"
@change="onChangeSchedulerEnd"
placeholder=" "
/>
</div>
@@ -263,7 +265,7 @@ import { storageKey, report } from '@/utils/constants'
import { api } from '@/utils/api'
import _ from 'lodash'
import axios from 'axios'
import { dateFormat, getMillisecond } from '@/utils/date-util'
import { dateFormat, getMillisecond, millTimestampDiffFromTz } from '@/utils/date-util'
import { ref, getCurrentInstance } from 'vue'
import i18n from '@/i18n'
export default {
@@ -279,10 +281,10 @@ export default {
const startTime = ref('')
const endTime = ref('')
function endTimeChange (val) {
endTime.value = val
endTime.value = val + millTimestampDiffFromTz()
}
function startTimeChang (val) {
startTime.value = val
startTime.value = val + millTimestampDiffFromTz()
}
const endDisabledDate = (time) => {
if (time.getTime() > new Date()) {
@@ -352,12 +354,24 @@ export default {
{ validator: paramValidator, message: i18n.global.t('validate.required'), trigger: 'blur' }
]
}
const mySchedulerStart = ref('')
const mySchedulerEnd = ref('')
const onChangeSchedulerStart = (val) => {
mySchedulerStart.value = getMillisecond(val) + millTimestampDiffFromTz()
}
const onChangeSchedulerEnd = (val) => {
mySchedulerEnd.value = getMillisecond(val) + millTimestampDiffFromTz()
}
return {
endDisabledDate,
startDisabledDate,
startTimeChang,
endTimeChange,
rules
rules,
mySchedulerStart,
mySchedulerEnd,
onChangeSchedulerStart,
onChangeSchedulerEnd
}
},
data () {
@@ -624,10 +638,12 @@ export default {
}
}
if (this.editObject.schedulerStart) {
schedulerStart = getMillisecond(this.editObject.schedulerStart)
// schedulerStart = getMillisecond(this.editObject.schedulerStart)
schedulerStart = this.mySchedulerStart
}
if (this.editObject.schedulerEnd) {
schedulerEnd = getMillisecond(this.editObject.schedulerEnd)
// schedulerEnd = getMillisecond(this.editObject.schedulerEnd)
schedulerEnd = this.mySchedulerEnd
}
const copyObject = _.cloneDeep(this.editObject)

View File

@@ -613,6 +613,7 @@ export default {
}
const param = {
tempId: row.id,
// todo 此处时间需要改,后续再确定
startTime: dateFormatToUTC(this.timeRange[0]),
endTime: dateFormatToUTC(this.timeRange[1]),
...this.pageObj