feat(system): 通知管理与文件选择器来源筛选
- 新增通知管理(渠道卡片化、模板 CRUD、参数按钮插入) - ImageSelector/AvatarSelector 增加上传来源 is_admin 筛选 - 宿主机详情页实时指标与硬件/网卡 IPv6 展示优化 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -33,6 +33,10 @@
|
||||
@input="handleSearch"
|
||||
style="width: 300px;"
|
||||
/>
|
||||
<el-select v-model="sourceFilter" placeholder="上传来源" clearable style="width: 130px; margin-left: 12px;" @change="handleSourceChange">
|
||||
<el-option label="管理员" :value="true" />
|
||||
<el-option label="用户" :value="false" />
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div class="file-grid" v-loading="loading">
|
||||
@@ -178,6 +182,7 @@ const currentPage = ref(1)
|
||||
const pageSize = ref(12)
|
||||
const total = ref(0)
|
||||
const searchKeyword = ref('')
|
||||
const sourceFilter = ref(undefined)
|
||||
const pendingFiles = ref([]) // 待上传文件列表
|
||||
const uploading = ref(false) // 批量上传中
|
||||
let fetchVersion = 0 // 防止 fetchFileList 竞态条件
|
||||
@@ -190,6 +195,7 @@ watch(() => props.modelValue, (newVal) => {
|
||||
selectedIds.value = new Set()
|
||||
currentPage.value = 1
|
||||
searchKeyword.value = ''
|
||||
sourceFilter.value = undefined
|
||||
fetchFileList()
|
||||
}
|
||||
})
|
||||
@@ -224,10 +230,11 @@ const fetchFileList = async () => {
|
||||
loading.value = true
|
||||
|
||||
try {
|
||||
const res = await getFileList({
|
||||
page: currentPage.value,
|
||||
count: pageSize.value
|
||||
})
|
||||
const params = { page: currentPage.value, count: pageSize.value }
|
||||
if (sourceFilter.value !== undefined && sourceFilter.value !== null && sourceFilter.value !== '') {
|
||||
params.is_admin = sourceFilter.value
|
||||
}
|
||||
const res = await getFileList(params)
|
||||
|
||||
// 如果有更新的请求发起,丢弃当前结果
|
||||
if (currentFetchVersion !== fetchVersion) return
|
||||
@@ -285,10 +292,15 @@ const handleTabClick = (tab) => {
|
||||
|
||||
// 处理搜索
|
||||
const handleSearch = () => {
|
||||
// 搜索时重置到第一页
|
||||
currentPage.value = 1
|
||||
}
|
||||
|
||||
// 来源筛选变化
|
||||
const handleSourceChange = () => {
|
||||
currentPage.value = 1
|
||||
fetchFileList()
|
||||
}
|
||||
|
||||
// 分页处理
|
||||
const handleSizeChange = (size) => {
|
||||
pageSize.value = size
|
||||
@@ -436,6 +448,7 @@ const handleClose = () => {
|
||||
currentPage.value = 1
|
||||
total.value = 0
|
||||
searchKeyword.value = ''
|
||||
sourceFilter.value = undefined
|
||||
// 清理待上传文件的预览URL
|
||||
pendingFiles.value.forEach(f => {
|
||||
if (f.previewUrl) URL.revokeObjectURL(f.previewUrl)
|
||||
@@ -495,6 +508,8 @@ const handleConfirm = () => {
|
||||
|
||||
.filter-section {
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.file-grid {
|
||||
|
||||
Reference in New Issue
Block a user