From 07a41ade45c962e93a9d449ce1be0eec52e66a6a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 19 三月 2025 10:44:32 +0800
Subject: [PATCH] 内部单不能修改报告

---
 src/components/view/a6-device-overview.vue |   59 ++++++++++++++++++++++++++++-------------------------------
 1 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/src/components/view/a6-device-overview.vue b/src/components/view/a6-device-overview.vue
index 5448024..c2a41c2 100644
--- a/src/components/view/a6-device-overview.vue
+++ b/src/components/view/a6-device-overview.vue
@@ -127,7 +127,7 @@
 	<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">
@@ -148,11 +148,12 @@
 			</div>
 			<div class="search_thing" style="padding-left: 30px;">
 				<el-button size="small" @click="refresh()">閲� 缃�</el-button>
-				<el-button size="small" type="primary" @click="currentPage= 1,list=[],finishLoding = false,refreshTable()">鏌� 璇�</el-button>
+				<el-button size="small" type="primary" @click="currentPage= 1,keyMap = {},list=[],finishLoding = false,refreshTable()">鏌� 璇�</el-button>
 			</div>
 		</div>
-		<div class="table" @scroll="scrollFn">
-      <ul v-loading="loading" class="card">
+		<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;
@@ -192,27 +193,18 @@
           </div>
         </li>
       </ul>
-      <div v-if="list.length<1&&!loading&&!isLoding" style="color:#909399;font-size:14px;text-align: center;margin-top:200px" >鏆傛棤鏁版嵁</div>
-      <div v-if="list.length>0">
-        <el-button
-          v-if="isLoding"
-          type="text"
-          style="display: flex; margin: 0 auto; color: #909399"
-          ><i class="el-icon-loading" style="font-size:20px"></i
-        ></el-button>
-         <el-button
-          type="text"
-          v-if="finishLoding"
-          style="display: flex; margin: 0 auto; color: #909399"
-          >宸茬粡娌℃湁鏇村鍟</el-button
-        >
-      </div>
+      </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:{
@@ -226,25 +218,29 @@
         pageSize: 16, // 涓�椤�16鏉�
         total: '',
         loading: true, // 缁勪欢loading鐨勫睍绀�,榛樿涓簍rue
-        isLoding: false, // 鍔犺浇涓紝loading鍥炬爣,榛樿涓簍rue
-        finishLoding: false // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡
+        finishLoding: false, // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡
+        keyMap: {}
 			}
 		},
     created() {
       this.selectEnumByCategory()
+      this.keyMap = {};
       this.currentPage = 1;
       this.list = [];
       this.refreshTable();
     },
 		methods: {
 			refreshTable() {
-        if(this.currentPage>1){
-          this.isLoding = true
-        }else{
-          this.loading = true
+        const key = `_${this.currentPage}`
+        const value = this.keyMap[key]
+        // 濡傛灉value瀛樺湪锛岃〃绀虹紦瀛樻湁鍊硷紝閭d箞闃绘璇锋眰
+        if(value) {
+          return
         }
-        if(this.list.length==0){
-          window.addEventListener("scroll", this.throttle(this.scrollFn, 20000));
+        // value涓嶅瓨鍦紝琛ㄧず绗竴娆¤姹�,璁剧疆鍗犱綅
+        this.keyMap[key] = 'temp'
+        if(this.currentPage==1){
+          this.loading = true
         }
         this.$axios.post(this.$api.deviceScope.selectDeviceParameter,{
 					page: {
@@ -261,15 +257,15 @@
             this.total = res.data.body.total
             let list = res.data.body.records.map(m=>{
               switch (m.deviceStatus){
-                case '0':
+                case 0:
                   // 姝e父
                   m.type ='success'
                   break;
-                case '1':
+                case 1:
                   // 鎶ュ簾
                   m.type ='warning'
                   break;
-                case '2':
+                case 2:
                   // 淇濅慨
                   m.type ='danger'
                   break;
@@ -291,13 +287,14 @@
               if(this.total==this.list.length){
                 this.finishLoding = true;
               }
+              this.currentPage++;
             }
           }
           this.loading = false
-          this.isLoding = false;
 				})
 			},
 			refresh() {
+        this.keyMap = {};
         this.currentPage= 1;
         this.list=[];
         this.finishLoding = false;

--
Gitblit v1.9.3