feat: 风险规则默认模板增加编辑按钮
This commit is contained in:
@@ -3,15 +3,18 @@
|
|||||||
<h2>风险规则</h2>
|
<h2>风险规则</h2>
|
||||||
|
|
||||||
<el-card style="margin-top:12px">
|
<el-card style="margin-top:12px">
|
||||||
<template #header><span style="font-weight:500">站点类型默认模板</span></template>
|
<template #header><span style="font-weight:500">默认模板</span></template>
|
||||||
<div style="display:flex;gap:12px;flex-wrap:wrap">
|
<div style="display:flex;gap:12px;flex-wrap:wrap">
|
||||||
<div v-for="dt in defaults" :key="dt.type" style="border:1px solid #ebeef5;border-radius:4px;padding:10px 14px;min-width:200px">
|
<div v-for="dt in defaults" :key="dt.type" style="border:1px solid #ebeef5;border-radius:4px;padding:10px 14px;min-width:200px">
|
||||||
<div style="font-weight:500;margin-bottom:4px"><el-tag size="small">{{ dt.type }}</el-tag></div>
|
<div style="font-weight:500;margin-bottom:4px"><el-tag size="small">{{ dt.type }}</el-tag></div>
|
||||||
<div style="font-size:12px;color:#909399;margin-bottom:8px">{{ dt.ruleCount }} 条规则</div>
|
<div style="font-size:12px;color:#909399;margin-bottom:8px">{{ dt.ruleCount }} 条规则</div>
|
||||||
<el-popover trigger="click" width="500" placement="bottom">
|
<div style="display:flex;gap:4px">
|
||||||
<pre style="font-size:11px;max-height:300px;overflow:auto">{{ JSON.stringify(dt.rules, null, 2) }}</pre>
|
<el-popover trigger="click" width="500" placement="bottom">
|
||||||
<template #reference><el-button size="small">查看</el-button></template>
|
<pre style="font-size:11px;max-height:300px;overflow:auto">{{ JSON.stringify(dt.rules, null, 2) }}</pre>
|
||||||
</el-popover>
|
<template #reference><el-button size="small">查看</el-button></template>
|
||||||
|
</el-popover>
|
||||||
|
<el-button size="small" type="primary" @click="editDefault(dt)">编辑默认</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
@@ -149,6 +152,14 @@ const fetchAll = async () => {
|
|||||||
} finally { loading.value = false }
|
} finally { loading.value = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const editDefault = (dt) => {
|
||||||
|
editSiteId.value = dt.type
|
||||||
|
editSiteType.value = dt.type
|
||||||
|
editingRules.value = JSON.parse(JSON.stringify(dt.rules))
|
||||||
|
editorMode.value = 'table'
|
||||||
|
window.scrollTo({top: document.body.scrollHeight, behavior:'smooth'})
|
||||||
|
}
|
||||||
|
|
||||||
const loadDefaultRules = (row) => {
|
const loadDefaultRules = (row) => {
|
||||||
editSiteId.value = row.siteId
|
editSiteId.value = row.siteId
|
||||||
editSiteType.value = row.siteType
|
editSiteType.value = row.siteType
|
||||||
|
|||||||
Reference in New Issue
Block a user