Skip to content

Commit ab28004

Browse files
authored
Merge pull request #66 from aice030/fix/55
Fix/55(View&Controller): 优化了页面布局和点击功能
2 parents ee48c71 + 892452b commit ab28004

File tree

5 files changed

+70
-33
lines changed

5 files changed

+70
-33
lines changed

client/src/components/AlarmChangeCard.vue

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
<template>
2-
<el-card class="alarm-change-card" shadow="hover">
2+
<el-card class="alarm-change-card" shadow="hover" :class="{ 'expandable': item.details }" @click="handleCardClick">
33
<div class="card-content">
44
<div class="card-header">
55
<div class="alarm-info">
66
<div class="service-name">{{ item.service }}</div>
77
<div class="change-description">{{ item.change }}</div>
88
<div class="timestamp">{{ item.timestamp }}</div>
99
</div>
10-
<el-button
11-
type="text"
12-
size="small"
13-
@click="toggleExpanded"
14-
class="expand-btn"
15-
>
10+
<div v-if="item.details" class="expand-indicator">
1611
<el-icon>
1712
<ArrowUp v-if="isExpanded" />
1813
<ArrowDown v-else />
1914
</el-icon>
20-
</el-button>
15+
</div>
2116
</div>
2217

2318
<!-- 详细信息 -->
@@ -45,6 +40,12 @@ const isExpanded = ref(false)
4540
const toggleExpanded = () => {
4641
isExpanded.value = !isExpanded.value
4742
}
43+
44+
const handleCardClick = () => {
45+
if (props.item.details) {
46+
toggleExpanded()
47+
}
48+
}
4849
</script>
4950

5051
<style scoped>
@@ -83,14 +84,24 @@ const toggleExpanded = () => {
8384
color: #6b7280;
8485
}
8586
86-
.expand-btn {
87+
.expand-indicator {
8788
width: 32px;
8889
height: 32px;
89-
padding: 0;
9090
display: flex;
9191
align-items: center;
9292
justify-content: center;
9393
margin-left: 16px;
94+
color: #6b7280;
95+
}
96+
97+
.expandable {
98+
cursor: pointer;
99+
transition: all 0.2s ease;
100+
}
101+
102+
.expandable:hover {
103+
transform: translateY(-1px);
104+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
94105
}
95106
96107
.details-section {

client/src/components/BatchDetail.vue

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="batch-detail">
2+
<div class="batch-detail" :class="{ 'expandable': batch.moduleRecords }" @click="handleBatchClick">
33
<div class="batch-header">
44
<div class="batch-info">
55
<div class="batch-name">{{ batch.name }}</div>
@@ -11,18 +11,12 @@
1111
{{ batch.status }}
1212
</el-tag>
1313
</div>
14-
<el-button
15-
v-if="batch.moduleRecords"
16-
type="text"
17-
size="small"
18-
@click="toggleModuleExpanded"
19-
class="expand-btn"
20-
>
14+
<div v-if="batch.moduleRecords" class="expand-indicator">
2115
<el-icon>
2216
<ArrowUp v-if="isModuleExpanded" />
2317
<ArrowDown v-else />
2418
</el-icon>
25-
</el-button>
19+
</div>
2620
</div>
2721

2822
<div class="batch-details">
@@ -69,6 +63,13 @@ const toggleModuleExpanded = () => {
6963
isModuleExpanded.value = !isModuleExpanded.value
7064
}
7165
66+
const handleBatchClick = (event: Event) => {
67+
if (props.batch.moduleRecords) {
68+
event.stopPropagation() // 阻止事件冒泡到父级
69+
toggleModuleExpanded()
70+
}
71+
}
72+
7273
const getBatchStatusType = (status: string) => {
7374
switch (status) {
7475
case '异常':
@@ -113,13 +114,23 @@ const getBatchStatusType = (status: string) => {
113114
font-size: 12px;
114115
}
115116
116-
.expand-btn {
117+
.expand-indicator {
117118
width: 24px;
118119
height: 24px;
119-
padding: 0;
120120
display: flex;
121121
align-items: center;
122122
justify-content: center;
123+
color: #6b7280;
124+
}
125+
126+
.expandable {
127+
cursor: pointer;
128+
transition: all 0.2s ease;
129+
}
130+
131+
.expandable:hover {
132+
background: #f1f5f9;
133+
border-color: #cbd5e1;
123134
}
124135
125136
.batch-details {

client/src/components/ChangeCard.vue

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<el-card class="change-card" shadow="hover">
2+
<el-card class="change-card" shadow="hover" :class="{ 'expandable': item.batches }" @click="handleCardClick">
33
<template #header>
44
<div class="card-header">
55
<div class="card-title">
@@ -11,18 +11,12 @@
1111
<span v-else-if="item.state === '已完成'">发布完成,{{ item.ok ? '正常' : '异常' }}</span>
1212
</span>
1313
</div>
14-
<el-button
15-
v-if="item.batches"
16-
type="text"
17-
size="small"
18-
@click="toggleExpanded"
19-
class="expand-btn"
20-
>
14+
<div v-if="item.batches" class="expand-indicator">
2115
<el-icon>
2216
<ArrowUp v-if="isExpanded" />
2317
<ArrowDown v-else />
2418
</el-icon>
25-
</el-button>
19+
</div>
2620
</div>
2721
</template>
2822

@@ -61,6 +55,12 @@ const toggleExpanded = () => {
6155
isExpanded.value = !isExpanded.value
6256
}
6357
58+
const handleCardClick = () => {
59+
if (props.item.batches) {
60+
toggleExpanded()
61+
}
62+
}
63+
6464
const getStatusDotClass = (state: string) => {
6565
switch (state) {
6666
case '已完成':
@@ -124,13 +124,23 @@ const getProgressColor = (state: string) => {
124124
margin-left: 8px;
125125
}
126126
127-
.expand-btn {
127+
.expand-indicator {
128128
width: 32px;
129129
height: 32px;
130-
padding: 0;
131130
display: flex;
132131
align-items: center;
133132
justify-content: center;
133+
color: #6b7280;
134+
}
135+
136+
.expandable {
137+
cursor: pointer;
138+
transition: all 0.2s ease;
139+
}
140+
141+
.expandable:hover {
142+
transform: translateY(-1px);
143+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
134144
}
135145
136146
.card-content {

client/src/views/ChangeLogView.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,14 @@ onMounted(() => {
295295
.title {
296296
font-size: 24px;
297297
font-weight: 600;
298+
color: #2c3e50;
298299
}
299300
300301
.page-title {
301302
font-size: 32px;
302303
font-weight: 600;
303304
margin-bottom: 16px;
305+
color: #2c3e50;
304306
}
305307
306308
.tabs {

client/src/views/HomeView.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,13 +1452,16 @@ const disposeMetricsCharts = () => {
14521452
.title {
14531453
font-size: 24px;
14541454
font-weight: 600;
1455+
color: #2c3e50;
14551456
}
14561457
14571458
.subtitle {
14581459
text-align: center;
14591460
font-size: 18px;
14601461
font-weight: 500;
1462+
margin-top: -30px;
14611463
margin-bottom: 12px;
1464+
color: #2c3e50;
14621465
}
14631466
14641467
.topology-card {
@@ -1554,7 +1557,7 @@ const disposeMetricsCharts = () => {
15541557
15551558
.legend {
15561559
position: absolute;
1557-
bottom: 12px;
1560+
bottom: 60px;
15581561
right: 12px;
15591562
background: rgba(255, 255, 255, 0.95);
15601563
backdrop-filter: blur(8px);

0 commit comments

Comments
 (0)