Преглед изворни кода

看客记录添加创建时间必传,sql数据量太大必传时间字段 我的看客记录

xgb пре 1 недеља
родитељ
комит
a467485638
2 измењених фајлова са 90 додато и 5 уклоњено
  1. 45 1
      src/views/course/courseWatchLog/index.vue
  2. 45 4
      src/views/course/courseWatchLog/watchLog.vue

+ 45 - 1
src/views/course/courseWatchLog/index.vue

@@ -815,16 +815,34 @@ export default {
     courseList().then(response => {
       this.courseLists = response.list;
     });
-    this.getList();
+
     this.getDicts("sys_course_watch_log_type_new").then(response => {
       this.logTypeOptions = response.data;
     });
     this.getDicts("sys_course_project").then(response => {
       this.projectOptions = response.data;
     });
+
+    // 设置默认当天时间 xgb 防止频繁查询大量数据
+    this.setToday();
+
+    this.getList();
     this.getCompanyUserListLikeName(true);
+
+    this.loading=false;
   },
   methods: {
+    setToday(){
+      const today = new Date();
+      const todayStart = new Date(today);
+      todayStart.setHours(0, 0, 0, 0);
+      const todayEnd = new Date(today);
+      todayEnd.setHours(23, 59, 59, 999);
+
+      this.createTimeText = [this.formatDate(todayStart), this.formatDate(todayEnd)];
+      this.queryParams.sTime = this.formatDate(todayStart);
+      this.queryParams.eTime = this.formatDate(todayEnd);
+    },
     /**
      * 处理所属销售下拉框显示状态变化
      */
@@ -1019,6 +1037,20 @@ export default {
     // 创建时间
     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('创建时间区间不能超过一个月');
+          this.createTimeText = null;
+          this.queryParams.sTime = null;
+          this.queryParams.eTime = null;
+          return;
+        }
+
         // this.createTimeText = this.formatDateRange(createTime);
         this.queryParams.sTime = this.formatDate(createTime[0]) || null;
         this.queryParams.eTime = this.formatDate(createTime[1]) || null;
@@ -1156,6 +1188,12 @@ export default {
     },
     /** 查询短链课程看课记录列表 */
     getList() {
+      // xgb 看课数据量太大必须限制时间
+      if (!this.createTimeText) {
+        this.$message.warning('请选择创建时间');
+        return;
+      }
+
       this.loading = true;
       if(this.queryParams.logType == "10"){
         this.queryParams.logType = null;
@@ -1223,6 +1261,8 @@ export default {
       this.queryParams.scheduleEndTime = null;
       this.queryParams.sopId = null; // 重置SOP ID
 
+      this.setToday();
+
       // 重置SOP搜索
       this.handleSopClear();
 
@@ -1289,6 +1329,10 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
+      if (!this.createTimeText) {
+        this.$message.warning('请选择创建时间');
+        return;
+      }
       const queryParams = this.queryParams;
       this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
           confirmButtonText: "确定",

+ 45 - 4
src/views/course/courseWatchLog/watchLog.vue

@@ -788,7 +788,7 @@ export default {
     courseList().then(response => {
       this.courseLists = response.list;
     });
-    this.getList();
+
     this.getDicts("sys_course_watch_log_type_new").then(response => {
       this.logTypeOptions = response.data;
     });
@@ -796,14 +796,30 @@ export default {
     this.getDicts("sys_company_or").then(response => {
       this.sysCompanyOr = response.data;
     });
-    getMyQwUserList().then(response => {
-      this.myQwUserList = response.data;
-    });
     this.getDicts("sys_course_project").then(response => {
       this.projectOptions = response.data;
     });
+    // 设置默认当天时间 xgb 防止频繁查询大量数据
+    this.setToday();
+
+    this.getList();
+    getMyQwUserList().then(response => {
+      this.myQwUserList = response.data;
+    });
+
   },
   methods: {
+    setToday(){
+      const today = new Date();
+      const todayStart = new Date(today);
+      todayStart.setHours(0, 0, 0, 0);
+      const todayEnd = new Date(today);
+      todayEnd.setHours(23, 59, 59, 999);
+
+      this.createTimeText = [this.formatDate(todayStart), this.formatDate(todayEnd)];
+      this.queryParams.sTime = this.formatDate(todayStart);
+      this.queryParams.eTime = this.formatDate(todayEnd);
+    },
 
     handleSendTypeChange() {
       // 重置相关参数
@@ -902,6 +918,20 @@ export default {
     // 创建时间
     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('创建时间区间不能超过一个月');
+          this.createTimeText = null;
+          this.queryParams.sTime = null;
+          this.queryParams.eTime = null;
+          return;
+        }
+
         // this.createTimeText = this.formatDateRange(createTime);
         this.queryParams.sTime = this.formatDate(createTime[0]) || null;
         this.queryParams.eTime = this.formatDate(createTime[1]) || null;
@@ -1027,6 +1057,11 @@ export default {
 
     /** 查询短链课程看课记录列表 */
     getList() {
+      // xgb 看课数据量太大必须限制时间
+      if (!this.createTimeText) {
+        this.$message.warning('请选择创建时间');
+        return;
+      }
       this.loading = true;
       let param = JSON.parse(JSON.stringify(this.queryParams));
       if (param.logType == "10") {
@@ -1100,6 +1135,8 @@ export default {
       // 统一重置日历组件
       this.resetCalendars();
 
+      this.setToday();
+
       this.handleQuery();
     },
     // 多选框选中数据
@@ -1161,6 +1198,10 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
+      if (!this.createTimeText) {
+        this.$message.warning('请选择创建时间');
+        return;
+      }
       const queryParams = this.queryParams;
       this.$confirm('是否确认导出所有短链课程看课记录数据项?', "警告", {
         confirmButtonText: "确定",