Parcourir la source

refactor(portraitManagement): 重构分组画像页面,拆分组件并添加标签切换功能

将原页面的代码拆分为能力画像和运行数据两个独立组件,为页面添加标签切换逻辑,抽离公共页面布局组件的标签功能,减少页面冗余代码
huoyi il y a 1 mois
Parent
commit
8416861764

+ 66 - 11
src/views/portraitManagement/components/page.vue

@@ -1,23 +1,49 @@
1 1
 <template>
2 2
   <div class="bg">
3 3
     <div class="page">
4
-      <div class="title">{{ title }}</div>
4
+      <div class="title-wrapper">
5
+        <div v-if="tabs.length>0" class="left-tab">
6
+          <div
7
+            v-for="(tab, index) in tabs"
8
+            :key="index"
9
+            class="tab-item"
10
+            :class="{ active: activeTab === index }"
11
+            @click="handleTabClick(index)"
12
+          >
13
+            {{ tab }}
14
+          </div>
15
+        </div>
16
+        <div class="title">{{ title }}</div>
17
+      </div>
5 18
       <div class="content">
6
-        <slot></slot>
19
+        <slot />
7 20
       </div>
8 21
     </div>
9 22
   </div>
10
-
11
-  
12 23
 </template>
13 24
 
14 25
 <script setup>
26
+import { ref } from 'vue'
27
+
15 28
 const props = defineProps({
16 29
   title: {
17 30
     type: String,
18 31
     default: '安检人事管理可视化大屏'
32
+  },
33
+  tabs: {
34
+    type: Array,
35
+    default: () => []
19 36
   }
20 37
 })
38
+
39
+const emit = defineEmits(['tabChange'])
40
+
41
+const activeTab = ref(0)
42
+
43
+const handleTabClick = (index) => {
44
+  activeTab.value = index
45
+  emit('tabChange', index)
46
+}
21 47
 </script>
22 48
 
23 49
 <style lang="scss" scoped>
@@ -33,7 +59,7 @@ const props = defineProps({
33 59
     content: '';
34 60
     position: absolute;
35 61
     inset: 0;
36
-    background: linear-gradient(45deg, #231A43, #1c2d3e) ;
62
+    background: linear-gradient(45deg, #231A43, #1c2d3e);
37 63
     opacity: 0.8;
38 64
     z-index: 1;
39 65
   }
@@ -44,16 +70,13 @@ const props = defineProps({
44 70
     flex-direction: column;
45 71
     min-height: 100vh;
46 72
   }
47
-  .title {
73
+  .title-wrapper {
74
+    display: flex;
75
+    align-items: center;
48 76
     height: 88px;
49
-    line-height: 88px;
50
-    text-align: center;
51
-    color: #fff;
52
-    font-size: 48px;
53 77
     background: #2b394d86;
54 78
     position: relative;
55 79
     margin-bottom: 2px;
56
-    font-weight: bold;
57 80
     &::before {
58 81
       content: '';
59 82
       position: absolute;
@@ -67,6 +90,38 @@ const props = defineProps({
67 90
       z-index: -1;
68 91
     }
69 92
   }
93
+  .left-tab {
94
+    display: flex;
95
+    padding: 0 20px;
96
+    .tab-item {
97
+      padding: 0 20px;
98
+      height: 88px;
99
+      line-height: 88px;
100
+      color: #a0c4ff;
101
+      font-size: 16px;
102
+      cursor: pointer;
103
+      transition: all 0.3s;
104
+     
105
+      &:hover {
106
+        background: rgba(15, 70, 250, 0.1);
107
+        color: #fff;
108
+      }
109
+      &.active {
110
+        background: rgba(15, 70, 250, 0.2);
111
+        color: #fff;
112
+        border-bottom-color: #cfdf89;
113
+      }
114
+    }
115
+  }
116
+  .title {
117
+    flex: 1;
118
+    height: 88px;
119
+    line-height: 88px;
120
+    text-align: center;
121
+    color: #fff;
122
+    font-size: 48px;
123
+    font-weight: bold;
124
+  }
70 125
   .content {
71 126
     flex: 1;
72 127
   }

Fichier diff supprimé car celui-ci est trop grand
+ 1162 - 0
src/views/portraitManagement/groupProfile/component/profile.vue


+ 20 - 0
src/views/portraitManagement/groupProfile/component/runData.vue

@@ -0,0 +1,20 @@
1
+<template>
2
+  <div class="operation-data">
3
+    <div class="placeholder">运行数据页面</div>
4
+  </div>
5
+</template>
6
+
7
+<script setup>
8
+</script>
9
+
10
+<style lang="scss" scoped>
11
+.operation-data {
12
+  padding: 20px;
13
+  .placeholder {
14
+    color: #fff;
15
+    font-size: 24px;
16
+    text-align: center;
17
+    padding: 100px 0;
18
+  }
19
+}
20
+</style>

Fichier diff supprimé car celui-ci est trop grand
+ 12 - 1151
src/views/portraitManagement/groupProfile/index.vue