From a0b1fdec2bc5ddad11e981936b80d0fdf1e4bc69 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 03 七月 2024 09:25:06 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/center-lims-before into master

---
 src/view/notice.vue |  420 ++++++++++++++++++++++++++---------------------------------
 1 files changed, 185 insertions(+), 235 deletions(-)

diff --git a/src/view/notice.vue b/src/view/notice.vue
index dac79a8..a7cc226 100644
--- a/src/view/notice.vue
+++ b/src/view/notice.vue
@@ -4,221 +4,141 @@
   title="娑堟伅閫氱煡"
   :visible.sync="drawer"
   :direction="direction"
-  :before-close="handleClose" style="height: 100vh;">
-    <div class="head">
-      <div class="head-search">
-        <label>娑堟伅绫诲瀷锛�</label>
-        <el-select v-model="type" placeholder="璇烽�夋嫨" style="width: 150px;" size="small">
-        <el-option
-          v-for="item in options"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value">
-        </el-option>
-      </el-select>
-      </div>
-      <el-dropdown style="margin-right: 20px;">
-        <span class="el-dropdown-link">
-          <span class="more">&middot;&middot;&middot;</span>
-        </span>
-        <el-dropdown-menu slot="dropdown">
-          <el-dropdown-item>
-            <i class="el-icon-check"></i>
-            <span>鏍囪鎵�鏈夋秷鎭负宸茶</span>
-          </el-dropdown-item>
-          <el-dropdown-item>
-            <i class="el-icon-delete"></i>
-            <span>鍒犻櫎鎵�鏈夊凡璇绘秷鎭�</span>
-          </el-dropdown-item>
-        </el-dropdown-menu>
-      </el-dropdown>
-    </div>
-    <div class="notice-content">
-      <div class="notice-content-item" v-for="(m,i) in list" :key="i">
-        <div class="btns">
-          <el-dropdown style="margin-right: 20px;" trigger="click" @command="handleDropdown">
-            <span class="el-dropdown-link">
-              <span class="more" style="line-height: 26px;display: inline-block;">&middot;&middot;&middot;</span>
-            </span>
-            <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item v-for="(n,j) in dropdownList" :key="j" :command="n.value">
-                {{ n.label }}
-              </el-dropdown-item>
-            </el-dropdown-menu>
-          </el-dropdown>
-          <i class="el-icon-close" style="cursor: pointer;"></i>
-        </div>
-        <div class="content">
-          <img :src="`../../static/img/notice-${m.type}.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.title }}</span>
-              <span class="time" style="color: #999999;font-size: 12px;">{{ m.time }}</span>
-            </h4>
-            <p style="color: #999999;font-size: 14px;margin-bottom: 6px;" class="ellipsis-multiline">{{ m.content }}</p>
-            <el-tag type="danger" size="small" v-if="m.status==0&&m.type==2" style="margin-bottom: 4px;">宸叉嫆缁�</el-tag>
-            <el-tag type="success" size="small" v-if="m.status==1&&m.type==2" style="margin-bottom: 4px;">宸叉帴鏀�</el-tag>
-            <p style="font-size: 12px;color: #999999;display: flex;align-items: center;justify-content: space-between;">
-              <span>鍙戦�佷汉锛歿{m.sendUser}}</span>
-              <span>鏀朵欢浜猴細{{ m.getUser }}</span>
+  :before-close="handleClose" style="height: 100vh;z-index: 9999999;" size="450px">
+    <div class="notice-content" v-loading="loading">
+      <el-button size="small" type="primary" @click="handleDropdownAll(1)" style="margin-bottom: 10px;margin-left: 330px;">鍏ㄩ儴宸茶</el-button>
+      <scroll-pagination @load="refresh" :finishLoding="finishLoding" :list="list" style="height: calc(100% - 50px);">
+        <div
+        class="notice-content-item"
+        v-for="(m,i) in list"
+        :key="i"
+        :class="{readStyle:m.viewStatus}"
+        @click="goNoticeDetail(m)">
+          <img :src="`../../static/img/notice-${m.viewStatus?1:0}-${m.messageType}.svg`" alt="" style="margin-right: 6px;">
+          <div class="notice-content-item-left">
+            <p>{{ m.theme }}</p>
+            <p style="width: 100%;display: flex;align-items: center;justify-content: space-between;">
+              <span>鍙戦�佷汉锛歿{ m.createUser }}</span>
+              <span>{{ m.createTime }}</span>
             </p>
           </div>
         </div>
