|
|
|
@ -42,7 +42,7 @@ export function useRules(
|
|
|
|
|
const targetTableColumnOptions = ref([] as { label: string; value: number }[]) |
|
|
|
|
const writerDatasourceOptions = ref([] as { label: string; value: number }[]) |
|
|
|
|
|
|
|
|
|
const fixValueSpan = computed(() => model.comparison_type === 1 ? 24 : 0) |
|
|
|
|
const fixValueSpan = computed(() => (model.comparison_type === 1 ? 24 : 0)) |
|
|
|
|
|
|
|
|
|
let preItemLen = 0 |
|
|
|
|
|
|
|
|
@ -67,7 +67,9 @@ export function useRules(
|
|
|
|
|
if (ruleLoading.value) return |
|
|
|
|
ruleLoading.value = true |
|
|
|
|
const result = await getRuleFormCreateJson(ruleId) |
|
|
|
|
const items = JSON.parse(result).map((item: IResponseJsonItem) => formatResponseJson(item)) |
|
|
|
|
const items = JSON.parse(result).map((item: IResponseJsonItem) => |
|
|
|
|
formatResponseJson(item) |
|
|
|
|
) |
|
|
|
|
updateRules(items, preItemLen) |
|
|
|
|
preItemLen = items.length |
|
|
|
|
ruleLoading.value = false |
|
|
|
@ -76,7 +78,6 @@ export function useRules(
|
|
|
|
|
const formatResponseJson = ( |
|
|
|
|
responseItem: IResponseJsonItem |
|
|
|
|
): IJsonItemParams => { |
|
|
|
|
responseItem.props.placeholder = t('project.node.' + responseItem.props.placeholder.split(' ').join('_').split(',').join('').toLowerCase()) |
|
|
|
|
const item: IJsonItemParams = { |
|
|
|
|
field: responseItem.field, |
|
|
|
|
options: responseItem.options, |
|
|
|
@ -95,7 +96,7 @@ export function useRules(
|
|
|
|
|
child.span = Math.floor(22 / item.props.rules.length) |
|
|
|
|
return child |
|
|
|
|
}) |
|
|
|
|
model[item.field] = [] |
|
|
|
|
model[item.field] = model[item.field] || [] |
|
|
|
|
delete item.props.rules |
|
|
|
|
} |
|
|
|
|
if (responseItem.emit) { |
|
|
|
@ -107,6 +108,17 @@ export function useRules(
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
if (responseItem.props.placeholder) { |
|
|
|
|
item.props.placeholder = t( |
|
|
|
|
'project.node.' + |
|
|
|
|
responseItem.props.placeholder |
|
|
|
|
.split(' ') |
|
|
|
|
.join('_') |
|
|
|
|
.split(',') |
|
|
|
|
.join('') |
|
|
|
|
.toLowerCase() |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
if (item.field === 'src_datasource_id') { |
|
|
|
|
item.options = srcDatasourceOptions |
|
|
|
|
} |
|
|
|
|