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

bug-767:刷新协定方的三个点后,同一个协定方显示了两条

张田田 преди 1 седмица
родител
ревизия
53650c6d64
променени са 1 файла, в които са добавени 6 реда и са изтрити 25 реда
  1. 6 25
      src/views/diagnosis/components/SuitTechAgreement.vue

+ 6 - 25
src/views/diagnosis/components/SuitTechAgreement.vue

@@ -1,10 +1,8 @@
 <template>
 <template>
   <div class="mr-t10 agreement">
   <div class="mr-t10 agreement">
-    <!-- 协定方标题(与中药协定方 agree-tab 样式一致) -->
     <div class="agree-tab flex-vertical-between">
     <div class="agree-tab flex-vertical-between">
       <div class="flex-center agree-active">协定方</div>
       <div class="flex-center agree-active">协定方</div>
     </div>
     </div>
-    <!-- 三组折叠(个人/科室/机构,手风琴单展开;每组加载更多三组同步翻页) -->
     <div class="collapse">
     <div class="collapse">
       <el-collapse v-model="activeNames" accordion>
       <el-collapse v-model="activeNames" accordion>
         <el-collapse-item
         <el-collapse-item
@@ -21,7 +19,6 @@
             >
             >
               <div class="med-name" @click="openDetail(item.pid)">{{ item.name }}</div>
               <div class="med-name" @click="openDetail(item.pid)">{{ item.name }}</div>
             </div>
             </div>
-            <!-- 每组加载更多:按钮常驻不隐藏;点对应分组看对应数组是否为空,空则提示「没有更多数据了」 -->
             <div class="collapse-more flex-center" @click="loadMore(group)">
             <div class="collapse-more flex-center" @click="loadMore(group)">
               <img src="../../../assets/point3.png" alt />
               <img src="../../../assets/point3.png" alt />
             </div>
             </div>
@@ -58,8 +55,6 @@ export default {
       pageNum: 1,
       pageNum: 1,
       pageSize: 10,
       pageSize: 10,
       loading: false,
       loading: false,
-      // 本次「加载更多」点的是哪个分组(共享方式 0/1/2),用于判断该分组返回数组是否为空
-      currentShowType: null,
       showDetail: false,
       showDetail: false,
       detailLoading: false,
       detailLoading: false,
       detail: {},
       detail: {},
@@ -99,7 +94,8 @@ export default {
           this.groups.personal.list = this.groups.personal.list.concat(d.personal || []);
           this.groups.personal.list = this.groups.personal.list.concat(d.personal || []);
           this.groups.department.list = this.groups.department.list.concat(d.department || []);
           this.groups.department.list = this.groups.department.list.concat(d.department || []);
           this.groups.institution.list = this.groups.institution.list.concat(d.institution || []);
           this.groups.institution.list = this.groups.institution.list.concat(d.institution || []);
-          this.checkLoadMore(d);
+          // 用后端返回的各分组总数判断是否还有更多
+          this.updateLoadMore(d);
         }
         }
       } catch (e) {
       } catch (e) {
         console.error("获取适宜技术协定方列表失败", e);
         console.error("获取适宜技术协定方列表失败", e);
@@ -107,26 +103,13 @@ export default {
         this.loading = false;
         this.loading = false;
       }
       }
     },
     },
-    checkLoadMore(d) {
-      const showTypeKey = { 0: "personal", 1: "department", 2: "institution" };
-      const key = showTypeKey[this.currentShowType];
-      // 初次加载(currentShowType 为 null)不提示
-      if (key == null) return;
-      const empty = !(d[key] || []).length;
-      if (empty) {
-        this.$message({
-          showClose: false,
-          message: "没有更多数据了",
-          type: "warning",
-        });
-        this.groups[key].loadMore = false;
-      }
-      // 消费后复位,避免下次初始加载误判
-      this.currentShowType = null;
+    updateLoadMore(d) {
+      this.groups.personal.loadMore = this.groups.personal.list.length < d.personalTotal;
+      this.groups.department.loadMore = this.groups.department.list.length < d.departmentTotal;
+      this.groups.institution.loadMore = this.groups.institution.list.length < d.institutionTotal;
     },
     },
     loadMore(group) {
     loadMore(group) {
       if (this.loading) return;
       if (this.loading) return;
-      // 该组已无更多:直接提示,不再重复请求(按钮仍常驻显示,与中药协定方一致)
       if (!group.loadMore) {
       if (!group.loadMore) {
         this.$message({
         this.$message({
           showClose: false,
           showClose: false,
@@ -135,8 +118,6 @@ export default {
         });
         });
         return;
         return;
       }
       }
-      // 记录本次点的是哪个分组(共享方式 0/1/2)
-      this.currentShowType = group.showType;
       this.pageNum += 1;
       this.pageNum += 1;
       this.fetchList();
       this.fetchList();
     },
     },