64 changed files with 1984 additions and 1120 deletions
@ -0,0 +1,43 @@ |
|||||
|
const GroovyFunctions = [ |
||||
|
{ label: 'PI', type: 'constant', apply: 'PI', detail: '常量 π' }, |
||||
|
{ label: 'E', type: 'constant', apply: 'E', detail: '常量 e' }, |
||||
|
{ label: 'IEEEremainder(v1,v2)', type: 'function', apply: 'IEEEremainder(v1,v2)', detail: '根据 IEEE 754 标准返回 v1 除以 v2 的余数' }, |
||||
|
{ label: 'abs(v)', type: 'function', apply: 'abs(v)', detail: '绝对值' }, |
||||
|
{ label: 'acos(v)', type: 'function', apply: 'acos(v)', detail: '反余弦' }, |
||||
|
{ label: 'asin(v)', type: 'function', apply: 'asin(v)', detail: '反正弦' }, |
||||
|
{ label: 'atan(v)', type: 'function', apply: 'atan(v)', detail: '' }, |
||||
|
{ label: 'atan2(v)', type: 'function', apply: 'atan2(v)', detail: '' }, |
||||
|
{ label: 'cbrt(v)', type: 'function', apply: 'cbrt(v)', detail: '' }, |
||||
|
{ label: 'ceil(v)', type: 'function', apply: 'ceil(v)', detail: '' }, |
||||
|
{ label: 'cos(v)', type: 'function', apply: 'cos(v)', detail: '' }, |
||||
|
{ label: 'cosh(v)', type: 'function', apply: 'cosh(v)', detail: '' }, |
||||
|
{ label: 'exp(v)', type: 'function', apply: 'exp(v)', detail: '' }, |
||||
|
{ label: 'expm1(v)', type: 'function', apply: 'expm1(v)', detail: '' }, |
||||
|
{ label: 'floor(v)', type: 'function', apply: 'floor(v)', detail: '' }, |
||||
|
{ label: 'inverseNormalDistributioin(x)', type: 'function', apply: 'inverseNormalDistributioin(x)', detail: '' }, |
||||
|
{ label: 'join(split,s1,s2,s3...,sn)', type: 'function', apply: 'join(split,s1,s2,s3...,sn)', detail: '' }, |
||||
|
{ label: 'ln(v)', type: 'function', apply: 'ln(v)', detail: '' }, |
||||
|
{ label: 'max(v1,v2,...)', type: 'function', apply: 'max(v1,v2,...)', detail: '' }, |
||||
|
{ label: 'min(v1,v2,...)', type: 'function', apply: 'min(v1,v2,...)', detail: '' }, |
||||
|
{ label: 'normalDistributioin(x)', type: 'function', apply: 'normalDistributioin(x)', detail: '' }, |
||||
|
{ label: 'pow(x,y)', type: 'function', apply: 'pow(x,y)', detail: '' }, |
||||
|
{ label: 'random()', type: 'function', apply: 'random()', detail: '' }, |
||||
|
{ label: 'rint(v)', type: 'function', apply: 'rint(v)', detail: '' }, |
||||
|
{ label: 'round(v)', type: 'function', apply: 'round(v)', detail: '' }, |
||||
|
{ label: 'sin(v)', type: 'function', apply: 'sin(v)', detail: '' }, |
||||
|
{ label: 'sinh(v)', type: 'function', apply: 'sinh(v)', detail: '' }, |
||||
|
{ label: 'sqrt(v)', type: 'function', apply: 'sqrt(v)', detail: '' }, |
||||
|
{ label: 'sum(v1,v2,...)', type: 'function', apply: 'sum(v1,v2,...)', detail: '' }, |
||||
|
{ label: 'tan(v)', type: 'function', apply: 'tan(v)', detail: '' }, |
||||
|
{ label: 'tanh(v)', type: 'function', apply: 'tanh(v)', detail: '' }, |
||||
|
{ label: 'toDegrees(v)', type: 'function', apply: 'toDegrees(v)', detail: '' }, |
||||
|
{ label: 'toRadians(v)', type: 'function', apply: 'toRadians(v)', detail: '' }, |
||||
|
{ |
||||
|
label: 'transformSequencing(value,sourceMin,sourceMax,targetMin,targetMax)', |
||||
|
type: 'function', |
||||
|
apply: 'transformSequencing(value,sourceMin,sourceMax,targetMin,targetMax)', |
||||
|
detail: '', |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
export default GroovyFunctions; |
File diff suppressed because it is too large
@ -0,0 +1,81 @@ |
|||||
|
<template> |
||||
|
<div v-show="showIfComputed"> |
||||
|
<w-grid ref="gridRef" v-bind="attrs"></w-grid> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { computed, defineProps, useAttrs, ref, watch } from 'vue'; |
||||
|
|
||||
|
const attrs = useAttrs(); |
||||
|
const rules = attrs.rules; |
||||
|
const props = defineProps({ |
||||
|
onChange: { |
||||
|
type: Function, |
||||
|
default: () => {}, |
||||
|
}, |
||||
|
modelValue: { type: String, default: undefined }, |
||||
|
showIf: { |
||||
|
type: Function, |
||||
|
default: () => { |
||||
|
return true; |
||||
|
}, |
||||
|
}, |
||||
|
disableIf: { |
||||
|
type: Function, |
||||
|
default: () => { |
||||
|
return false; |
||||
|
}, |
||||
|
}, |
||||
|
form: { |
||||
|
type: Object, |
||||
|
default: undefined, |
||||
|
}, |
||||
|
}); |
||||
|
const emit = defineEmits(['update:modelValue', 'change']); |
||||
|
|
||||
|
const gridRef =ref(); |
||||
|
const gridValue = ref(props.modelValue); |
||||
|
watch( |
||||
|
() => props.modelValue, |
||||
|
(newVal, oldVal) => { |
||||
|
gridValue.value = newVal; |
||||
|
}, |
||||
|
); |
||||
|
|
||||
|
const rulesComputed = computed(() => { |
||||
|
let result = rules || <any>[]; |
||||
|
if (!showIfComputed.value) { |
||||
|
result = []; |
||||
|
} |
||||
|
return result; |
||||
|
}); |
||||
|
|
||||
|
const showIfComputed = computed(() => { |
||||
|
return props.showIf({ |
||||
|
value: gridValue.value, |
||||
|
form: props.form, |
||||
|
}); |
||||
|
}); |
||||
|
const disableIfComputed = computed(() => { |
||||
|
if (props.form && props.form.getStatus() === 'view') { |
||||
|
return true; |
||||
|
} |
||||
|
return props.disableIf({ |
||||
|
value: gridValue.value, |
||||
|
form: props.form, |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
const updateModelValue = (value) => { |
||||
|
emit('update:modelValue', value, props.form); |
||||
|
changeValue(value); |
||||
|
}; |
||||
|
|
||||
|
const changeValue = (value) => { |
||||
|
emit('change', { |
||||
|
value: value, |
||||
|
form: props.form, |
||||
|
}); |
||||
|
}; |
||||
|
</script> |
@ -0,0 +1,84 @@ |
|||||
|
import { EditorView, ViewPlugin, ViewUpdate, MatchDecorator, Decoration, DecorationSet, WidgetType } from '@codemirror/view'; |
||||
|
|
||||
|
class PlaceholderWidget extends WidgetType { |
||||
|
constructor(name) { |
||||
|
super(); |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
eq(other) { |
||||
|
return this.name == other.name; |
||||
|
} |
||||
|
|
||||
|
toDOM() { |
||||
|
const elt = document.createElement('span'); |
||||
|
elt.setAttribute('placeholder', true); |
||||
|
elt.style.cssText = ` |
||||
|
border: 1px solid gray; |
||||
|
border-radius: 4px; |
||||
|
padding: 2px 2px; |
||||
|
`;
|
||||
|
elt.textContent = this.name; |
||||
|
return elt; |
||||
|
} |
||||
|
|
||||
|
ignoreEvent() { |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const placeholderMatcher = new MatchDecorator({ |
||||
|
regexp: /\$\{(.+?)\}/g, |
||||
|
decoration: (match) => |
||||
|
Decoration.replace({ |
||||
|
widget: new PlaceholderWidget(match[1]), |
||||
|
}), |
||||
|
}); |
||||
|
|
||||
|
const placeholderPlugin = ViewPlugin.fromClass( |
||||
|
class { |
||||
|
placeholders: DecorationSet; |
||||
|
constructor(view: EditorView) { |
||||
|
this.placeholders = placeholderMatcher.createDeco(view); |
||||
|
} |
||||
|
update(update: ViewUpdate) { |
||||
|
this.placeholders = placeholderMatcher.updateDeco(update, this.placeholders); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
decorations: (instance) => instance.placeholders, |
||||
|
provide: (plugin) => |
||||
|
EditorView.atomicRanges.of((view) => { |
||||
|
return view.plugin(plugin)?.placeholders || Decoration.none; |
||||
|
}), |
||||
|
eventHandlers: { |
||||
|
mouseover: (e, view) => { |
||||
|
const target = e.target as HTMLElement; |
||||
|
if (target.tagName.toLowerCase() === 'span' && target.getAttribute('placeholder')) { |
||||
|
target.style.cssText = ` |
||||
|
border: 1px solid gray; |
||||
|
border-radius: 4px; |
||||
|
padding: 2px 2px; |
||||
|
background: orange; |
||||
|
`;
|
||||
|
} |
||||
|
}, |
||||
|
mouseout: (e, view) => { |
||||
|
const target = e.target as HTMLElement; |
||||
|
if (target.tagName.toLowerCase() === 'span' && target.getAttribute('placeholder')) { |
||||
|
target.style.cssText = ` |
||||
|
border: 1px solid gray; |
||||
|
border-radius: 4px; |
||||
|
padding: 2px 2px; |
||||
|
`;
|
||||
|
} |
||||
|
}, |
||||
|
contextmenu: (e, view) => { |
||||
|
e.preventDefault(); |
||||
|
console.log(view); |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
); |
||||
|
|
||||
|
export default placeholderPlugin; |
@ -0,0 +1,43 @@ |
|||||
|
const GroovyFunctions = [ |
||||
|
{ label: 'PI', type: 'constant', apply: 'PI', detail: '常量 π' }, |
||||
|
{ label: 'E', type: 'constant', apply: 'E', detail: '常量 e' }, |
||||
|
{ label: 'IEEEremainder(v1,v2)', type: 'function', apply: 'IEEEremainder(v1,v2)', detail: '根据 IEEE 754 标准返回 v1 除以 v2 的余数' }, |
||||
|
{ label: 'abs(v)', type: 'function', apply: 'abs(v)', detail: '绝对值' }, |
||||
|
{ label: 'acos(v)', type: 'function', apply: 'acos(v)', detail: '反余弦' }, |
||||
|
{ label: 'asin(v)', type: 'function', apply: 'asin(v)', detail: '反正弦' }, |
||||
|
{ label: 'atan(v)', type: 'function', apply: 'atan(v)', detail: '' }, |
||||
|
{ label: 'atan2(v)', type: 'function', apply: 'atan2(v)', detail: '' }, |
||||
|
{ label: 'cbrt(v)', type: 'function', apply: 'cbrt(v)', detail: '' }, |
||||
|
{ label: 'ceil(v)', type: 'function', apply: 'ceil(v)', detail: '' }, |
||||
|
{ label: 'cos(v)', type: 'function', apply: 'cos(v)', detail: '' }, |
||||
|
{ label: 'cosh(v)', type: 'function', apply: 'cosh(v)', detail: '' }, |
||||
|
{ label: 'exp(v)', type: 'function', apply: 'exp(v)', detail: '' }, |
||||
|
{ label: 'expm1(v)', type: 'function', apply: 'expm1(v)', detail: '' }, |
||||
|
{ label: 'floor(v)', type: 'function', apply: 'floor(v)', detail: '' }, |
||||
|
{ label: 'inverseNormalDistributioin(x)', type: 'function', apply: 'inverseNormalDistributioin(x)', detail: '' }, |
||||
|
{ label: 'join(split,s1,s2,s3...,sn)', type: 'function', apply: 'join(split,s1,s2,s3...,sn)', detail: '' }, |
||||
|
{ label: 'ln(v)', type: 'function', apply: 'ln(v)', detail: '' }, |
||||
|
{ label: 'max(v1,v2,...)', type: 'function', apply: 'max(v1,v2,...)', detail: '' }, |
||||
|
{ label: 'min(v1,v2,...)', type: 'function', apply: 'min(v1,v2,...)', detail: '' }, |
||||
|
{ label: 'normalDistributioin(x)', type: 'function', apply: 'normalDistributioin(x)', detail: '' }, |
||||
|
{ label: 'pow(x,y)', type: 'function', apply: 'pow(x,y)', detail: '' }, |
||||
|
{ label: 'random()', type: 'function', apply: 'random()', detail: '' }, |
||||
|
{ label: 'rint(v)', type: 'function', apply: 'rint(v)', detail: '' }, |
||||
|
{ label: 'round(v)', type: 'function', apply: 'round(v)', detail: '' }, |
||||
|
{ label: 'sin(v)', type: 'function', apply: 'sin(v)', detail: '' }, |
||||
|
{ label: 'sinh(v)', type: 'function', apply: 'sinh(v)', detail: '' }, |
||||
|
{ label: 'sqrt(v)', type: 'function', apply: 'sqrt(v)', detail: '' }, |
||||
|
{ label: 'sum(v1,v2,...)', type: 'function', apply: 'sum(v1,v2,...)', detail: '' }, |
||||
|
{ label: 'tan(v)', type: 'function', apply: 'tan(v)', detail: '' }, |
||||
|
{ label: 'tanh(v)', type: 'function', apply: 'tanh(v)', detail: '' }, |
||||
|
{ label: 'toDegrees(v)', type: 'function', apply: 'toDegrees(v)', detail: '' }, |
||||
|
{ label: 'toRadians(v)', type: 'function', apply: 'toRadians(v)', detail: '' }, |
||||
|
{ |
||||
|
label: 'transformSequencing(value,sourceMin,sourceMax,targetMin,targetMax)', |
||||
|
type: 'function', |
||||
|
apply: 'transformSequencing(value,sourceMin,sourceMax,targetMin,targetMax)', |
||||
|
detail: '', |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
export default GroovyFunctions; |
@ -0,0 +1,525 @@ |
|||||
|
<template> |
||||
|
<w-grid |
||||
|
ref="gridRef" |
||||
|
:title="$t('re.resources.designer.processor.grid.title')" |
||||
|
dense-body |
||||
|
class="px-1" |
||||
|
hide-bottom |
||||
|
:config-button="false" |
||||
|
selection="multiple" |
||||
|
:checkbox-selection="false" |
||||
|
: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', |
||||
|
click: undefined, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
], |
||||
|
'edit', |
||||
|
'remove', |
||||
|
'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) }, |
||||
|
{ |
||||
|
width: '100%', |
||||
|
name: 'content', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.content'), |
||||
|
sortable: false, |
||||
|
format: (value, row) => { |
||||
|
const type = row.type; |
||||
|
|
||||
|
return ''; |
||||
|
}, |
||||
|
}, |
||||
|
]" |
||||
|
:editor="{ |
||||
|
dialog: { |
||||
|
width: '600px', |
||||
|
height: '400px', |
||||
|
}, |
||||
|
form: { |
||||
|
colsNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'parameter', label: 'parameter', type: 'text', defaultValue: parameter.id, hidden: true }, |
||||
|
{ name: 'id', label: $t('id'), type: 'text', hidden: true }, |
||||
|
{ name: 'order', label: $t('order'), type: 'number', hidden: true }, |
||||
|
{ name: 'type', label: $t('type'), type: 'text', hidden: true }, |
||||
|
{ name: 'description', label: $t('description'), type: 'text' }, |
||||
|
{ name: 'enable', label: $t('enable'), type: 'checkbox', defaultValue: true }, |
||||
|
{ |
||||
|
name: 'optionCode', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.optionCode'), |
||||
|
type: 'select', |
||||
|
options: [], |
||||
|
showIf: (arg) => { |
||||
|
return 'OPTION_VALUE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'arithmetic', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.arithmetic'), |
||||
|
type: 'code-mirror', |
||||
|
showIf: (arg) => { |
||||
|
return 'ARITHMETIC' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'ternaryCondition', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.ternaryCondition'), |
||||
|
type: 'code-mirror', |
||||
|
lang: 'java', |
||||
|
rows: 1, |
||||
|
height: '32px', |
||||
|
autoCompletionOptions: GroovyFunctions, |
||||
|
extAutoCompletionOptions: GroovyFunctions, |
||||
|
showIf: (arg) => { |
||||
|
return 'TERNARY' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'ternaryTrue', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.ternaryTrue'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'TERNARY' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'ternaryFalse', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.ternaryFalse'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'TERNARY' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'when', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.when'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'WHEN_THEN' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'then', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.then'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'WHEN_THEN' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'isWhenThenShorted', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.isWhenThenShorted'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'WHEN_THEN' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'numberRange', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.numberRange'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'NUMBER_RANGE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'conditionRange', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.conditionRange'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'CONDITION_RANGE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'decisionTable2C', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.decisionTable2C'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'DECISION_TABLE_2C' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'decisionTable', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.decisionTable'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'DECISION_TABLE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'decisionTree', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.decisionTree'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'DECISION_TREE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'executionFlow', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.executionFlow'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'EXECUTION_FLOW' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'pmml', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.pmml'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'PMML' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'groovyScript', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.groovyScript'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'GROOVY_SCRIPT' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'sqlDatasourceName', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.sqlDatasourceName'), |
||||
|
type: 'select', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'SQL' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'sql', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.sql'), |
||||
|
type: 'select', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'SQL' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'sqlParameterValues', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.sqlParameterValues'), |
||||
|
type: 'select', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'SQL' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'sqlFieldMapping', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.sqlFieldMapping'), |
||||
|
type: 'select', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'SQL' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t(''), primaryKey: true }, |
||||
|
{ name: 'parameter', label: $t('') }, |
||||
|
{ name: 'description', label: $t('') }, |
||||
|
{ name: 'order', label: $t('') }, |
||||
|
{ name: 'enable', label: $t('') }, |
||||
|
{ name: 'type', label: $t('') }, |
||||
|
|
||||
|
{ 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') }, |
||||
|
|
||||
|
{ 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') }, |
||||
|
|
||||
|
{ 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() }, |
||||
|
{ name: 'corporationCode', label: $t('corporationCode') }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
></w-grid> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref, onMounted } from 'vue'; |
||||
|
import { Environment, Formater, EnumTools, Options } from '@/platform'; |
||||
|
import GroovyFunctions from './GroovyFunctions'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
fetchDataUrl: { type: String, default: '' }, |
||||
|
dataUrl: { type: String, default: '' }, |
||||
|
}); |
||||
|
|
||||
|
const parameter = { |
||||
|
jpaVersion: null, |
||||
|
dataComeFrom: 'INPUT', |
||||
|
creator: 'admin', |
||||
|
createDate: '2024-06-25 11:01:38', |
||||
|
lastModifier: 'admin', |
||||
|
lastModifyDate: '2024-06-25 11:01:38', |
||||
|
id: '88691f14-c1ec-4d64-9727-aab6c636fe5f', |
||||
|
code: 'P1628257078232', |
||||
|
name: '是否及格', |
||||
|
description: null, |
||||
|
type: 'OUT', |
||||
|
valueType: 'java.lang.String', |
||||
|
valueTypeVersion: null, |
||||
|
valueScale: null, |
||||
|
valueRoundingMode: null, |
||||
|
valueTypeIsList: false, |
||||
|
defaultValue: null, |
||||
|
order: 2, |
||||
|
model: 'df5b4629-52e1-47aa-a7d7-0dcf7143136c', |
||||
|
_rowKey_: '9d6373aa-ce47-4723-8468-58eb07ed827c', |
||||
|
ticked: true, |
||||
|
selected: true, |
||||
|
_tickedCount: 0, |
||||
|
}; |
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'rowClick', evt: Event, row: any, index: number): void; |
||||
|
(e: 'beforeRequestData', requestParams: URLSearchParams | any, callback: any): void; |
||||
|
}>(); |
||||
|
const gridRef = ref(); |
||||
|
|
||||
|
const refresh = () => { |
||||
|
gridRef.value.refresh(); |
||||
|
}; |
||||
|
|
||||
|
onMounted(() => { |
||||
|
gridRef.value.refresh(); |
||||
|
}); |
||||
|
|
||||
|
defineExpose({ |
||||
|
refresh, |
||||
|
}); |
||||
|
|
||||
|
const Enums = await EnumTools.fetch(['io.sc.engine.rule.core.enums.ProcessorType']); |
||||
|
</script> |
@ -0,0 +1,12 @@ |
|||||
|
<template> |
||||
|
<div class="q-pa-md"> |
||||
|
<q-btn color="purple" label="Show Loading" @click="showLoading" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { axios, Environment } from '@/platform'; |
||||
|
|
||||
|
const showLoading = () => { |
||||
|
axios.post(Environment.apiContextPath('/api/re/resource/createExample'), [], { loading: true }).then(() => {}); |
||||
|
}; |
||||
|
</script> |
@ -0,0 +1,43 @@ |
|||||
|
const GroovyFunctions = [ |
||||
|
{ label: 'PI', type: 'constant', apply: 'PI', detail: '常量 π' }, |
||||
|
{ label: 'E', type: 'constant', apply: 'E', detail: '常量 e' }, |
||||
|
{ label: 'IEEEremainder(v1,v2)', type: 'function', apply: 'IEEEremainder(v1,v2)', detail: '根据 IEEE 754 标准返回 v1 除以 v2 的余数' }, |
||||
|
{ label: 'abs(v)', type: 'function', apply: 'abs(v)', detail: '绝对值' }, |
||||
|
{ label: 'acos(v)', type: 'function', apply: 'acos(v)', detail: '反余弦' }, |
||||
|
{ label: 'asin(v)', type: 'function', apply: 'asin(v)', detail: '反正弦' }, |
||||
|
{ label: 'atan(v)', type: 'function', apply: 'atan(v)', detail: '' }, |
||||
|
{ label: 'atan2(v)', type: 'function', apply: 'atan2(v)', detail: '' }, |
||||
|
{ label: 'cbrt(v)', type: 'function', apply: 'cbrt(v)', detail: '' }, |
||||
|
{ label: 'ceil(v)', type: 'function', apply: 'ceil(v)', detail: '' }, |
||||
|
{ label: 'cos(v)', type: 'function', apply: 'cos(v)', detail: '' }, |
||||
|
{ label: 'cosh(v)', type: 'function', apply: 'cosh(v)', detail: '' }, |
||||
|
{ label: 'exp(v)', type: 'function', apply: 'exp(v)', detail: '' }, |
||||
|
{ label: 'expm1(v)', type: 'function', apply: 'expm1(v)', detail: '' }, |
||||
|
{ label: 'floor(v)', type: 'function', apply: 'floor(v)', detail: '' }, |
||||
|
{ label: 'inverseNormalDistributioin(x)', type: 'function', apply: 'inverseNormalDistributioin(x)', detail: '' }, |
||||
|
{ label: 'join(split,s1,s2,s3...,sn)', type: 'function', apply: 'join(split,s1,s2,s3...,sn)', detail: '' }, |
||||
|
{ label: 'ln(v)', type: 'function', apply: 'ln(v)', detail: '' }, |
||||
|
{ label: 'max(v1,v2,...)', type: 'function', apply: 'max(v1,v2,...)', detail: '' }, |
||||
|
{ label: 'min(v1,v2,...)', type: 'function', apply: 'min(v1,v2,...)', detail: '' }, |
||||
|
{ label: 'normalDistributioin(x)', type: 'function', apply: 'normalDistributioin(x)', detail: '' }, |
||||
|
{ label: 'pow(x,y)', type: 'function', apply: 'pow(x,y)', detail: '' }, |
||||
|
{ label: 'random()', type: 'function', apply: 'random()', detail: '' }, |
||||
|
{ label: 'rint(v)', type: 'function', apply: 'rint(v)', detail: '' }, |
||||
|
{ label: 'round(v)', type: 'function', apply: 'round(v)', detail: '' }, |
||||
|
{ label: 'sin(v)', type: 'function', apply: 'sin(v)', detail: '' }, |
||||
|
{ label: 'sinh(v)', type: 'function', apply: 'sinh(v)', detail: '' }, |
||||
|
{ label: 'sqrt(v)', type: 'function', apply: 'sqrt(v)', detail: '' }, |
||||
|
{ label: 'sum(v1,v2,...)', type: 'function', apply: 'sum(v1,v2,...)', detail: '' }, |
||||
|
{ label: 'tan(v)', type: 'function', apply: 'tan(v)', detail: '' }, |
||||
|
{ label: 'tanh(v)', type: 'function', apply: 'tanh(v)', detail: '' }, |
||||
|
{ label: 'toDegrees(v)', type: 'function', apply: 'toDegrees(v)', detail: '' }, |
||||
|
{ label: 'toRadians(v)', type: 'function', apply: 'toRadians(v)', detail: '' }, |
||||
|
{ |
||||
|
label: 'transformSequencing(value,sourceMin,sourceMax,targetMin,targetMax)', |
||||
|
type: 'function', |
||||
|
apply: 'transformSequencing(value,sourceMin,sourceMax,targetMin,targetMax)', |
||||
|
detail: '', |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
export default GroovyFunctions; |
@ -0,0 +1,525 @@ |
|||||
|
<template> |
||||
|
<w-grid |
||||
|
ref="gridRef" |
||||
|
:title="$t('re.resources.designer.processor.grid.title')" |
||||
|
dense-body |
||||
|
class="px-1" |
||||
|
hide-bottom |
||||
|
:config-button="false" |
||||
|
selection="multiple" |
||||
|
:checkbox-selection="false" |
||||
|
: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', |
||||
|
click: undefined, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
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'); |
||||
|
}, |
||||
|
}, |
||||
|
], |
||||
|
'edit', |
||||
|
'remove', |
||||
|
'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) }, |
||||
|
{ |
||||
|
width: '100%', |
||||
|
name: 'content', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.content'), |
||||
|
sortable: false, |
||||
|
format: (value, row) => { |
||||
|
const type = row.type; |
||||
|
|
||||
|
return ''; |
||||
|
}, |
||||
|
}, |
||||
|
]" |
||||
|
:editor="{ |
||||
|
dialog: { |
||||
|
width: '600px', |
||||
|
height: '400px', |
||||
|
}, |
||||
|
form: { |
||||
|
colsNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'parameter', label: 'parameter', type: 'text', defaultValue: parameter.id, hidden: true }, |
||||
|
{ name: 'id', label: $t('id'), type: 'text', hidden: true }, |
||||
|
{ name: 'order', label: $t('order'), type: 'number', hidden: true }, |
||||
|
{ name: 'type', label: $t('type'), type: 'text', hidden: true }, |
||||
|
{ name: 'description', label: $t('description'), type: 'text' }, |
||||
|
{ name: 'enable', label: $t('enable'), type: 'checkbox', defaultValue: true }, |
||||
|
{ |
||||
|
name: 'optionCode', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.optionCode'), |
||||
|
type: 'select', |
||||
|
options: [], |
||||
|
showIf: (arg) => { |
||||
|
return 'OPTION_VALUE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'arithmetic', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.arithmetic'), |
||||
|
type: 'code-mirror', |
||||
|
showIf: (arg) => { |
||||
|
return 'ARITHMETIC' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'ternaryCondition', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.ternaryCondition'), |
||||
|
type: 'code-mirror', |
||||
|
lang: 'java', |
||||
|
rows: 1, |
||||
|
height: '32px', |
||||
|
autoCompletionOptions: GroovyFunctions, |
||||
|
extAutoCompletionOptions: GroovyFunctions, |
||||
|
showIf: (arg) => { |
||||
|
return 'TERNARY' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'ternaryTrue', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.ternaryTrue'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'TERNARY' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'ternaryFalse', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.ternaryFalse'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'TERNARY' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'when', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.when'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'WHEN_THEN' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'then', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.then'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'WHEN_THEN' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'isWhenThenShorted', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.isWhenThenShorted'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'WHEN_THEN' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'numberRange', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.numberRange'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'NUMBER_RANGE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'conditionRange', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.conditionRange'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'CONDITION_RANGE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'decisionTable2C', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.decisionTable2C'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'DECISION_TABLE_2C' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'decisionTable', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.decisionTable'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'DECISION_TABLE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'decisionTree', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.decisionTree'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'DECISION_TREE' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'executionFlow', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.executionFlow'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'EXECUTION_FLOW' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'pmml', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.pmml'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'PMML' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'groovyScript', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.groovyScript'), |
||||
|
type: 'code-mirror', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'GROOVY_SCRIPT' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'sqlDatasourceName', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.sqlDatasourceName'), |
||||
|
type: 'select', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'SQL' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'sql', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.sql'), |
||||
|
type: 'select', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'SQL' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'sqlParameterValues', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.sqlParameterValues'), |
||||
|
type: 'select', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'SQL' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'sqlFieldMapping', |
||||
|
label: $t('re.resources.designer.processor.grid.entity.sqlFieldMapping'), |
||||
|
type: 'select', |
||||
|
rows: 1, |
||||
|
showIf: (arg) => { |
||||
|
return 'SQL' === arg.form.getFieldValue('type'); |
||||
|
}, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t(''), primaryKey: true }, |
||||
|
{ name: 'parameter', label: $t('') }, |
||||
|
{ name: 'description', label: $t('') }, |
||||
|
{ name: 'order', label: $t('') }, |
||||
|
{ name: 'enable', label: $t('') }, |
||||
|
{ name: 'type', label: $t('') }, |
||||
|
|
||||
|
{ 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') }, |
||||
|
|
||||
|
{ 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') }, |
||||
|
|
||||
|
{ 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() }, |
||||
|
{ name: 'corporationCode', label: $t('corporationCode') }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
></w-grid> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref, onMounted } from 'vue'; |
||||
|
import { Environment, Formater, EnumTools, Options } from '@/platform'; |
||||
|
import GroovyFunctions from './GroovyFunctions'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
fetchDataUrl: { type: String, default: '' }, |
||||
|
dataUrl: { type: String, default: '' }, |
||||
|
}); |
||||
|
|
||||
|
const parameter = { |
||||
|
jpaVersion: null, |
||||
|
dataComeFrom: 'INPUT', |
||||
|
creator: 'admin', |
||||
|
createDate: '2024-06-25 11:01:38', |
||||
|
lastModifier: 'admin', |
||||
|
lastModifyDate: '2024-06-25 11:01:38', |
||||
|
id: '88691f14-c1ec-4d64-9727-aab6c636fe5f', |
||||
|
code: 'P1628257078232', |
||||
|
name: '是否及格', |
||||
|
description: null, |
||||
|
type: 'OUT', |
||||
|
valueType: 'java.lang.String', |
||||
|
valueTypeVersion: null, |
||||
|
valueScale: null, |
||||
|
valueRoundingMode: null, |
||||
|
valueTypeIsList: false, |
||||
|
defaultValue: null, |
||||
|
order: 2, |
||||
|
model: 'df5b4629-52e1-47aa-a7d7-0dcf7143136c', |
||||
|
_rowKey_: '9d6373aa-ce47-4723-8468-58eb07ed827c', |
||||
|
ticked: true, |
||||
|
selected: true, |
||||
|
_tickedCount: 0, |
||||
|
}; |
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'rowClick', evt: Event, row: any, index: number): void; |
||||
|
(e: 'beforeRequestData', requestParams: URLSearchParams | any, callback: any): void; |
||||
|
}>(); |
||||
|
const gridRef = ref(); |
||||
|
|
||||
|
const refresh = () => { |
||||
|
gridRef.value.refresh(); |
||||
|
}; |
||||
|
|
||||
|
onMounted(() => { |
||||
|
gridRef.value.refresh(); |
||||
|
}); |
||||
|
|
||||
|
defineExpose({ |
||||
|
refresh, |
||||
|
}); |
||||
|
|
||||
|
const Enums = await EnumTools.fetch(['io.sc.engine.rule.core.enums.ProcessorType']); |
||||
|
</script> |
@ -0,0 +1,12 @@ |
|||||
|
<template> |
||||
|
<div class="q-pa-md"> |
||||
|
<q-btn color="purple" label="Show Loading" @click="showLoading" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { axios, Environment } from '@/platform'; |
||||
|
|
||||
|
const showLoading = () => { |
||||
|
axios.post(Environment.apiContextPath('/api/re/resource/createExample'), [], { loading: true }).then(() => {}); |
||||
|
}; |
||||
|
</script> |
Loading…
Reference in new issue