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

Merge branch 'master_course_log_20251022'

xdd пре 2 дана
родитељ
комит
e69feace08

+ 39 - 13
src/views/course/courseWatchLog/index.vue

@@ -72,6 +72,7 @@
         <el-select v-model="queryParams.companyUserId" clearable filterable remote
                    placeholder="请输入关键词" :remote-method="loadCompanyUserOptions"
                    v-select-load-more="loadMoreCompanyUserOptions"
+                   @change="handleCompanyUserChange"
                    :loading="companyUserOptionsLoading">
           <el-option
             v-for="item in companyUserOptions"
@@ -85,6 +86,7 @@
         <el-select v-model="queryParams.companyUserId" clearable filterable remote
                    placeholder="请输入关键词"
                    v-select-load-more="loadMoreCompanyUserOptions"
+                   @change="handleCompanyUserChange"
                    :loading="companyUserOptionsLoading">
           <el-option
             v-for="item in companyUserOptionsByAll"
@@ -774,7 +776,7 @@ export default {
         name: undefined,
         hasNextPage: false,
         pageNum: 1,
-        pageSize: 200
+        pageSize: 10
       },
       companyUserOptions: [],
       companyUserOptionsByAll: [],
@@ -796,7 +798,7 @@ export default {
       this.courseLists = response.list;
     });
     this.getList();
-    this.getDicts("sys_course_watch_log_type").then(response => {
+    this.getDicts("sys_course_watch_log_type_new").then(response => {
       this.logTypeOptions = response.data;
     });
     this.getDicts("sys_course_project").then(response => {
@@ -805,15 +807,33 @@ export default {
     this.getCompanyUserListLikeName(true);
   },
   methods: {
+    /**
+     * 当销售被选择
+     * 级联更新企微列表
+     */
+    handleCompanyUserChange(companyUserId){
+      if (companyUserId) {
+        // 清空当前企微选择
+        this.queryParams.qwUserName = "";
+        this.qwUserOptions = [];
+        this.qwUserOptionsParams.pageNum = 1;
+
+        // 重新加载企微列表,传入销售ID作为过滤条件
+        this.getQwList();
+      } else {
+        // 清空销售时也清空企微
+        this.queryParams.qwUserName = "";
+        this.qwUserOptions = [];
+        this.qwUserOptionsParams.pageNum = 1;
+        this.getQwList(); // 重新加载所有企微
+      }
+    },
     /**
      * 根据名称模糊查询用户列表
      * @param query 参数
      */
     loadCompanyUserOptions(query) {
       this.companyUserOptions = [];
-      if (query === '') {
-        return;
-      }
 
       this.companyUserOptionsParams.pageNum = 1
       this.companyUserOptionsParams.name = query
@@ -826,9 +846,6 @@ export default {
      */
     loadQwUserOptions(query) {
       this.qwUserOptions = [];
-      if (query === '') {
-        return;
-      }
       this.qwUserOptionsParams.pageNum = 1
       // 将搜索关键词设置到queryParams中
       this.queryParams.qwUserName = query
@@ -869,12 +886,21 @@ export default {
 
     },
     getQwList() {
+      const params = {
+        name: this.qwUserOptionsParams.name,
+        pageNum: this.qwUserOptionsParams.pageNum,
+        pageSize: this.qwUserOptionsParams.pageSize,
+        // 添加销售ID作为过滤条件
+        companyUserId: this.queryParams.companyUserId || null
+      };
       console.log("企微参数", this.queryParams);
-      getQwList(this.queryParams).then(response => {
-        this.qwUserOptions = [...this.qwUserOptions, ...response.rows]
-        // 根据实际返回的数据结构设置hasNextPage
-        this.qwUserOptionsParams.hasNextPage = response.rows && response.rows.length >= this.qwUserOptionsParams.pageSize
-        this.qwUserOptionsLoading = false;
+      getQwList(params).then(response => {
+        if (this.qwUserOptionsParams.pageNum === 1) {
+          this.qwUserOptions = response.rows || [];
+        } else {
+          this.qwUserOptions = [...this.qwUserOptions, ...(response.rows || [])];
+        }
+        this.qwUserOptionsParams.hasNextPage = response.rows && response.rows.length >= this.qwUserOptionsParams.pageSize;
       });
     },
 

+ 1 - 1
src/views/course/courseWatchLog/myCourseWatchLog.vue

@@ -382,7 +382,7 @@ export default {
       this.courseLists = response.list;
     });
     this.getList();
-    this.getDicts("sys_course_watch_log_type").then(response => {
+    this.getDicts("sys_course_watch_log_type_new").then(response => {
       this.logTypeOptions = response.data;
     });