Преглед на файлове

会员看课记录 可以根据 会员营期的开始时间和结束时候来查

三七 преди 3 дни
родител
ревизия
cccec59119
променени са 3 файла, в които са добавени 281 реда и са изтрити 6 реда
  1. 95 2
      src/views/course/courseWatchLog/deptWatchLog.vue
  2. 92 2
      src/views/course/courseWatchLog/index.vue
  3. 94 2
      src/views/course/courseWatchLog/watchLog.vue

+ 95 - 2
src/views/course/courseWatchLog/deptWatchLog.vue

@@ -230,6 +230,24 @@
           @change="qecCreateTimeChange"
         />
       </el-form-item>
+
+
+      <el-form-item label="营期课程时间" prop="periodTime">
+        <el-date-picker
+          v-model="periodTimeText"
+          type="datetimerange"
+          align="right"
+          unlink-panels
+          value-format="yyyy-MM-dd HH:mm:ss"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :picker-options="pickerOptions"
+          @change="qecPeriodTimeChange"
+          :default-time="['00:00:00', '23:59:59']">
+        </el-date-picker>
+      </el-form-item>
+
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -452,16 +470,19 @@ export default {
       createCalendarKey: 0,
       updateCalendarKey: 0,
       qecCalendarKey: 0,
+      periodTimeKey: 0,
 
       createTimeText: '',
       scheduleTimeText: '',  // 新增
       updateTimeText: '',    // 新增
       qecCreateTimeText: '', // 新增
+      periodTimeText: '', // 营期课程时间
 
       scheduleTime: [],  // 改为数组
       createTime: [],    // 改为数组
       updateTime: [],    // 改为数组
       qecCreateTime: [], // 改为数组
+      periodTime: [], // 改为数组
 
       // 控制日历显隐
       showScheduleCalendar: false,
@@ -517,9 +538,9 @@ export default {
 
       pickerOptions: {
         disabledDate(time) {
-          // 获取6天前的日期(加上今天就是7天)
+          // 获取13天前的日期(加上今天就是14天)
           const sixDaysAgo = new Date();
-          sixDaysAgo.setDate(sixDaysAgo.getDate() - 6);
+          sixDaysAgo.setDate(sixDaysAgo.getDate() - 13);
           sixDaysAgo.setHours(0, 0, 0, 0);
 
           // 获取明天的日期(不包括今天)
@@ -554,6 +575,8 @@ export default {
         upETime:null,
         qecSTime:null,
         qecETime:null,
+        periodSTime:null,
+        periodETime:null,
         scheduleStartTime: null,
         scheduleEndTime: null,
         sendType:process.env.VUE_APP_COURSE_DEFAULT,
@@ -595,17 +618,20 @@ export default {
       this.createTime = [];
       this.updateTime = [];
       this.qecCreateTime = [];
+      this.periodTime = [];
 
       this.scheduleTimeText = '';
       this.createTimeText = '';
       this.updateTimeText = '';
       this.qecCreateTimeText = '';
+      this.periodTimeText = [];
 
       // 强制刷新日历组件
       this.scheduleCalendarKey++;
       this.createCalendarKey++;
       this.updateCalendarKey++;
       this.qecCalendarKey++;
+      this.periodTimeKey++;
     },
     formatDateRange(dates) {
       if (!dates || dates.length < 2) return '';
@@ -687,6 +713,8 @@ export default {
       this.queryParams.upETime = null;
       this.queryParams.qecSTime = null;
       this.queryParams.qecETime = null;
+      this.queryParams.periodSTime = null;
+      this.queryParams.periodDTime = null;
       this.queryParams.scheduleStartTime = null;
       this.queryParams.scheduleEndTime = null;
       this.queryParams.sopId = null; // 重置SOP ID
@@ -891,6 +919,71 @@ export default {
         this.queryParams.qecETime = null;
       }
     },
+
+    //营期课程时间
+    qecPeriodTimeChange(periodTime){
+
+      if (periodTime && periodTime.length >= 2) {
+        // 检查选择的日期范围是否超过7天(包括起始和结束日期)
+        const startDate = new Date(periodTime[0]);
+        const endDate = new Date(periodTime[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));
+
+        // 如果超过6天的范围(总共7天,包括起始日)
+        if (diffDays > 13) {
+          this.$message.error('时间选择范围不能超过14天');
+          // 清空选择
+          this.periodTime = [];
+          this.periodTimeText = [];
+          this.queryParams.periodSTime = null;
+          this.queryParams.periodETime = null;
+          this.periodTimeKey++;
+          return;
+        }
+
+        this.queryParams.periodSTime = this.formatDate(periodTime[0]) || null;
+        this.queryParams.periodETime = this.formatDate(periodTime[1]) || null;
+
+      } else {
+
+        this.periodTimeText = '';
+        this.queryParams.periodSTime = null;
+        this.queryParams.periodETime = null;
+      }
+
+    },
+
+    formatDate(date) {
+      if (!date) return ''
+
+      // 确保 date 是 Date 对象
+      let dateObj = date
+      if (typeof date === 'string') {
+        dateObj = new Date(date)
+      }
+
+      // 如果转换失败,返回空字符串
+      if (!(dateObj instanceof Date) || isNaN(dateObj.getTime())) {
+        return ''
+      }
+
+      // 使用更安全的格式化方法
+      const year = dateObj.getFullYear()
+      const month = String(dateObj.getMonth() + 1).padStart(2, '0')
+      const day = String(dateObj.getDate()).padStart(2, '0')
+      const hours = String(dateObj.getHours()).padStart(2, '0')
+      const minutes = String(dateObj.getMinutes()).padStart(2, '0')
+      const seconds = String(dateObj.getSeconds()).padStart(2, '0')
+
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
+    },
+
     /**
      * 根据名称模糊查询用户列表
      * @param query 参数

+ 92 - 2
src/views/course/courseWatchLog/index.vue

@@ -216,6 +216,23 @@
         />
       </el-form-item>
 
+
+      <el-form-item label="营期课程时间" prop="periodTime">
+        <el-date-picker
+          v-model="periodTimeText"
+          type="datetimerange"
+          align="right"
+          unlink-panels
+          value-format="yyyy-MM-dd HH:mm:ss"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :picker-options="pickerOptions"
+          @change="qecPeriodTimeChange"
+          :default-time="['00:00:00', '23:59:59']">
+        </el-date-picker>
+      </el-form-item>
+
       <el-form-item label="是否为会员" prop="isVip">
         <el-select
           filterable
@@ -564,16 +581,19 @@ export default {
       createCalendarKey: 0,
       updateCalendarKey: 0,
       qecCalendarKey: 0,
+      periodTimeKey: 0,
 
       createTimeText: '',
       scheduleTimeText: '',  // 新增
       updateTimeText: '',    // 新增
       qecCreateTimeText: '', // 新增
+      periodTimeText: '', // 营期课程时间
 
       scheduleTime: [],  // 改为数组
       createTime: [],    // 改为数组
       updateTime: [],    // 改为数组
       qecCreateTime: [], // 改为数组
+      periodTime: [], // 改为数组
 
       // 控制日历显隐
       showScheduleCalendar: false,
@@ -588,9 +608,9 @@ export default {
       activeName:"2",
       pickerOptions: {
         disabledDate(time) {
-          // 获取6天前的日期(加上今天就是7天)
+          // 获取13天前的日期(加上今天就是14天)
           const sixDaysAgo = new Date();
-          sixDaysAgo.setDate(sixDaysAgo.getDate() - 6);
+          sixDaysAgo.setDate(sixDaysAgo.getDate() - 13);
           sixDaysAgo.setHours(0, 0, 0, 0);
 
           // 获取明天的日期(不包括今天)
@@ -707,6 +727,8 @@ export default {
         upETime:null,
         qecSTime:null,
         qecETime:null,
+        periodSTime:null,
+        periodETime:null,
         scheduleStartTime: null,
         scheduleEndTime: null,
         sendType:process.env.VUE_APP_COURSE_DEFAULT,
@@ -786,17 +808,20 @@ export default {
       this.createTime = [];
       this.updateTime = [];
       this.qecCreateTime = [];
+      this.periodTime = [];
 
       this.scheduleTimeText = [];
       this.createTimeText = [];
       this.updateTimeText = [];
       this.qecCreateTimeText = [];
+      this.periodTimeText = [];
 
       // 强制刷新日历组件
       this.scheduleCalendarKey++;
       this.createCalendarKey++;
       this.updateCalendarKey++;
       this.qecCalendarKey++;
+      this.periodTimeKey++;
     },
     formatDateRange(dates) {
       if (!dates || dates.length < 2) return '';
@@ -891,6 +916,69 @@ export default {
       }
     },
 
+    //营期课程时间
+    qecPeriodTimeChange(periodTime){
+
+      if (periodTime && periodTime.length >= 2) {
+        // 检查选择的日期范围是否超过7天(包括起始和结束日期)
+        const startDate = new Date(periodTime[0]);
+        const endDate = new Date(periodTime[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));
+
+        // 如果超过6天的范围(总共7天,包括起始日)
+        if (diffDays > 13) {
+          this.$message.error('时间选择范围不能超过14天');
+          // 清空选择
+          this.periodTime = [];
+          this.periodTimeText = [];
+          this.queryParams.periodSTime = null;
+          this.queryParams.periodETime = null;
+          this.periodTimeKey++;
+          return;
+        }
+
+        this.queryParams.periodSTime = this.formatDate(periodTime[0]) || null;
+        this.queryParams.periodETime = this.formatDate(periodTime[1]) || null;
+
+      } else {
+
+        this.periodTimeText = '';
+        this.queryParams.periodSTime = null;
+        this.queryParams.periodETime = null;
+      }
+
+    },
+
+    formatDate(date) {
+      if (!date) return ''
+
+      // 确保 date 是 Date 对象
+      let dateObj = date
+      if (typeof date === 'string') {
+        dateObj = new Date(date)
+      }
+
+      // 如果转换失败,返回空字符串
+      if (!(dateObj instanceof Date) || isNaN(dateObj.getTime())) {
+        return ''
+      }
+
+      // 使用更安全的格式化方法
+      const year = dateObj.getFullYear()
+      const month = String(dateObj.getMonth() + 1).padStart(2, '0')
+      const day = String(dateObj.getDate()).padStart(2, '0')
+      const hours = String(dateObj.getHours()).padStart(2, '0')
+      const minutes = String(dateObj.getMinutes()).padStart(2, '0')
+      const seconds = String(dateObj.getSeconds()).padStart(2, '0')
+
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
+    },
 
 
     handleClickX(tab,event){
@@ -964,6 +1052,8 @@ export default {
       this.queryParams.upETime = null;
       this.queryParams.qecSTime = null;
       this.queryParams.qecETime = null;
+      this.queryParams.periodSTime = null;
+      this.queryParams.periodDTime = null;
       this.queryParams.scheduleStartTime = null;
       this.queryParams.scheduleEndTime = null;
       this.queryParams.sopId = null; // 重置SOP ID

+ 94 - 2
src/views/course/courseWatchLog/watchLog.vue

@@ -222,6 +222,23 @@
           @change="qecCreateTimeChange"
         />
       </el-form-item>
+
+      <el-form-item label="营期课程时间" prop="periodTime">
+        <el-date-picker
+          v-model="periodTimeText"
+          type="datetimerange"
+          align="right"
+          unlink-panels
+          value-format="yyyy-MM-dd HH:mm:ss"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :picker-options="pickerOptions"
+          @change="qecPeriodTimeChange"
+          :default-time="['00:00:00', '23:59:59']">
+        </el-date-picker>
+      </el-form-item>
+
       <el-form-item label="是否为会员" prop="isVip">
         <el-select
           filterable
@@ -595,16 +612,19 @@ export default {
       createCalendarKey: 0,
       updateCalendarKey: 0,
       qecCalendarKey: 0,
+      periodTimeKey: 0,
 
       createTimeText: '',
       scheduleTimeText: '',  // 新增
       updateTimeText: '',    // 新增
       qecCreateTimeText: '', // 新增
+      periodTimeText: '', // 营期课程时间
 
       scheduleTime: [],  // 改为数组
       createTime: [],    // 改为数组
       updateTime: [],    // 改为数组
       qecCreateTime: [], // 改为数组
+      periodTime: [], // 改为数组
 
       // 控制日历显隐
       showScheduleCalendar: false,
@@ -619,9 +639,9 @@ export default {
       activeName:"2",
       pickerOptions: {
         disabledDate(time) {
-          // 获取6天前的日期(加上今天就是7天)
+          // 获取13天前的日期(加上今天就是14天)
           const sixDaysAgo = new Date();
-          sixDaysAgo.setDate(sixDaysAgo.getDate() - 6);
+          sixDaysAgo.setDate(sixDaysAgo.getDate() - 13);
           sixDaysAgo.setHours(0, 0, 0, 0);
 
           // 获取明天的日期(不包括今天)
@@ -740,6 +760,8 @@ export default {
         upETime:null,
         qecSTime:null,
         qecETime:null,
+        periodSTime:null,
+        periodETime:null,
         scheduleStartTime: null,
         scheduleEndTime: null,
         sendType:process.env.VUE_APP_COURSE_DEFAULT,
@@ -804,17 +826,20 @@ export default {
       this.createTime = [];
       this.updateTime = [];
       this.qecCreateTime = [];
+      this.periodTime = [];
 
       this.scheduleTimeText = '';
       this.createTimeText = '';
       this.updateTimeText = '';
       this.qecCreateTimeText = '';
+      this.periodTimeText = [];
 
       // 强制刷新日历组件
       this.scheduleCalendarKey++;
       this.createCalendarKey++;
       this.updateCalendarKey++;
       this.qecCalendarKey++;
+      this.periodTimeKey++;
     },
     formatDateRange(dates) {
       if (!dates || dates.length < 2) return '';
@@ -925,6 +950,71 @@ export default {
         this.queryParams.qecETime = null;
       }
     },
+
+    //营期课程时间
+    qecPeriodTimeChange(periodTime){
+
+      if (periodTime && periodTime.length >= 2) {
+        // 检查选择的日期范围是否超过7天(包括起始和结束日期)
+        const startDate = new Date(periodTime[0]);
+        const endDate = new Date(periodTime[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));
+
+        // 如果超过6天的范围(总共7天,包括起始日)
+        if (diffDays > 13) {
+          this.$message.error('时间选择范围不能超过14天');
+          // 清空选择
+          this.periodTime = [];
+          this.periodTimeText = [];
+          this.queryParams.periodSTime = null;
+          this.queryParams.periodETime = null;
+          this.periodTimeKey++;
+          return;
+        }
+
+        this.queryParams.periodSTime = this.formatDate(periodTime[0]) || null;
+        this.queryParams.periodETime = this.formatDate(periodTime[1]) || null;
+
+      } else {
+
+        this.periodTimeText = '';
+        this.queryParams.periodSTime = null;
+        this.queryParams.periodETime = null;
+      }
+
+    },
+
+    formatDate(date) {
+      if (!date) return ''
+
+      // 确保 date 是 Date 对象
+      let dateObj = date
+      if (typeof date === 'string') {
+        dateObj = new Date(date)
+      }
+
+      // 如果转换失败,返回空字符串
+      if (!(dateObj instanceof Date) || isNaN(dateObj.getTime())) {
+        return ''
+      }
+
+      // 使用更安全的格式化方法
+      const year = dateObj.getFullYear()
+      const month = String(dateObj.getMonth() + 1).padStart(2, '0')
+      const day = String(dateObj.getDate()).padStart(2, '0')
+      const hours = String(dateObj.getHours()).padStart(2, '0')
+      const minutes = String(dateObj.getMinutes()).padStart(2, '0')
+      const seconds = String(dateObj.getSeconds()).padStart(2, '0')
+
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
+    },
+
     /** 查询短链课程看课记录列表 */
     getList() {
       this.loading = true;
@@ -987,6 +1077,8 @@ export default {
       this.queryParams.upETime = null;
       this.queryParams.qecSTime = null;
       this.queryParams.qecETime = null;
+      this.queryParams.periodSTime = null;
+      this.queryParams.periodDTime = null;
       this.queryParams.scheduleStartTime = null;
       this.queryParams.scheduleEndTime = null;
       this.queryParams.sopId = null; // 重置SOP ID