Merge branch 'main' into ota-manager

This commit is contained in:
hrz 2025-04-22 23:35:50 +08:00 committed by GitHub
commit 72cf7d3874
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 78 additions and 27 deletions

View file

@ -15,11 +15,20 @@
<div class="content-panel"> <div class="content-panel">
<div class="content-area"> <div class="content-area">
<el-card class="device-card" shadow="never"> <el-card class="device-card" shadow="never">
<el-table ref="deviceTable" :data="paginatedDeviceList" @selection-change="handleSelectionChange" <el-table
class="transparent-table" :header-cell-class-name="headerCellClassName" v-loading="loading" ref="deviceTable"
element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" :data="paginatedDeviceList"
class="transparent-table"
:header-cell-class-name="headerCellClassName"
v-loading="loading"
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.7)"> element-loading-background="rgba(255, 255, 255, 0.7)">
<el-table-column type="selection" align="center" width="120"></el-table-column> <el-table-column label="选择" align="center" width="120">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.selected"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="设备型号" prop="model" align="center"> <el-table-column label="设备型号" prop="model" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ getFirmwareTypeName(scope.row.model) }} {{ getFirmwareTypeName(scope.row.model) }}
@ -59,7 +68,7 @@
<div class="table_bottom"> <div class="table_bottom">
<div class="ctrl_btn"> <div class="ctrl_btn">
<el-button size="mini" type="primary" class="select-all-btn" @click="toggleAllSelection"> <el-button size="mini" type="primary" class="select-all-btn" @click="handleSelectAll">
{{ isAllSelected ? '取消全选' : '全选' }} {{ isAllSelected ? '取消全选' : '全选' }}
</el-button> </el-button>
<el-button type="success" size="mini" class="add-device-btn" @click="handleAddDevice"> <el-button type="success" size="mini" class="add-device-btn" @click="handleAddDevice">
@ -115,7 +124,6 @@ export default {
deviceList: [], deviceList: [],
loading: false, loading: false,
userApi: null, userApi: null,
}; };
}, },
computed: { computed: {
@ -131,7 +139,10 @@ export default {
paginatedDeviceList() { paginatedDeviceList() {
const start = (this.currentPage - 1) * this.pageSize; const start = (this.currentPage - 1) * this.pageSize;
const end = start + this.pageSize; const end = start + this.pageSize;
return this.filteredDeviceList.slice(start, end); return this.filteredDeviceList.slice(start, end).map(item => ({
...item,
selected: false
}));
}, },
pageCount() { pageCount() {
return Math.ceil(this.filteredDeviceList.length / this.pageSize); return Math.ceil(this.filteredDeviceList.length / this.pageSize);
@ -168,15 +179,16 @@ export default {
this.currentPage = 1; this.currentPage = 1;
}, },
handleSelectionChange(val) { handleSelectAll() {
this.selectedDevices = val; this.isAllSelected = !this.isAllSelected;
this.isAllSelected = val.length === this.paginatedDeviceList.length; this.paginatedDeviceList.forEach(row => {
}, row.selected = this.isAllSelected;
toggleAllSelection() { });
this.$refs.deviceTable.toggleAllSelection(); this.selectedDevices = this.paginatedDeviceList.filter(device => device.selected);
}, },
deleteSelected() { deleteSelected() {
this.selectedDevices = this.paginatedDeviceList.filter(device => device.selected);
if (this.selectedDevices.length === 0) { if (this.selectedDevices.length === 0) {
this.$message.warning({ this.$message.warning({
message: '请至少选择一条记录', message: '请至少选择一条记录',
@ -460,6 +472,13 @@ export default {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
} }
::v-deep .el-card__body {
padding: 15px;
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
}
.table_bottom { .table_bottom {
display: flex; display: flex;
@ -469,6 +488,7 @@ export default {
padding-bottom: 10px; padding-bottom: 10px;
} }
.ctrl_btn { .ctrl_btn {
display: flex; display: flex;
gap: 8px; gap: 8px;
@ -614,13 +634,7 @@ export default {
display: none !important; display: none !important;
} }
:deep(.custom-selection-header::after) {
content: "选择";
display: inline-block;
color: black;
font-weight: bold;
padding-bottom: 18px;
}
:deep(.el-table .el-button--text) { :deep(.el-table .el-button--text) {
color: #7079aa; color: #7079aa;
@ -657,4 +671,25 @@ export default {
padding-bottom: 16px; padding-bottom: 16px;
} }
} }
:deep(.el-checkbox__inner) {
background-color: #eeeeee !important;
border-color: #cccccc !important;
}
:deep(.el-checkbox__inner:hover) {
border-color: #cccccc !important;
}
:deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
background-color: #5f70f3 !important;
border-color: #5f70f3 !important;
}
::v-deep .el-table--border::after,
::v-deep .el-table--group::after,
::v-deep .el-table::before {
display: none !important;
}
</style> </style>

View file

@ -403,13 +403,21 @@ export default {
.params-card { .params-card {
background: white; background: white;
flex: 1;
display: flex;
flex-direction: column;
border: none; border: none;
box-shadow: none; box-shadow: none;
overflow: hidden;
::v-deep .el-card__body {
padding: 15px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
} }
}
.table_bottom { .table_bottom {
display: flex; display: flex;

View file

@ -425,13 +425,21 @@ export default {
.user-card { .user-card {
background: white; background: white;
flex: 1;
display: flex;
flex-direction: column;
border: none; border: none;
box-shadow: none; box-shadow: none;
overflow: hidden;
::v-deep .el-card__body {
padding: 15px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
} }
}
.table_bottom { .table_bottom {
display: flex; display: flex;