设备管理页面自适应 #150

Merged
hnu202326010221 merged 3 commits from pangqr_branch into develop 4 months ago

@ -608,17 +608,17 @@ const formatTime = (time) => {
<table class="table">
<thead>
<tr>
<th style="width: 40px; text-align: center;">
<th>
<input type="checkbox" :checked="isAllSelected" @change="toggleAllSelection">
</th>
<th style="width: 120px;">设备名称</th>
<th style="width: 100px;">设备编号</th>
<th style="width: 140px;">MAC地址</th>
<th style="width: 120px;">购买日期</th>
<th style="width: 120px;">绑定用户账号</th>
<th style="width: 100px;">设备状态</th>
<th style="width: 100px;">数据信息</th>
<th style="width: 180px;">操作</th>
<th>设备名称</th>
<th>设备编号</th>
<th>MAC地址</th>
<th>购买日期</th>
<th>绑定用户账号</th>
<th>设备状态</th>
<th>数据信息</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@ -923,6 +923,10 @@ const formatTime = (time) => {
padding: var(--space-5);
}
.table-container {
overflow-x: auto;
}
.table {
width: 100%;
border-collapse: collapse;
@ -931,12 +935,12 @@ const formatTime = (time) => {
.table th,
.table td {
padding: 20px 16px;
padding: 16px 12px;
text-align: center;
vertical-align: middle;
border-bottom: 1px solid var(--color-gray-200);
word-wrap: break-word;
height: 80px; /* 固定行高 */
height: 72px;
box-sizing: border-box;
}
@ -945,8 +949,56 @@ const formatTime = (time) => {
font-weight: 600;
color: var(--color-gray-700);
font-size: 14px;
padding: 18px 16px;
height: 60px; /* 表头稍矮一些 */
padding: 16px 12px;
height: 56px;
}
/* 设置列宽 - 9列布局 */
.table th:nth-child(1),
.table td:nth-child(1) {
width: 4%;
}
.table th:nth-child(2),
.table td:nth-child(2) {
width: 10%;
text-align: left;
padding-left: 16px;
}
.table th:nth-child(3),
.table td:nth-child(3) {
width: 9%;
}
.table th:nth-child(4),
.table td:nth-child(4) {
width: 13%;
}
.table th:nth-child(5),
.table td:nth-child(5) {
width: 10%;
}
.table th:nth-child(6),
.table td:nth-child(6) {
width: 11%;
}
.table th:nth-child(7),
.table td:nth-child(7) {
width: 9%;
}
.table th:nth-child(8),
.table td:nth-child(8) {
width: 8%;
}
.table th:nth-child(9),
.table td:nth-child(9) {
width: 26%;
}
/* 保持原样式不变,只添加新增的样式 */
@ -1002,53 +1054,49 @@ const formatTime = (time) => {
.device-info {
display: flex;
align-items: center;
gap: var(--space-3);
}
.device-icon {
font-size: 1.5rem;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
background: var(--color-gray-100);
border-radius: var(--radius-lg);
flex-shrink: 0;
gap: 12px;
height: 100%;
}
.device-details {
flex: 1;
min-width: 0;
overflow: hidden;
}
.device-name {
font-weight: 600;
color: var(--color-gray-900);
margin-bottom: var(--space-1);
font-size: var(--text-sm);
color: var(--color-gray-700);
margin-bottom: 2px;
font-size: 14px;
line-height: 1.3;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.device-model {
font-size: var(--text-xs);
font-size: 12px;
color: var(--color-gray-500);
line-height: 1.2;
}
.device-id {
font-weight: 600;
color: var(--color-gray-900);
font-size: var(--text-sm);
font-size: 14px;
}
.mac-address {
font-weight: 600;
color: var(--color-gray-900);
font-size: var(--text-sm);
font-size: 14px;
}
.purchase-date {
font-weight: 600;
color: var(--color-gray-900);
font-size: var(--text-sm);
font-size: 14px;
}
.bound-user {
@ -1060,22 +1108,19 @@ const formatTime = (time) => {
.user-id {
font-weight: 600;
color: var(--color-gray-900);
font-size: var(--text-sm);
}
.user-status {
font-size: var(--text-xs);
font-size: 14px;
}
.status-tag {
display: inline-flex;
align-items: center;
gap: var(--space-1);
padding: var(--space-1) var(--space-3);
border-radius: var(--radius-xl);
font-size: var(--text-xs);
gap: 4px;
padding: 6px 12px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
border: 1px solid;
white-space: nowrap;
}
.status-tag.green {
@ -1103,24 +1148,97 @@ const formatTime = (time) => {
}
.status-icon {
font-size: var(--text-xs);
font-size: 12px;
}
.action-buttons {
display: inline-flex;
gap: var(--space-2);
flex-wrap: wrap;
display: flex;
gap: 8px;
align-items: center;
justify-content: center;
height: 100%;
flex-wrap: nowrap;
}
.btn {
border: 1px solid var(--color-gray-300);
transition: all 0.2s ease;
font-weight: 500;
border-radius: 6px;
cursor: pointer;
}
.btn.small {
padding: 8px 16px;
font-size: 13px;
min-width: auto;
white-space: nowrap;
}
.btn.small .btn-icon {
margin-right: 4px;
}
.btn:hover {
background: var(--color-gray-200);
transform: translateY(-1px);
}
.btn.primary {
background: var(--color-primary-500);
color: white;
border-color: var(--color-primary-500);
}
.btn.primary:hover {
background: var(--color-primary-600);
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.btn.secondary {
background: white;
color: var(--color-gray-700);
border-color: var(--color-gray-300);
}
.btn.secondary:hover {
background: var(--color-gray-100);
border-color: var(--color-gray-400);
}
.btn.small.secondary {
background: white;
color: var(--color-gray-700);
border-color: var(--color-gray-300);
}
.btn.small.secondary:hover {
background: var(--color-gray-100);
border-color: var(--color-gray-400);
}
.btn.warning {
background: linear-gradient(135deg, var(--color-warning-500) 0%, var(--color-warning-600) 100%);
color: #fff;
box-shadow: var(--shadow-md);
background: #e6a23c;
color: white;
border-color: #e6a23c;
}
.btn.warning:hover {
background: #ebb563;
border-color: #ebb563;
transform: translateY(-1px);
box-shadow: var(--shadow-lg);
}
.btn.small.warning {
background: #e6a23c;
color: white;
border-color: #e6a23c;
}
.btn.small.warning:hover {
background: #ebb563;
border-color: #ebb563;
}
.btn:disabled {
@ -1441,33 +1559,37 @@ const formatTime = (time) => {
justify-content: center;
}
@media (max-width: 1024px) {
/* 响应式设计 */
@media (max-width: 1200px) {
.toolbar {
flex-direction: column;
gap: var(--space-4);
gap: var(--space-3);
align-items: stretch;
}
.filter-group, .search-group, .action-group {
width: 100%;
max-width: none;
justify-content: flex-start;
.search-group {
flex-wrap: wrap;
}
.search-group {
max-width: none;
.panel-header {
flex-direction: column;
gap: var(--space-3);
align-items: flex-start;
}
.table-container {
overflow-x: auto;
.batch-group {
margin-left: 0;
width: 100%;
justify-content: flex-start;
}
.monitoring-grid {
grid-template-columns: 1fr;
gap: var(--space-4);
.cards-grid {
grid-template-columns: repeat(2, 1fr);
}
}
.batch-actions {
@media (max-width: 1024px) {
.monitoring-grid {
grid-template-columns: 1fr;
gap: var(--space-4);
}
@ -1475,28 +1597,29 @@ const formatTime = (time) => {
@media (max-width: 768px) {
.action-buttons {
flex-direction: column;
flex-wrap: wrap;
gap: 6px;
}
.action-buttons .btn {
width: 100%;
justify-content: center;
.action-buttons .btn.small {
padding: 6px 12px;
font-size: 12px;
}
.device-info {
flex-direction: column;
text-align: center;
gap: var(--space-2);
.table th,
.table td {
padding: 12px 8px;
font-size: 13px;
}
.stat-item {
.search-group {
flex-direction: column;
text-align: center;
gap: var(--space-2);
}
.toolbar {
padding: var(--space-3);
.search-group .select,
.search-group .input,
.search-group .btn {
width: 100%;
}
.table-footer {
@ -1504,21 +1627,54 @@ const formatTime = (time) => {
gap: var(--space-3);
align-items: center;
}
.pagination {
flex-wrap: wrap;
justify-content: center;
}
}
@media (max-width: 640px) {
.cards-grid {
grid-template-columns: 1fr 1fr;
grid-template-columns: 1fr;
}
.filter-group {
.pagination-btn {
padding: 6px 10px;
min-width: 36px;
font-size: 13px;
}
.modal-content {
width: 95%;
max-height: 90vh;
}
.custom-date-range {
flex-direction: column;
align-items: stretch;
}
.pagination {
flex-wrap: wrap;
justify-content: center;
.date-input-group {
width: 100%;
}
.date-input {
width: 100%;
}
.action-buttons {
flex-direction: column;
gap: 4px;
}
.action-buttons .btn.small {
width: 100%;
padding: 6px 8px;
font-size: 11px;
}
.btn.small .btn-icon {
margin-right: 2px;
}
}

Loading…
Cancel
Save