iview DatePicker 结束时间改为23:59:59

<DatePicker type="datetimerange"
            ref="DatePicker"
            v-model="formInline.searchTime"
            format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择查询时间范围"
            :transfer=true
            @on-change="timeChange"
            style="width: 100%">DatePicker>
// vue methods
timeChange(time) {
	if(time.length && time[0] && time[1]) {
	    // 没有选择时间就默认23:59:59
	    if(this.DateUtil.format(new Date(this.formInline.searchTime[1]), 'yyyy-MM-dd hh:mm:ss').slice(-8) === '00:00:00') {
	        this.formInline.searchTime[1] = new Date(this.DateUtil.format(new Date(this.formInline.searchTime[1]), 'yyyy-MM-dd') + ' 23:59:59');
	    }
	    this.formInline.startTime = this.DateUtil.format(new Date(this.formInline.searchTime[0]), 'yyyy-MM-dd hh:mm:ss');
	    this.formInline.endTime = this.DateUtil.format(new Date(this.formInline.searchTime[1]), 'yyyy-MM-dd hh:mm:ss');
	} else {
	    this.formInline.startTime = '';
	    this.formInline.endTime = '';
	}
	this.$refs['DatePicker'].internalValue = this.formInline.searchTime;
},

你可能感兴趣的:(iview)