You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.9 KiB

10 months ago
<template>
<w-dialog
ref="dialogRef"
:title="$t('re.resources.designer.parameter.grid.title')"
:can-maximize="false"
:maximized="false"
:buttons="[
{
label: $t('confirm'),
noCaps: true,
click: click,
10 months ago
},
]"
>
<div class="pt-2">
<q-select v-model="modelValueRef" :label="$t('parameter')" outlined dense emit-value map-options :options="modelValueOptionsRef"></q-select>
10 months ago
</div>
</w-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { axios, Environment, Tools } from 'platform-core';
const props = defineProps({
targetType: { type: String, default: undefined },
target: { type: Object, default: undefined },
10 months ago
processor: { type: Object, default: undefined },
});
const emit = defineEmits<{
(e: 'afterMatched', objectProperties: any): void;
}>();
const dialogRef = ref();
const modelValueRef = ref('');
const modelValueOptionsRef = ref([]);
10 months ago
let currentObjectProperties = {};
const click = () => {
let url = '';
if (props.targetType === 'parameter') {
url = Environment.apiContextPath('/api/re/model/parameter/processor/autoMatch');
} else if (props.targetType === 'indicator') {
url = Environment.apiContextPath('/api/re/indicator/processor/autoMatch');
}
axios
.post(url, {
id: modelValueRef.value,
objectProperties: currentObjectProperties,
})
.then((response) => {
emit('afterMatched', response.data);
close();
});
};
10 months ago
const open = (objectProperties) => {
currentObjectProperties = objectProperties;
modelValueRef.value = undefined;
10 months ago
dialogRef.value.show();
let url = '';
if (props.targetType === 'parameter') {
url = Environment.apiContextPath('/api/re/model/parameter/findParametersByParameterId?parameterId=' + props.target.id);
} else if (props.targetType === 'indicator') {
url = Environment.apiContextPath('/api/re/indicator/findIndicatorsByIndicatorId?indicatorId=' + props.target.id);
}
axios.get(url).then((response) => {
10 months ago
const options = [];
8 months ago
response.data.forEach((item) => {
10 months ago
const valueType = item.valueType;
if (
valueType !== 'java.lang.Boolean' &&
valueType !== 'java.lang.Long' &&
valueType !== 'java.lang.Float' &&
valueType !== 'Float' &&
valueType !== 'java.math.BigDecimal' &&
valueType !== 'java.lang.String' &&
valueType !== 'java.util.Date' &&
valueType !== 'io.sc.engine.rule.core.classes.ResourceAbstract' &&
valueType !== 'io.sc.engine.rule.core.classes.RuleResult' &&
valueType !== 'io.sc.engine.rule.core.classes.SingleRuleResult' &&
!valueType.startsWith('List') &&
!valueType.startsWith('Map')
) {
options.push({ value: item.id, label: item.name });
}
8 months ago
});
modelValueOptionsRef.value = options;
10 months ago
});
};
const close = () => {
dialogRef.value.hide();
};
defineExpose({
open,
close,
});
</script>