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 baseInfoLoading = ref(false);
const priorityField = ref('');
const formRules = ref<FormItem[]>([]); const formRules = ref<FormItem[]>([]);
const formItem = ref<FormRuleItem[]>([]); const formItem = ref<FormRuleItem[]>([]);
const fApi = ref<Api>(); const fApi = ref<Api>();
@ -110,6 +112,7 @@
} }
} }
if (item.internal && item.type === 'SELECT') { if (item.internal && item.type === 'SELECT') {
priorityField.value = item.fieldId;
// TODO: // TODO:
return false; return false;
} }
@ -142,18 +145,27 @@
const saveLoading = ref(false); const saveLoading = ref(false);
function makeParams() { 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 { return {
...baseInfoForm.value, ...baseInfoForm.value,
moduleId: props.activeCase.moduleId || 'root', moduleId: props.activeCase.moduleId || 'root',
id: props.activeCase.id, id: props.activeCase.id,
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
caseEditType: props.activeCase.caseEditType || 'STEP', caseEditType: props.activeCase.caseEditType || 'STEP',
customFields: formItem.value.map((item: any) => { customFields,
return {
fieldId: item.field,
value: Array.isArray(item.value) ? JSON.stringify(item.value) : item.value,
};
}),
}; };
} }