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.

1602 lines
62 KiB

1 year ago
<template>
10 months ago
<div style="height: 100%">
<w-grid
ref="gridRef"
:title="$t('re.resources.designer.processor.grid.title')"
8 months ago
:draggable="true"
10 months ago
dense-body
class="px-1"
hide-bottom
:config-button="false"
selection="multiple"
10 months ago
db-click-operation="edit"
10 months ago
:checkbox-selection="true"
10 months ago
:tree="false"
:fetch-data-url="Environment.apiContextPath('/api/re/model/parameter/processor/findByParameterId?parameterId=' + parameter.id)"
:data-url="Environment.apiContextPath('/api/re/model/parameter/processor')"
:pageable="false"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[
'refresh',
'separator',
[
{
extend: 'add',
10 months ago
enableIf: (arg) => {
return !readOnly;
},
10 months ago
click: undefined,
1 year ago
},
10 months ago
{
extend: 'add',
name: 'objectProperties',
label: Formater.enum(Enums.ProcessorType)('OBJECT_PROPERTIES'),
icon: 'bi-card-list',
enableIf: (arg) => {
const valueType = parameter.valueType;
return (
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')
);
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'OBJECT_PROPERTIES');
},
},
10 months ago
{
extend: 'add',
name: 'optionValue',
label: Formater.enum(Enums.ProcessorType)('OPTION_VALUE'),
icon: 'bi-card-list',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'OPTION_VALUE');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'mathFormula',
label: Formater.enum(Enums.ProcessorType)('MATH_FORMULA'),
icon: 'bi-calculator',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'MATH_FORMULA');
},
10 months ago
},
10 months ago
{
extend: 'add',
name: 'arithmetic',
label: Formater.enum(Enums.ProcessorType)('ARITHMETIC'),
icon: 'bi-calculator',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'ARITHMETIC');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'ternary',
label: Formater.enum(Enums.ProcessorType)('TERNARY'),
icon: 'bi-question',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'TERNARY');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'whenThen',
label: Formater.enum(Enums.ProcessorType)('WHEN_THEN'),
icon: 'bi-sliders',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'WHEN_THEN');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'numberRange',
label: Formater.enum(Enums.ProcessorType)('NUMBER_RANGE'),
icon: 'bi-justify',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'NUMBER_RANGE');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'conditionRange',
label: Formater.enum(Enums.ProcessorType)('CONDITION_RANGE'),
icon: 'bi-rainbow',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'CONDITION_RANGE');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'decisionTable2c',
label: Formater.enum(Enums.ProcessorType)('DECISION_TABLE_2C'),
icon: 'bi-grid-3x2',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'DECISION_TABLE_2C');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'decisionTable',
label: Formater.enum(Enums.ProcessorType)('DECISION_TABLE'),
icon: 'bi-grid-3x3',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'DECISION_TABLE');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'decisionTree',
label: Formater.enum(Enums.ProcessorType)('DECISION_TREE'),
icon: 'bi-tree',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'DECISION_TREE');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'executionFlow',
label: Formater.enum(Enums.ProcessorType)('EXECUTION_FLOW'),
icon: 'bi-bounding-box-circles',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'EXECUTION_FLOW');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'pmml',
label: Formater.enum(Enums.ProcessorType)('PMML'),
icon: 'bi-filetype-xml',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'PMML');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'groovyScript',
label: Formater.enum(Enums.ProcessorType)('GROOVY_SCRIPT'),
icon: 'bi-code',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'GROOVY_SCRIPT');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'sql',
label: Formater.enum(Enums.ProcessorType)('SQL'),
icon: 'bi-filetype-sql',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'SQL');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'rule',
label: Formater.enum(Enums.ProcessorType)('RULE'),
icon: 'bi-shadows',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'RULE');
},
1 year ago
},
10 months ago
{
extend: 'add',
name: 'singleRule',
label: Formater.enum(Enums.ProcessorType)('SINGLE_RULE'),
icon: 'bi-noise-reduction',
enableIf: (arg) => {
return parameter.type !== 'RULE_RESULT' && parameter.type !== 'SINGLE_RULE_RESULT';
},
afterClick: (arg) => {
arg.grid.getEditorForm().setFieldValue('type', 'SINGLE_RULE');
},
1 year ago
},
10 months ago
],
1 year ago
{
10 months ago
extend: 'edit',
10 months ago
enableIf: (arg) => {
return arg.selected;
},
10 months ago
click: (arg) => {
const type = arg.selected?.type;
if ('DECISION_TREE' === type) {
8 months ago
decisionTreeDialogRef.open(parameter.id, arg.selected?.id);
10 months ago
} else if ('EXECUTION_FLOW' === type) {
executionFlowDialogRef.open(arg.selected?.id);
} else {
arg._click(arg);
}
1 year ago
},
},
10 months ago
{
extend: 'remove',
enableIf: (arg) => {
return !readOnly && arg.selected;
},
},
10 months ago
'separator',
1 year ago
{
10 months ago
name: 'enable',
label: (arg) => {
if (arg.selected?.enable) {
return $t('disable');
}
return $t('enable');
1 year ago
},
10 months ago
icon: (arg) => {
if (arg.selected?.enable) {
return 'bi-x';
}
return 'bi-check';
1 year ago
},
enableIf: (arg) => {
10 months ago
return !readOnly && arg.selected;
1 year ago
},
10 months ago
click: (arg) => {
const data = arg.selected;
data.enable = !data.enable;
axios.put(Environment.apiContextPath('/api/re/model/parameter/processor/' + data.id), data).then((response) => {
gridRef.replaceRow(response.data);
});
1 year ago
},
},
10 months ago
'separator',
'view',
'separator',
'export',
]"
:columns="[
{ width: 80, name: 'enable', label: $t('isEnable'), align: 'center', sortable: false, format: Formater.enableTag() },
{ width: 60, name: 'order', label: $t('order'), sortable: false, align: 'right' },
{ width: 150, name: 'type', label: $t('type'), sortable: false, format: Formater.enum(Enums.ProcessorType) },
1 year ago
{
10 months ago
width: '100%',
name: 'content',
label: $t('re.resources.designer.processor.grid.entity.content'),
sortable: false,
format: (value, row) => {
const type = row.type;
10 months ago
if ('OBJECT_PROPERTIES' === type) {
let str = '';
if (row.objectCondition) {
str += `<div class='py-2'>When ` + PlaceHolder.replace(row.objectCondition) + ' Then</div>';
}
const objs = Tools.json2Object(row.objectProperties);
if (objs) {
str += `<div class='border border-b-0 overflow-auto' style='max-height:100px'>`;
str += `<table width='100%' height='100%'>`;
8 months ago
objs.forEach((obj) => {
10 months ago
str += '<tr>';
str += ` <td width='30%'>` + obj.name + `</td>`;
str += ` <td width='70%'><span>` + ('' + PlaceHolder.replace(obj.expression)) + '</span></td>';
str += '</tr>';
8 months ago
});
10 months ago
str += '</table>';
str += `</div>`;
}
return str;
} else if ('OPTION_VALUE' === type) {
10 months ago
return row.optionCode;
10 months ago
} else if ('MATH_FORMULA' === type) {
return {
10 months ago
componentType: 'w-math',
10 months ago
attrs: {
modelValue: row.mathFormula,
readOnly: true,
zoom: 2,
},
};
10 months ago
} else if ('ARITHMETIC' === type) {
10 months ago
return {
componentType: 'w-code-mirror',
attrs: {
lang: 'java',
rows: 4,
modelValue: row.arithmetic,
editable: false,
placeholder: true,
lineWrap: true,
},
};
10 months ago
} else if ('TERNARY' === type) {
return row.ternaryCondition + ' <b><span>?</span></b> ' + row.ternaryTrue + ' <b><span>:</span></b> ' + row.ternaryFalse;
} else if ('WHEN_THEN' === type) {
let str = '';
if (row.isWhenThenShorted) {
str += '<span>' + $t('re.resources.designer.processor.grid.entity.isWhenThenShorted') + ', </span>';
10 months ago
}
10 months ago
if (row.when) {
str += '<span>When</span> ' + PlaceHolder.replace(row.when) + ' ';
}
if (row.then) {
str += '<span>Then</span> ' + PlaceHolder.replace(row.then);
10 months ago
}
return str;
10 months ago
} else if ('NUMBER_RANGE' === type) {
const objs = Tools.json2Object(row.numberRange);
if (objs) {
10 months ago
let str = `<div class='border border-b-0 overflow-auto' style='max-height:100px'>`;
str += `<table width='100%' height='100%'>`;
8 months ago
objs.forEach((obj, index) => {
10 months ago
str += '<tr>';
8 months ago
if (index == 0) {
10 months ago
str += ' <td rowspan=' + objs.length + '>' + PlaceHolder.replace(row.numberRangeVar) + '</td>';
}
str += ' <td>' + Tools.generateIntervalRange(obj.minIncluded, obj.min, obj.max, obj.maxIncluded) + '</td>';
str += ' <td>' + ('' + PlaceHolder.replace('' + obj.value)) + '</td>';
str += '</tr>';
8 months ago
});
10 months ago
str += '</table>';
str += '</div>';
return str;
}
return '';
} else if ('CONDITION_RANGE' === type) {
const objs = Tools.json2Object(row.conditionRange);
if (objs) {
10 months ago
let str = `<div class='border border-b-0 overflow-auto' style='max-height:100px'>`;
str += `<table width='100%' height='100%'>`;
8 months ago
objs.forEach((obj) => {
10 months ago
str += '<tr>';
str += ' <td>' + PlaceHolder.replace(obj.condition) + '</td>';
str += ' <td><span>' + ('' + PlaceHolder.replace(obj.value)) + '</span></td>';
str += '</tr>';
8 months ago
});
10 months ago
str += '</table>';
str += `</div>`;
return str;
}
return '';
} else if ('PMML' === type) {
return transfromContent(row.pmml);
} else if ('GROOVY_SCRIPT' === type) {
return transfromContent(row.groovyScript);
} else if ('DECISION_TREE' === type) {
return transfromContent(row.decisionTree);
} else if ('EXECUTION_FLOW' === type) {
return transfromContent(row.executionFlow);
10 months ago
} else if ('SQL' === type) {
return {
componentType: 'w-code-mirror',
attrs: {
lang: 'sql',
rows: 4,
editable: false,
modelValue: row.sql,
placeholder: true,
},
};
10 months ago
}
10 months ago
},
1 year ago
},
10 months ago
]"
:editor="{
dialog: {
10 months ago
width: editorDialogWidthRef,
10 months ago
},
form: {
10 months ago
colsNum: 5,
10 months ago
fields: [
8 months ago
{ colSpan: 5, name: 'parameter', label: 'parameter', type: 'w-text', defaultValue: parameter.id, showIf: false },
{ colSpan: 5, name: 'id', label: $t('id'), type: 'w-text', showIf: false },
{ colSpan: 5, name: 'order', label: $t('order'), type: 'w-number', showIf: false },
{ colSpan: 5, name: 'type', label: $t('type'), type: 'w-text', showIf: false },
{ colSpan: 5, name: 'description', label: $t('description'), type: 'w-text', showIf: false },
{ colSpan: 5, name: 'enable', label: $t('enable'), type: 'w-checkbox', defaultValue: true, showIf: false },
10 months ago
{
10 months ago
colSpan: 5,
name: 'objectCondition',
label: $t('re.resources.designer.processor.grid.entity.objectCondition'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
rows: 3,
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
showIf: (arg) => {
return 'OBJECT_PROPERTIES' === arg.form.getFieldValue('type');
},
},
{
colSpan: 5,
name: 'objectProperties',
label: $t('re.resources.designer.processor.grid.entity.objectProperties'),
showIf: (arg) => {
return 'OBJECT_PROPERTIES' === arg.form.getFieldValue('type');
},
type: 'w-grid',
title: $t('re.resources.designer.processor.grid.entity.objectProperties'),
height: 400,
autoFetchData: false,
dbClickOperation: 'edit',
dense: true,
draggable: true,
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
'separator',
{
name: 'autoMatch',
label: $t('autoMatch'),
icon: 'bi-link-45deg',
click: () => {
const grid = gridRef.getEditorForm().getFieldComponent('objectProperties');
const localData = grid.getLocalData();
const objectProperties = [];
8 months ago
localData.forEach((item) => {
10 months ago
objectProperties.push({
code: item.code,
name: item.name,
expression: item.expression,
});
8 months ago
});
10 months ago
objectPropertiesMatcherDialogRef.open(objectProperties);
},
},
'edit',
10 months ago
{
extend: 'remove',
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('objectProperties');
const selecteds = arg.selecteds;
8 months ago
selecteds.forEach((selected) => {
10 months ago
selected.expression = '';
grid.replaceRow(selected);
8 months ago
});
10 months ago
},
},
'separator',
{
extend: 'remove',
name: 'removeAll',
label: $t('removeAll'),
icon: 'bi-trash3',
enableIf: () => {
return true;
},
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('objectProperties');
const rows = grid.getLocalData();
8 months ago
rows.forEach((row) => {
10 months ago
row.expression = '';
8 months ago
});
10 months ago
grid.setLocalData(rows);
},
},
10 months ago
],
primaryKey: 'code',
columns: [
8 months ago
{ name: 'code', label: 'code', showIf: false },
10 months ago
{
width: 300,
name: 'name',
label: $t('propertyName'),
align: 'left',
sortable: false,
format: (value, row) => {
if (row.expression) {
const expression = row.expression.replace(/\$\{(.+?)\.(.+?)\}/g, '$2');
if (expression.trim() !== value.trim()) {
return `<span class='text-red-500'>` + value + '</span>';
}
}
return value;
},
},
{
width: '100%',
name: 'expression',
label: $t('expression'),
sortable: false,
format: (value) => {
return PlaceHolder.replace(value);
},
},
],
editor: {
dialog: {
width: '800px',
},
form: {
colsNum: 1,
fields: [
8 months ago
{ name: 'code', label: 'code', showIf: false },
10 months ago
{
name: 'expression',
label: $t('expression'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
rows: 3,
lineWrap: true,
lineBreak: false,
placeholder: true,
autoCompletion: autoCompletion,
},
],
},
},
onBeforeEditorDataSubmit: (data, callback) => {
const grid = gridRef.getEditorForm().getFieldComponent('objectProperties');
const form = grid.getEditorForm();
if ('edit' == form.getStatus()) {
grid.replaceRow(data);
callback(false);
}
},
},
{
colSpan: 5,
10 months ago
name: 'optionCode',
label: $t('re.resources.designer.processor.grid.entity.optionCode'),
8 months ago
type: 'w-select',
10 months ago
options: optionOptionsRef,
showIf: (arg) => {
return 'OPTION_VALUE' === arg.form.getFieldValue('type');
},
10 months ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'mathFormula',
label: $t('re.resources.designer.processor.grid.entity.mathFormula'),
8 months ago
type: 'w-math',
10 months ago
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
showIf: (arg) => {
return 'MATH_FORMULA' === arg.form.getFieldValue('type');
},
10 months ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'arithmetic',
label: $t('re.resources.designer.processor.grid.entity.arithmetic'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
rows: 5,
placeholder: true,
10 months ago
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
showIf: (arg) => {
return 'ARITHMETIC' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'ternaryCondition',
label: $t('re.resources.designer.processor.grid.entity.ternaryCondition'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
10 months ago
rows: 4,
10 months ago
placeholder: true,
10 months ago
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
showIf: (arg) => {
return 'TERNARY' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'ternaryTrue',
label: $t('re.resources.designer.processor.grid.entity.ternaryTrue'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
10 months ago
rows: 4,
10 months ago
placeholder: true,
10 months ago
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
showIf: (arg) => {
return 'TERNARY' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'ternaryFalse',
label: $t('re.resources.designer.processor.grid.entity.ternaryFalse'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
10 months ago
rows: 4,
10 months ago
placeholder: true,
10 months ago
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
showIf: (arg) => {
return 'TERNARY' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'when',
label: $t('re.resources.designer.processor.grid.entity.when'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
10 months ago
rows: 4,
lineWrap: true,
lineBreak: false,
10 months ago
placeholder: true,
10 months ago
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
showIf: (arg) => {
return 'WHEN_THEN' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'then',
label: $t('re.resources.designer.processor.grid.entity.then'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
10 months ago
rows: 4,
lineWrap: true,
lineBreak: false,
10 months ago
placeholder: true,
10 months ago
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
showIf: (arg) => {
return 'WHEN_THEN' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'isWhenThenShorted',
label: $t('re.resources.designer.processor.grid.entity.isWhenThenShorted'),
8 months ago
type: 'w-checkbox',
10 months ago
showIf: (arg) => {
return 'WHEN_THEN' === arg.form.getFieldValue('type');
},
10 months ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'numberRangeVar',
label: $t('re.resources.designer.processor.grid.entity.numberRangeVar'),
showIf: (arg) => {
return 'NUMBER_RANGE' === arg.form.getFieldValue('type');
10 months ago
},
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
10 months ago
rows: 3,
lineWrap: true,
lineBreak: false,
10 months ago
placeholder: true,
10 months ago
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
},
{
10 months ago
colSpan: 5,
10 months ago
name: 'numberRange',
label: $t('re.resources.designer.processor.grid.entity.numberRange'),
showIf: (arg) => {
return 'NUMBER_RANGE' === arg.form.getFieldValue('type');
10 months ago
},
10 months ago
type: 'w-grid',
height: 300,
10 months ago
dbClickOperation: 'edit',
10 months ago
autoFetchData: false,
10 months ago
denseBody: true,
draggable: true,
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
'add',
'clone',
'edit',
{
extend: 'remove',
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('numberRange');
grid.removeRows(arg.selecteds);
},
10 months ago
},
10 months ago
'separator',
{
name: 'example',
label: $t('example'),
icon: 'bi-balloon',
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('numberRange');
const sampleData = [
{ uuid: Tools.uuid(), minIncluded: false, min: null, max: 0, maxIncluded: false, value: 1 },
{ uuid: Tools.uuid(), minIncluded: true, min: 0, max: 1, maxIncluded: false, value: 2 },
{ uuid: Tools.uuid(), minIncluded: true, min: 1, max: 2, maxIncluded: false, value: 3 },
{ uuid: Tools.uuid(), minIncluded: true, min: 2, max: 3, maxIncluded: false, value: 4 },
{ uuid: Tools.uuid(), minIncluded: true, min: 3, max: null, maxIncluded: false, value: 5 },
{ uuid: Tools.uuid(), minIncluded: false, min: null, max: null, maxIncluded: false, value: 0 },
];
grid.setLocalData(sampleData);
},
10 months ago
},
10 months ago
],
primaryKey: 'uuid',
columns: [
8 months ago
{ width: 200, name: 'uuid', label: 'uuid', showIf: false },
10 months ago
{
width: 60,
name: 'minIncluded',
label: $t('include'),
align: 'center',
sortable: false,
format: (value) => {
if (value) {
return '[';
} else {
return '(';
}
},
10 months ago
},
10 months ago
{ width: 150, name: 'min', label: $t('minValue'), align: 'right', sortable: false },
{ width: 150, name: 'max', label: $t('maxValue'), align: 'right', sortable: false },
10 months ago
{
width: 60,
name: 'maxIncluded',
label: $t('include'),
align: 'center',
sortable: false,
format: (value) => {
if (value) {
10 months ago
return ']';
10 months ago
} else {
return ')';
}
},
10 months ago
},
10 months ago
{ width: '100%', name: 'value', label: $t('value'), sortable: false },
],
editor: {
dialog: {
width: '600px',
10 months ago
},
10 months ago
form: {
colsNum: 4,
fields: [
8 months ago
{ name: 'uuid', label: 'uuid', showIf: false, colSpan: 4 },
8 months ago
{ name: 'min', label: $t('minValue'), type: 'w-text', colSpan: 3 },
{ name: 'minIncluded', label: $t('include'), type: 'w-checkbox' },
{ name: 'max', label: $t('maxValue'), type: 'w-text', colSpan: 3 },
{ name: 'maxIncluded', label: $t('include'), type: 'w-checkbox' },
{ name: 'value', label: $t('value'), type: 'w-number', colSpan: 3 },
10 months ago
],
10 months ago
},
},
10 months ago
onBeforeEditorDataSubmit: (data, callback) => {
const grid = gridRef.getEditorForm().getFieldComponent('numberRange');
const form = grid.getEditorForm();
if ('add' == form.getStatus() || 'clone' == form.getStatus()) {
data.uuid = Tools.uuid();
grid.addRow(data);
callback(false);
} else if ('edit' == form.getStatus()) {
grid.replaceRow(data);
callback(false);
}
},
},
{
10 months ago
colSpan: 5,
10 months ago
name: 'conditionRange',
label: $t('re.resources.designer.processor.grid.entity.conditionRange'),
showIf: (arg) => {
return 'CONDITION_RANGE' === arg.form.getFieldValue('type');
10 months ago
},
10 months ago
type: 'w-grid',
height: 300,
10 months ago
dbClickOperation: 'edit',
10 months ago
autoFetchData: false,
10 months ago
denseBody: true,
draggable: true,
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
'add',
'clone',
'edit',
{
extend: 'remove',
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('conditionRange');
grid.removeRows(arg.selecteds);
},
},
'separator',
{
name: 'example',
label: $t('example'),
icon: 'bi-balloon',
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('conditionRange');
const sampleData = [
{ uuid: Tools.uuid(), condition: '${变量名}<=0', value: '0' },
{ uuid: Tools.uuid(), condition: '${变量名}>0 && ${变量名}<=50', value: '50' },
{ uuid: Tools.uuid(), condition: '${变量名}>50 && ${变量名}<=80', value: '80' },
{ uuid: Tools.uuid(), condition: '${变量名}>80 && ${变量名}<=100', value: '100' },
{ uuid: Tools.uuid(), condition: '${变量名}>100', value: '60' },
];
grid.setLocalData(sampleData);
10 months ago
},
10 months ago
},
],
primaryKey: 'uuid',
columns: [
8 months ago
{ name: 'uuid', label: 'uuid', showIf: false },
10 months ago
{
name: 'condition',
label: $t('condition'),
align: 'left',
sortable: false,
format: (value) => {
return PlaceHolder.replace(value);
},
},
{
name: 'value',
label: $t('value'),
sortable: false,
format: (value) => {
return PlaceHolder.replace(value);
10 months ago
},
10 months ago
},
],
editor: {
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
8 months ago
{ name: 'uuid', label: 'uuid', showIf: false },
10 months ago
{
name: 'condition',
label: $t('condition'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
10 months ago
rows: 4,
10 months ago
placeholder: true,
10 months ago
lineWrap: true,
lineBreak: false,
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
},
{
name: 'value',
label: $t('value'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
10 months ago
rows: 4,
lineWrap: true,
lineBreak: false,
10 months ago
placeholder: true,
10 months ago
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
},
],
},
},
onBeforeEditorDataSubmit: (data, callback) => {
const grid = gridRef.getEditorForm().getFieldComponent('conditionRange');
const form = grid.getEditorForm();
if ('add' == form.getStatus() || 'clone' == form.getStatus()) {
data.uuid = Tools.uuid();
grid.addRow(data);
callback(false);
} else if ('edit' == form.getStatus()) {
grid.replaceRow(data);
callback(false);
}
10 months ago
},
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'decisionTable2C',
label: $t('re.resources.designer.processor.grid.entity.decisionTable2C'),
8 months ago
type: 'w-code-mirror',
10 months ago
rows: 1,
showIf: (arg) => {
return 'DECISION_TABLE_2C' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'decisionTable',
label: $t('re.resources.designer.processor.grid.entity.decisionTable'),
8 months ago
type: 'w-code-mirror',
10 months ago
rows: 1,
showIf: (arg) => {
return 'DECISION_TABLE' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'decisionTree',
label: $t('re.resources.designer.processor.grid.entity.decisionTree'),
8 months ago
type: 'w-code-mirror',
10 months ago
rows: 20,
lineNumber: true,
10 months ago
toolbar: false,
10 months ago
showIf: (arg) => {
return 'DECISION_TREE' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'executionFlow',
label: $t('re.resources.designer.processor.grid.entity.executionFlow'),
8 months ago
type: 'w-code-mirror',
10 months ago
rows: 20,
lineNumber: true,
toolbar: false,
10 months ago
showIf: (arg) => {
return 'EXECUTION_FLOW' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'pmml',
label: $t('re.resources.designer.processor.grid.entity.pmml'),
8 months ago
type: 'w-code-mirror',
10 months ago
rows: 20,
10 months ago
lineNumber: true,
10 months ago
toolbar: false,
10 months ago
lang: 'xml',
showIf: (arg) => {
return 'PMML' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'groovyScript',
label: $t('re.resources.designer.processor.grid.entity.groovyScript'),
8 months ago
type: 'w-code-mirror',
10 months ago
rows: 20,
lineNumber: true,
lang: 'java',
10 months ago
lineWrap: false,
lineBreak: true,
placeholder: true,
autoCompletion: autoCompletion,
9 months ago
userDefinedFunctions: userDefinedFunctionsRef,
10 months ago
showIf: (arg) => {
return 'GROOVY_SCRIPT' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 5,
10 months ago
name: 'sqlDatasourceName',
label: $t('re.resources.designer.processor.grid.entity.sqlDatasourceName'),
8 months ago
type: 'w-select',
10 months ago
clearable: true,
options: dsOptionsRef,
10 months ago
rows: 1,
showIf: (arg) => {
return 'SQL' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 3,
10 months ago
name: 'sql',
label: $t('re.resources.designer.processor.grid.entity.sql'),
8 months ago
type: 'w-code-mirror',
10 months ago
height: 180,
lang: 'sql',
toolbar: false,
placeholder: true,
autoCompletion: autoCompletion,
10 months ago
showIf: (arg) => {
return 'SQL' === arg.form.getFieldValue('type');
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 2,
10 months ago
name: 'sqlParameterValues',
label: $t('re.resources.designer.processor.grid.entity.sqlParameterValues'),
showIf: (arg) => {
return 'SQL' === arg.form.getFieldValue('type');
},
10 months ago
type: 'w-grid',
height: 150,
title: $t('re.resources.designer.processor.grid.entity.sqlParameterValues'),
autoFetchData: false,
dense: true,
dbClickOperation: 'edit',
draggable: true,
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'analyze',
label: $t('analyze'),
icon: 'bi-tag',
click: (arg) => {
const sql = gridRef.getEditorForm().getFieldValue('sql');
const regex = /\$\{[\u0000-\uFFFF]+?\}/g;
const array = sql.match(regex);
const rows = [];
8 months ago
array.forEach((item) => {
10 months ago
rows.push({ uuid: Tools.uuid(), name: item, value: '' });
8 months ago
});
10 months ago
const grid = gridRef.getEditorForm().getFieldComponent('sqlParameterValues');
grid.setLocalData(rows);
},
},
'separator',
'add',
'edit',
[
{
extend: 'remove',
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('sqlParameterValues');
grid.removeRows(arg.selecteds);
},
},
{
extend: 'remove',
name: 'removeAll',
label: $t('deleteAll'),
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('sqlParameterValues');
grid.setLocalData([]);
},
},
],
],
primaryKey: 'uuid',
columns: [
8 months ago
{ name: 'uuid', label: 'uuid', showIf: false },
10 months ago
{
width: '50%',
name: 'name',
label: $t('name'),
align: 'left',
sortable: false,
format: (value) => {
return PlaceHolder.replace(value);
},
},
{
width: '100%',
name: 'value',
label: $t('value'),
sortable: false,
},
],
editor: {
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
8 months ago
{ name: 'uuid', label: 'uuid', showIf: false },
10 months ago
{
name: 'name',
label: $t('name'),
8 months ago
type: 'w-code-mirror',
10 months ago
lang: 'java',
rows: 1,
placeholder: true,
autoCompletion: autoCompletion,
},
{
name: 'value',
label: $t('value'),
8 months ago
type: 'w-text',
10 months ago
},
],
},
},
onBeforeEditorDataSubmit: (data, callback) => {
const grid = gridRef.getEditorForm().getFieldComponent('sqlParameterValues');
const form = grid.getEditorForm();
if ('add' == form.getStatus() || 'clone' == form.getStatus()) {
data.uuid = Tools.uuid();
grid.addRow(data);
callback(false);
} else if ('edit' == form.getStatus()) {
grid.replaceRow(data);
callback(false);
}
},
1 year ago
},
10 months ago
{
10 months ago
colSpan: 3,
name: 'sqlQueryResult',
label: $t('re.resources.designer.processor.grid.entity.sqlQueryResult'),
showIf: (arg) => {
return 'SQL' === arg.form.getFieldValue('type');
},
type: 'w-grid',
height: 250,
autoFetchData: false,
title: $t('re.resources.designer.processor.grid.entity.sqlQueryResult'),
dense: true,
draggable: true,
pageable: false,
checkboxSelection: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
{
name: 'execute',
label: $t('execute'),
icon: 'bi-caret-right',
click: (arg) => {
const sql = gridRef.getEditorForm().getFieldValue('sql');
10 months ago
const grid = gridRef.getEditorForm().getFieldComponent('sqlParameterValues');
const sqlParameterValues = grid?.getLocalData();
10 months ago
axios
.post(Environment.apiContextPath('/api/re/model/parameter/processor/executeSql'), {
sql: sql,
sqlParameterValues: sqlParameterValues,
})
.then((response) => {
const fieldMetaDatas = response.data.fieldMetaDatas;
8 months ago
fieldMetaDatas.forEach((field) => {
10 months ago
field.value = field.name;
8 months ago
});
10 months ago
const data = response.data.data;
const grid = gridRef.getEditorForm().getFieldComponent('sqlQueryResult');
sqlQueryResultFieldsRef = fieldMetaDatas;
grid.setLocalData(data);
});
},
},
],
columns: computed(() => {
return sqlQueryResultFieldsRef;
}),
},
{
colSpan: 2,
10 months ago
name: 'sqlFieldMapping',
label: $t('re.resources.designer.processor.grid.entity.sqlFieldMapping'),
showIf: (arg) => {
return 'SQL' === arg.form.getFieldValue('type');
},
10 months ago
type: 'w-grid',
height: 250,
width: '100%',
autoFetchData: false,
title: $t('re.resources.designer.processor.grid.entity.sqlFieldMapping'),
dense: true,
dbClickOperation: 'edit',
draggable: true,
pageable: false,
configButton: false,
toolbarConfigure: { noIcon: false },
toolbarActions: [
'add',
'edit',
[
{
extend: 'remove',
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('sqlFieldMapping');
grid.removeRows(arg.selecteds);
},
},
{
extend: 'remove',
name: 'removeAll',
label: $t('deleteAll'),
click: (arg) => {
const grid = gridRef.getEditorForm().getFieldComponent('sqlFieldMapping');
grid.setLocalData([]);
},
},
],
],
primaryKey: 'uuid',
columns: [
8 months ago
{ name: 'uuid', label: 'uuid', showIf: false },
10 months ago
{
width: '50%',
name: 'field',
label: $t('fieldName'),
align: 'left',
sortable: false,
},
{
width: '50%',
name: 'parameter',
label: $t('parameterName'),
sortable: false,
format: (value) => {
return PlaceHolder.replace(value);
},
},
],
editor: {
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
8 months ago
{ name: 'uuid', label: 'uuid', showIf: false },
10 months ago
{
name: 'field',
label: $t('fieldName'),
8 months ago
type: 'w-select',
10 months ago
options: sqlQueryResultFieldsRef,
},
{
name: 'parameter',
label: $t('parameterName'),
8 months ago
type: 'w-select',
10 months ago
options: parameterOptionsRef,
10 months ago
},
],
},
},
onBeforeEditorDataSubmit: (data, callback) => {
const grid = gridRef.getEditorForm().getFieldComponent('sqlFieldMapping');
const form = grid.getEditorForm();
if ('add' == form.getStatus() || 'clone' == form.getStatus()) {
data.uuid = Tools.uuid();
grid.addRow(data);
callback(false);
} else if ('edit' == form.getStatus()) {
grid.replaceRow(data);
callback(false);
}
},
1 year ago
},
10 months ago
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
10 months ago
{ name: 'order', label: $t('order') },
{ name: 'id', label: $t('id'), primaryKey: true },
{ name: 'parameter', label: $t('parameter') },
{ name: 'description', label: $t('description') },
{ name: 'enable', label: $t('enable') },
{ name: 'type', label: $t('type') },
10 months ago
{ name: 'optionCode', label: $t('re.resources.designer.processor.grid.entity.optionCode') },
{ name: 'arithmetic', label: $t('re.resources.designer.processor.grid.entity.arithmetic') },
{ name: 'ternaryCondition', label: $t('re.resources.designer.processor.grid.entity.ternaryCondition') },
{ name: 'ternaryTrue', label: $t('re.resources.designer.processor.grid.entity.ternaryTrue') },
{ name: 'ternaryFalse', label: $t('re.resources.designer.processor.grid.entity.ternaryFalse') },
{ name: 'when', label: $t('re.resources.designer.processor.grid.entity.when') },
{ name: 'then', label: $t('re.resources.designer.processor.grid.entity.then') },
{ name: 'isWhenThenShorted', label: $t('re.resources.designer.processor.grid.entity.isWhenThenShorted') },
{ name: 'rule', label: $t('re.resources.designer.processor.grid.entity.rule') },
{ name: 'singleRule', label: $t('re.resources.designer.processor.grid.entity.singleRule') },
{ name: 'numberRange', label: $t('re.resources.designer.processor.grid.entity.numberRange') },
{ name: 'conditionRange', label: $t('re.resources.designer.processor.grid.entity.conditionRange') },
{ name: 'decisionTable2C', label: $t('re.resources.designer.processor.grid.entity.decisionTable2C') },
{ name: 'decisionTable', label: $t('re.resources.designer.processor.grid.entity.decisionTable') },
{ name: 'groovyScript', label: $t('re.resources.designer.processor.grid.entity.groovyScript') },
1 year ago
10 months ago
{ name: 'sqlDatasourceName', label: $t('re.resources.designer.processor.grid.entity.sqlDatasourceName') },
{ name: 'sql', label: $t('re.resources.designer.processor.grid.entity.sql') },
{ name: 'sqlParameterValues', label: $t('re.resources.designer.processor.grid.entity.sqlParameterValues') },
{ name: 'sqlFieldMapping', label: $t('re.resources.designer.processor.grid.entity.sqlFieldMapping') },
1 year ago
10 months ago
{ name: 'dataComeFrom', label: $t('dataComeFrom') },
{ name: 'creator', label: $t('creator') },
{ name: 'createDate', label: $t('createDate') },
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
],
},
}"
@before-editor-data-submit="
(data, callback) => {
const form = gridRef.getEditorForm();
10 months ago
if ('OBJECT_PROPERTIES' === data.type) {
const grid = form.getFieldComponent('objectProperties');
const localData = grid.getLocalData();
const objectProperties = [];
8 months ago
localData.forEach((item) => {
10 months ago
objectProperties.push({
code: item.code,
name: item.name,
expression: item.expression,
});
8 months ago
});
10 months ago
data.objectProperties = Tools.object2Json(objectProperties);
} else if ('NUMBER_RANGE' === data.type) {
10 months ago
const grid = form.getFieldComponent('numberRange');
const localData = grid.getLocalData();
const ranges = [];
8 months ago
localData.forEach((item) => {
10 months ago
ranges.push({
uuid: item.uuid,
minIncluded: item.minIncluded,
min: item.min,
max: item.max,
maxIncluded: item.maxIncluded,
value: item.value,
});
8 months ago
});
10 months ago
data.numberRange = Tools.object2Json(ranges);
} else if ('CONDITION_RANGE' === data.type) {
const grid = form.getFieldComponent('conditionRange');
const localData = grid.getLocalData();
const ranges = [];
8 months ago
localData.forEach((item) => {
10 months ago
ranges.push({
uuid: item.uuid,
condition: item.condition,
value: item.value,
});
8 months ago
});
10 months ago
data.conditionRange = Tools.object2Json(ranges);
10 months ago
} else if ('SQL' === data.type) {
const sqlParameterValuesGrid = form.getFieldComponent('sqlParameterValues');
const sqlParameterValuesLocalData = sqlParameterValuesGrid.getLocalData();
const sqlParameterValues = [];
8 months ago
sqlParameterValuesLocalData.forEach((item) => {
10 months ago
sqlParameterValues.push({
uuid: item.uuid,
name: item.name,
value: item.value,
});
8 months ago
});
10 months ago
data.sqlParameterValues = Tools.object2Json(sqlParameterValues);
const sqlFieldMappingGrid = form.getFieldComponent('sqlFieldMapping');
const sqlFieldMappingLocalData = sqlFieldMappingGrid.getLocalData();
const sqlFieldMapping = [];
8 months ago
sqlFieldMappingLocalData.forEach((item) => {
10 months ago
sqlFieldMapping.push({
uuid: item.uuid,
field: item.field,
parameter: item.parameter,
});
8 months ago
});
10 months ago
data.sqlFieldMapping = Tools.object2Json(sqlFieldMapping);
10 months ago
}
10 months ago
}
"
@after-editor-open="
8 months ago
(args) => {
const row = args.data;
10 months ago
// 获取代码提示列表
axios.get(Environment.apiContextPath('/api/re/common/listParameterAndValueTypeByParameterId/' + parameter.id)).then((response) => {
autoCompletionManager.setParameters(response.data.parameters);
autoCompletionManager.setValueTypes(response.data.valueTypes);
});
// 获取选项输入参数列表
axios.get(Environment.apiContextPath('/api/re/model/parameter/listParemtersByParameterId/' + parameter.id)).then((response) => {
const parameters = response.data;
const options = [];
8 months ago
parameters.forEach((item) => {
10 months ago
if (item.type === 'IN_OPTION') {
options.push({ label: item.name, value: item.code });
10 months ago
}
8 months ago
});
10 months ago
optionOptionsRef = options;
10 months ago
});
10 months ago
if ('add' == gridRef.getEditorForm().getStatus()) {
// 获取对象属性列表
axios.get(Environment.apiContextPath('/api/re/model/parameter/listObejctPropertiesByParameterId/' + parameter.id)).then((response) => {
const properties = response.data;
const grid = gridRef.getEditorForm().getFieldComponent('objectProperties');
grid?.setLocalData(properties);
});
} else if ('edit' == gridRef.getEditorForm().getStatus()) {
// 获取对象属性列表
axios.get(Environment.apiContextPath('/api/re/model/parameter/processor/listObejctPropertiesByProcessorId/' + row.id)).then((response) => {
const properties = response.data;
const grid = gridRef.getEditorForm().getFieldComponent('objectProperties');
grid?.setLocalData(properties);
10 months ago
});
10 months ago
}
10 months ago
//获取所有参数列表
axios.get(Environment.apiContextPath('api/re/model/parameter/findParametersByParameterId?parameterId=' + parameter.id)).then((response) => {
const options = [];
8 months ago
response.data.forEach((indicator) => {
10 months ago
options.push({ label: indicator.name, value: '${' + indicator.name + '}' });
8 months ago
});
10 months ago
parameterOptionsRef = options;
});
10 months ago
const type = gridRef.getEditorForm().getFieldValue('type');
if ('OPTION_VALUE' === type) {
editorDialogWidthRef = '40%';
} else if ('SQL' === type || 'OBJECT_PROPERTIES' === type) {
editorDialogWidthRef = '80%';
} else {
9 months ago
editorDialogWidthRef = '70%';
10 months ago
}
if ('OBJECT_PROPERTIES' === type) {
} else if ('OPTION_VALUE' === type) {
10 months ago
} else if ('NUMBER_RANGE' === type) {
const grid = gridRef.getEditorForm().getFieldComponent('numberRange');
const rows = Tools.json2Object(row.numberRange);
grid.setLocalData(rows);
} else if ('CONDITION_RANGE' === type) {
const grid = gridRef.getEditorForm().getFieldComponent('conditionRange');
const rows = Tools.json2Object(row.conditionRange);
grid.setLocalData(rows);
10 months ago
} else if ('DECISION_TABLE_2C' === type) {
const grid = gridRef.getEditorForm().getFieldComponent('decisionTable2C');
const rows = Tools.json2Object(row.decisionTable2C);
grid.setLocalData(rows);
} else if ('SQL' === type) {
const sqlParameterValuesGrid = gridRef.getEditorForm().getFieldComponent('sqlParameterValues');
const sqlParameterValuesRows = Tools.json2Object(row.sqlParameterValues);
sqlParameterValuesGrid.setLocalData(sqlParameterValuesRows);
const sqlFieldMappingGrid = gridRef.getEditorForm().getFieldComponent('sqlFieldMapping');
const sqlFieldMappingRows = Tools.json2Object(row.sqlFieldMapping);
sqlFieldMappingGrid.setLocalData(sqlFieldMappingRows);
}
}
"
@row-db-click="
8 months ago
(args) => {
const type = args.row.type;
10 months ago
if ('DECISION_TREE' === type) {
8 months ago
decisionTreeDialogRef.open(args.row.id);
10 months ago
} else if ('EXECUTION_FLOW' === type) {
8 months ago
executionFlowDialogRef.open(args.row.id);
10 months ago
} else {
8 months ago
gridRef.edit(args.row);
10 months ago
}
}
10 months ago
"
></w-grid>
<DecisionTreeDialog ref="decisionTreeDialogRef"></DecisionTreeDialog>
<ExecutionFlowDialog ref="executionFlowDialogRef"></ExecutionFlowDialog>
10 months ago
<ObjectPropertiesMatcherDialog
ref="objectPropertiesMatcherDialogRef"
:parameter="parameter"
@after-matched="
(objectProperties) => {
const grid = gridRef.getEditorForm().getFieldComponent('objectProperties');
grid.setLocalData(objectProperties);
}
"
></ObjectPropertiesMatcherDialog>
10 months ago
</div>
1 year ago
</template>
<script setup lang="ts">
10 months ago
import { ref, onMounted, computed, toValue } from 'vue';
10 months ago
import { axios, Environment, Formater, Tools, EnumTools, Options } from 'platform-core';
10 months ago
import { PlaceHolder } from '@/utils/PlaceHolder';
10 months ago
import DecisionTreeDialog from './DecisionTreeDialog.vue';
import ExecutionFlowDialog from './ExecutionFlowDialog.vue';
10 months ago
import ObjectPropertiesMatcherDialog from './ObjectPropertiesMatcherDialog.vue';
import { AutoCompletionManager } from '@/views/shared/AutoCompletionManager';
1 year ago
const props = defineProps({
fetchDataUrl: { type: String, default: '' },
dataUrl: { type: String, default: '' },
parameter: { type: Object, default: undefined },
10 months ago
readOnly: { type: Boolean, default: false },
1 year ago
});
const gridRef = ref();
10 months ago
const optionOptionsRef = ref([]);
10 months ago
const dsOptionsRef = ref([]);
const sqlQueryResultFieldsRef = ref([]);
10 months ago
const parameterOptionsRef = ref();
9 months ago
const userDefinedFunctionsRef = ref();
10 months ago
const editorDialogWidthRef = ref('50%');
10 months ago
const decisionTreeDialogRef = ref();
const executionFlowDialogRef = ref();
10 months ago
const objectPropertiesMatcherDialogRef = ref();
const autoCompletionManager = new AutoCompletionManager();
const autoCompletion = (context) => {
return autoCompletionManager.autoCompletion(context);
};
10 months ago
const transfromContent = (xml) => {
const div = document.createElement('div');
div.textContent = xml;
const result = div.outerHTML;
div.parentNode?.removeChild(div);
return result;
};
1 year ago
const refresh = () => {
gridRef.value.refresh();
};
onMounted(() => {
gridRef.value.refresh();
});
defineExpose({
refresh,
});
const Enums = await EnumTools.fetch(['io.sc.engine.rule.core.enums.ProcessorType']);
10 months ago
axios.get(Environment.apiContextPath('/api/system/datasource')).then((response) => {
const items = response.data?.content;
if (items) {
const options = [];
8 months ago
items.forEach((item) => {
10 months ago
options.push({ label: item.name, value: item.name });
8 months ago
});
10 months ago
dsOptionsRef.value = options;
}
});
9 months ago
axios.get(Environment.apiContextPath('/api/re/function?pageable=false')).then((response) => {
const options = [];
const items = response.data?.content;
if (items && items.length > 0) {
8 months ago
items.forEach((item) => {
9 months ago
if (item.enable) {
options.push(item);
}
8 months ago
});
9 months ago
}
userDefinedFunctionsRef.value = options;
});
1 year ago
</script>