|
|
@@ -854,10 +854,10 @@ export default {
|
|
|
this.qecCreateTime = [];
|
|
|
this.periodTime = [];
|
|
|
|
|
|
- this.scheduleTimeText = '';
|
|
|
- this.createTimeText = '';
|
|
|
- this.updateTimeText = '';
|
|
|
- this.qecCreateTimeText = '';
|
|
|
+ this.scheduleTimeText = [];
|
|
|
+ this.createTimeText = [];
|
|
|
+ this.updateTimeText = [];
|
|
|
+ this.qecCreateTimeText = [];
|
|
|
this.periodTimeText = [];
|
|
|
|
|
|
// 强制刷新日历组件
|
|
|
@@ -904,31 +904,48 @@ export default {
|
|
|
// 营期时间
|
|
|
handleScheduleTimeChange(scheduleTime) {
|
|
|
if (scheduleTime && scheduleTime.length >= 2) {
|
|
|
+ if(!this.checkDateRangeLimit(scheduleTime)){
|
|
|
+ this.scheduleTimeText = null;
|
|
|
+ this.queryParams.scheduleStartTime=null;
|
|
|
+ this.queryParams.scheduleStartTime=null;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// this.scheduleTimeText = this.formatDateRange(scheduleTime);
|
|
|
this.queryParams.scheduleStartTime = scheduleTime[0] || null;
|
|
|
this.queryParams.scheduleEndTime = scheduleTime[1] || null;
|
|
|
- console.log(this.queryParams.scheduleStartTime)
|
|
|
- console.log(this.queryParams.scheduleEndTime)
|
|
|
} else {
|
|
|
this.scheduleTimeText = [];
|
|
|
this.queryParams.scheduleStartTime = null;
|
|
|
this.queryParams.scheduleEndTime = null;
|
|
|
}
|
|
|
},
|
|
|
+ checkDateRangeLimit(dateRange) {
|
|
|
+ if (dateRange && dateRange.length >= 2) {
|
|
|
+ const startDate = new Date(dateRange[0]);
|
|
|
+ const endDate = new Date(dateRange[1]);
|
|
|
+
|
|
|
+ // 设置时间为当天开始,避免时间部分影响计算
|
|
|
+ startDate.setHours(0, 0, 0, 0);
|
|
|
+ endDate.setHours(0, 0, 0, 0);
|
|
|
+
|
|
|
+ const timeDiff = Math.abs(endDate - startDate);
|
|
|
+ const diffDays = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
|
|
|
+
|
|
|
+ if (diffDays > 31) { // maxDays-1 因为包含起始日
|
|
|
+ this.$message.warning('时间区间不能超过一个月');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
// 创建时间
|
|
|
createChange(createTime) {
|
|
|
if (createTime && createTime.length >= 2) {
|
|
|
- const startDate = new Date(createTime[0]);
|
|
|
- const endDate = new Date(createTime[1]);
|
|
|
- const timeDiff = Math.abs(endDate.getTime() - startDate.getTime());
|
|
|
- const diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
|
|
|
-
|
|
|
- // 限制时间区间为一个月
|
|
|
- if (diffDays > 31) {
|
|
|
- this.$message.warning('创建时间区间不能超过一个月');
|
|
|
+ if(!this.checkDateRangeLimit(createTime)){
|
|
|
this.createTimeText = null;
|
|
|
- this.queryParams.sTime = null;
|
|
|
- this.queryParams.eTime = null;
|
|
|
+ this.queryParams.sTime=null;
|
|
|
+ this.queryParams.eTime=null;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -945,6 +962,13 @@ export default {
|
|
|
// 更新时间
|
|
|
updateChange(updateTime) {
|
|
|
if (updateTime && updateTime.length >= 2) {
|
|
|
+ if(!this.checkDateRangeLimit(updateTime)){
|
|
|
+ this.updateTimeText = null;
|
|
|
+ this.queryParams.upSTime=null;
|
|
|
+ this.queryParams.upETime=null;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// this.updateTimeText = this.formatDateRange(updateTime);
|
|
|
this.queryParams.upSTime = updateTime[0] || null;
|
|
|
this.queryParams.upETime = updateTime[1] || null;
|
|
|
@@ -1057,11 +1081,14 @@ export default {
|
|
|
|
|
|
/** 查询短链课程看课记录列表 */
|
|
|
getList() {
|
|
|
- // xgb 看课数据量太大必须限制时间
|
|
|
- if (!this.createTimeText) {
|
|
|
- this.$message.warning('请选择创建时间');
|
|
|
+ // xgb 看课数据量太大必须限制时间if (this.isEmptyArray(this.createTimeText) &&
|
|
|
+ if (this.isEmptyArray(this.createTimeText) &&
|
|
|
+ this.isEmptyArray(this.updateTimeText) &&
|
|
|
+ this.isEmptyArray(this.scheduleTimeText)) {
|
|
|
+ this.$message.warning('请选择创建时间或营期时间或最新更新时间');
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
this.loading = true;
|
|
|
let param = JSON.parse(JSON.stringify(this.queryParams));
|
|
|
if (param.logType == "10") {
|
|
|
@@ -1071,6 +1098,8 @@ export default {
|
|
|
this.courseWatchLogList = response.rows;
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
// 取消按钮
|
|
|
@@ -1196,10 +1225,17 @@ export default {
|
|
|
}).catch(() => {
|
|
|
});
|
|
|
},
|
|
|
+ // 添加辅助方法
|
|
|
+ isEmptyArray(arr) {
|
|
|
+ return !arr || arr.length === 0;
|
|
|
+ },
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
|
- if (!this.createTimeText) {
|
|
|
- this.$message.warning('请选择创建时间');
|
|
|
+ // xgb 看课数据量太大必须限制时间
|
|
|
+ if (this.isEmptyArray(this.createTimeText) &&
|
|
|
+ this.isEmptyArray(this.updateTimeText) &&
|
|
|
+ this.isEmptyArray(this.scheduleTimeText)) {
|
|
|
+ this.$message.warning('请选择创建时间或营期时间或最新更新时间');
|
|
|
return;
|
|
|
}
|
|
|
const queryParams = this.queryParams;
|