From 1cea882d9db70226e73161fdadccecd82fd23992 Mon Sep 17 00:00:00 2001 From: mediabot-pt <295750538+mediabot-pt@users.noreply.github.com> Date: Mon, 6 Jul 2026 23:02:16 +0800 Subject: [PATCH] refactor: make applicable condition a read-only tag in card header Applicable is preset-defined, not editable on card Shown as grey tag after action label: \u5c01\u53f7/\u5220\u9664\u8d26\u53f7 (\u975e\u5c01\u5b58\u8d26\u53f7) Remove applicable dropdown from card body, onApplicableChange handler --- web/src/views/RiskRules.vue | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/web/src/views/RiskRules.vue b/web/src/views/RiskRules.vue index e62736f..414166d 100644 --- a/web/src/views/RiskRules.vue +++ b/web/src/views/RiskRules.vue @@ -92,6 +92,7 @@ {{ metricLabel(rule.metric) }} {{ condLabel(rule.condition) }} {{ rule.threshold }}{{ rule.unit || '' }} → {{ rule.type==='EXEMPT' ? '保号' : rule.type==='RATIO'||rule.type==='DRATIO' ? '封号(缓刑7天)' : '封号/删除账号' }} + {{ applicableLabel(rule.applicable) }}
#{{ idx + 1 }} @@ -163,15 +164,6 @@ {{ rule.unit || '' }}
- - -
- 适用条件 - - - - -
@@ -260,16 +252,7 @@ const taskReqDefaults = [ { metric:'avg_seed_time', label:'平均做种时间', threshold:24, unit:'小时', condition:'GTE', enabled:true }, ] -const onApplicableChange = (rule) => { - const key = `${rule.type}|${rule.applicable||''}` - if (parsed.value.some(r => r !== rule && `${r.type}|${r.applicable||''}` === key)) { - ElMessage.warning('同类型+适用条件的规则已存在') - rule.applicable = '' - sync() - return - } - sync() -} +const applicableLabel = (v) => applicableOptions.find(x => x.value === v)?.label || v // ============ 预设规则模板 ============ const presets = [ @@ -320,7 +303,7 @@ const sortedRules = computed(() => { }) const ruleText = (r) => { - const appText = r.applicable ? `(${applicableOptions.find(x=>x.value===r.applicable)?.label||r.applicable})` : '' + const appText = r.applicable ? `(${applicableLabel(r.applicable)})` : '' if (r.type === 'EXEMPT') { return `等级豁免:永久保留 ≥ ${rankDisplay(r.permRank)}、封存豁免 ≥ ${rankDisplay(r.sealExemptRank)} → 保号` } @@ -447,6 +430,7 @@ onMounted(fetchAll) .card-body { padding: 6px 12px 10px 12px; display: flex; flex-direction: column; gap: 6px; } .rule-fixed-text { font-size: 13px; color: #303133; } .type-tag { font-size: 12px; color: #303133; font-weight: 500; } +.applicable-tag { font-size: 11px; color: #909399; margin-left: 2px; } .field-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; } .field-label { font-weight: 500; color: #606266; font-size: 12px; min-width: 56px; }