-        <div class="new-notice" v-if="m.isRead==0">
-          <span>new</span>
-        </div>
-      </div>
+      </scroll-pagination>
+      <!-- <div v-if="list.length<1&&!loading" style="color:#909399;font-size:14px;text-align: center;margin-top:200px" >鏆傛棤鏁版嵁</div> -->
     </div>
   </el-drawer>
 </div>
 </template>
 
 <script>
+import ScrollPagination from '../components/tool/scroll-paging.vue'
 export default {
+  components: {
+    ScrollPagination
+  },
   data(){
     return{
       drawer:false,
       direction:'rtl',
       options:[],
       type:'0',
-      list:[
+      dropdownList0:[
         {
-          type:1,
-          title:'鏍囬',
-          content:'鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:0,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:0,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-        {
-          type:2,
-          title:'鏍囬',
-          content:'鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:1,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:1,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-        {
-          type:3,
-          title:'鏍囬',
-          content:'鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:1,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:0,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-        {
-          type:4,
-          title:'鏍囬',
-          content:'鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:1,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:0,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-        {
-          type:5,
-          title:'鏍囬',
-          content:'鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:1,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:0,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-        {
-          type:6,
-          title:'鏍囬',
-          content:'鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:1,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:1,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-        {
-          type:6,
-          title:'鏍囬',
-          content:'鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:1,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:1,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-        {
-          type:6,
-          title:'鏍囬',
-          content:'鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:1,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:1,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-        {
-          type:6,
-          title:'鏍囬',
-          content:'鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:1,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:1,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-        {
-          type:6,
-          title:'鏍囬',
-          content:'鍐呭',
-          time:'2019-08-07 15:34:26',
-          status:1,//娑堟伅鐘舵�侊細鎷掔粷銆佹帴鏀�
-          isRead:1,//鏄惁宸茶
-          sendUser:'灏忔槑',
-          getUser:'鏉庡崕',
-        },
-      ],
-      dropdownList:[
-        {
-          label:'鎷掔粷',
+          label:'閫氳繃',
           value:0
         },
         {
-          label:'鎺ユ敹',
+          label:'涓嶉�氳繃',
           value:1
         },
         {
-          label:'閫氳繃',
+          label:'鏌ョ湅鏇村',
+          value:4
+        },
+      ],
+      dropdownList1:[
+        {
+          label:'鎵瑰噯',
           value:2
         },
         {
-          label:'涓嶉�氳繃',
+          label:'涓嶆壒鍑�',
           value:3
         },
         {
-          label:'鎵瑰噯',
+          label:'鏌ョ湅鏇村',
           value:4
         },
-        {
-          label:'涓嶆壒鍑�',
-          value:5
-        },
-        {
-          label:'鏌ョ湅鏇村',
-          value:6
-        },
-      ]
+      ],
+      list:[
+        // {
+        //   messageType:1,
+        //   theme:'娴嬭瘯鏍囬',
+        //   createTime: '2019-08-30 15:46:17',
+        //   createUser:'<USERNAME>',
+        //   viewStatus:false,
+        // },
+        // {
+        //   messageType:2,
+        //   theme:'娴嬭瘯鏍囬',
+        //   createTime: '2019-08-30 15:46:17',
+        //   createUser:'<USERNAME>',
+        //   viewStatus:true,
+        // },
+      ],
+      currentPage:1,
+      pageSize: 8, // 涓�椤�7鏉�
+      total: null,
+      loading: true, // 缁勪欢loading鐨勫睍绀�,榛樿涓簍rue
+      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
+      }
+      if(this.list.length==0){
+        this.finishLoding = false
+      }
+      let type = this.type==0?null:this.type;
+      this.$axios.get(this.$api.informationNotification.page+'?size='+this.pageSize+'&current='+this.currentPage+(type?'&messageType='+type:'')).then(res => {
+        if(res.code === 201){
+          return
+        }
+        let list = res.data.records;
+        this.total = res.data.total;
+        if(list.length==0){
+          this.finishLoding = true;
+        }else{
+          if(list.length<this.pageSize){
+            this.finishLoding = true;
+          }
+          this.list = this.list.concat(list)
+          if(this.total==this.list.length){
+            this.finishLoding = true;
+          }
+          this.currentPage++
+        }
+        this.loading = false
+      })
+    },
     open(){
       this.drawer = true;
     },
@@ -233,26 +153,79 @@
         this.options = data;
       })
     },
