Skip to content

Commit

Permalink
feat: 策略编辑,引入模型审计不需要字段映射 --story=120594134
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasikeai committed Jan 15, 2025
1 parent 0a24075 commit 3a07436
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@
// 获取审计参数(自定义规则审计、引入模型审计)
const fields = comRef.value.getFields();
// 非联表不需要link_table参数
if (fields.configs.config_type !== 'LinkTable') {
if (fields.configs.config_type !== 'LinkTable' && fields.configs.data_source) {
fields.configs.data_source.link_table = null;
}
// 合并参数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@
<value-item
ref="valueItemRef"
:item="item"
:select="select" />
:select="select"
:strategy-type="strategyType" />
</div>
</div>
</template>
</div>
</template>
<script setup lang='tsx'>
import { ref } from 'vue';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';

import StrategyManageService from '@service/strategy-manage';
Expand All @@ -73,22 +74,27 @@
interface Props {
strategyId: number,
data: StrategyModel,
select: Array<DatabaseTableFieldModel>
select: Array<DatabaseTableFieldModel>,
strategyType: string
}

const props = defineProps<Props>();

const { t, locale } = useI18n();
const valueItemRef = ref();

const column = [
{ label: t('事件分组') },
{ label: t('字段名称') },
{ label: t('字段显示名') },
{ label: t('重点展示'), tips: t('开启后将在单据里优先展示') },
{ label: t('字段映射'), tips: t('系统字段需要关联到策略,默认按照规则自动从结果字段内获取填充,可修改') },
{ label: t('字段说明'), tips: t('在单据页,鼠标移入label,即可显示字段说明') },
];
const column = computed(() => {
const initColumn = [
{ label: t('事件分组') },
{ label: t('字段名称') },
{ label: t('字段显示名') },
{ label: t('重点展示'), tips: t('开启后将在单据里优先展示') },
{ label: t('字段映射'), tips: t('系统字段需要关联到策略,默认按照规则自动从结果字段内获取填充,可修改') },
{ label: t('字段说明'), tips: t('在单据页,鼠标移入label,即可显示字段说明') },
];
props.strategyType === 'rule' ? initColumn : initColumn.splice(4, 1);
return initColumn;
});

const groupMap = {
event_basic_field_configs: t('基本信息'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
v-for="(value, valueKey) in config"
:key="valueKey">
<div
v-if="!['example', 'prefix'].includes(valueKey)"
v-if="!excludeKey.includes(valueKey)"
class="item">
<!-- 是否重点展示 -->
<bk-switcher
Expand Down Expand Up @@ -79,7 +79,7 @@
</template>

<script setup lang='ts'>
import { ref } from 'vue';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import DatabaseTableFieldModel from '@model/strategy/database-table-field';
Expand All @@ -92,17 +92,26 @@
}
interface Props {
item: StrategyFieldEvent['event_basic_field_configs'],
select: Array<DatabaseTableFieldModel>
select: Array<DatabaseTableFieldModel>,
strategyType: string
}
defineProps<Props>();
const props = defineProps<Props>();
const { t } = useI18n();
const selectVerifyRef = ref();
const requiredField = ['raw_event_id', 'event_time', 'event_source', 'operator'];
const optionalField = ['event_content', 'event_type'];
const excludeKey = computed<Array<string>>(() => {
const initKey = ['example', 'prefix'];
if (props.strategyType === 'model') {
initKey.push('map_config');
}
return initKey;
});
defineExpose<Exposes>({
getValue() {
if (!selectVerifyRef.value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
ref="eventRef"
:data="editData"
:select="select"
:strategy-id="editData.strategy_id" />
:strategy-id="editData.strategy_id"
:strategy-type="strategyType" />
</template>
</card-part-vue>
</audit-form>
Expand Down Expand Up @@ -147,7 +148,8 @@
}
interface Props {
editData: StrategyModel,
select: Array<DatabaseTableFieldModel>
select: Array<DatabaseTableFieldModel>,
strategyType: string
}

const props = defineProps<Props>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
:edit-data="editData"
:is-edit-data-loading="isEditDataLoading"
:select="formData.configs.select"
:strategy-type="formData.strategy_type"
style="margin-bottom: 24px;"
@cancel="handleCancel"
@next-step="(step: any, params: any) => handleNextStep(step, params)"
Expand Down

0 comments on commit 3a07436

Please sign in to comment.