Ver código fonte

看课记录查询条件创建时间默认为当天

luolinsong 3 semanas atrás
pai
commit
b86d4f190d
1 arquivos alterados com 28 adições e 5 exclusões
  1. 28 5
      src/views/course/courseWatchLog/index.vue

+ 28 - 5
src/views/course/courseWatchLog/index.vue

@@ -33,7 +33,7 @@
       <el-form-item label="客户id" prop="userId" >
         <el-input
           v-model="queryParams.userId"
-          placeholder="请输入会员昵称"
+          placeholder="请输入会员id"
           clearable
           size="small"
           @keyup.enter.native="handleQuery"
@@ -714,7 +714,7 @@ export default {
       qecCalendarKey: 0,
       periodTimeKey: 0,
 
-      createTimeText: '',
+      createTimeText: [],
       scheduleTimeText: '',  // 新增
       updateTimeText: '',    // 新增
       qecCreateTimeText: '', // 新增
@@ -908,6 +908,7 @@ export default {
   created() {
     // 初始化时根据默认的sendType加载课程列表
     this.loadCourseList();
+     this.initDefaultCreateTime();
     this.getList();
     this.getDicts("sys_course_watch_log_type_new").then(response => {
       this.logTypeOptions = response.data;
@@ -921,6 +922,26 @@ export default {
     this.getCompanyUserListLikeName(true);
   },
   methods: {
+
+    initDefaultCreateTime() {
+      // 获取当前日期
+      const today = new Date();
+      // 格式化日期为 yyyy-MM-dd
+      const year = today.getFullYear();
+      const month = String(today.getMonth() + 1).padStart(2, '0');
+      const day = String(today.getDate()).padStart(2, '0');
+      const todayStr = `${year}-${month}-${day}`;
+
+      // 设置默认时间范围为当天 00:00:00 到 23:59:59
+      this.createTimeText = [
+        `${todayStr} 00:00:00`,
+        `${todayStr} 23:59:59`
+      ];
+
+      // 同步更新查询参数
+      this.queryParams.sTime = `${todayStr} 00:00:00`;
+      this.queryParams.eTime = `${todayStr} 23:59:59`;
+    },
     /**
      * 处理所属销售下拉框显示状态变化
      */
@@ -1208,13 +1229,12 @@ export default {
       }
     },
     // 创建时间
-    createChange(createTime) {
+     createChange(createTime) {
       if (createTime && createTime.length >= 2) {
-        // this.createTimeText = this.formatDateRange(createTime);
         this.queryParams.sTime = this.formatDate(createTime[0]) || null;
         this.queryParams.eTime = this.formatDate(createTime[1]) || null;
       } else {
-        this.createTimeText = '';
+        this.createTimeText = [];
         this.queryParams.sTime = null;
         this.queryParams.eTime = null;
       }
@@ -1427,6 +1447,9 @@ export default {
       // 统一重置日历组件
       this.resetCalendars();
 
+      // ========== 重置后恢复创建时间默认值 ==========
+      this.initDefaultCreateTime();
+
       this.handleQuery();
     },
     // 多选框选中数据