diff --git a/web/src/views/RiskRules.vue b/web/src/views/RiskRules.vue
index 4a690cf..48a7a59 100644
--- a/web/src/views/RiskRules.vue
+++ b/web/src/views/RiskRules.vue
@@ -43,20 +43,34 @@
-
该类型暂无规则
-
+ 双向可视化
+
- {{ s.row.level }}
+
-
-
-
- {{ s.row.metric }} {{ condText(s.row.condition) }} {{ s.row.threshold }} {{ s.row.unit||'' }}
+
+
-
- {{ appText(s.row) || '-' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ×
+ 该类型暂无规则
+ 添加
@@ -69,8 +83,6 @@ import api from '../api'; import { Refresh } from '@element-plus/icons-vue'
const loading = ref(false), saving = ref(false), sites = ref([]), rulesMap = ref({})
const editType = ref(''), editorJson = ref('[]')
const fmt = (t) => t ? (t.substring(0,19)||'').replace('T',' ') : '-'
-const condText = (c) => ({GT:'>',LT:'<',GTE:'>=',LTE:'<=',EQ:'='})[c]||c
-const appText = (r) => r.applicable ? Object.entries(r.applicable).map(([k,v])=>k+'>='+v).join(', ') : null
const parsed = computed(() => { try { return JSON.parse(editorJson.value) } catch { return [] } })
const merged = computed(() => (Array.isArray(sites.value)?sites.value:[]).map(s => ({
siteId: s.siteId, names: s.names, siteType: s.siteType,
@@ -98,7 +110,9 @@ const editRule = async (row) => {
try { const r = await api.raw.get('/admin/risk-rules/'+row.siteType); editorJson.value = (r?.data||r)?.rules ? JSON.stringify((r.data||r).rules, null, 2) : '[]' }
catch { editorJson.value = '[]' }
}
-const addRule = () => { parsed.value.push({type:'TRAFFIC',name:'',metric:'',threshold:0,unit:'DAY',condition:'GT',level:'WARN'}); editorJson.value = JSON.stringify(parsed.value, null, 2) }
+const sync = () => { editorJson.value = JSON.stringify(parsed.value, null, 2) }
+const remove = (idx) => { parsed.value.splice(idx,1); sync() }
+const addRule = () => { parsed.value.push({type:'TRAFFIC',name:'',metric:'',threshold:0,unit:'DAY',condition:'GT',level:'WARN'}); sync() }
const saveRules = async () => {
saving.value = true
try { await api.raw.post('/risk-rules/'+editType.value, { rules: parsed.value }); ElMessage.success('已保存'); editType.value=''; fetchAll() }
diff --git a/web/src/views/SitePages.vue b/web/src/views/SitePages.vue
index 1f047be..6bb7915 100644
--- a/web/src/views/SitePages.vue
+++ b/web/src/views/SitePages.vue
@@ -42,15 +42,25 @@
-
暂无页面入口
-
-
-
-
-
- {{ resolveUrl(s.row.url) }}
+ 双向可视化
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ×
+ 暂无页面入口
+ 添加
@@ -93,7 +103,9 @@ const editPage = async (row) => {
catch { editorJson.value = '[]' }
}
-const addEntry = () => { parsed.value.push({key:'',label:'',url:'{base}',method:'GET'}); editorJson.value = JSON.stringify(parsed.value, null, 2) }
+const syncToJson = () => { editorJson.value = JSON.stringify(parsed.value, null, 2) }
+const remove = (idx) => { parsed.value.splice(idx,1); syncToJson() }
+const addEntry = () => { parsed.value.push({key:'',label:'',url:'{base}',method:'GET'}); syncToJson() }
const savePages = async () => {
saving.value = true
try { await api.raw.put('/sites/'+editSiteId.value+'/pages', { entries: parsed.value }); ElMessage.success('已保存'); editSiteId.value=''; fetchAll() }