fix(功能用例): 脑图用例详情保存用例等级失败问题

This commit is contained in:
guoyuqi 2024-06-26 21:20:38 +08:00 committed by 刘瑞斌
parent e5a1488710
commit 080e6767a4
1 changed files with 18 additions and 6 deletions

View File

@ -89,6 +89,8 @@
});
const baseInfoLoading = ref(false);
const priorityField = ref('');
const formRules = ref<FormItem[]>([]);
const formItem = ref<FormRuleItem[]>([]);
const fApi = ref<Api>();
@ -110,6 +112,7 @@
}
}
if (item.internal && item.type === 'SELECT') {
priorityField.value = item.fieldId;
// TODO:
return false;
}
@ -142,18 +145,27 @@
const saveLoading = ref(false);
function makeParams() {
const priority = formItem.value.find((item) => item.title === 'Case Priority' || item.title === '用例等级')?.field;
const selectedNode: MinderJsonNode = window.minder.getSelectedNode();
const customFields = formItem.value.map((item: any) => {
return {
fieldId: item.field,
value: Array.isArray(item.value) ? JSON.stringify(item.value) : item.value,
};
});
const selectedNodePriorityNumber = selectedNode?.data?.priority ? selectedNode?.data?.priority : 0;
const realPriorityNumber = selectedNodePriorityNumber > 0 ? selectedNodePriorityNumber - 1 : 0;
const priorityNumber = `P${realPriorityNumber}`;
if (!priority) {
customFields.push({ fieldId: priorityField.value, value: priorityNumber });
}
return {
...baseInfoForm.value,
moduleId: props.activeCase.moduleId || 'root',
id: props.activeCase.id,
projectId: appStore.currentProjectId,
caseEditType: props.activeCase.caseEditType || 'STEP',
customFields: formItem.value.map((item: any) => {
return {
fieldId: item.field,
value: Array.isArray(item.value) ? JSON.stringify(item.value) : item.value,
};
}),
customFields,
};
}