From ee2882cff02d3545b66c7591f88ed4800f730a9a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 21 五月 2025 10:00:17 +0800
Subject: [PATCH] 消息通知数据自动筛选

---
 src/components/view/a6-device-overview.vue |  272 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 242 insertions(+), 30 deletions(-)

diff --git a/src/components/view/a6-device-overview.vue b/src/components/view/a6-device-overview.vue
index c692528..c2a41c2 100644
--- a/src/components/view/a6-device-overview.vue
+++ b/src/components/view/a6-device-overview.vue
@@ -33,29 +33,93 @@
 		width: calc(100% - 40px);
 		height: calc(100% - 60px - 80px - 10px - 40px);
 		padding: 20px;
+    overflow-y: auto;
 	}
 
-  ul {
+  .card {
     list-style-type: none;
     display: grid;
-    grid-template-columns: repeat(auto-fit, 370px);
-    justify-content: center;
-    grid-gap: 22px;
+    grid-template-columns: repeat(auto-fit, 415px);
+    /* justify-content: center; */
+    grid-gap: 16px;
+    min-height: 300px;
   }
-  ul li{
-    width: 370px;
-    height: 160px;
+  .card li{
+    width: 415px;
+    height: 165px;
     border-radius: 8px 8px 8px 8px;
     border: 1px solid #EEEEEE;
     margin: 0 !important;
     display: flex;
     align-items: center;
+    box-sizing: border-box;
+    padding: 16px;
+    font-size: 14px;
+    color: #666666;
+    position: relative;
+    overflow: hidden;
   }
-  ul li img{
-    width: 131px;
-    height: 131px;
+  .card li .img{
+    width: 114px;
+    height: 114px;
     border-radius: 16px;
     margin-right: 24px;
+  }
+  .list-left .list-left-info{
+    line-height: 36px;
+    display: flex;
+  }
+  .text-truncate {
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap
+  }
+  .circles{
+    position: absolute;
+    width: 70px;
+    height: 70px;
+    right: 0;
+    top: 0;
+    z-index: 0;
+  }
+  .circles .circle{
+    border-radius: 50%;
+    opacity: 0.2;
+  }
+  .circle0,.circle1,.circle2{
+    width: 60px;
+    height: 60px;
+    position: absolute;
+  }
+  .circle3{
+    width: 16px;
+    height: 16px;
+    position: absolute;
+  }
+  .circle0{
+    bottom: 6px;
+    left: 0;
+  }
+  .circle1{
+    bottom: 0;
+    right: -30px;
+  }
+  .circle2{
+    left: 0;
+    top: -30px;
+  }
+  .circle3{
+    top: 0;
+    right: 0;
+  }
+  .success .circle{
+    background: #34BD66;
+  }
+  .danger .circle{
+    background: #FF3838;
+  }
+  .warning .circle{
+    background: #FBB247;
   }
 </style>
 
@@ -63,13 +127,13 @@
 	<div class="role_manage">
 		<div>
 			<el-row class="title">
-				<el-col :span="12" style="padding-left: 20px;">璁惧鎬昏</el-col>
+				<el-col :span="12" style="padding-left: 20px;text-align: left;">璁惧鎬昏</el-col>
 			</el-row>
 		</div>
 		<div class="search">
       <div class="search_thing">
 				<div class="search_label">鐘舵�侊細</div>
-				<el-select v-model="searchForm.status" placeholder="鍏ㄩ儴" size="small">
+				<el-select v-model="entity.deviceStatus" placeholder="鍏ㄩ儴" size="small">
 					<el-option
 					  v-for="item in options"
 					  :key="item.value"
@@ -80,33 +144,48 @@
 			</div>
 			<div class="search_thing">
 				<div class="search_label">璁惧鍚嶇О锛�</div>
-				<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="searchForm.name"
-						@keyup.enter.native="refreshTable()"></el-input></div>
+				<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="entity.deviceName"></el-input></div>
 			</div>
 			<div class="search_thing" style="padding-left: 30px;">
 				<el-button size="small" @click="refresh()">閲� 缃�</el-button>
-				<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
+				<el-button size="small" type="primary" @click="currentPage= 1,keyMap = {},list=[],finishLoding = false,refreshTable()">鏌� 璇�</el-button>
 			</div>
 		</div>
-		<div class="table">
-      <ul>
-        <li v-for="m in 10" :key="m">
-          <img src="https://cn.bing.com/images/search?view=detailV2&ccid=2rNAMzsn&id=EE3F6A1D4B80118C0F4376BEBAD7B9690DCA0029&thid=OIP.2rNAMzsnuOFoZdUl_OIltQHaE8&mediaurl=https%3a%2f%2fts1.cn.mm.bing.net%2fth%2fid%2fR-C.dab340333b27b8e16865d525fce225b5%3frik%3dKQDKDWm517q%252bdg%26riu%3dhttp%253a%252f%252fseopic.699pic.com%252fphoto%252f50052%252f2932.jpg_wh1200.jpg%26ehk%3dViGq82qf5d0jyp5G9R6ZLs8p6PmBR4IGfEPP48JYdZg%253d%26risl%3d%26pid%3dImgRaw%26r%3d0&exph=800&expw=1200&q=%e5%9c%a8%e7%ba%bf%e8%ae%be%e5%a4%87%e5%9b%be%e7%89%87%e4%b8%8d%e8%b7%a8%e5%9f%9f&simid=608030609452501280&FORM=IRPRST&ck=E1891E3AC31F578247B495D0C618E8AE&selectedIndex=1&itb=0&ajaxhist=0&ajaxserp=0" alt="">
+		<div class="table" v-loading="loading">
+      <scroll-pagination @load="refreshTable" :finishLoding="finishLoding" :list="list" v-if="list.length>0||loading">
+        <ul class="card">
+        <li v-for="(m,i) in list" :key="i">
+          <el-image class="img" :src="javaApi+'/img/'+m.imageUpload">
+            <div slot="error" class="image-error" style="width: 112px;
+            height: 112px;
+            border-radius: 16px;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            border: 1px solid #EEEEEE;">
+              <i class="el-icon-picture-outline" style="font-size:30px;color:#666666;"></i>
+            </div>
+          </el-image>
           <div class="list-left">
             <div class="list-left-info">
               <span class="label">璁惧鍚嶇О锛�</span>
-              <span>灏忚垶鐏垫缉娑℃贩鍚堝櫒</span>
+              <span style="color:#3A7BFA;
+              font-size: 16px;
+              display: inline-block;
+              width: 129px;
+              word-break: break-all;" class="text-truncate">{{m.deviceName?m.deviceName:'鏃�'}}</span>
             </div>
             <div class="list-left-info">
               <span class="label">瑙勬牸鍨嬪彿锛�</span>
-              <span>CASJTS-C004-01</span>
+              <span style="color:#333333;font-size: 16px;">{{m.specificationModel?m.specificationModel:'鏃�'}}</span>
             </div>
             <div class="list-left-info">
               <span class="label">鐘舵�侊細</span>
-              <el-tag type="danger">鏍囩浜�</el-tag>
+              <el-tag :type="m.type" v-if="m.deviceStatusName">{{m.deviceStatusName}}</el-tag>
+              <span v-else style="color:#333333;font-size: 16px;">鏃�</span>
             </div>
           </div>
-          <div class="circles">
+          <div class="circles" :class="m.type">
             <div class="circle0 circle"></div>
             <div class="circle1 circle"></div>
             <div class="circle2 circle"></div>
@@ -114,28 +193,161 @@
           </div>
         </li>
       </ul>
+      </scroll-pagination>
+      <div v-if="list.length<1&&!loading" style="color:#909399;font-size:14px;text-align: center;margin-top:200px" >鏆傛棤鏁版嵁</div>
 		</div>
 	</div>
 </template>
 
 <script>
+import ScrollPagination from '../tool/scroll-paging.vue'
 	export default {
+    components: {
+      ScrollPagination
+    },
 		data() {
 			return {
+        entity:{
+          deviceStatus: null,
+					deviceName: null,
+          orderBy: {field: "id", order: "asc"}
+        },
         options:[],
-        // 鎼滅储琛ㄥ崟
-        searchForm:{}
+        list:[],
+        currentPage: 1, // 褰撳墠椤�
+        pageSize: 16, // 涓�椤�16鏉�
+        total: '',
+        loading: true, // 缁勪欢loading鐨勫睍绀�,榛樿涓簍rue
+        finishLoding: false, // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡
+        keyMap: {}
 			}
 		},
-		mounted() {
-		},
+    created() {
+      this.selectEnumByCategory()
+      this.keyMap = {};
+      this.currentPage = 1;
+      this.list = [];
+      this.refreshTable();
+    },
 		methods: {
 			refreshTable() {
-
+        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
+        }
+        this.$axios.post(this.$api.deviceScope.selectDeviceParameter,{
+					page: {
+            current: this.currentPage,
+            size: this.pageSize
+          },
+					entity: this.entity
+				}, {
+					headers: {
+						'Content-Type': 'application/json'
+					}
+				}).then(res => {
+          if(res.code==200){
+            this.total = res.data.body.total
+            let list = res.data.body.records.map(m=>{
+              switch (m.deviceStatus){
+                case 0:
+                  // 姝e父
+                  m.type ='success'
+                  break;
+                case 1:
+                  // 鎶ュ簾
+                  m.type ='warning'
+                  break;
+                case 2:
+                  // 淇濅慨
+                  m.type ='danger'
+                  break;
+              }
+              this.options.forEach(j=>{
+                if(m.deviceStatus==j.value){
+                  m.deviceStatusName = j.label
+                }
+              })
+              return m;
+            })
+            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
+				})
 			},
 			refresh() {
-
+        this.keyMap = {};
+        this.currentPage= 1;
+        this.list=[];
+        this.finishLoding = false;
+        this.entity={
+          deviceStatus: null,
+					deviceName: null,
+          orderBy: {field: "id", order: "asc"}
+        };
+        this.refreshTable()
 			},
-		}
+      // 鑾峰彇瀛楀吀
+      selectEnumByCategory() {
+				this.$axios.post(this.$api.enums.selectEnumByCategory, {
+					category: "璁惧鐘舵��"
+				}).then(res => {
+					this.options = res.data
+				})
+			},
+      // 婊氬姩瑙﹀簳鍔犺浇
+      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.refreshTable();
+          }
+        } 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);
+          }
+        };
+      },
+		},
+    destroyed() {
+      window.removeEventListener("scroll", this.throttle(), false);
+    },
 	}
 </script>

--
Gitblit v1.9.3