From 083c818af77d33d619dba3dc20f94e996225a1c7 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期四, 16 五月 2024 10:28:39 +0800
Subject: [PATCH] 增加人事系统对接

---
 src/view/notice.vue |   63 +++++++++++--------------------
 1 files changed, 22 insertions(+), 41 deletions(-)

diff --git a/src/view/notice.vue b/src/view/notice.vue
index 4aae834..be68420 100644
--- a/src/view/notice.vue
+++ b/src/view/notice.vue
@@ -34,10 +34,11 @@
       </el-dropdown>
     </div>
     <div class="notice-content" v-loading="loading">
-      <scroll-pagination @load="refresh" :finishLoding="finishLoding">
+      <scroll-pagination @load="refresh" :finishLoding="finishLoding" :list="list">
         <div class="notice-content-item" v-for="(m,i) in list" :key="i">
           <div class="btns" v-if="m">
-            <el-dropdown style="margin-right: 20px;" trigger="click" @command="e=>handleDropdown(e,m)" v-if="m.messageType==2||m.messageType==3">
+            <!-- v-if="m.messageType==2||m.messageType==3" -->
+            <el-dropdown style="margin-right: 20px;" trigger="click" @command="e=>handleDropdown(e,m)" v-if="false">
               <span class="el-dropdown-link">
                 <span class="more" style="line-height: 26px;display: inline-block;">&middot;&middot;&middot;</span>
               </span>
@@ -54,14 +55,14 @@
             </el-dropdown>
             <i class="el-icon-close" style="cursor: pointer;" @click="handleDel(m)"></i>
           </div>
-          <div class="content">
+          <div class="content" @click="goNoticeDetail(m)" style="cursor: pointer;">
             <img :src="`../../static/img/notice-${m.messageType}.svg`" alt="" style="width: 50px;margin-right: 18px;">
             <div class="content-info">
               <h4 style="font-weight: normal;margin-bottom: 4px;display: flex;align-items: center;justify-content: space-between;">
-                <span>{{ m.theme }}<el-tag :type="!m.messageStatus?'danger':'success'" size="small" v-if="m.messageType==1||m.messageType==2||m.messageType==3" style="margin-left: 8px;">{{ !m.messageStatus?'鏈鐞�':'宸插鐞�' }}</el-tag></span>
+                <span>{{ m.theme }}<el-tag :type="!m.viewStatus?'danger':'success'" size="small" v-if="m.messageType==1||m.messageType==2||m.messageType==3" style="margin-left: 8px;">{{ !m.viewStatus?'鏈鐞�':'宸插鐞�' }}</el-tag></span>
                 <span class="time" style="color: #999999;font-size: 12px;">{{ m.createTime }}</span>
               </h4>
-              <p style="color: #999999;font-size: 14px;margin-bottom: 6px;cursor: pointer;" class="ellipsis-multiline" @click="goNoticeDetail(m)">{{ m.content }}</p>
+              <p style="color: #999999;font-size: 14px;margin-bottom: 6px;" class="ellipsis-multiline">{{ m.content }}</p>
               <p style="font-size: 12px;color: #999999;display: flex;align-items: center;justify-content: space-between;">
                 <span>鍙戦�佷汉锛歿{m.createUser}}</span>
                 <span>鏀朵欢浜猴細{{ m.consigneeUser }}</span>
@@ -124,17 +125,27 @@
       pageSize: 8, // 涓�椤�7鏉�
       total: null,
       loading: true, // 缁勪欢loading鐨勫睍绀�,榛樿涓簍rue
-      finishLoding: false // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡
+      finishLoding: false, // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡
+      keyMap:{}
     }
   },
   mounted(){
     this.getTypeDicts();
     this.currentPage = 1;
+    this.keyMap = {};
     this.list = [];
     this.refresh();
   },
   methods:{
     refresh(){
+      const key = `_${this.currentPage}`
+      const value = this.keyMap[key]
+      // 濡傛灉value瀛樺湪锛岃〃绀虹紦瀛樻湁鍊硷紝閭d箞闃绘璇锋眰
+      if(value) {
+        return
+      }
+      // value涓嶅瓨鍦紝琛ㄧず绗竴娆¤姹�,璁剧疆鍗犱綅
+      this.keyMap[key] = 'temp'
       if(this.currentPage==1){
         this.loading = true
       }
@@ -190,8 +201,10 @@
           p: "abcd"
         },29);
         this.list = [];
+        this.keyMap = {};
         this.currentPage = 1;
         this.refresh();
+        this.$emit('goNoticeDetail')
       })
     },
     handleDropdown(e,row){
@@ -215,6 +228,7 @@
           }
           this.$message.success('鍒犻櫎鎴愬姛')
           this.list = [];
+          this.keyMap = {};
           this.currentPage = 1;
           this.refresh()
         }).catch(e => {
@@ -222,40 +236,9 @@
         })
       }).catch(() => {})
     },
-    // 婊氬姩瑙﹀簳鍔犺浇
-    scrollFn() {
-      let clientHeight = document.documentElement.clientHeight - 18; //鍙鍖哄煙
-      let scrollHeight = document.body.scrollHeight; // 婊氬姩鏂囨。楂樺害
-      let scrollTop = parseInt(document.documentElement.scrollTop); // 宸叉粴鍔ㄧ殑楂樺害
-      let height = 300;
-      if (
-        scrollTop + clientHeight >= scrollHeight - height &&
-        scrollHeight != 0
-      ) {
-        if (!this.finishLoding&&this.currentPage*this.pageSize<this.total) {
-          this.currentPage = this.currentPage + 1;
-          this.refresh();
-        }
-      } else {
-        return false;
-      }
-    },
-    throttle(fn, wait) {
-      // 灏佽鍑芥暟杩涜鑺傛祦
-      var timer = null;
-      return function () {
-        var context = this;
-        var args = arguments;
-        if (!timer) {
-          timer = setTimeout(function () {
-            fn.apply(context, args);
-            timer = null;
-          }, wait);
-        }
-      };
-    },
     handleType(){
       this.list = [];
+      this.keyMap = {};
       this.currentPage = 1;
       this.refresh();
     },
@@ -270,13 +253,11 @@
         }
         this.$message.success('鎿嶄綔鎴愬姛')
         this.list = [];
+        this.keyMap = {};
         this.currentPage = 1;
         this.refresh();
       })
     }
-  },
-  destroyed() {
-    window.removeEventListener("scroll", this.throttle(), false);
   },
 }
 </script>

--
Gitblit v1.9.3