WEB/src/components/settings/sections/BasicSettingsSection.vue
yin b37ebdba46 feat(scanbox): 新增自定义过滤条件预设,并在设置中心集中管理
- ScanBox「过滤」页签新增预设树:系统条件 + 我的自定义条件,支持一键应用、
  取消应用、条件追加合并,以及把当前筛选条件「存为过滤条件」并自动切换页签
- 新增 scan-filter-presets 工具与 scanFilterPresets store:条件按账号保存
  (用户级 scope,不随仓库隔离),页面字段元数据由 ScanBox 挂载时自动登记,
  预设固定输出扁平结构,页面查询构建无需区分条件来源
- 设置中心新增「自定义过滤条件」分区:左侧页面列表、右侧条件管理,
  支持启用/排序/编辑/复制/删除/恢复默认
- 设置中心分组重组为「字段与列 / 筛选与查询 / 系统设置 / 设备与打印 /
  导航与入口 / 数据与维护」,原「表格与性能」「页面与标签缓存」合并为
  「基础设置」,单条目分组不再重复显示分组标题
- tbyc-config 新增 scanFilterPresets 分区,支持随统一配置导入导出;
  stockQueryBuilder 兼容预设条件信封结构并跳过元数据键
- 新增《自定义过滤条件-设计与实施》文档,更新设置中心设计文档
2026-11-09 18:00:15 +08:00

133 lines
4.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
基础设置(合并原「表格与性能」+「页面与标签缓存」两个分区)
数据源:experimental store(localStorage: experimental_{user}_{role})
-->
<template>
<div class="settings-section">
<div class="section-header">
<div>
<div class="section-title">基础设置</div>
<div class="section-desc">表格渲染策略与页面 / 标签缓存(仅影响本机)。</div>
</div>
<el-button size="small" @click="handleReset">恢复默认</el-button>
</div>
<div class="section-block">
<div class="block-title">表格渲染</div>
<div class="block-desc">调整大列表表格的渲染调度策略</div>
<div class="settings-card">
<div class="setting-row">
<span class="setting-label">表格工作模式</span>
<el-radio-group v-model="tableMode" size="small">
<el-radio value="resource">低占用(默认)</el-radio>
<el-radio value="performance">高性能</el-radio>
</el-radio-group>
<span class="setting-hint">低占用优先减少资源开销;高性能优先滚动与渲染流畅度</span>
</div>
</div>
</div>
<div class="section-block">
<div class="block-title">页面缓存</div>
<div class="block-desc">通过顶部导航栏 / 页面标签切换的路由页面缓存策略</div>
<div class="settings-card">
<div class="setting-row">
<span class="setting-label">页面缓存</span>
<el-switch v-model="pageCacheEnabled" />
<span class="setting-hint">关闭后切换页面会重新加载</span>
</div>
<div class="setting-row">
<span class="setting-label">最大缓存页面数量</span>
<el-input-number
:model-value="pageCacheMax"
:min="1"
:max="50"
size="small"
:disabled="!pageCacheEnabled"
@change="handlePageCacheMaxChange"
/>
<span class="setting-hint">超出后淘汰最久未使用的页面</span>
</div>
</div>
</div>
<div class="section-block">
<div class="block-title">标签缓存</div>
<div class="block-desc">含标签页切换功能页面的 KeepAlive 缓存策略</div>
<div class="settings-card">
<div class="setting-row">
<span class="setting-label">标签缓存</span>
<el-switch v-model="tabCacheEnabled" />
</div>
<div class="setting-row">
<span class="setting-label">最大缓存标签数量</span>
<el-input-number
:model-value="tabCacheMax"
:min="1"
:max="20"
size="small"
:disabled="!tabCacheEnabled"
@change="handleTabCacheMaxChange"
/>
<span class="setting-hint">超出后淘汰最久未使用的标签</span>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { ElMessage } from 'element-plus'
import { useExperimentalStore, type TableMode } from '@/stores/modules/experimental'
defineOptions({ name: 'SettingsBasicSection' })
const experimentalStore = useExperimentalStore()
const tableMode = computed({
get: () => experimentalStore.tableMode,
set: (mode: TableMode) => {
experimentalStore.setTableMode(mode)
}
})
const pageCacheEnabled = computed({
get: () => experimentalStore.pageCacheEnabled,
set: (val: boolean) => {
experimentalStore.setPageCacheEnabled(val)
}
})
const pageCacheMax = computed(() => experimentalStore.pageCacheMax)
const tabCacheEnabled = computed({
get: () => experimentalStore.tabCacheEnabled,
set: (val: boolean) => {
experimentalStore.setTabCacheEnabled(val)
}
})
const tabCacheMax = computed(() => experimentalStore.tabCacheMax)
function handlePageCacheMaxChange(val: number | undefined) {
experimentalStore.setPageCacheMax(Number(val ?? 1))
}
function handleTabCacheMaxChange(val: number | undefined) {
experimentalStore.setTabCacheMax(Number(val ?? 1))
}
function handleReset() {
experimentalStore.resetToDefaults()
ElMessage.success('已恢复基础设置默认值')
}
</script>
<style lang="scss" scoped>
@use './shared.scss';
</style>