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.

207 lines
6.7 KiB

1 year ago
<template>
10 months ago
<div style="height: 100%">
<w-grid
ref="gridRef"
6 months ago
:title="$t('re.processor.grid.title')"
7 months ago
dnd-mode="server"
10 months ago
dense-body
class="px-1"
hide-bottom
:config-button="false"
selection="multiple"
8 months ago
db-click-operation="customEdit"
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',
7 months ago
enableIf: (args: any) => {
10 months ago
return !readOnly;
},
10 months ago
click: undefined,
1 year ago
},
6 months ago
...processorManager.getToolbarAction(),
10 months ago
],
6 months ago
'clone',
1 year ago
{
10 months ago
extend: 'edit',
8 months ago
name: 'customEdit',
7 months ago
enableIf: (args: any) => {
return args.selected;
10 months ago
},
7 months ago
click: (args: any) => {
const type = args.selected?.type;
8 months ago
if ('DECISION_TREE' === type) {
7 months ago
decisionTreeDialogRef.open(parameter.id, args.selected?.id);
8 months ago
} else if ('EXECUTION_FLOW' === type) {
7 months ago
executionFlowDialogRef.open(parameter.id, args.selected?.id);
8 months ago
} else {
7 months ago
args._click(args);
8 months ago
}
1 year ago
},
},
10 months ago
{
extend: 'remove',
7 months ago
enableIf: (args: any) => {
return !readOnly && args.selected;
10 months ago
},
},
10 months ago
'separator',
1 year ago
{
10 months ago
name: 'enable',
7 months ago
label: (args: any) => {
if (args.selected?.enable) {
10 months ago
return $t('disable');
}
return $t('enable');
1 year ago
},
7 months ago
icon: (args: any) => {
if (args.selected?.enable) {
10 months ago
return 'bi-x';
}
return 'bi-check';
1 year ago
},
7 months ago
enableIf: (args: any) => {
return !readOnly && args.selected;
1 year ago
},
7 months ago
click: (args: any) => {
const data = args.selected;
10 months ago
data.enable = !data.enable;
axios.put(Environment.apiContextPath('/api/re/model/parameter/processor/' + data.id), data).then((response) => {
gridRef.updateLocalData(response.data);
10 months ago
});
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: 150,
name: 'type',
label: $t('type'),
sortable: false,
format: (value, row) => {
return $t('io.sc.engine.rule.core.enums.ProcessorType.' + value);
},
},
1 year ago
{
10 months ago
width: '100%',
name: 'content',
6 months ago
label: $t('re.processor.grid.entity.content'),
10 months ago
sortable: false,
7 months ago
title: () => {},
format: (value: any, row: any) => {
7 months ago
return processorManager.format(value, row);
10 months ago
},
1 year ago
},
10 months ago
]"
:editor="{
dialog: {
7 months ago
width: '50%',
10 months ago
},
form: {
6 months ago
colsNum: 12,
10 months ago
fields: [
6 months ago
{ colSpan: 12, name: 'parameter', label: 'parameter', type: 'w-text', defaultValue: parameter.id, showIf: false },
{ colSpan: 12, name: 'id', label: $t('id'), type: 'w-text', showIf: false },
{ colSpan: 12, name: 'order', label: $t('order'), type: 'w-number', showIf: false },
{ colSpan: 12, name: 'type', label: $t('type'), type: 'w-text', showIf: false },
{ colSpan: 12, name: 'description', label: $t('description'), type: 'w-text', showIf: false },
{ colSpan: 12, name: 'enable', label: $t('enable'), type: 'w-checkbox', defaultValue: true, showIf: false },
6 months ago
...processorManager.getEditorFields(),
10 months ago
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
10 months ago
{ name: 'parameter', label: $t('parameter') },
5 months ago
{ name: 'type', label: $t('type') },
{ name: 'id', label: $t('id'), primaryKey: true },
10 months ago
{ name: 'description', label: $t('description') },
{ name: 'enable', label: $t('enable') },
5 months ago
{ name: 'order', label: $t('order') },
7 months ago
...processorManager.getViewerFields(),
6 months ago
...CorporationAuditorEntityManager.getViewerFields(),
10 months ago
],
},
}"
@before-editor-data-submit="
(args) => {
7 months ago
processorManager.beforeEditorDataSubmit(args);
10 months ago
}
"
@after-editor-open="
8 months ago
(args) => {
7 months ago
processorManager.afterEditorOpen(args);
10 months ago
}
"
10 months ago
></w-grid>
<DecisionTreeDialog ref="decisionTreeDialogRef"></DecisionTreeDialog>
<ExecutionFlowDialog ref="executionFlowDialogRef"></ExecutionFlowDialog>
10 months ago
<ObjectPropertiesMatcherDialog
ref="objectPropertiesMatcherDialogRef"
7 months ago
:target-type="Processor.PARAMETER"
:target="parameter"
10 months ago
@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">
import 'tailwindcss/utilities.css';
import { ref, onMounted } from 'vue';
6 months ago
import { $t, axios, Environment, Formater, CorporationAuditorEntityManager } from 'platform-core';
7 months ago
import { ProcessorManager } from '@/views/shared/ProcessorManager';
import { Processor } from '@/views/shared/Processor';
10 months ago
import { PlaceHolder } from '@/utils/PlaceHolder';
10 months ago
import DecisionTreeDialog from './DecisionTreeDialog.vue';
import ExecutionFlowDialog from './ExecutionFlowDialog.vue';
import ObjectPropertiesMatcherDialog from '@/views/shared/ObjectPropertiesMatcherDialog.vue';
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 decisionTreeDialogRef = ref();
const executionFlowDialogRef = ref();
10 months ago
const objectPropertiesMatcherDialogRef = ref();
6 months ago
const processorManagerContext = {
target: props.parameter,
objectPropertiesMatcherDialogRef: objectPropertiesMatcherDialogRef,
};
const processorManager = new ProcessorManager(Processor.PARAMETER, processorManagerContext);
1 year ago
const refresh = () => {
gridRef.value.refresh();
};
onMounted(() => {
gridRef.value.refresh();
});
defineExpose({
refresh,
});
1 year ago
</script>