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.

210 lines
7.7 KiB

1 year ago
<template>
<w-grid
ref="gridRef"
:title="$t('re.resources.designer.testCaseParameter.grid.title')"
dense-body
class="px-1"
hide-bottom
:config-button="false"
selection="multiple"
:checkbox-selection="false"
:tree="false"
:tree-icon="
(row) => {
if (row.category === 'M') {
return { name: 'folder', color: 'amber' };
} else {
return { name: 'bi-p-circle' };
}
}
"
10 months ago
db-click-operation="edit"
1 year ago
:fetch-data-url="Environment.apiContextPath('/api/re/testCaseParameter/findByTestCase?testCaseId=' + testCase.id)"
:data-url="Environment.apiContextPath('/api/re/testCaseParameter')"
:pageable="false"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[
'refresh',
'separator',
{
extend: 'edit',
},
'separator',
{
name: 'execute',
label: $t('execute'),
icon: 'bi-caret-right',
click: () => {
10 months ago
axios.post(Environment.apiContextPath('/api/re/testCase/executeTestCase/' + testCase.id), {}, { loading: true }).then(() => {
1 year ago
gridRef?.refresh();
});
},
},
'separator',
'view',
'separator',
'export',
]"
:columns="[
{ width: 300, name: 'name', label: $t('name') },
10 months ago
{ width: 100, name: 'indicatorType', label: $t('type'), format: Formater.enum(Enums.IndicatorType) },
1 year ago
{
width: 100,
name: 'valueType',
label: $t('re.resources.designer.parameter.grid.entity.valueType'),
10 months ago
format: (value, row) => {
1 year ago
return ValueTypeMap[value];
10 months ago
// if (row.valueTypeVersion) {
// return ValueTypeMap[value] + ' (V' + row.valueTypeVersion + ')';
// }
// if (row.valueType == 'java.math.BigDecimal') {
// if (row.valueRoundingMode == 'HALF_UP') {
// return ValueTypeMap[value] + '(' + row.valueScale + ')';
// } else {
// return ValueTypeMap[value] + '(' + row.valueScale + ',' + Formater.enum(Enums.RoundingMode)(row.valueRoundingMode) + ')';
// }
// }
// var result = ValueTypeMap[value];
// result = result || row.valueType;
// if (result) {
// result = result.replace('<', '&lt;');
// result = result.replace('>', '&gt;');
// }
// return result;
1 year ago
},
},
{ width: 100, name: 'defaultValue', label: $t('defaultValue') },
{ width: 100, name: 'inputValue', label: $t('re.resources.designer.testCaseParameter.grid.entity.inputValue') },
{ width: 100, name: 'expectValue', label: $t('re.resources.designer.testCaseParameter.grid.entity.expectValue') },
{ width: 100, name: 'resultValue', label: $t('re.resources.designer.testCaseParameter.grid.entity.resultValue') },
{ width: 100, name: 'skipCheck', label: $t('re.resources.designer.testCaseParameter.grid.entity.skipCheck') },
{ width: 100, name: 'testResult', label: $t('re.resources.designer.testCaseParameter.grid.entity.testResult'), format: PassOrNotFormater },
]"
:editor="{
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
8 months ago
{ name: 'testCase', label: $t('testCase'), type: 'w-text', defaultValue: testCase.id, hidden: true },
{ name: 'id', label: $t('id'), type: 'w-text', hidden: true },
{ name: 'source', label: $t('source'), type: 'w-text', hidden: true },
{ name: 'parameterType', label: $t('parameterType'), type: 'w-text', hidden: true },
{ name: 'scoreCardVarType', label: $t('scoreCardVarType'), type: 'w-text', hidden: true },
{ name: 'indicatorType', label: $t('indicatorType'), type: 'w-text', hidden: true },
1 year ago
{
name: 'inputValue',
label: $t('re.resources.designer.testCaseParameter.grid.entity.inputValue'),
8 months ago
type: 'w-code-mirror',
1 year ago
rows: 4,
showIf: (arg) => {
const parameterType = arg.form.getFieldValue('parameterType');
const scoreCardVarType = arg.form.getFieldValue('scoreCardVarType');
const indicatorType = arg.form.getFieldValue('indicatorType');
if (
(!Tools.isUndefinedOrNull(parameterType) && (parameterType === 'IN' || parameterType === 'IN_OPTION' || parameterType === 'INDICATOR')) ||
(!Tools.isUndefinedOrNull(scoreCardVarType) && scoreCardVarType !== 'RESULT') ||
(!Tools.isUndefinedOrNull(indicatorType) && indicatorType === 'INTERFACE')
) {
return true;
}
return false;
},
},
{
name: 'expectValue',
label: $t('re.resources.designer.testCaseParameter.grid.entity.expectValue'),
8 months ago
type: 'w-code-mirror',
1 year ago
rows: 4,
showIf: (arg) => {
const parameterType = arg.form.getFieldValue('parameterType');
const scoreCardVarType = arg.form.getFieldValue('scoreCardVarType');
const indicatorType = arg.form.getFieldValue('indicatorType');
if (
(!Tools.isUndefinedOrNull(parameterType) &&
(parameterType === 'INTERMEDIATE' || parameterType === 'OUT' || parameterType === 'RULE_RESULT' || parameterType === 'SINGLE_RULE_RESULT')) ||
!Tools.isUndefinedOrNull(scoreCardVarType) ||
(!Tools.isUndefinedOrNull(indicatorType) && indicatorType === 'INDICATOR')
) {
return true;
}
return false;
},
},
{
name: 'resultValue',
label: $t('re.resources.designer.testCaseParameter.grid.entity.resultValue'),
8 months ago
type: 'w-code-mirror',
1 year ago
rows: 4,
lang: 'json',
},
8 months ago
{ name: 'skipCheck', label: $t('re.resources.designer.testCaseParameter.grid.entity.skipCheck'), type: 'w-checkbox' },
1 year ago
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ 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') },
],
},
}"
@row-click="
(evt, row, index) => {
emit('rowClick', evt, row, index);
}
"
@before-request-data="
() => {
emit('beforeRequestData');
}
"
></w-grid>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { axios, Environment, EnumTools, Formater, Options, Tools } from 'platform-core';
import PassOrNotFormater from '@/utils/PassOrNotFormater';
const props = defineProps({
testCase: { type: Object, default: undefined },
});
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,
});
10 months ago
const Enums = await EnumTools.fetch(['io.sc.engine.rule.core.enums.IndicatorType', 'io.sc.platform.core.enums.RoundingMode']);
1 year ago
let ValueTypeMap = {};
const response = await axios.get(Environment.apiContextPath('/api/re/dictionary/getAllDictionaryMap'));
if (response && response.data) {
ValueTypeMap = {};
for (const item of response.data) {
ValueTypeMap[item.key] = item.value;
}
}
</script>