|
|
@@ -11,7 +11,14 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="添加时间" prop="createTime">
|
|
|
- <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
|
|
|
+ <el-date-picker v-model="createTime" size="small"
|
|
|
+ style="width: 220px"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ type="daterange" range-separator="-"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ @change="change"></el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
@@ -19,11 +26,11 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
- <el-table
|
|
|
- border
|
|
|
- v-loading="loading"
|
|
|
+ <el-table
|
|
|
+ border
|
|
|
+ v-loading="loading"
|
|
|
:data="courseWatchLogList"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
:show-summary="true"
|
|
|
:summary-method="getSummaries"
|
|
|
ref="table1">
|
|
|
@@ -200,18 +207,53 @@ export default {
|
|
|
rules: {
|
|
|
},
|
|
|
scheduleTime: null,
|
|
|
+ pickerOptions: {
|
|
|
+ disabledDate(time) {
|
|
|
+ // 获取6天前的日期(加上今天就是7天)
|
|
|
+ const sixDaysAgo = new Date();
|
|
|
+ sixDaysAgo.setDate(sixDaysAgo.getDate() - 6);
|
|
|
+ sixDaysAgo.setHours(0, 0, 0, 0);
|
|
|
+
|
|
|
+ // 获取明天的日期(不包括今天)
|
|
|
+ const tomorrow = new Date();
|
|
|
+ tomorrow.setDate(tomorrow.getDate() + 1);
|
|
|
+ tomorrow.setHours(0, 0, 0, 0);
|
|
|
+
|
|
|
+ return time.getTime() < sixDaysAgo.getTime() || time.getTime() >= tomorrow.getTime();
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
courseList().then(response => {
|
|
|
this.courseLists = response.list;
|
|
|
});
|
|
|
- this.getList();
|
|
|
+
|
|
|
+ const today = new Date();
|
|
|
+ const sevenDaysAgo = new Date();
|
|
|
+ sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 6);
|
|
|
+ this.queryParams.sTime = this.formatDate(sevenDaysAgo);
|
|
|
+ this.queryParams.eTime = this.formatDate(today);
|
|
|
+
|
|
|
this.getDicts("sys_course_watch_log_type").then(response => {
|
|
|
this.logTypeOptions = response.data;
|
|
|
});
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.getList();
|
|
|
+ }, 200);
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ formatDate(date) {
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
+ },
|
|
|
+
|
|
|
getSummaries(param) {
|
|
|
let totalNum = 0;
|
|
|
const { columns, data } = param;
|
|
|
@@ -292,6 +334,7 @@ export default {
|
|
|
},
|
|
|
/** 查询短链课程看课记录列表 */
|
|
|
getList() {
|
|
|
+
|
|
|
this.loading = true;
|
|
|
myQwWatchLogStatisticsList(this.queryParams).then(response => {
|
|
|
this.courseWatchLogList = response.rows;
|
|
|
@@ -303,6 +346,7 @@ export default {
|
|
|
this.$refs.table1?.doLayout();
|
|
|
}, 2000);
|
|
|
});
|
|
|
+
|
|
|
},
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
@@ -337,8 +381,13 @@ export default {
|
|
|
this.resetForm("queryForm");
|
|
|
this.createTime = null;
|
|
|
this.scheduleTime = null;
|
|
|
- this.queryParams.sTime = null;
|
|
|
- this.queryParams.eTime = null;
|
|
|
+
|
|
|
+ const today = new Date();
|
|
|
+ const sevenDaysAgo = new Date();
|
|
|
+ sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 6);
|
|
|
+ this.queryParams.sTime = this.formatDate(sevenDaysAgo);
|
|
|
+ this.queryParams.eTime = this.formatDate(today);
|
|
|
+
|
|
|
this.queryParams.scheduleStartTime = null;
|
|
|
this.queryParams.scheduleEndTime = null;
|
|
|
this.handleQuery();
|