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.

266 lines
10 KiB

2 years ago
<template>
<w-grid
ref="gridRef"
:title="$t('erm.kpi.indicator.grid.title')"
:config-button="true"
selection="multiple"
:checkbox-selection="true"
:sticky-num="2"
:data-url="Environment.apiContextPath('/api/erm/kpi/indicator')"
:query-form-cols-num="4"
:query-form-fields="[
1 year ago
{ name: 'code', label: $t('code'), type: 'w-text' },
{ name: 'name', label: $t('name'), type: 'w-text' },
2 years ago
{
name: 'enable',
label: $t('enable'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
options: Options.yesNo(),
queryOperator: 'equals',
},
{
name: 'source',
label: $t('erm.kpi.indicator.grid.entity.source'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_SOURCE),
2 years ago
queryOperator: 'equals',
},
{
name: 'category',
label: $t('erm.kpi.indicator.grid.entity.category'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY),
2 years ago
queryOperator: 'equals',
},
{
name: 'categoryRisk',
label: $t('erm.kpi.indicator.grid.entity.categoryRisk'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY_RISK),
2 years ago
queryOperator: 'equals',
},
{
name: 'categoryBusiness',
label: $t('erm.kpi.indicator.grid.entity.categoryBusiness'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY_BUSINESS),
2 years ago
queryOperator: 'equals',
},
{
name: 'categoryCal',
label: $t('erm.kpi.indicator.grid.entity.categoryCal'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY_CAL),
2 years ago
queryOperator: 'equals',
},
{
name: 'unit',
label: $t('erm.kpi.indicator.grid.entity.unit'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_UNIT),
2 years ago
queryOperator: 'equals',
},
{
name: 'frequency',
label: $t('erm.kpi.indicator.grid.entity.frequency'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_FREQUENCY),
2 years ago
queryOperator: 'equals',
},
]"
:pagination="{
sortBy: 'lastModifyDate',
descending: true,
}"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[['query', 'moreQuery'], 'reset', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']"
:columns="[
{ width: 100, name: 'code', label: $t('code') },
{ width: 300, name: 'name', label: $t('name') },
{ width: 70, name: 'enable', label: $t('enable'), align: 'center', format: Formater.enableTag() },
2 years ago
{ width: 70, name: 'unit', label: $t('erm.kpi.indicator.grid.entity.unit'), format: Formater.dictionary(DICTIONARY_MAP.INDICATOR_UNIT) },
{ width: 70, name: 'frequency', label: $t('erm.kpi.indicator.grid.entity.frequency'), format: Formater.dictionary(DICTIONARY_MAP.INDICATOR_FREQUENCY) },
{ width: 80, name: 'category', label: $t('erm.kpi.indicator.grid.entity.category'), format: Formater.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY) },
{
width: 100,
name: 'categoryCal',
label: $t('erm.kpi.indicator.grid.entity.categoryCal'),
format: Formater.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY_CAL),
},
2 years ago
{
width: 100,
name: 'categoryRisk',
label: $t('erm.kpi.indicator.grid.entity.categoryRisk'),
2 years ago
format: Formater.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY_RISK),
2 years ago
},
{
width: 100,
name: 'categoryBusiness',
label: $t('erm.kpi.indicator.grid.entity.categoryBusiness'),
2 years ago
format: Formater.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY_BUSINESS),
2 years ago
},
{
width: 100,
name: 'source',
label: $t('erm.kpi.indicator.grid.entity.source'),
2 years ago
format: Formater.dictionary(DICTIONARY_MAP.INDICATOR_SOURCE),
2 years ago
},
{
width: 100,
name: 'superviseCondition',
label: $t('erm.kpi.indicator.grid.entity.superviseCondition'),
format: (value, row) => {
if (row.superviseCondition && !Tools.isUndefinedOrNull(row.superviseValue)) {
return row.superviseCondition + row.superviseValue;
}
return '';
},
},
{ width: 300, name: 'superviseSource', label: $t('erm.kpi.indicator.grid.entity.superviseSource') },
{ width: 200, name: 'formula', label: $t('erm.kpi.indicator.grid.entity.formula') },
{ width: 300, name: 'sql', label: $t('erm.kpi.indicator.grid.entity.sql') },
{ width: 100, name: 'lastModifier', label: $t('lastModifier') },
{ width: 110, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() },
]"
:editor="{
dialog: {
width: '800px',
height: '650px',
},
form: {
colsNum: 3,
fields: [
1 year ago
{ name: 'code', label: $t('code'), type: 'w-text', requiredIf: true },
{ name: 'name', label: $t('name'), type: 'w-text', requiredIf: true },
{ name: 'enable', label: $t('enable'), type: 'w-checkbox', defaultValue: true },
{ name: 'description', label: $t('description'), colSpan: 3, type: 'w-textarea', rows: 3 },
2 years ago
{
name: 'source',
label: $t('erm.kpi.indicator.grid.entity.source'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_SOURCE),
2 years ago
},
{
name: 'category',
label: $t('erm.kpi.indicator.grid.entity.category'),
1 year ago
type: 'w-select',
requiredIf: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY),
2 years ago
},
{
name: 'categoryCal',
label: $t('erm.kpi.indicator.grid.entity.categoryCal'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY_CAL),
2 years ago
},
{
name: 'categoryRisk',
label: $t('erm.kpi.indicator.grid.entity.categoryRisk'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY_RISK),
2 years ago
},
{
name: 'categoryBusiness',
label: $t('erm.kpi.indicator.grid.entity.categoryBusiness'),
1 year ago
type: 'w-select',
2 years ago
clearable: true,
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_CATEGORY_BUSINESS),
2 years ago
},
{
name: 'unit',
label: $t('erm.kpi.indicator.grid.entity.unit'),
1 year ago
type: 'w-select',
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_UNIT),
2 years ago
},
{
name: 'frequency',
label: $t('erm.kpi.indicator.grid.entity.frequency'),
1 year ago
type: 'w-select',
2 years ago
options: Options.dictionary(DICTIONARY_MAP.INDICATOR_FREQUENCY),
2 years ago
},
1 year ago
{ name: 'formula', label: $t('erm.kpi.indicator.grid.entity.formula'), type: 'w-code-mirror', colSpan: 3, rows: 3 },
{ name: 'sql', label: $t('erm.kpi.indicator.grid.entity.sql'), type: 'w-code-mirror', colSpan: 3, rows: 3 },
2 years ago
{
name: 'superviseSource',
label: $t('erm.kpi.indicator.grid.entity.superviseSource'),
1 year ago
type: 'w-text',
2 years ago
},
{
name: 'superviseCondition',
label: $t('erm.kpi.indicator.grid.entity.superviseCondition'),
1 year ago
type: 'w-select',
2 years ago
options: CONDITIONS,
},
{
name: 'superviseValue',
label: $t('erm.kpi.indicator.grid.entity.superviseValue'),
1 year ago
type: 'w-number',
2 years ago
},
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'id', label: $t('id') },
{ name: 'code', label: $t('code') },
{ name: 'name', label: $t('name') },
{ name: 'description', label: $t('description') },
{ name: 'enable', label: $t('enable'), format: Formater.none() },
{ name: 'category', label: $t('erm.kpi.indicator.grid.entity.category'), format: Formater.none() },
{ name: 'categoryRisk', label: $t('erm.kpi.indicator.grid.entity.categoryRisk'), format: Formater.none() },
{ name: 'categoryBusiness', label: $t('erm.kpi.indicator.grid.entity.categoryBusiness'), format: Formater.none() },
{ name: 'categoryCal', label: $t('erm.kpi.indicator.grid.entity.categoryCal'), format: Formater.none() },
{ name: 'unit', label: $t('erm.kpi.indicator.grid.entity.unit'), format: Formater.none() },
{ name: 'frequency', label: $t('erm.kpi.indicator.grid.entity.frequency'), format: Formater.none() },
{ name: 'source', label: $t('erm.kpi.indicator.grid.entity.source'), format: Formater.none() },
{ name: 'formula', label: $t('erm.kpi.indicator.grid.entity.formula') },
{ name: 'sql', label: $t('erm.kpi.indicator.grid.entity.sql') },
{ name: 'superviseSource', label: $t('erm.kpi.indicator.grid.entity.superviseSource') },
{ name: 'superviseCondition', label: $t('erm.kpi.indicator.grid.entity.superviseCondition') },
{ name: 'superviseValue', label: $t('erm.kpi.indicator.grid.entity.superviseValue') },
{ 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') },
],
},
}"
1 year ago
@row-click="(args) => {}"
2 years ago
></w-grid>
</template>
<script setup lang="ts">
import 'tailwindcss/utilities.css';
2 years ago
import { ref } from 'vue';
import { Environment, DictionaryTools, Formater, Options, Tools } from 'platform-core';
import IndicatorStatus from './IndicatorStatus';
const gridRef = ref();
2 years ago
const DICTIONARY_MAP = await DictionaryTools.fetch([
'INDICATOR_CATEGORY',
'INDICATOR_CATEGORY_RISK',
'INDICATOR_CATEGORY_BUSINESS',
'INDICATOR_CATEGORY_CAL',
'INDICATOR_UNIT',
'INDICATOR_FREQUENCY',
'INDICATOR_SOURCE',
]);
2 years ago
const CONDITIONS = ['>', '>=', '<', '<='];
</script>