39 changed files with 912 additions and 1306 deletions
@ -1,167 +0,0 @@ |
|||||
<template> |
|
||||
<w-dialog ref="dialogRef" :title="$t('engine.st.scenario.dialog.title')" width="800px" :can-maximize="false"> |
|
||||
<div class="px-2" style="height: 100%"> |
|
||||
<w-grid |
|
||||
ref="gridRef" |
|
||||
:height="200" |
|
||||
:title="$t('engine.st.scenario.grid.title')" |
|
||||
dense |
|
||||
selection="multiple" |
|
||||
:pageable="false" |
|
||||
:full-screen-button="false" |
|
||||
:toolbar-configure="{ noIcon: false }" |
|
||||
:toolbar-actions="['query', 'separator', 'refresh', 'separator', 'add', 'edit', 'remove', 'separator']" |
|
||||
:query-form-fields="[]" |
|
||||
:auto-fetch-data="false" |
|
||||
:fetch-data-url="dataUrl + '?' + foreignKey + '=' + foreignValue" |
|
||||
:data-url="dataUrl" |
|
||||
:columns="[ |
|
||||
{ width: 100, name: 'indicator', label: $t('engine.st.scenario.grid.entity.indicator') }, |
|
||||
{ width: 100, name: 'lowGrade', label: $t('engine.st.scenario.grid.entity.lowGrade') }, |
|
||||
{ width: 100, name: 'midGrade', label: $t('engine.st.scenario.grid.entity.midGrade') }, |
|
||||
{ width: 100, name: 'highGrade', label: $t('engine.st.scenario.grid.entity.highGrade') }, |
|
||||
]" |
|
||||
:editor="{ |
|
||||
dialog: { |
|
||||
width: '600px', |
|
||||
}, |
|
||||
form: { |
|
||||
colsNum: 1, |
|
||||
fields: [ |
|
||||
{ |
|
||||
name: 'testCase', |
|
||||
label: $t('engine.st.scenario.grid.entity.testCase'), |
|
||||
type: 'text', |
|
||||
defaultValue: foreignValue, |
|
||||
}, |
|
||||
{ |
|
||||
name: 'indicator', |
|
||||
label: $t('engine.st.scenario.grid.entity.indicator'), |
|
||||
type: 'select', |
|
||||
options: indicatorOptionsRef, |
|
||||
}, |
|
||||
{ width: 100, name: 'lowGrade', label: $t('engine.st.scenario.grid.entity.lowGrade'), type: 'number', precision: 6 }, |
|
||||
{ width: 100, name: 'midGrade', label: $t('engine.st.scenario.grid.entity.midGrade'), type: 'number', precision: 6 }, |
|
||||
{ width: 100, name: 'highGrade', label: $t('engine.st.scenario.grid.entity.highGrade'), type: 'number', precision: 6 }, |
|
||||
], |
|
||||
}, |
|
||||
}" |
|
||||
></w-grid> |
|
||||
<div id="echart" style="width: 100%; height: 300px"></div> |
|
||||
</div> |
|
||||
</w-dialog> |
|
||||
</template> |
|
||||
<script setup lang="ts"> |
|
||||
import { ref, nextTick } from 'vue'; |
|
||||
import { useI18n } from 'vue-i18n'; |
|
||||
import * as echarts from 'echarts'; |
|
||||
import { axios, Environment, Tools } from 'platform-core'; |
|
||||
|
|
||||
const { t } = useI18n(); |
|
||||
|
|
||||
const props = defineProps({ |
|
||||
opener: { type: Object, default: undefined }, |
|
||||
dataUrl: { type: String, default: '' }, |
|
||||
foreignKey: { type: String, default: '' }, |
|
||||
foreignValue: { type: String, default: '' }, |
|
||||
}); |
|
||||
|
|
||||
const dialogRef = ref(); |
|
||||
const foreignKeyRef = ref(''); |
|
||||
const gridRef = ref(); |
|
||||
let echart; |
|
||||
|
|
||||
const indicatorOptionsRef = ref([ |
|
||||
{ label: t('engine.st.economicIndicator.grid.entity.GDP'), value: 'GDP' }, |
|
||||
{ label: t('engine.st.economicIndicator.grid.entity.M2'), value: 'M2' }, |
|
||||
{ label: t('engine.st.economicIndicator.grid.entity.CPI'), value: 'CPI' }, |
|
||||
{ label: t('engine.st.economicIndicator.grid.entity.HPI'), value: 'HPI' }, |
|
||||
{ label: t('engine.st.economicIndicator.grid.entity.PMI'), value: 'PMI' }, |
|
||||
{ label: t('engine.st.economicIndicator.grid.entity.BLR'), value: 'BLR' }, |
|
||||
]); |
|
||||
|
|
||||
const open = (foreignKey: string) => { |
|
||||
foreignKeyRef.value = foreignKey; |
|
||||
dialogRef.value.show(); |
|
||||
|
|
||||
nextTick(() => { |
|
||||
gridRef.value.refresh(); |
|
||||
if (!echart) { |
|
||||
echart = echarts.init(document.getElementById('echart'), null, { width: 800, height: 300 }); |
|
||||
} else { |
|
||||
echart.dispose(); |
|
||||
echart = echarts.init(document.getElementById('echart'), null, { width: 800, height: 300 }); |
|
||||
} |
|
||||
echart?.setOption({ |
|
||||
animation: false, |
|
||||
title: { |
|
||||
text: 'KS 曲线', |
|
||||
left: 'center', |
|
||||
}, |
|
||||
grid: { |
|
||||
show: true, |
|
||||
containLabel: true, |
|
||||
}, |
|
||||
legend: { |
|
||||
top: 30, |
|
||||
data: ['正常样本占比', '违约样本占比'], |
|
||||
}, |
|
||||
tooltip: {}, |
|
||||
xAxis: { |
|
||||
gridIndex: 0, |
|
||||
name: '评分', |
|
||||
nameLocation: 'middle', |
|
||||
nameGap: 30, |
|
||||
smooth: true, |
|
||||
boundaryGap: false, |
|
||||
axisTick: { |
|
||||
interval: 0, |
|
||||
}, |
|
||||
data: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100], |
|
||||
}, |
|
||||
yAxis: { |
|
||||
gridIndex: 0, |
|
||||
name: '样本占比', |
|
||||
nameLocation: 'middle', |
|
||||
nameGap: 30, |
|
||||
smooth: false, |
|
||||
boundaryGap: false, |
|
||||
axisTick: { |
|
||||
interval: 0, |
|
||||
}, |
|
||||
data: null, |
|
||||
}, |
|
||||
series: [ |
|
||||
{ |
|
||||
name: '正常样本占比', |
|
||||
type: 'line', |
|
||||
barWidth: 0, |
|
||||
data: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.15, 0.28, 0.36, 0.43, 0.49, 0.57, 0.66, 0.77, 0.91, 1.0], |
|
||||
}, |
|
||||
{ |
|
||||
name: '违约样本占比', |
|
||||
type: 'line', |
|
||||
barWidth: 0, |
|
||||
data: [ |
|
||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.037037, 0.08642, 0.609053, 0.662551, 0.707819, 0.720165, 0.769547, 0.814815, 0.855967, 0.897119, |
|
||||
0.962963, 1.0, |
|
||||
], |
|
||||
}, |
|
||||
], |
|
||||
}); |
|
||||
echart?.resize(); |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const close = () => { |
|
||||
dialogRef.value.hide(); |
|
||||
if (echart) { |
|
||||
echart.dispose(); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
defineExpose({ |
|
||||
open, |
|
||||
close, |
|
||||
}); |
|
||||
</script> |
|
@ -0,0 +1,74 @@ |
|||||
|
<template> |
||||
|
<w-dialog |
||||
|
ref="dialogRef" |
||||
|
:title="$t('engine.st.scenario.percentileDialog.title')" |
||||
|
width="400px" |
||||
|
:can-maximize="false" |
||||
|
:buttons="[ |
||||
|
{ |
||||
|
label: $t('confirm'), |
||||
|
click: () => { |
||||
|
emit('afterSetting', formRef.getData()); |
||||
|
}, |
||||
|
}, |
||||
|
]" |
||||
|
> |
||||
|
<w-form |
||||
|
ref="formRef" |
||||
|
:cols-num="1" |
||||
|
:fields="[ |
||||
|
{ |
||||
|
name: 'precision', |
||||
|
label: $t('engine.st.scenario.percentileDialog.entity.precision'), |
||||
|
type: 'select', |
||||
|
options: [0, 1, 2, 3, 4, 5, 6], |
||||
|
defaultValue: 2, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'low', |
||||
|
label: $t('engine.st.scenario.percentileDialog.entity.low'), |
||||
|
type: 'select', |
||||
|
options: [0.01, 0.05, 0.1, 0.9, 0.95, 0.99], |
||||
|
defaultValue: 0.1, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'mid', |
||||
|
label: $t('engine.st.scenario.percentileDialog.entity.mid'), |
||||
|
type: 'select', |
||||
|
options: [0.01, 0.05, 0.1, 0.9, 0.95, 0.99], |
||||
|
defaultValue: 0.05, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'high', |
||||
|
label: $t('engine.st.scenario.percentileDialog.entity.high'), |
||||
|
type: 'select', |
||||
|
options: [0.01, 0.05, 0.1, 0.9, 0.95, 0.99], |
||||
|
defaultValue: 0.01, |
||||
|
}, |
||||
|
]" |
||||
|
></w-form> |
||||
|
</w-dialog> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue'; |
||||
|
|
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'afterSetting', settings: object, dialogComponent: any): void; |
||||
|
}>(); |
||||
|
|
||||
|
const dialogRef = ref(); |
||||
|
const formRef = ref(); |
||||
|
|
||||
|
const open = () => { |
||||
|
dialogRef.value.show(); |
||||
|
}; |
||||
|
|
||||
|
const close = () => { |
||||
|
dialogRef.value.hide(); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
open, |
||||
|
close, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,224 @@ |
|||||
|
<template> |
||||
|
<div style="height: 100%"> |
||||
|
<w-grid |
||||
|
ref="gridRef" |
||||
|
:title="$t('data')" |
||||
|
dense |
||||
|
:checkbox-selection="true" |
||||
|
:fetch-data-url="Environment.apiContextPath('/api/st/scenarioFactor?defineId=' + factorDefine.id)" |
||||
|
:data-url="Environment.apiContextPath('/api/st/scenarioFactor')" |
||||
|
:pageable="false" |
||||
|
:sort-by="['year', 'quarter', 'month', 'day']" |
||||
|
:query-form-cols-num="4" |
||||
|
:query-form-fields="[]" |
||||
|
:toolbar-actions="[ |
||||
|
'refresh', |
||||
|
'separator', |
||||
|
{ |
||||
|
extend: 'add', |
||||
|
enableIf: () => { |
||||
|
return factorDefine.type === 'ORIGINAL'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'fillWithPercentile', |
||||
|
label: $t('engine.st.scenario.scenarioFactor.grid.toolbar.fillWithPercentile'), |
||||
|
icon: 'bi-brush', |
||||
|
enableIf: (arg) => { |
||||
|
return arg.selected; |
||||
|
}, |
||||
|
click: (arg) => { |
||||
|
if (arg.selected) { |
||||
|
dialogRef.open(); |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'clone', |
||||
|
enableIf: () => { |
||||
|
return factorDefine.type === 'ORIGINAL'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'edit', |
||||
|
enableIf: () => { |
||||
|
return factorDefine.type === 'ORIGINAL'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
extend: 'remove', |
||||
|
enableIf: () => { |
||||
|
return factorDefine.type === 'ORIGINAL'; |
||||
|
}, |
||||
|
}, |
||||
|
'separator', |
||||
|
'view', |
||||
|
'separator', |
||||
|
'export', |
||||
|
]" |
||||
|
:columns="[ |
||||
|
{ width: 60, name: 'year', label: t('year'), align: 'right' }, |
||||
|
{ width: 60, name: 'quarter', label: t('quarter'), align: 'right' }, |
||||
|
{ width: 60, name: 'month', label: t('month'), align: 'right' }, |
||||
|
{ width: 100, name: 'valueLow', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueLow') }, |
||||
|
{ width: 100, name: 'valueMid', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueMid') }, |
||||
|
{ width: 100, name: 'valueHigh', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueHigh') }, |
||||
|
]" |
||||
|
:editor="{ |
||||
|
dialog: { |
||||
|
width: '600px', |
||||
|
}, |
||||
|
form: { |
||||
|
colsNum: 1, |
||||
|
fields: [ |
||||
|
{ |
||||
|
name: 'define', |
||||
|
label: $t('define'), |
||||
|
type: 'text', |
||||
|
defaultValue: factorDefine.id, |
||||
|
hidden: true, |
||||
|
}, |
||||
|
{ name: 'year', label: $t('year'), type: 'number', required: true }, |
||||
|
{ |
||||
|
name: 'quarter', |
||||
|
label: $t('quarter'), |
||||
|
type: 'number', |
||||
|
required: true, |
||||
|
showIf: () => { |
||||
|
return factorDefine.period === 'QUARTER'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'month', |
||||
|
label: $t('month'), |
||||
|
type: 'number', |
||||
|
required: true, |
||||
|
showIf: () => { |
||||
|
return factorDefine.period === 'MONTH'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'day', |
||||
|
label: $t('day'), |
||||
|
type: 'number', |
||||
|
required: true, |
||||
|
showIf: () => { |
||||
|
return factorDefine.period === 'DAY'; |
||||
|
}, |
||||
|
}, |
||||
|
{ name: 'valueLow', label: $t('engine.st.scenario.scenarioFactor.grid.entity.valueLow'), type: 'text', required: true }, |
||||
|
{ name: 'valueMid', label: $t('engine.st.scenario.scenarioFactor.grid.entity.valueMid'), type: 'text', required: true }, |
||||
|
{ name: 'valueHigh', label: $t('engine.st.scenario.scenarioFactor.grid.entity.valueHigh'), type: 'text', required: true }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t('id') }, |
||||
|
{ name: 'define', label: $t('engine.st.indepFactorDefine.grid.entity.factorDefine') }, |
||||
|
{ name: 'year', label: $t('year') }, |
||||
|
{ name: 'quarter', label: $t('quarter') }, |
||||
|
{ name: 'month', label: $t('month') }, |
||||
|
{ name: 'value', label: $t('value') }, |
||||
|
{ 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') }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
@after-request-data=" |
||||
|
() => { |
||||
|
const rows = gridRef.getRows(); |
||||
|
const xAxisData = []; |
||||
|
const seriesData = []; |
||||
|
for (const row of rows) { |
||||
|
xAxisData.push(row.year + (row.month ? '-' + row.month : '')); |
||||
|
seriesData.push(row.valueLow); |
||||
|
} |
||||
|
echartsOptionRef = { |
||||
|
title: { |
||||
|
text: factorDefine.name, |
||||
|
left: 'center', |
||||
|
}, |
||||
|
xAxis: { |
||||
|
type: 'category', |
||||
|
name: $t('period'), |
||||
|
data: xAxisData, |
||||
|
}, |
||||
|
yAxis: { |
||||
|
type: 'value', |
||||
|
name: $t('value'), |
||||
|
}, |
||||
|
series: [ |
||||
|
{ |
||||
|
data: seriesData, |
||||
|
type: 'line', |
||||
|
smooth: true, |
||||
|
}, |
||||
|
], |
||||
|
}; |
||||
|
} |
||||
|
" |
||||
|
></w-grid> |
||||
|
<PercentileDialog ref="dialogRef" @after-setting="fillWithPercentile"></PercentileDialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref, computed, onUpdated } from 'vue'; |
||||
|
import { useI18n } from 'vue-i18n'; |
||||
|
import { axios, Environment, Formater } from 'platform-core'; |
||||
|
import PercentileDialog from './PercentileDialog.vue'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
factorDefine: { |
||||
|
type: Object, |
||||
|
default: () => { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
const { t } = useI18n(); |
||||
|
const gridRef = ref(); |
||||
|
const echartsOptionRef = ref(); |
||||
|
const dialogRef = ref(); |
||||
|
|
||||
|
const getFactorColumns = computed(() => { |
||||
|
let result = [{ width: 60, name: 'year', label: t('year'), align: 'right' }]; |
||||
|
if (props.factorDefine.period === 'QUARTER') { |
||||
|
result.push({ width: 60, name: 'quarter', label: t('quarter'), align: 'right' }); |
||||
|
} else if (props.factorDefine.period === 'MONTH') { |
||||
|
result.push({ width: 60, name: 'month', label: t('month'), align: 'right' }); |
||||
|
} |
||||
|
result.push({ width: 100, name: 'valueLow', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueLow') }); |
||||
|
result.push({ width: 100, name: 'valueMid', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueMid') }); |
||||
|
result.push({ width: 100, name: 'valueHigh', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueHigh') }); |
||||
|
return result; |
||||
|
}); |
||||
|
|
||||
|
const fillWithPercentile = (settings) => { |
||||
|
axios |
||||
|
.post(Environment.apiContextPath('/api/st/scenarioFactor/fillWithPercentile?scenarioFactorId=' + gridRef.value.getSelectedRow().id), settings) |
||||
|
.then(() => { |
||||
|
refresh(); |
||||
|
dialogRef.value.close(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const refresh = () => { |
||||
|
gridRef.value.refresh(); |
||||
|
}; |
||||
|
|
||||
|
onUpdated(() => { |
||||
|
gridRef.value.refresh(); |
||||
|
}); |
||||
|
|
||||
|
defineExpose({ |
||||
|
refresh, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,220 @@ |
|||||
|
<template> |
||||
|
<w-grid |
||||
|
ref="treeGridRef" |
||||
|
:title="$t('engine.st.indepFactorDefine.grid.title')" |
||||
|
dense |
||||
|
:checkbox-selection="false" |
||||
|
:tree="true" |
||||
|
:tree-icon=" |
||||
|
(row) => { |
||||
|
if (row.type === 'FOLDER') { |
||||
|
return { name: 'folder', color: 'amber' }; |
||||
|
} else if (row.type === 'ORIGINAL') { |
||||
|
return { name: 'bi-file-earmark-text' }; |
||||
|
} else if (row.type === 'EXTEND_ARITHMETIC') { |
||||
|
return { name: 'bi-file-earmark-text', color: 'green' }; |
||||
|
} else if (row.type === 'EXTEND_DELAY') { |
||||
|
return { name: 'bi-file-earmark-text', color: 'blue' }; |
||||
|
} else if (row.type === 'EXTEND_DIFFERENTIAL') { |
||||
|
return { name: 'bi-file-earmark-text', color: 'amber' }; |
||||
|
} else { |
||||
|
return { name: 'bi-file-earmark-text' }; |
||||
|
} |
||||
|
} |
||||
|
" |
||||
|
:data-url="Environment.apiContextPath('/api/st/scenarioFactorDefine')" |
||||
|
:pageable="false" |
||||
|
:sort-by="['order']" |
||||
|
:toolbar-actions="[ |
||||
|
'refresh', |
||||
|
'separator', |
||||
|
'expand', |
||||
|
'separator', |
||||
|
{ |
||||
|
name: 'synchronize', |
||||
|
label: $t('synchronize'), |
||||
|
icon: 'bi-repeat', |
||||
|
click: () => {}, |
||||
|
}, |
||||
|
'separator', |
||||
|
'view', |
||||
|
'separator', |
||||
|
'export', |
||||
|
]" |
||||
|
:columns="[ |
||||
|
{ width: 160, name: 'name', label: $t('name') }, |
||||
|
{ width: 150, name: 'code', label: $t('code') }, |
||||
|
{ |
||||
|
width: 100, |
||||
|
name: 'type', |
||||
|
label: $t('type'), |
||||
|
format: (value, row) => { |
||||
|
if (value === 'FOLDER') { |
||||
|
return ''; |
||||
|
} |
||||
|
return Formater.enum(Enums.FactorDefineType)(value); |
||||
|
}, |
||||
|
}, |
||||
|
{ width: 60, name: 'period', label: $t('period'), format: Formater.enum(Enums.Period) }, |
||||
|
{ width: 70, name: 'valueType', label: $t('valueType'), format: Formater.enum(Enums.ValueType) }, |
||||
|
]" |
||||
|
:editor="{ |
||||
|
dialog: { |
||||
|
width: '500px', |
||||
|
}, |
||||
|
form: { |
||||
|
colsNum: 1, |
||||
|
fields: [ |
||||
|
{ |
||||
|
name: 'type', |
||||
|
label: $t('type'), |
||||
|
type: 'select', |
||||
|
required: true, |
||||
|
options: Options.enum(Enums.FactorDefineType), |
||||
|
onChange: (arg) => { |
||||
|
findAllWithoutById(arg.form.getFieldValue('id')); |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'code', |
||||
|
label: $t('code'), |
||||
|
type: 'text', |
||||
|
required: true, |
||||
|
showIf: (arg) => { |
||||
|
return arg.form.getFieldValue('type') !== 'FOLDER'; |
||||
|
}, |
||||
|
}, |
||||
|
{ name: 'name', label: $t('name'), type: 'text', required: true }, |
||||
|
{ name: 'description', label: $t('description'), type: 'text' }, |
||||
|
{ name: 'order', label: $t('order'), type: 'number' }, |
||||
|
{ |
||||
|
name: 'period', |
||||
|
label: $t('period'), |
||||
|
required: true, |
||||
|
type: 'select', |
||||
|
options: Options.enum(Enums.Period), |
||||
|
showIf: (arg) => { |
||||
|
return arg.form.getFieldValue('type') !== 'FOLDER'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'valueType', |
||||
|
label: $t('valueType'), |
||||
|
required: true, |
||||
|
type: 'select', |
||||
|
options: Options.enum(Enums.ValueType), |
||||
|
showIf: (arg) => { |
||||
|
return arg.form.getFieldValue('type') !== 'FOLDER'; |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
name: 'formula', |
||||
|
label: $t('engine.st.indepFactorDefine.grid.entity.formula'), |
||||
|
type: 'code-mirror', |
||||
|
required: true, |
||||
|
showIf: (arg) => { |
||||
|
return arg.form.getFieldValue('type') === 'EXTEND_ARITHMETIC'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'delayFactorDefine', |
||||
|
label: $t('engine.st.indepFactorDefine.grid.entity.delayFactorDefine'), |
||||
|
type: 'select', |
||||
|
options: factorDefineOptionsRef, |
||||
|
required: true, |
||||
|
showIf: (arg) => { |
||||
|
return arg.form.getFieldValue('type') === 'EXTEND_DELAY'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'delayIssue', |
||||
|
label: $t('engine.st.indepFactorDefine.grid.entity.delayIssue'), |
||||
|
type: 'number', |
||||
|
required: true, |
||||
|
showIf: (arg) => { |
||||
|
return arg.form.getFieldValue('type') === 'EXTEND_DELAY'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'differentialFactorDefine', |
||||
|
label: $t('engine.st.indepFactorDefine.grid.entity.differentialFactorDefine'), |
||||
|
type: 'select', |
||||
|
options: factorDefineOptionsRef, |
||||
|
required: true, |
||||
|
showIf: (arg) => { |
||||
|
return arg.form.getFieldValue('type') === 'EXTEND_DIFFERENTIAL'; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'differentialDegree', |
||||
|
label: $t('engine.st.indepFactorDefine.grid.entity.differentialDegree'), |
||||
|
type: 'number', |
||||
|
required: true, |
||||
|
showIf: (arg) => { |
||||
|
return arg.form.getFieldValue('type') === 'EXTEND_DIFFERENTIAL'; |
||||
|
}, |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t('id') }, |
||||
|
{ name: 'type', label: $t('type') }, |
||||
|
{ name: 'period', label: $t('period') }, |
||||
|
{ name: 'code', label: $t('code') }, |
||||
|
{ name: 'name', label: $t('name') }, |
||||
|
{ name: 'description', label: $t('description') }, |
||||
|
{ name: 'order', label: $t('order') }, |
||||
|
{ name: 'valueType', label: $t('valueType') }, |
||||
|
|
||||
|
{ name: 'formula', label: $t('engine.st.indepFactorDefine.grid.entity.formula') }, |
||||
|
{ name: 'delayFactorDefine', label: $t('engine.st.indepFactorDefine.grid.entity.delayFactorDefine') }, |
||||
|
{ name: 'delayIssue', label: $t('engine.st.indepFactorDefine.grid.entity.delayIssue') }, |
||||
|
{ name: 'differentialFactorDefine', label: $t('engine.st.indepFactorDefine.grid.entity.differentialFactorDefine') }, |
||||
|
{ name: 'differentialDegree', label: $t('engine.st.indepFactorDefine.grid.entity.differentialDegree') }, |
||||
|
|
||||
|
{ 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') }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
@after-editor-open=" |
||||
|
(selected) => { |
||||
|
if (selected?.type === 'EXTEND_DELAY' || selected?.type === 'EXTEND_DIFFERENTIAL') { |
||||
|
findAllWithoutById(selected.id); |
||||
|
} |
||||
|
} |
||||
|
" |
||||
|
></w-grid> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue'; |
||||
|
import { Environment, Formater, Options, EnumTools, axios } from 'platform-core'; |
||||
|
|
||||
|
const treeGridRef = ref(); |
||||
|
const factorDefineOptionsRef = ref([]); |
||||
|
const Enums = await EnumTools.fetch(['io.sc.engine.st.enums.FactorDefineType', 'io.sc.engine.st.enums.Period', 'io.sc.engine.st.enums.ValueType']); |
||||
|
const findAllWithoutById = (id) => { |
||||
|
axios.get(Environment.apiContextPath('/api/st/indepFactorDefine/findAllWithoutById?defineId=' + (id ? id : ''))).then((response) => { |
||||
|
const defines = response?.data; |
||||
|
if (defines) { |
||||
|
const options = []; |
||||
|
for (const define of defines) { |
||||
|
if (define.type !== 'FOLDER') { |
||||
|
options.push({ value: define.id, label: define.name }); |
||||
|
} |
||||
|
} |
||||
|
console.log(factorDefineOptionsRef.value); |
||||
|
factorDefineOptionsRef.value = options; |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
</script> |
@ -1,211 +0,0 @@ |
|||||
<template> |
|
||||
<q-splitter :model-value="40" class="w-full" style="height: 100%"> |
|
||||
<template #before> |
|
||||
<div class="pr-1" style="height: 100%"> |
|
||||
<w-grid |
|
||||
ref="targetGridRef" |
|
||||
:title="$t('engine.st.target.grid.title')" |
|
||||
:config-button="true" |
|
||||
selection="multiple" |
|
||||
:checkbox-selection="true" |
|
||||
:data-url="Environment.apiContextPath('/api/st/target')" |
|
||||
:pageable="false" |
|
||||
:toolbar-configure="{ noIcon: false }" |
|
||||
:toolbar-actions="['refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|
||||
:columns="[ |
|
||||
{ name: 'code', label: $t('code') }, |
|
||||
{ name: 'name', label: $t('name') }, |
|
||||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|
||||
{ width: 110, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|
||||
]" |
|
||||
:editor="{ |
|
||||
dialog: { |
|
||||
width: '600px', |
|
||||
}, |
|
||||
form: { |
|
||||
colsNum: 1, |
|
||||
fields: [ |
|
||||
{ name: 'code', label: $t('code'), type: 'text', required: true }, |
|
||||
{ name: 'name', label: $t('name'), type: 'text', required: true }, |
|
||||
{ name: 'description', label: $t('description'), type: 'text' }, |
|
||||
], |
|
||||
}, |
|
||||
}" |
|
||||
: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: 'dataComeFrom', label: $t('dataComeFrom'), format: Formater.none() }, |
|
||||
{ name: 'creator', label: $t('creator') }, |
|
||||
{ name: 'createDate', label: $t('createDate') }, |
|
||||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|
||||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|
||||
], |
|
||||
}, |
|
||||
}" |
|
||||
@row-click=" |
|
||||
(evt, row, index) => { |
|
||||
currentSelectedTarget = row.id; |
|
||||
targetIndicatorGridRef?.refresh(); |
|
||||
} |
|
||||
" |
|
||||
@before-request-data=" |
|
||||
() => { |
|
||||
currentSelectedTarget = ''; |
|
||||
targetIndicatorGridRef?.refresh(); |
|
||||
} |
|
||||
" |
|
||||
></w-grid> |
|
||||
</div> |
|
||||
</template> |
|
||||
<template #after> |
|
||||
<div class="pl-1" style="height: 100%"> |
|
||||
<w-grid |
|
||||
ref="targetIndicatorGridRef" |
|
||||
:title="$t('engine.st.targetIndicator.grid.title')" |
|
||||
:checkbox-selection="true" |
|
||||
:fetch-data-url="Environment.apiContextPath('/api/st/targetIndicator?target=' + currentSelectedTarget)" |
|
||||
:data-url="Environment.apiContextPath('/api/st/targetIndicator')" |
|
||||
:pageable="false" |
|
||||
:sort-by="['year', 'month', 'quarter']" |
|
||||
:query-form-cols-num="4" |
|
||||
:query-form-fields="[ |
|
||||
{ |
|
||||
name: 'periodType', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.periodType'), |
|
||||
type: 'select', |
|
||||
options: Options.enum(StatisticalPeriodTypeEnums), |
|
||||
queryOperator: 'equals', |
|
||||
}, |
|
||||
]" |
|
||||
:toolbar-actions="['query', 'separator', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|
||||
:columns="[ |
|
||||
{ name: 'periodType', label: $t('engine.st.targetIndicator.grid.entity.periodType'), format: Formater.enum(StatisticalPeriodTypeEnums) }, |
|
||||
{ name: 'year', label: $t('year') }, |
|
||||
{ name: 'month', label: $t('month') }, |
|
||||
{ name: 'quarter', label: $t('quarter') }, |
|
||||
{ |
|
||||
name: 'pd', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.PD'), |
|
||||
title: $t('engine.st.targetIndicator.grid.entity.PD.title'), |
|
||||
align: 'right', |
|
||||
format: Formater.percent(), |
|
||||
}, |
|
||||
{ |
|
||||
name: 'lgd', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.LGD'), |
|
||||
title: $t('engine.st.targetIndicator.grid.entity.LGD.title'), |
|
||||
align: 'right', |
|
||||
format: Formater.percent(), |
|
||||
}, |
|
||||
{ |
|
||||
name: 'ccf', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.CCF'), |
|
||||
title: $t('engine.st.targetIndicator.grid.entity.CCF.title'), |
|
||||
align: 'right', |
|
||||
format: Formater.percent(), |
|
||||
}, |
|
||||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|
||||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|
||||
]" |
|
||||
:editor="{ |
|
||||
dialog: { |
|
||||
width: '600px', |
|
||||
}, |
|
||||
form: { |
|
||||
colsNum: 1, |
|
||||
fields: [ |
|
||||
{ |
|
||||
name: 'target', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.target'), |
|
||||
type: 'text', |
|
||||
defaultValue: currentSelectedTarget, |
|
||||
hidden: true, |
|
||||
}, |
|
||||
{ |
|
||||
name: 'periodType', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.periodType'), |
|
||||
type: 'select', |
|
||||
options: Options.enum(StatisticalPeriodTypeEnums), |
|
||||
}, |
|
||||
{ |
|
||||
name: 'year', |
|
||||
label: $t('year'), |
|
||||
type: 'select', |
|
||||
options: yearOptionsRef, |
|
||||
showIf: (arg) => { |
|
||||
return arg.form.getFieldValue('periodType') === 'YEAR'; |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
name: 'month', |
|
||||
label: $t('month'), |
|
||||
type: 'select', |
|
||||
options: monthOptionsRef, |
|
||||
showIf: (arg) => { |
|
||||
return arg.form.getFieldValue('periodType') === 'MONTH'; |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
name: 'quarter', |
|
||||
label: $t('quarter'), |
|
||||
type: 'select', |
|
||||
options: quarterOptionsRef, |
|
||||
showIf: (arg) => { |
|
||||
return arg.form.getFieldValue('periodType') === 'QUARTER'; |
|
||||
}, |
|
||||
}, |
|
||||
{ name: 'pd', label: $t('engine.st.targetIndicator.grid.entity.PD'), type: 'number', precision: 6 }, |
|
||||
{ name: 'lgd', label: $t('engine.st.targetIndicator.grid.entity.LGD'), type: 'number', precision: 6 }, |
|
||||
{ name: 'ccf', label: $t('engine.st.targetIndicator.grid.entity.CCF'), type: 'number', precision: 6 }, |
|
||||
], |
|
||||
}, |
|
||||
}" |
|
||||
:viewer="{ |
|
||||
panel: { |
|
||||
columnNum: 1, |
|
||||
fields: [ |
|
||||
{ name: 'id', label: $t('id') }, |
|
||||
{ name: 'target', label: $t('engine.st.targetIndicator.grid.entity.target') }, |
|
||||
{ name: 'periodType', label: $t('engine.st.targetIndicator.grid.entity.periodType') }, |
|
||||
{ name: 'year', label: $t('year') }, |
|
||||
{ name: 'month', label: $t('month') }, |
|
||||
{ name: 'pd', label: $t('engine.st.targetIndicator.grid.entity.PD') }, |
|
||||
{ name: 'lgd', label: $t('engine.st.targetIndicator.grid.entity.LGD') }, |
|
||||
{ name: 'ccf', label: $t('engine.st.targetIndicator.grid.entity.CCF') }, |
|
||||
{ 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> |
|
||||
</div> |
|
||||
</template> |
|
||||
</q-splitter> |
|
||||
</template> |
|
||||
<script setup lang="ts"> |
|
||||
import { ref } from 'vue'; |
|
||||
import { axios, Environment, Formater, Options, EnumTools } from 'platform-core'; |
|
||||
|
|
||||
const targetGridRef = ref(); |
|
||||
const targetIndicatorGridRef = ref(); |
|
||||
const userGridRef = ref(); |
|
||||
const currentSelectedTarget = ref(''); |
|
||||
|
|
||||
const years = []; |
|
||||
for (let i = 0; i < 30; i++) { |
|
||||
years.push(new Date().getFullYear() - i); |
|
||||
} |
|
||||
const yearOptionsRef = ref(years); |
|
||||
const monthOptionsRef = ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); |
|
||||
const quarterOptionsRef = ref([1, 2, 3, 4]); |
|
||||
const StatisticalPeriodTypeEnums = await EnumTools.fetch('io.sc.engine.st.enums.StatisticalPeriodType'); |
|
||||
</script> |
|
@ -1,211 +0,0 @@ |
|||||
<template> |
|
||||
<q-splitter :model-value="40" class="w-full" style="height: 100%"> |
|
||||
<template #before> |
|
||||
<div class="pr-1" style="height: 100%"> |
|
||||
<w-grid |
|
||||
ref="testCaseGridRef" |
|
||||
:title="$t('engine.st.testCase.grid.title')" |
|
||||
:config-button="true" |
|
||||
selection="multiple" |
|
||||
:checkbox-selection="true" |
|
||||
:data-url="Environment.apiContextPath('/api/st/testCase')" |
|
||||
:pageable="false" |
|
||||
:toolbar-configure="{ noIcon: false }" |
|
||||
:toolbar-actions="['refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|
||||
:columns="[ |
|
||||
{ name: 'code', label: $t('code') }, |
|
||||
{ name: 'name', label: $t('name') }, |
|
||||
{ width: 100, name: 'lastModifier', label: $t('lastModifier') }, |
|
||||
{ width: 110, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|
||||
]" |
|
||||
:editor="{ |
|
||||
dialog: { |
|
||||
width: '600px', |
|
||||
}, |
|
||||
form: { |
|
||||
colsNum: 1, |
|
||||
fields: [ |
|
||||
{ name: 'code', label: $t('code'), type: 'text', required: true }, |
|
||||
{ name: 'name', label: $t('name'), type: 'text', required: true }, |
|
||||
{ name: 'description', label: $t('description'), type: 'text' }, |
|
||||
], |
|
||||
}, |
|
||||
}" |
|
||||
: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: 'dataComeFrom', label: $t('dataComeFrom'), format: Formater.none() }, |
|
||||
{ name: 'creator', label: $t('creator') }, |
|
||||
{ name: 'createDate', label: $t('createDate') }, |
|
||||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|
||||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() }, |
|
||||
], |
|
||||
}, |
|
||||
}" |
|
||||
@row-click=" |
|
||||
(evt, row, index) => { |
|
||||
currentSelectedTarget = row.id; |
|
||||
targetIndicatorGridRef?.refresh(); |
|
||||
} |
|
||||
" |
|
||||
@before-request-data=" |
|
||||
() => { |
|
||||
currentSelectedTarget = ''; |
|
||||
targetIndicatorGridRef?.refresh(); |
|
||||
} |
|
||||
" |
|
||||
></w-grid> |
|
||||
</div> |
|
||||
</template> |
|
||||
<template #after> |
|
||||
<div class="pl-1" style="height: 100%"> |
|
||||
<w-grid |
|
||||
ref="targetIndicatorGridRef" |
|
||||
:title="$t('engine.st.targetIndicator.grid.title')" |
|
||||
:checkbox-selection="true" |
|
||||
:fetch-data-url="Environment.apiContextPath('/api/st/targetIndicator?target=' + currentSelectedTarget)" |
|
||||
:data-url="Environment.apiContextPath('/api/st/targetIndicator')" |
|
||||
:pageable="false" |
|
||||
:sort-by="['year', 'month', 'quarter']" |
|
||||
:query-form-cols-num="4" |
|
||||
:query-form-fields="[ |
|
||||
{ |
|
||||
name: 'periodType', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.periodType'), |
|
||||
type: 'select', |
|
||||
options: Options.enum(StatisticalPeriodTypeEnums), |
|
||||
queryOperator: 'equals', |
|
||||
}, |
|
||||
]" |
|
||||
:toolbar-actions="['query', 'separator', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']" |
|
||||
:columns="[ |
|
||||
{ name: 'periodType', label: $t('engine.st.targetIndicator.grid.entity.periodType'), format: Formater.enum(StatisticalPeriodTypeEnums) }, |
|
||||
{ name: 'year', label: $t('year') }, |
|
||||
{ name: 'month', label: $t('month') }, |
|
||||
{ name: 'quarter', label: $t('quarter') }, |
|
||||
{ |
|
||||
name: 'pd', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.PD'), |
|
||||
title: $t('engine.st.targetIndicator.grid.entity.PD.title'), |
|
||||
align: 'right', |
|
||||
format: Formater.percent(), |
|
||||
}, |
|
||||
{ |
|
||||
name: 'lgd', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.LGD'), |
|
||||
title: $t('engine.st.targetIndicator.grid.entity.LGD.title'), |
|
||||
align: 'right', |
|
||||
format: Formater.percent(), |
|
||||
}, |
|
||||
{ |
|
||||
name: 'ccf', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.CCF'), |
|
||||
title: $t('engine.st.targetIndicator.grid.entity.CCF.title'), |
|
||||
align: 'right', |
|
||||
format: Formater.percent(), |
|
||||
}, |
|
||||
{ name: 'lastModifier', label: $t('lastModifier') }, |
|
||||
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() }, |
|
||||
]" |
|
||||
:editor="{ |
|
||||
dialog: { |
|
||||
width: '600px', |
|
||||
}, |
|
||||
form: { |
|
||||
colsNum: 1, |
|
||||
fields: [ |
|
||||
{ |
|
||||
name: 'target', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.target'), |
|
||||
type: 'text', |
|
||||
defaultValue: currentSelectedTarget, |
|
||||
hidden: true, |
|
||||
}, |
|
||||
{ |
|
||||
name: 'periodType', |
|
||||
label: $t('engine.st.targetIndicator.grid.entity.periodType'), |
|
||||
type: 'select', |
|
||||
options: Options.enum(StatisticalPeriodTypeEnums), |
|
||||
}, |
|
||||
{ |
|
||||
name: 'year', |
|
||||
label: $t('year'), |
|
||||
type: 'select', |
|
||||
options: yearOptionsRef, |
|
||||
showIf: (arg) => { |
|
||||
return arg.form.getFieldValue('periodType') === 'YEAR'; |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
name: 'month', |
|
||||
label: $t('month'), |
|
||||
type: 'select', |
|
||||
options: monthOptionsRef, |
|
||||
showIf: (arg) => { |
|
||||
return arg.form.getFieldValue('periodType') === 'MONTH'; |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
name: 'quarter', |
|
||||
label: $t('quarter'), |
|
||||
type: 'select', |
|
||||
options: quarterOptionsRef, |
|
||||
showIf: (arg) => { |
|
||||
return arg.form.getFieldValue('periodType') === 'QUARTER'; |
|
||||
}, |
|
||||
}, |
|
||||
{ name: 'pd', label: $t('engine.st.targetIndicator.grid.entity.PD'), type: 'number', precision: 6 }, |
|
||||
{ name: 'lgd', label: $t('engine.st.targetIndicator.grid.entity.LGD'), type: 'number', precision: 6 }, |
|
||||
{ name: 'ccf', label: $t('engine.st.targetIndicator.grid.entity.CCF'), type: 'number', precision: 6 }, |
|
||||
], |
|
||||
}, |
|
||||
}" |
|
||||
:viewer="{ |
|
||||
panel: { |
|
||||
columnNum: 1, |
|
||||
fields: [ |
|
||||
{ name: 'id', label: $t('id') }, |
|
||||
{ name: 'target', label: $t('engine.st.targetIndicator.grid.entity.target') }, |
|
||||
{ name: 'periodType', label: $t('engine.st.targetIndicator.grid.entity.periodType') }, |
|
||||
{ name: 'year', label: $t('year') }, |
|
||||
{ name: 'month', label: $t('month') }, |
|
||||
{ name: 'pd', label: $t('engine.st.targetIndicator.grid.entity.PD') }, |
|
||||
{ name: 'lgd', label: $t('engine.st.targetIndicator.grid.entity.LGD') }, |
|
||||
{ name: 'ccf', label: $t('engine.st.targetIndicator.grid.entity.CCF') }, |
|
||||
{ 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> |
|
||||
</div> |
|
||||
</template> |
|
||||
</q-splitter> |
|
||||
</template> |
|
||||
<script setup lang="ts"> |
|
||||
import { ref } from 'vue'; |
|
||||
import { axios, Environment, Formater, Options, EnumTools } from 'platform-core'; |
|
||||
|
|
||||
const testCaseGridRef = ref(); |
|
||||
const targetIndicatorGridRef = ref(); |
|
||||
const userGridRef = ref(); |
|
||||
const currentSelectedTarget = ref(''); |
|
||||
|
|
||||
const years = []; |
|
||||
for (let i = 0; i < 30; i++) { |
|
||||
years.push(new Date().getFullYear() - i); |
|
||||
} |
|
||||
const yearOptionsRef = ref(years); |
|
||||
const monthOptionsRef = ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); |
|
||||
const quarterOptionsRef = ref([1, 2, 3, 4]); |
|
||||
const StatisticalPeriodTypeEnums = await EnumTools.fetch('io.sc.engine.st.enums.StatisticalPeriodType'); |
|
||||
</script> |
|
@ -0,0 +1,103 @@ |
|||||
|
<template> |
||||
|
<w-grid |
||||
|
ref="gridRef" |
||||
|
:title="$t('engine.st.testCase.grid.title')" |
||||
|
dense |
||||
|
:checkbox-selection="true" |
||||
|
:tree="false" |
||||
|
:data-url="Environment.apiContextPath('/api/st/testCase')" |
||||
|
:pageable="false" |
||||
|
:sort-by="['lastModifyDate']" |
||||
|
:toolbar-actions="[ |
||||
|
'refresh', |
||||
|
'separator', |
||||
|
'add', |
||||
|
'clone', |
||||
|
'edit', |
||||
|
'remove', |
||||
|
'separator', |
||||
|
{ |
||||
|
name: 'test', |
||||
|
label: $t('test'), |
||||
|
icon: 'bi-caret-right', |
||||
|
enableIf: (arg) => { |
||||
|
return arg.selected; |
||||
|
}, |
||||
|
click: (arg) => { |
||||
|
if (arg.selected) { |
||||
|
axios.post(Environment.apiContextPath('/api/st/testCase/test?testCaseId=' + arg.selected.id)).then(() => { |
||||
|
NotifyManager.success(); |
||||
|
emit('afterTest'); |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
'view', |
||||
|
'separator', |
||||
|
'export', |
||||
|
]" |
||||
|
:columns="[ |
||||
|
{ width: 160, name: 'name', label: $t('name') }, |
||||
|
{ |
||||
|
width: 150, |
||||
|
name: 'model', |
||||
|
label: $t('engine.st.testCase.grid.entity.model'), |
||||
|
format: (value, row) => { |
||||
|
return modelMap[value]; |
||||
|
}, |
||||
|
}, |
||||
|
]" |
||||
|
:editor="{ |
||||
|
dialog: { |
||||
|
width: '500px', |
||||
|
}, |
||||
|
form: { |
||||
|
colsNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'name', label: $t('name'), type: 'text', required: true }, |
||||
|
{ name: 'model', label: $t('engine.st.testCase.grid.entity.model'), type: 'select', options: modelOptionsRef, required: true }, |
||||
|
], |
||||
|
}, |
||||
|
}" |
||||
|
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 1, |
||||
|
fields: [ |
||||
|
{ name: 'id', label: $t('id') }, |
||||
|
{ name: 'name', label: $t('name') }, |
||||
|
{ name: 'model', label: $t('model') }, |
||||
|
{ 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 } from 'vue'; |
||||
|
import { Environment, Formater, axios, NotifyManager } from 'platform-core'; |
||||
|
|
||||
|
const emit = defineEmits<{ |
||||
|
(e: 'afterTest'): void; |
||||
|
}>(); |
||||
|
|
||||
|
const gridRef = ref(); |
||||
|
const modelMap = {}; |
||||
|
const modelOptionsRef = ref([]); |
||||
|
|
||||
|
axios.get(Environment.apiContextPath('/api/st/model?pageable=false')).then((response) => { |
||||
|
const options = []; |
||||
|
for (const item of response.data.content) { |
||||
|
modelMap[item.id] = item.name; |
||||
|
options.push({ |
||||
|
value: item.id, |
||||
|
label: item.name, |
||||
|
}); |
||||
|
} |
||||
|
modelOptionsRef.value = options; |
||||
|
}); |
||||
|
</script> |
@ -1,15 +0,0 @@ |
|||||
package io.sc.engine.st.controller; |
|
||||
|
|
||||
import io.sc.engine.st.jpa.entity.TargetIndicatorEntity; |
|
||||
import io.sc.engine.st.jpa.repository.TargetIndicatorRepository; |
|
||||
import io.sc.engine.st.service.TargetIndicatorService; |
|
||||
import io.sc.engine.st.vo.TargetIndicatorVo; |
|
||||
import io.sc.platform.mvc.controller.support.RestCrudController; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
|
|
||||
@RestController("io.sc.engine.st.controller.TargetIndicatorWebController") |
|
||||
@RequestMapping("/api/st/targetIndicator") |
|
||||
public class TargetIndicatorWebController extends RestCrudController<TargetIndicatorVo, TargetIndicatorEntity,String, TargetIndicatorRepository, TargetIndicatorService> { |
|
||||
|
|
||||
} |
|
@ -1,15 +0,0 @@ |
|||||
package io.sc.engine.st.controller; |
|
||||
|
|
||||
import io.sc.engine.st.jpa.entity.TargetEntity; |
|
||||
import io.sc.engine.st.jpa.repository.TargetRepository; |
|
||||
import io.sc.engine.st.service.TargetService; |
|
||||
import io.sc.engine.st.vo.TargetVo; |
|
||||
import io.sc.platform.mvc.controller.support.RestCrudController; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
|
|
||||
@RestController("io.sc.engine.st.controller.TargetWebController") |
|
||||
@RequestMapping("/api/st/target") |
|
||||
public class TargetWebController extends RestCrudController<TargetVo, TargetEntity,String, TargetRepository, TargetService> { |
|
||||
|
|
||||
} |
|
@ -1,11 +0,0 @@ |
|||||
package io.sc.engine.st.enums; |
|
||||
|
|
||||
/** |
|
||||
* 周期枚举 |
|
||||
*/ |
|
||||
public enum PeriodType { |
|
||||
YEAR, //年
|
|
||||
QUARTER, //季度
|
|
||||
MONTH, //月
|
|
||||
DAY; //日
|
|
||||
} |
|
@ -1,10 +0,0 @@ |
|||||
package io.sc.engine.st.enums; |
|
||||
|
|
||||
/** |
|
||||
* 统计周期类型枚举 |
|
||||
*/ |
|
||||
public enum StatisticalPeriodType { |
|
||||
YEAR, //年
|
|
||||
QUARTER, //季度
|
|
||||
MONTH; //月
|
|
||||
} |
|
@ -1,118 +0,0 @@ |
|||||
package io.sc.engine.st.jpa.entity; |
|
||||
|
|
||||
import io.sc.engine.st.enums.PeriodType; |
|
||||
import io.sc.engine.st.enums.ValueType; |
|
||||
import io.sc.engine.st.vo.FactorTypeVo; |
|
||||
import io.sc.engine.st.vo.FactorVo; |
|
||||
import io.sc.platform.orm.entity.CorporationAuditorEntity; |
|
||||
import org.hibernate.annotations.GenericGenerator; |
|
||||
|
|
||||
import javax.persistence.*; |
|
||||
import javax.validation.constraints.NotBlank; |
|
||||
import javax.validation.constraints.Size; |
|
||||
|
|
||||
@Entity(name="io.sc.engine.st.jpa.entity.FactorEntity") |
|
||||
@Table(name="ST_FACTOR") |
|
||||
public class FactorEntity extends CorporationAuditorEntity<FactorVo> { |
|
||||
@Id |
|
||||
@GeneratedValue(generator = "system-uuid") |
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid2") |
|
||||
@Column(name="ID_", length=36) |
|
||||
@Size(max=36) |
|
||||
protected String id; |
|
||||
|
|
||||
@Column(name="YEAR_") |
|
||||
protected Integer year; |
|
||||
|
|
||||
@Column(name="QUARTER_") |
|
||||
protected Integer quarter; |
|
||||
|
|
||||
@Column(name="MONTH_") |
|
||||
protected Integer month; |
|
||||
|
|
||||
@Column(name="DAY_") |
|
||||
protected Integer day; |
|
||||
|
|
||||
@Column(name="VALUE_", length=255) |
|
||||
@Size(max=255) |
|
||||
protected String value; |
|
||||
|
|
||||
@ManyToOne(fetch=FetchType.LAZY) |
|
||||
@JoinColumn(name="FACTOR_TYPE_ID_") |
|
||||
protected FactorTypeEntity factorType; |
|
||||
|
|
||||
@Override |
|
||||
public FactorVo toVo() { |
|
||||
FactorVo vo =new FactorVo(); |
|
||||
super.toVo(vo); |
|
||||
vo.setId(this.getId()); |
|
||||
vo.setYear(this.getYear()); |
|
||||
vo.setQuarter(this.getQuarter()); |
|
||||
vo.setMonth(this.getMonth()); |
|
||||
vo.setDay(this.getDay()); |
|
||||
vo.setValue(this.getValue()); |
|
||||
vo.setFactorType(this.getFactorType()==null?null:this.getFactorType().getId()); |
|
||||
return vo; |
|
||||
} |
|
||||
|
|
||||
public FactorEntity(){} |
|
||||
public FactorEntity(String id){ |
|
||||
this.id =id; |
|
||||
} |
|
||||
|
|
||||
public String getId() { |
|
||||
return id; |
|
||||
} |
|
||||
|
|
||||
public void setId(String id) { |
|
||||
this.id = id; |
|
||||
} |
|
||||
|
|
||||
public Integer getYear() { |
|
||||
return year; |
|
||||
} |
|
||||
|
|
||||
public void setYear(Integer year) { |
|
||||
this.year = year; |
|
||||
} |
|
||||
|
|
||||
public Integer getQuarter() { |
|
||||
return quarter; |
|
||||
} |
|
||||
|
|
||||
public void setQuarter(Integer quarter) { |
|
||||
this.quarter = quarter; |
|
||||
} |
|
||||
|
|
||||
public Integer getMonth() { |
|
||||
return month; |
|
||||
} |
|
||||
|
|
||||
public void setMonth(Integer month) { |
|
||||
this.month = month; |
|
||||
} |
|
||||
|
|
||||
public Integer getDay() { |
|
||||
return day; |
|
||||
} |
|
||||
|
|
||||
public void setDay(Integer day) { |
|
||||
this.day = day; |
|
||||
} |
|
||||
|
|
||||
public String getValue() { |
|
||||
return value; |
|
||||
} |
|
||||
|
|
||||
public void setValue(String value) { |
|
||||
this.value = value; |
|
||||
} |
|
||||
|
|
||||
public FactorTypeEntity getFactorType() { |
|
||||
return factorType; |
|
||||
} |
|
||||
|
|
||||
public void setFactorType(FactorTypeEntity factorType) { |
|
||||
this.factorType = factorType; |
|
||||
} |
|
||||
} |
|
@ -1,82 +0,0 @@ |
|||||
package io.sc.engine.st.jpa.entity; |
|
||||
|
|
||||
import io.sc.engine.st.vo.TargetVo; |
|
||||
import io.sc.platform.orm.entity.CorporationAuditorEntity; |
|
||||
import org.hibernate.annotations.GenericGenerator; |
|
||||
|
|
||||
import javax.persistence.*; |
|
||||
import javax.validation.constraints.NotBlank; |
|
||||
import javax.validation.constraints.Size; |
|
||||
|
|
||||
@Entity(name="io.sc.engine.st.jpa.entity.TargetEntity") |
|
||||
@Table(name="ST_TARGET") |
|
||||
public class TargetEntity extends CorporationAuditorEntity<TargetVo> { |
|
||||
@Id |
|
||||
@GeneratedValue(generator = "system-uuid") |
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid2") |
|
||||
@Column(name="ID_", length=36) |
|
||||
@Size(max=36) |
|
||||
protected String id; |
|
||||
|
|
||||
@Column(name="CODE_", length=255) |
|
||||
@NotBlank |
|
||||
@Size(max=255) |
|
||||
protected String code; |
|
||||
|
|
||||
@Column(name="NAME_", length=255) |
|
||||
@NotBlank |
|
||||
@Size(max=255) |
|
||||
protected String name; |
|
||||
|
|
||||
@Column(name="DESCRIPTION_", length=255) |
|
||||
@Size(max=255) |
|
||||
protected String description; |
|
||||
@Override |
|
||||
public TargetVo toVo() { |
|
||||
TargetVo vo =new TargetVo(); |
|
||||
super.toVo(vo); |
|
||||
vo.setId(this.getId()); |
|
||||
vo.setCode(this.getCode()); |
|
||||
vo.setName(this.getName()); |
|
||||
vo.setDescription(this.getDescription()); |
|
||||
return vo; |
|
||||
} |
|
||||
|
|
||||
public TargetEntity(){} |
|
||||
|
|
||||
public TargetEntity(String id) { |
|
||||
this.id = id; |
|
||||
} |
|
||||
|
|
||||
public String getId() { |
|
||||
return id; |
|
||||
} |
|
||||
|
|
||||
public void setId(String id) { |
|
||||
this.id = id; |
|
||||
} |
|
||||
|
|
||||
public String getCode() { |
|
||||
return code; |
|
||||
} |
|
||||
|
|
||||
public void setCode(String code) { |
|
||||
this.code = code; |
|
||||
} |
|
||||
|
|
||||
public String getName() { |
|
||||
return name; |
|
||||
} |
|
||||
|
|
||||
public void setName(String name) { |
|
||||
this.name = name; |
|
||||
} |
|
||||
|
|
||||
public String getDescription() { |
|
||||
return description; |
|
||||
} |
|
||||
|
|
||||
public void setDescription(String description) { |
|
||||
this.description = description; |
|
||||
} |
|
||||
} |
|
@ -1,135 +0,0 @@ |
|||||
package io.sc.engine.st.jpa.entity; |
|
||||
|
|
||||
import io.sc.engine.st.enums.StatisticalPeriodType; |
|
||||
import io.sc.engine.st.vo.TargetIndicatorVo; |
|
||||
import io.sc.platform.orm.entity.CorporationAuditorEntity; |
|
||||
import org.hibernate.annotations.GenericGenerator; |
|
||||
|
|
||||
import javax.persistence.*; |
|
||||
import javax.validation.constraints.NotBlank; |
|
||||
import javax.validation.constraints.Size; |
|
||||
|
|
||||
@Entity(name="io.sc.engine.st.jpa.entity.TargetIndicatorEntity") |
|
||||
@Table(name="ST_TARGET_INDICATOR") |
|
||||
public class TargetIndicatorEntity extends CorporationAuditorEntity<TargetIndicatorVo> { |
|
||||
@Id |
|
||||
@GeneratedValue(generator = "system-uuid") |
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid2") |
|
||||
@Column(name="ID_", length=36) |
|
||||
@Size(max=36) |
|
||||
protected String id; |
|
||||
|
|
||||
@Column(name="PERIOD_TYPE_") |
|
||||
@Enumerated(EnumType.STRING) |
|
||||
protected StatisticalPeriodType periodType; |
|
||||
|
|
||||
@Column(name="YEAR_") |
|
||||
protected Integer year; |
|
||||
|
|
||||
@Column(name="MONTH_") |
|
||||
protected Integer month; |
|
||||
|
|
||||
@Column(name="QUARTER_") |
|
||||
protected Integer quarter; |
|
||||
|
|
||||
@Column(name="PD_") |
|
||||
protected Double pd; |
|
||||
|
|
||||
@Column(name="LGD_") |
|
||||
protected Double lgd; |
|
||||
|
|
||||
@Column(name="CCF_") |
|
||||
protected Double ccf; |
|
||||
|
|
||||
@ManyToOne(fetch=FetchType.LAZY) |
|
||||
@JoinColumn(name="TARGET_ID_") |
|
||||
protected TargetEntity target; |
|
||||
|
|
||||
@Override |
|
||||
public TargetIndicatorVo toVo() { |
|
||||
TargetIndicatorVo vo =new TargetIndicatorVo(); |
|
||||
super.toVo(vo); |
|
||||
vo.setId(this.getId()); |
|
||||
vo.setPeriodType(this.getPeriodType()); |
|
||||
vo.setYear(this.getYear()); |
|
||||
vo.setMonth(this.getMonth()); |
|
||||
vo.setQuarter(this.getQuarter()); |
|
||||
vo.setPd(this.getPd()); |
|
||||
vo.setLgd(this.getLgd()); |
|
||||
vo.setCcf(this.getCcf()); |
|
||||
vo.setTarget(this.getTarget()==null?null:this.getTarget().getId()); |
|
||||
return vo; |
|
||||
} |
|
||||
|
|
||||
public String getId() { |
|
||||
return id; |
|
||||
} |
|
||||
|
|
||||
public void setId(String id) { |
|
||||
this.id = id; |
|
||||
} |
|
||||
|
|
||||
public StatisticalPeriodType getPeriodType() { |
|
||||
return periodType; |
|
||||
} |
|
||||
|
|
||||
public void setPeriodType(StatisticalPeriodType periodType) { |
|
||||
this.periodType = periodType; |
|
||||
} |
|
||||
|
|
||||
public Integer getYear() { |
|
||||
return year; |
|
||||
} |
|
||||
|
|
||||
public void setYear(Integer year) { |
|
||||
this.year = year; |
|
||||
} |
|
||||
|
|
||||
public Integer getMonth() { |
|
||||
return month; |
|
||||
} |
|
||||
|
|
||||
public void setMonth(Integer month) { |
|
||||
this.month = month; |
|
||||
} |
|
||||
|
|
||||
public Integer getQuarter() { |
|
||||
return quarter; |
|
||||
} |
|
||||
|
|
||||
public void setQuarter(Integer quarter) { |
|
||||
this.quarter = quarter; |
|
||||
} |
|
||||
|
|
||||
public Double getPd() { |
|
||||
return pd; |
|
||||
} |
|
||||
|
|
||||
public void setPd(Double pd) { |
|
||||
this.pd = pd; |
|
||||
} |
|
||||
|
|
||||
public Double getLgd() { |
|
||||
return lgd; |
|
||||
} |
|
||||
|
|
||||
public void setLgd(Double lgd) { |
|
||||
this.lgd = lgd; |
|
||||
} |
|
||||
|
|
||||
public Double getCcf() { |
|
||||
return ccf; |
|
||||
} |
|
||||
|
|
||||
public void setCcf(Double ccf) { |
|
||||
this.ccf = ccf; |
|
||||
} |
|
||||
|
|
||||
public TargetEntity getTarget() { |
|
||||
return target; |
|
||||
} |
|
||||
|
|
||||
public void setTarget(TargetEntity target) { |
|
||||
this.target = target; |
|
||||
} |
|
||||
} |
|
@ -1,10 +0,0 @@ |
|||||
package io.sc.engine.st.jpa.repository; |
|
||||
|
|
||||
import io.sc.engine.st.jpa.entity.TargetIndicatorEntity; |
|
||||
import io.sc.platform.orm.repository.DaoRepository; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
@Service("io.sc.engine.st.jpa.repository.TargetIndicatorRepository") |
|
||||
public interface TargetIndicatorRepository extends DaoRepository<TargetIndicatorEntity,String>{ |
|
||||
|
|
||||
} |
|
@ -1,10 +0,0 @@ |
|||||
package io.sc.engine.st.jpa.repository; |
|
||||
|
|
||||
import io.sc.engine.st.jpa.entity.TargetEntity; |
|
||||
import io.sc.platform.orm.repository.DaoRepository; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
@Service("io.sc.engine.st.jpa.repository.TargetRepository") |
|
||||
public interface TargetRepository extends DaoRepository<TargetEntity,String>{ |
|
||||
|
|
||||
} |
|
@ -1,8 +0,0 @@ |
|||||
package io.sc.engine.st.service; |
|
||||
|
|
||||
import io.sc.engine.st.jpa.entity.TargetIndicatorEntity; |
|
||||
import io.sc.engine.st.jpa.repository.TargetIndicatorRepository; |
|
||||
import io.sc.platform.orm.service.DaoService; |
|
||||
|
|
||||
public interface TargetIndicatorService extends DaoService<TargetIndicatorEntity, String, TargetIndicatorRepository>{ |
|
||||
} |
|
@ -1,8 +0,0 @@ |
|||||
package io.sc.engine.st.service; |
|
||||
|
|
||||
import io.sc.engine.st.jpa.entity.TargetEntity; |
|
||||
import io.sc.engine.st.jpa.repository.TargetRepository; |
|
||||
import io.sc.platform.orm.service.DaoService; |
|
||||
|
|
||||
public interface TargetService extends DaoService<TargetEntity, String, TargetRepository>{ |
|
||||
} |
|
@ -1,12 +0,0 @@ |
|||||
package io.sc.engine.st.service.impl; |
|
||||
|
|
||||
import io.sc.engine.st.jpa.entity.TargetIndicatorEntity; |
|
||||
import io.sc.engine.st.jpa.repository.TargetIndicatorRepository; |
|
||||
import io.sc.engine.st.service.TargetIndicatorService; |
|
||||
import io.sc.platform.orm.service.impl.DaoServiceImpl; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
@Service("io.sc.engine.st.service.impl.TargetIndicatorServiceImpl") |
|
||||
public class TargetIndicatorServiceImpl extends DaoServiceImpl<TargetIndicatorEntity, String, TargetIndicatorRepository> implements TargetIndicatorService { |
|
||||
|
|
||||
} |
|
@ -1,12 +0,0 @@ |
|||||
package io.sc.engine.st.service.impl; |
|
||||
|
|
||||
import io.sc.engine.st.jpa.entity.TargetEntity; |
|
||||
import io.sc.engine.st.jpa.repository.TargetRepository; |
|
||||
import io.sc.engine.st.service.TargetService; |
|
||||
import io.sc.platform.orm.service.impl.DaoServiceImpl; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
@Service("io.sc.engine.st.service.impl.TargetServiceImpl") |
|
||||
public class TargetServiceImpl extends DaoServiceImpl<TargetEntity, String, TargetRepository> implements TargetService { |
|
||||
|
|
||||
} |
|
@ -1,12 +1,126 @@ |
|||||
package io.sc.engine.st.service.impl; |
package io.sc.engine.st.service.impl; |
||||
|
|
||||
import io.sc.engine.st.jpa.entity.TestCaseEntity; |
import io.sc.engine.st.jpa.entity.*; |
||||
|
import io.sc.engine.st.jpa.entity.sub.DepArithmeticFactorDefineEntity; |
||||
import io.sc.engine.st.jpa.repository.TestCaseRepository; |
import io.sc.engine.st.jpa.repository.TestCaseRepository; |
||||
|
import io.sc.engine.st.service.ScenarioFactorService; |
||||
import io.sc.engine.st.service.TestCaseService; |
import io.sc.engine.st.service.TestCaseService; |
||||
|
import io.sc.engine.st.service.TestResultService; |
||||
|
import io.sc.engine.st.support.PeriodWrapper; |
||||
|
import io.sc.engine.st.vo.DepFactorDefineVo; |
||||
|
import io.sc.engine.st.vo.ScenarioFactorVo; |
||||
|
import io.sc.engine.st.vo.sub.DepArithmeticFactorDefineVo; |
||||
|
import io.sc.platform.core.util.StringUtil; |
||||
|
import io.sc.platform.groovy.GroovyScriptExecutor; |
||||
import io.sc.platform.orm.service.impl.DaoServiceImpl; |
import io.sc.platform.orm.service.impl.DaoServiceImpl; |
||||
|
import io.sc.platform.orm.util.EntityVoUtil; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.*; |
||||
|
|
||||
@Service("io.sc.engine.st.service.impl.TestCaseServiceImpl") |
@Service("io.sc.engine.st.service.impl.TestCaseServiceImpl") |
||||
public class TestCaseServiceImpl extends DaoServiceImpl<TestCaseEntity, String, TestCaseRepository> implements TestCaseService { |
public class TestCaseServiceImpl extends DaoServiceImpl<TestCaseEntity, String, TestCaseRepository> implements TestCaseService { |
||||
|
@Autowired private ScenarioFactorService scenarioFactorService; |
||||
|
@Autowired private TestResultService testResultService; |
||||
|
@Autowired private JdbcTemplate jdbcTemplate; |
||||
|
|
||||
|
@Override |
||||
|
public void test(String testCaseId) throws Exception { |
||||
|
if(StringUtils.hasText(testCaseId)){ |
||||
|
TestCaseEntity testCaseEntity =findById(testCaseId); |
||||
|
if(testCaseEntity!=null){ |
||||
|
ModelEntity modelEntity =testCaseEntity.getModel(); |
||||
|
if(modelEntity!=null) { |
||||
|
List<IndepFactorDefineEntity> factorDefineEntities = modelEntity.getIndepFactorDefines(); |
||||
|
DepFactorDefineVo depFactorDefineVo = modelEntity.getDepFactorDefine().toVo(); |
||||
|
if(factorDefineEntities!=null && !factorDefineEntities.isEmpty()){ |
||||
|
Map<PeriodWrapper,Map<String,Object>> lowRecords =new TreeMap<>(PeriodWrapper.comparator); |
||||
|
Map<PeriodWrapper,Map<String,Object>> midRecords =new TreeMap<>(PeriodWrapper.comparator); |
||||
|
Map<PeriodWrapper,Map<String,Object>> highRecords =new TreeMap<>(PeriodWrapper.comparator); |
||||
|
for(IndepFactorDefineEntity entity : factorDefineEntities){ |
||||
|
List<ScenarioFactorVo> vos =scenarioFactorService.findByFactorDefineId(entity.getId()); |
||||
|
if(vos!=null && !vos.isEmpty()){ |
||||
|
for(ScenarioFactorVo vo : vos){ |
||||
|
Map<String,Object> lowRecord =lowRecords.get(vo.calUniqueKey()); |
||||
|
if(lowRecord==null){ |
||||
|
lowRecord =new HashMap<>(); |
||||
|
lowRecords.put(vo.calUniqueKey(),lowRecord); |
||||
|
} |
||||
|
lowRecord.put(entity.getCode(),vo.getValueLow()); |
||||
|
|
||||
|
Map<String,Object> midRecord =midRecords.get(vo.calUniqueKey()); |
||||
|
if(midRecord==null){ |
||||
|
midRecord =new HashMap<>(); |
||||
|
midRecords.put(vo.calUniqueKey(),midRecord); |
||||
|
} |
||||
|
midRecord.put(entity.getCode(),vo.getValueMid()); |
||||
|
|
||||
|
Map<String,Object> highRecord =highRecords.get(vo.calUniqueKey()); |
||||
|
if(highRecord==null){ |
||||
|
highRecord =new HashMap<>(); |
||||
|
highRecords.put(vo.calUniqueKey(),highRecord); |
||||
|
} |
||||
|
highRecord.put(entity.getCode(),vo.getValueHigh()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
String groovyScript =modelEntity.getFormula(); |
||||
|
List<TestResultEntity> testResultEntities =new ArrayList<>(); |
||||
|
for(PeriodWrapper key : lowRecords.keySet()){ |
||||
|
Map<String,Object> lowRecord =lowRecords.get(key); |
||||
|
Map<String, Object> lowContext =new HashMap<>(); |
||||
|
for(String var : lowRecord.keySet()) { |
||||
|
lowContext.put(var,new BigDecimal(lowRecord.get(var).toString())); |
||||
|
} |
||||
|
|
||||
|
Map<String,Object> midRecord =midRecords.get(key); |
||||
|
Map<String, Object> midContext =new HashMap<>(); |
||||
|
for(String var : midRecord.keySet()) { |
||||
|
midContext.put(var,new BigDecimal(midRecord.get(var).toString())); |
||||
|
} |
||||
|
|
||||
|
Map<String,Object> highRecord =highRecords.get(key); |
||||
|
Map<String, Object> highContext =new HashMap<>(); |
||||
|
for(String var : highRecord.keySet()) { |
||||
|
highContext.put(var,new BigDecimal(highRecord.get(var).toString())); |
||||
|
} |
||||
|
Double lowValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(groovyScript,lowContext).toString()); |
||||
|
Double midValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(groovyScript,midContext).toString()); |
||||
|
Double highValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(groovyScript,highContext).toString()); |
||||
|
|
||||
|
if(depFactorDefineVo instanceof DepArithmeticFactorDefineVo){ |
||||
|
DepArithmeticFactorDefineVo vo =(DepArithmeticFactorDefineVo)depFactorDefineVo; |
||||
|
String reverseScript =vo.getReverseFormula(); |
||||
|
if(StringUtils.hasText(reverseScript)){ |
||||
|
lowValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(reverseScript,"X",lowValue).toString()); |
||||
|
midValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(reverseScript,"X",midValue).toString()); |
||||
|
highValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(reverseScript,"X",highValue).toString()); |
||||
|
} |
||||
|
} |
||||
|
lowValue =new BigDecimal(lowValue).setScale(6,BigDecimal.ROUND_HALF_UP).doubleValue(); |
||||
|
midValue =new BigDecimal(midValue).setScale(6,BigDecimal.ROUND_HALF_UP).doubleValue(); |
||||
|
highValue =new BigDecimal(highValue).setScale(6,BigDecimal.ROUND_HALF_UP).doubleValue(); |
||||
|
|
||||
|
TestResultEntity resultEntity =new TestResultEntity(); |
||||
|
resultEntity.setTestCase(testCaseEntity); |
||||
|
resultEntity.setYear(key.getYear()); |
||||
|
resultEntity.setQuarter(key.getQuarter()); |
||||
|
resultEntity.setMonth(key.getMonth()); |
||||
|
resultEntity.setValueLow(lowValue); |
||||
|
resultEntity.setValueMid(midValue); |
||||
|
resultEntity.setValueHigh(highValue); |
||||
|
testResultEntities.add(resultEntity); |
||||
|
} |
||||
|
jdbcTemplate.update("delete from ST_TEST_RESULT where TEST_CASE_ID_=?",testCaseId); |
||||
|
testResultService.getRepository().saveAll(testResultEntities); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
|
@ -1,88 +0,0 @@ |
|||||
package io.sc.engine.st.vo; |
|
||||
|
|
||||
import io.sc.engine.st.enums.StatisticalPeriodType; |
|
||||
import io.sc.platform.orm.api.vo.CorporationAuditorVo; |
|
||||
|
|
||||
public class TargetIndicatorVo extends CorporationAuditorVo { |
|
||||
protected String id; |
|
||||
protected StatisticalPeriodType periodType; |
|
||||
protected Integer year; |
|
||||
protected Integer month; |
|
||||
protected Integer quarter; |
|
||||
protected Double pd; |
|
||||
protected Double lgd; |
|
||||
protected Double ccf; |
|
||||
protected String target; |
|
||||
|
|
||||
public String getId() { |
|
||||
return id; |
|
||||
} |
|
||||
|
|
||||
public void setId(String id) { |
|
||||
this.id = id; |
|
||||
} |
|
||||
|
|
||||
public StatisticalPeriodType getPeriodType() { |
|
||||
return periodType; |
|
||||
} |
|
||||
|
|
||||
public void setPeriodType(StatisticalPeriodType periodType) { |
|
||||
this.periodType = periodType; |
|
||||
} |
|
||||
|
|
||||
public Integer getYear() { |
|
||||
return year; |
|
||||
} |
|
||||
|
|
||||
public void setYear(Integer year) { |
|
||||
this.year = year; |
|
||||
} |
|
||||
|
|
||||
public Integer getMonth() { |
|
||||
return month; |
|
||||
} |
|
||||
|
|
||||
public void setMonth(Integer month) { |
|
||||
this.month = month; |
|
||||
} |
|
||||
|
|
||||
public Integer getQuarter() { |
|
||||
return quarter; |
|
||||
} |
|
||||
|
|
||||
public void setQuarter(Integer quarter) { |
|
||||
this.quarter = quarter; |
|
||||
} |
|
||||
|
|
||||
public Double getPd() { |
|
||||
return pd; |
|
||||
} |
|
||||
|
|
||||
public void setPd(Double pd) { |
|
||||
this.pd = pd; |
|
||||
} |
|
||||
|
|
||||
public Double getLgd() { |
|
||||
return lgd; |
|
||||
} |
|
||||
|
|
||||
public void setLgd(Double lgd) { |
|
||||
this.lgd = lgd; |
|
||||
} |
|
||||
|
|
||||
public Double getCcf() { |
|
||||
return ccf; |
|
||||
} |
|
||||
|
|
||||
public void setCcf(Double ccf) { |
|
||||
this.ccf = ccf; |
|
||||
} |
|
||||
|
|
||||
public String getTarget() { |
|
||||
return target; |
|
||||
} |
|
||||
|
|
||||
public void setTarget(String target) { |
|
||||
this.target = target; |
|
||||
} |
|
||||
} |
|
@ -1,43 +0,0 @@ |
|||||
package io.sc.engine.st.vo; |
|
||||
|
|
||||
import io.sc.platform.orm.api.vo.CorporationAuditorVo; |
|
||||
|
|
||||
public class TargetVo extends CorporationAuditorVo { |
|
||||
protected String id; |
|
||||
protected String code; |
|
||||
protected String name; |
|
||||
protected String description; |
|
||||
|
|
||||
public String getId() { |
|
||||
return id; |
|
||||
} |
|
||||
|
|
||||
public void setId(String id) { |
|
||||
this.id = id; |
|
||||
} |
|
||||
|
|
||||
public String getCode() { |
|
||||
return code; |
|
||||
} |
|
||||
|
|
||||
public void setCode(String code) { |
|
||||
this.code = code; |
|
||||
} |
|
||||
|
|
||||
public String getName() { |
|
||||
return name; |
|
||||
} |
|
||||
|
|
||||
public void setName(String name) { |
|
||||
this.name = name; |
|
||||
} |
|
||||
|
|
||||
public String getDescription() { |
|
||||
return description; |
|
||||
} |
|
||||
|
|
||||
public void setDescription(String description) { |
|
||||
this.description = description; |
|
||||
} |
|
||||
|
|
||||
} |
|
|
|
@ -0,0 +1,8 @@ |
|||||
|
package io.sc.platform.core.service; |
||||
|
|
||||
|
import io.sc.platform.core.support.KeyValue; |
||||
|
import org.springframework.expression.Expression; |
||||
|
|
||||
|
public interface SpringExpressionParserService { |
||||
|
public <T> T eval(String expression, Class<T> clazz, KeyValue<String,Object>... keyValues); |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package io.sc.platform.core.service.impl; |
||||
|
|
||||
|
import io.sc.platform.core.service.SpringExpressionParserService; |
||||
|
import io.sc.platform.core.support.KeyValue; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.context.ApplicationContext; |
||||
|
import org.springframework.context.expression.BeanFactoryResolver; |
||||
|
import org.springframework.expression.Expression; |
||||
|
import org.springframework.expression.ExpressionParser; |
||||
|
import org.springframework.expression.spel.standard.SpelExpressionParser; |
||||
|
import org.springframework.expression.spel.support.StandardEvaluationContext; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class SpringExpressionParserServiceImpl implements SpringExpressionParserService { |
||||
|
@Autowired private ApplicationContext applicationContext; |
||||
|
|
||||
|
private ExpressionParser parser = new SpelExpressionParser(); |
||||
|
|
||||
|
@Override |
||||
|
public <T> T eval(String expression, Class<T> clazz, KeyValue<String,Object>... keyValues) { |
||||
|
Expression _expression =parser.parseExpression(expression); |
||||
|
if(_expression==null){ |
||||
|
return null; |
||||
|
} |
||||
|
StandardEvaluationContext context = new StandardEvaluationContext(); |
||||
|
if(applicationContext!=null) { |
||||
|
context.setBeanResolver(new BeanFactoryResolver(applicationContext)); |
||||
|
} |
||||
|
if(keyValues!=null && keyValues.length>0){ |
||||
|
for(KeyValue<String,Object> keyValue : keyValues){ |
||||
|
context.setVariable(keyValue.getKey(),keyValue.getValue()); |
||||
|
} |
||||
|
} |
||||
|
return _expression.getValue(context,clazz); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue