feat(需求): ①用户管理补「角色」筛选(前端+后端 role 参数) ②软件/数字人版本页补版本号搜索 ③全站 el-select 统一 filterable(分组/所属管理员/角色等大下拉可模糊搜索)

This commit is contained in:
2026-09-06 23:43:00 +08:00
parent 970affec95
commit f00fdcd42a
10 changed files with 115 additions and 25 deletions
@@ -29,11 +29,18 @@ const items = ref<DigitalHumanVersion[]>([])
/** 分页(对齐 admin.js:6311 pageSize=20 + 数字页码 + 跳转;Java 列表接口不分页,前端分页呈现)。 */
const pageSize = 20
const page = ref(1)
/** 版本号搜索(客户端过滤)。 */
const versionKeyword = ref('')
const filteredItems = computed(() => {
const kw = (versionKeyword.value || '').trim().toLowerCase()
if (!kw) return items.value
return items.value.filter((item) => `${item.version}`.toLowerCase().includes(kw))
})
const pagedItems = computed(() => {
const start = (page.value - 1) * pageSize
return items.value.slice(start, start + pageSize)
return filteredItems.value.slice(start, start + pageSize)
})
const totalPages = computed(() => Math.max(1, Math.ceil(items.value.length / pageSize)))
const totalPages = computed(() => Math.max(1, Math.ceil(filteredItems.value.length / pageSize)))
const jumpPage = ref('')
const uploadVisible = ref(false)
@@ -191,7 +198,10 @@ onMounted(load)
<section class="panel-box">
<div class="dh-head">
<h3>版本列表</h3>
<button class="btn" type="button" @click="uploadVisible = true">上传新版本</button>
<div class="dh-head-tools">
<input v-model="versionKeyword" type="text" placeholder="搜索版本号" class="dh-keyword" />
<button class="btn" type="button" @click="uploadVisible = true">上传新版本</button>
</div>
</div>
<div class="table-scroll digital-human-version-table-scroll">
@@ -242,13 +252,13 @@ onMounted(load)
<td colspan="8" class="empty-tip">加载中...</td>
</tr>
<tr v-else>
<td colspan="8" class="empty-tip">暂无版本记录</td>
<td colspan="8" class="empty-tip">{{ versionKeyword ? '暂无匹配版本' : '暂无版本记录' }}</td>
</tr>
</tbody>
</table>
</div>
<div v-if="items.length > pageSize" class="pagination">
<div v-if="filteredItems.length > pageSize" class="pagination">
<button type="button" :disabled="page <= 1" @click="changePage(page - 1)">上一页</button>
<span class="page-nums">
<template v-for="n in totalPages" :key="n">
@@ -322,6 +332,33 @@ h3 {
gap: 12px;
margin-bottom: 16px;
}
.dh-head-tools {
display: flex;
align-items: center;
gap: 10px;
}
.dh-keyword {
width: 200px;
min-height: 42px;
padding: 6px 12px;
border: 1px solid #cbd9e6;
border-radius: 9px;
background: #f8fbfd;
color: #24384d;
font-size: 13.5px;
font-family: inherit;
color-scheme: light;
outline: none;
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.dh-keyword:hover {
border-color: #9fb7cd;
}
.dh-keyword:focus {
background: #ffffff;
border-color: #5f85ad;
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
}
.btn {
display: inline-flex;
align-items: center;
@@ -2,7 +2,7 @@
import { formatDateTime } from '@/utils/datetime'
/** 软件版本管理页 · 像素复刻旧版 admin.html panel-version(自绘:面板头+上传新版本、版本列表、全量无分页同旧版)。
* script 逻辑沿用现有 Vue 实现(上传弹窗成功留驻含链接)。 */
import { onMounted, ref } from 'vue'
import { computed, onMounted, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { fetchSoftwareVersions, uploadSoftwareVersion } from './version-api.ts'
import type { SoftwareVersionItem } from './version-dto.ts'
@@ -10,6 +10,13 @@ import { isNonEmptyVersion } from './version-dto.ts'
const loading = ref(false)
const items = ref<SoftwareVersionItem[]>([])
/** 版本号搜索(客户端过滤)。 */
const versionKeyword = ref('')
const filteredItems = computed(() => {
const kw = (versionKeyword.value || '').trim().toLowerCase()
if (!kw) return items.value
return items.value.filter((item) => `${item.version}`.toLowerCase().includes(kw))
})
const uploadVisible = ref(false)
const uploading = ref(false)
@@ -83,7 +90,10 @@ onMounted(load)
<section class="panel-box">
<div class="version-head">
<h3>版本列表</h3>
<button class="btn" type="button" @click="openUpload">上传新版本</button>
<div class="version-head-tools">
<input v-model="versionKeyword" type="text" placeholder="搜索版本号" class="version-keyword" />
<button class="btn" type="button" @click="openUpload">上传新版本</button>
</div>
</div>
<div class="table-scroll version-table-scroll">
@@ -97,8 +107,8 @@ onMounted(load)
</tr>
</thead>
<tbody>
<template v-if="items.length">
<tr v-for="row in items" :key="row.version + row.id">
<template v-if="filteredItems.length">
<tr v-for="row in filteredItems" :key="row.version + row.id">
<td>{{ row.version }}</td>
<td>
<a v-if="row.fileUrl" class="link-cell" :href="row.fileUrl" target="_blank" rel="noopener" :title="row.fileUrl">{{ row.fileUrl }}</a>
@@ -115,7 +125,7 @@ onMounted(load)
<td colspan="4" class="empty-tip">加载中...</td>
</tr>
<tr v-else>
<td colspan="4" class="empty-tip">暂无版本记录</td>
<td colspan="4" class="empty-tip">{{ versionKeyword ? '暂无匹配版本' : '暂无版本记录' }}</td>
</tr>
</tbody>
</table>
@@ -174,6 +184,33 @@ h3 {
gap: 12px;
margin-bottom: 16px;
}
.version-head-tools {
display: flex;
align-items: center;
gap: 10px;
}
.version-keyword {
width: 200px;
min-height: 42px;
padding: 6px 12px;
border: 1px solid #cbd9e6;
border-radius: 9px;
background: #f8fbfd;
color: #24384d;
font-size: 13.5px;
font-family: inherit;
color-scheme: light;
outline: none;
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.version-keyword:hover {
border-color: #9fb7cd;
}
.version-keyword:focus {
background: #ffffff;
border-color: #5f85ad;
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
}
.btn {
display: inline-flex;
align-items: center;