From 7f61b1328994273b63e95ad4ad4c014fc3baeac9 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期一, 04 三月 2024 17:22:01 +0800
Subject: [PATCH] fix:修改图标细节

---
 src/views/daoAnOffice/right/danger/dataTable.vue |   79 ++++++++++++++++++++++++++++++++++++++-
 src/views/daoAnOffice/right/danger/index.vue     |   18 ++++++---
 2 files changed, 88 insertions(+), 9 deletions(-)

diff --git a/src/views/daoAnOffice/right/danger/dataTable.vue b/src/views/daoAnOffice/right/danger/dataTable.vue
index f532285..d9fce59 100644
--- a/src/views/daoAnOffice/right/danger/dataTable.vue
+++ b/src/views/daoAnOffice/right/danger/dataTable.vue
@@ -11,7 +11,7 @@
     </div>
     <div class="table-container flex-1">
       <div class="table-content">
-        <el-table class="data-table" :data="tableData" :highlight-current-row="false" :stripe="true"
+        <el-table class="data-table" ref="dataTable" :data="tableData" :highlight-current-row="false" :stripe="true"
           :header-cell-style="{ backgroundColor: 'transparent', color: '#79A5E9', borderColor: '#29466A' }"
           :cell-style="{ color: '#79A5E9', borderColor: '#29466A', paddingTop: '10px', paddingBottom: '10px' }"
           :row-style="{ backgroundColor: 'transparent' }">
@@ -46,7 +46,9 @@
 </template>
 
 <script setup>
-import { ref } from 'vue';
+import { ref, onMounted, onUnmounted, nextTick, inject, watch } from 'vue';
+
+const tableState = inject('tableState');
 
 const tableType = ref([
   { id: 1, type: '鏈湀', isActive: true },
@@ -54,6 +56,36 @@
 ]);
 
 const tableData = [
+  {
+    street: '濂庡厜濉旇閬�',
+    num1: 12,
+    num2: 5,
+    num3: 2
+  },
+  {
+    street: '濂庡厜濉旇閬�',
+    num1: 12,
+    num2: 5,
+    num3: 2
+  },
+  {
+    street: '濂庡厜濉旇閬�',
+    num1: 12,
+    num2: 5,
+    num3: 2
+  },
+  {
+    street: '濂庡厜濉旇閬�',
+    num1: 12,
+    num2: 5,
+    num3: 2
+  },
+  {
+    street: '濂庡厜濉旇閬�',
+    num1: 12,
+    num2: 5,
+    num3: 2
+  },
   {
     street: '濂庡厜濉旇閬�',
     num1: 12,
@@ -110,6 +142,46 @@
   });
   selectItem.isActive = true;
 }
+
+
+// 澶勭悊琛ㄦ牸婊氬姩
+let timer = null;
+const dataTable = ref(null);
+
+// const clearScroll = () => {
+//   clearInterval(timer);
+//   timer = null;
+// }
+
+// const createScroll = () => {
+//   clearScroll();
+//   const table = dataTable.value.layout.table.refs;
+
+//   const tableWrapper = table.bodyWrapper.firstElementChild.firstElementChild;
+//   console.log(tableWrapper);
+//   timer = setInterval(() => {
+//     tableWrapper.scrollTop += 1;
+//     if (tableWrapper.clientHeight + tableWrapper.scrollTop >= tableWrapper.scrollHeight) {
+//       tableWrapper.scrollTop = 0;
+//     }
+//   }, 100);
+// }
+// watch(tableState, (newValue) => {
+//   console.log(newValue);
+//   if (newValue) {
+//     nextTick(() => {
+//       setTimeout(() => {
+//         createScroll();
+//       }, 2000);
+//     })
+//   } else {
+//     clearScroll();
+//   }
+// })
+
+// onUnmounted(() => {
+//   clearScroll();
+// });
 </script>
 
 <style lang="scss" scoped>
@@ -180,4 +252,5 @@
 
 .el-table__fixed-right {
   height: 100% !important;
-}</style>
\ No newline at end of file
+}
+</style>
\ No newline at end of file
diff --git a/src/views/daoAnOffice/right/danger/index.vue b/src/views/daoAnOffice/right/danger/index.vue
index 89a7bb1..ef6ec52 100644
--- a/src/views/daoAnOffice/right/danger/index.vue
+++ b/src/views/daoAnOffice/right/danger/index.vue
@@ -4,8 +4,8 @@
   <RightTitle title="瀹夊叏闅愭偅鎯呭喌">
     <template #top>
       <div class="select-container flex">
-        <div class="item whitespace-no-wrap cursor-pointer" :class="{'select-active': item.isActive}" v-for="item in selectItems" :key="item.itemIndex"
-          @click="changeSelect(item)">
+        <div class="item whitespace-no-wrap cursor-pointer" :class="{ 'select-active': item.isActive }"
+          v-for="item in selectItems" :key="item.itemIndex" @click="changeSelect(item)">
           {{ item.name }}
         </div>
       </div>
@@ -27,18 +27,24 @@
 import RightTitle from "@/components/right-title";
 import DataView from './dataView.vue';
 import InfoView from './infoView.vue';
-import { ref } from 'vue';
+import { ref, provide } from 'vue';
 
-
+const tableState = ref(false);
 const selectItems = ref([
   { itemIndex: 1, name: '瀹夊叏闅愭偅', isActive: true },
   { itemIndex: 2, name: '鏁版嵁缁熻', isActive: false },
 ]);
-
+// 渚濊禆
+provide('tableState',tableState);
 
 const changeSelect = (selectItem) => {
   selectItems.value.map(item => item.isActive = false);
   selectItem.isActive = true;
+  if (selectItem.itemIndex === 2) {
+    tableState.value = true;
+  } else {
+    tableState.value = false;
+  }
 }
 
 </script>
@@ -59,7 +65,7 @@
 }
 
 .select-active {
- color: #fff; 
+  color: #fff;
 }
 
 .item:last-child {

--
Gitblit v1.8.0