Browse Source

调整部门看课记录查询参数

yfh 3 tuần trước cách đây
mục cha
commit
0e531a4dad
1 tập tin đã thay đổi với 109 bổ sung0 xóa
  1. 109 0
      src/views/course/courseWatchLog/deptWatchLog.vue

+ 109 - 0
src/views/course/courseWatchLog/deptWatchLog.vue

@@ -1,6 +1,16 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
+      <el-form-item label="看课方式" prop="sendType">
+        <el-select v-model="queryParams.sendType" placeholder="选择看课方式"  clearable size="small" @change="handleSendTypeChange">
+          <el-option
+            v-for="dict in sendTypeOptions"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
       <el-form-item label="会员ID" prop="userId">
         <el-input
           v-model="queryParams.userId"
@@ -61,6 +71,26 @@
           />
         </el-select>
       </el-form-item>
+      <!-- sop名称 -->
+      <el-form-item label="SOP名称" prop="sopId" v-if="queryParams.sendType == 2">
+        <el-autocomplete
+          v-model="sopSearchText"
+          :fetch-suggestions="querySopAsync"
+          placeholder="请输入SOP名称"
+          clearable
+          size="small"
+          style="width: 200px"
+          @select="handleSopSelect"
+          @clear="handleSopClear"
+          :trigger-on-focus="false"
+        >
+          <template slot-scope="{ item }">
+            <div class="sop-item">
+              <span class="sop-name">{{ item.name }}</span>
+            </div>
+          </template>
+        </el-autocomplete>
+      </el-form-item>
       <el-form-item label="企微ID" prop="qwUserUserId">
         <el-input
           v-model="queryParams.qwUserUserId"
@@ -352,6 +382,8 @@ import { getCompanyUserListLikeName } from "@/api/company/companyUser";
 import {getTask} from "@/api/common";
 import Vue from 'vue'
 import Calendar from 'vue-mobile-calendar'
+import {infoSop} from "@/api/qw/sop";
+import {getMyQwUserList} from "@/api/qw/user";
 Vue.use(Calendar)
 
 
@@ -359,6 +391,15 @@ export default {
   name: "CourseWatchLog",
   data() {
     return {
+      sopSearchText: '', // SOP搜索框显示的文本
+      selectedSopId: null, // 选中的SOP ID
+      sendTypeOptions:[{
+        dictLabel:"会员",dictValue:'1'
+      },
+        {
+          dictLabel:"企微",dictValue:'2'
+        }
+      ],
       // 日历 key 控制刷新
       scheduleCalendarKey: 0,
       createCalendarKey: 0,
@@ -468,6 +509,8 @@ export default {
         qecETime:null,
         scheduleStartTime: null,
         scheduleEndTime: null,
+        sendType:process.env.VUE_APP_COURSE_DEFAULT,
+        sopId: null, // sopId
       },
       // 表单参数
       form: {},
@@ -495,6 +538,10 @@ export default {
     });
   },
   methods: {
+    handleSendTypeChange() {
+      this.handleQuery(); // 重新查询列表
+    },
+
     // 重置日历组件
     resetCalendars() {
       this.scheduleTime = [];
@@ -595,8 +642,15 @@ export default {
       this.queryParams.qecETime = null;
       this.queryParams.scheduleStartTime = null;
       this.queryParams.scheduleEndTime = null;
+      this.queryParams.sopId = null; // 重置SOP ID
       this.scheduleTime=null;
       this.updateTime=null;
+
+      // 重置SOP搜索
+      this.handleSopClear();
+      // 统一重置日历组件
+      this.resetCalendars();
+
       this.handleQuery();
     },
     // 多选框选中数据
@@ -826,6 +880,61 @@ export default {
       this.companyUserOptionsParams.pageNum += 1
       this.getCompanyUserListLikeName()
     },
+    /**
+     * 选择SOP
+     * @param {object} item - 选中的SOP项
+     */
+    handleSopSelect(item) {
+      this.selectedSopId = item.id;
+      this.queryParams.sopId = item.id;
+      this.sopSearchText = item.name;
+    },
+
+    /**
+     * 清空SOP选择
+     */
+    handleSopClear() {
+      this.selectedSopId = null;
+      this.queryParams.sopId = null;
+      this.sopSearchText = '';
+    },
+
+    /**
+     * 异步查询SOP列表
+     * @param {string} queryString - 查询字符串
+     * @param {function} callback - 回调函数
+     */
+    querySopAsync(queryString, callback) {
+      if (!queryString) {
+        callback([]);
+        return;
+      }
+
+      infoSop({ name: queryString }).then(response => {
+        if (response && response.rows) {
+          const suggestions = response.rows.map(item => ({
+            value: item.name,
+            id: item.id,
+            name: item.name
+          }));
+          callback(suggestions);
+        } else {
+          callback([]);
+        }
+      }).catch(error => {
+        console.error('通过sop查询失败:', error);
+        callback([]);
+      });
+    },
+    updateQwuser() {
+      for (const user of this.myQwUserList) {
+        if (user.dictValue == this.queryParams.qwUserId) {
+          this.queryParams.corpId = user.corpId;
+          break;
+        }
+      }
+      this.getList();
+    },
   }
 };
 </script>