-    goNoticeDetail(){
+    goNoticeDetail(row){
+      this.$axios.put(this.$api.informationNotification.triggerModificationStatusToRead+'/'+row.id).then(res => {
+        row.num = Math.random(100);
+        localStorage.setItem("noticeInfo", JSON.stringify(row))
+        this.$bus.$emit("change", JSON.stringify(row));
+        this.$parent.addTab({
+          v: "娑堟伅璇︽儏",
+          i: "el-icon-s-tools",
+          u: "notice-detail",
+          k:35,
+          p: "abcd"
+        },29);
+        this.list = [];
+        this.keyMap = {};
+        this.currentPage = 1;
+        this.refresh();
+        this.$emit('goNoticeDetail')
+      })
       this.drawer = false;
-      this.$parent.addTab({
-			v: "娑堟伅璇︽儏",
-			i: "el-icon-s-tools",
-			u: "notice-detail",
-      k:35,
-			p: "abcd"
-		},29);
     },
-    handleDropdown(e){
+    handleDropdown(e,row){
       switch(e){
         case 0:
           break;
-        case 6:
-          this.goNoticeDetail()
+        case 4:
+          this.goNoticeDetail(row)
           break;
       }
+    },
+    handleDel(row){
+      this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      }).then(() => {
+        this.$axios.delete(this.$api.informationNotification.deleteDataBasedOnId+'?id='+row.id).then(res => {
+          if (res.code === 201) {
+            return
+          }
+          this.$message.success('鍒犻櫎鎴愬姛')
+          this.list = [];
+          this.keyMap = {};
+          this.currentPage = 1;
+          this.refresh()
+        }).catch(e => {
+          this.$message.error('鍒犻櫎澶辫触')
+        })
+      }).catch(() => {})
+    },
+    handleType(){
+      this.list = [];
+      this.keyMap = {};
+      this.currentPage = 1;
+      this.refresh();
+    },
+    handleDropdownAll(e){
+      let type = false;
+      if(e==1){
+        type = true;
+      }
+      this.$axios.put(this.$api.informationNotification.informationReadOrDelete+'/'+type).then(res => {
+        if(res.code===201){
+          return
+        }
+        this.$message.success('鎿嶄綔鎴愬姛')
+        this.list = [];
+        this.keyMap = {};
+        this.currentPage = 1;
+        this.refresh();
+        this.$emit('goNoticeDetail')
+      })
     }
-  }
+  },
 }
 </script>
 
@@ -289,66 +262,43 @@
   cursor: pointer;
 }
 .notice-content{
-  height: calc(100% - 60px);
+  height: 100%;
   overflow-y: auto;
   box-sizing: border-box;
   padding: 0 16px;
 }
 .notice-content-item{
-  position: relative;
   width: 100%;
-  padding: 8px;
+  padding: 9px;
   border-radius: 8px;
   box-sizing: border-box;
-  border: 1px solid #EEEEEE;
   margin-bottom: 10px;
   overflow: hidden;
-}
-.btns{
-  position: absolute;
-  right: 20px;
-  top: 4px;
-  z-index: 4;
-}
-.notice-content-item .btns{
-  opacity: 0;
-}
-.time{
-  opacity: 1;
-}
-.notice-content-item:hover{
-  box-shadow: 4px 4px 8px 0px rgba(51,51,51,0.04);
-}
-.notice-content-item:hover .btns{
-  opacity: 1;
-}
-.notice-content-item:hover .time{
-  opacity: 0;
-}
-.content{
+  background: #FBF2ED;
   display: flex;
   align-items: center;
+  cursor: pointer;
 }
-.content-info{
-  flex: 1;
+.notice-content-item-left{
+  width: 100%;
 }
-.new-notice{
-  position: absolute;
-  left: 0;
-  top: 0;
-  width: 0;
-  height: 0;
-  border-top: 14px solid red;
-  border-right: 14px solid transparent;
-  border-bottom: 14px solid transparent;
-  border-left: 14px solid red;
+.notice-content-item-left p:nth-child(1){
+  font-size: 14px;
+  color: #FF7756;
+  line-height: 18px;
+  margin-bottom: 8px;
 }
-.new-notice span{
-  position: absolute;
+.notice-content-item-left p:nth-child(2){
+  color: #FFAB97;
   font-size: 12px;
-  top: -13px;
-  left: -17px;
-  color: #fff;
-  transform: rotate(-45deg) scale(0.8);
+}
+.readStyle{
+  background: #E9F6F2;
+}
+.readStyle .notice-content-item-left p:nth-child(1){
+  color: #198D8A;
+}
+.readStyle .notice-content-item-left p:nth-child(2){
+  color: #90CBCD;
 }
 </style>

--
Gitblit v1.9.3