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.

163 lines
4.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')"
6 months ago
dnd-mode="server"
6 months ago
dense-body
10 months ago
hide-bottom
db-click-operation="edit"
:config-button="true"
selection="multiple"
:checkbox-selection="false"
:tree="false"
:fetch-data-url="Environment.apiContextPath('/api/re/indicator/processor?indicator=' + indicator.id)"
:data-url="Environment.apiContextPath('/api/re/indicator/processor')"
:pageable="false"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[
'refresh',
'separator',
[
{
extend: 'add',
click: undefined,
enableIf: (arg) => {
return !readOnly;
},
10 months ago
},
6 months ago
...processorManager.getToolbarAction(),
10 months ago
],
1 year ago
{
10 months ago
extend: 'clone',
1 year ago
enableIf: (arg) => {
10 months ago
return !readOnly && arg.selected;
1 year ago
},
},
{
10 months ago
extend: 'edit',
1 year ago
enableIf: (arg) => {
10 months ago
return !readOnly && arg.selected;
1 year ago
},
},
{
10 months ago
extend: 'remove',
1 year ago
enableIf: (arg) => {
10 months ago
return !readOnly && arg.selected;
1 year ago
},
},
10 months ago
'separator',
'view',
'separator',
'export',
]"
:columns="[
{
width: 120,
name: 'type',
label: $t('type'),
sortable: false,
format: (value, row) => {
return $t('io.sc.engine.rule.core.enums.ProcessorType.' + value);
},
},
10 months ago
{
width: '100%',
name: 'content',
6 months ago
label: $t('re.processor.grid.entity.content'),
10 months ago
sortable: false,
title: () => {},
format: (value: any, row: any) => {
6 months ago
return processorManager.format(value, row);
10 months ago
},
1 year ago
},
10 months ago
]"
:editor="{
dialog: {
width: '80%',
},
form: {
6 months ago
colsNum: 12,
10 months ago
fields: [
6 months ago
{ colSpan: 12, name: 'indicator', label: 'indicator', type: 'w-text', defaultValue: indicator.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 },
6 months ago
...processorManager.getEditorFields(),
10 months ago
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'order', label: $t('order') },
{ name: 'id', label: $t('id'), primaryKey: true },
{ name: 'indicator', label: $t('indicator') },
{ name: 'description', label: $t('description') },
{ name: 'enable', label: $t('enable') },
{ name: 'type', label: $t('type') },
6 months ago
...processorManager.getViewerFields(),
6 months ago
...CorporationAuditorEntityManager.getViewerFields(),
10 months ago
],
},
}"
@before-editor-data-submit="
(args) => {
6 months ago
processorManager.beforeEditorDataSubmit(args);
10 months ago
}
10 months ago
"
@after-editor-open="
8 months ago
(args) => {
6 months ago
processorManager.afterEditorOpen(args);
10 months ago
}
10 months ago
"
></w-grid>
<ObjectPropertiesMatcherDialog
ref="objectPropertiesMatcherDialogRef"
target-type="indicator"
:target="indicator"
10 months ago
@after-matched="
(objectProperties) => {
const grid = gridRef.getEditorForm().getFieldComponent('objectProperties');
grid.setLocalData(objectProperties);
}
"
></ObjectPropertiesMatcherDialog>
</div>
1 year ago
</template>
<script setup lang="ts">
import 'tailwindcss/utilities.css';
import { ref, onMounted } from 'vue';
6 months ago
import { axios, Environment, Formater, Tools, CorporationAuditorEntityManager } from 'platform-core';
6 months ago
import { ProcessorManager } from '@/views/shared/ProcessorManager';
7 months ago
import { Processor } from '@/views/shared/Processor';
10 months ago
import { PlaceHolder } from '@/utils/PlaceHolder';
import ObjectPropertiesMatcherDialog from '@/views/shared/ObjectPropertiesMatcherDialog.vue';
7 months ago
1 year ago
const props = defineProps({
indicator: { type: Object, default: undefined },
10 months ago
readOnly: { type: Boolean, default: false },
1 year ago
});
const gridRef = ref();
10 months ago
const objectPropertiesMatcherDialogRef = ref();
6 months ago
const processorManagerContext = {
target: props.indicator,
objectPropertiesMatcherDialogRef: objectPropertiesMatcherDialogRef,
};
const processorManager = new ProcessorManager(Processor.INDICATOR, processorManagerContext);
1 year ago
const refresh = () => {
1 year ago
gridRef?.value?.refresh();
1 year ago
};
onMounted(() => {
1 year ago
gridRef?.value?.refresh();
1 year ago
});
defineExpose({
refresh,
});
</script>