fix: 报告box Time limit 为 customize的时候,时间选择器增加限制
This commit is contained in:
@@ -74,6 +74,7 @@
|
|||||||
size="small"
|
size="small"
|
||||||
:format="dateFormat"
|
:format="dateFormat"
|
||||||
:disabled="!!editObject.id"
|
:disabled="!!editObject.id"
|
||||||
|
:disabled-date="disabledDate"
|
||||||
prefix-icon="cn-icon cn-icon-shijian"
|
prefix-icon="cn-icon cn-icon-shijian"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
placeholder=" "
|
placeholder=" "
|
||||||
@@ -91,6 +92,8 @@
|
|||||||
size="small"
|
size="small"
|
||||||
:format="dateFormat"
|
:format="dateFormat"
|
||||||
:disabled="!!editObject.id"
|
:disabled="!!editObject.id"
|
||||||
|
:disabled-date="disabledDate"
|
||||||
|
@change="timeChange"
|
||||||
prefix-icon="cn-icon cn-icon-shijian"
|
prefix-icon="cn-icon cn-icon-shijian"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
placeholder=" "
|
placeholder=" "
|
||||||
@@ -277,6 +280,7 @@ import { api } from '@/utils/api'
|
|||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import { get, post, put } from '@/utils/http'
|
import { get, post, put } from '@/utils/http'
|
||||||
import { dateFormat, getMillisecond } from '@/utils/date-util'
|
import { dateFormat, getMillisecond } from '@/utils/date-util'
|
||||||
|
import { ref } from 'vue'
|
||||||
const paramValidator = (rule, value, callback) => {
|
const paramValidator = (rule, value, callback) => {
|
||||||
let validate = true
|
let validate = true
|
||||||
if (value && value.length > 0) {
|
if (value && value.length > 0) {
|
||||||
@@ -305,6 +309,24 @@ export default {
|
|||||||
categoryList: Array,
|
categoryList: Array,
|
||||||
currentCategoryId: Number
|
currentCategoryId: Number
|
||||||
},
|
},
|
||||||
|
setup () {
|
||||||
|
const picker = ref('')
|
||||||
|
function timeChange (val) {
|
||||||
|
picker.value = val
|
||||||
|
}
|
||||||
|
const disabledDate = (time) => {
|
||||||
|
if (time.getTime() > new Date()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (picker.value != '' && picker.value < time) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
disabledDate,
|
||||||
|
timeChange
|
||||||
|
}
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
url: api.reportTemp,
|
url: api.reportTemp,
|
||||||
@@ -431,36 +453,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'editObject.config.startTime': {
|
|
||||||
handler (n) {
|
|
||||||
const nowDate = new Date().getTime()
|
|
||||||
const starDate = new Date(this.editObject.config.startTime)
|
|
||||||
const endData = new Date(this.editObject.config.endTime)
|
|
||||||
if (this.editObject.config.endTime !== null && this.editObject.config.startTime !== null) {
|
|
||||||
if (starDate.getTime() > endData.getTime()) {
|
|
||||||
this.editObject.config.startTime = ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.editObject.config.startTime !== null && starDate.getTime() > nowDate) {
|
|
||||||
this.editObject.config.startTime = ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'editObject.config.endTime': {
|
|
||||||
handler (n) {
|
|
||||||
const nowDate = new Date().getTime()
|
|
||||||
const starDate = new Date(this.editObject.config.startTime)
|
|
||||||
const endData = new Date(this.editObject.config.endTime)
|
|
||||||
if (this.editObject.config.endTime !== null && this.editObject.config.startTime !== null) {
|
|
||||||
if (starDate.getTime() > endData.getTime()) {
|
|
||||||
this.editObject.config.endTime = ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.editObject.config.startTime !== null && endData.getTime() > nowDate) {
|
|
||||||
this.editObject.config.endTime = ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
object: {
|
object: {
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user