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