fix(脑图): 无自定义字段保存无响应修复

This commit is contained in:
baiqi 2024-06-26 16:28:28 +08:00 committed by 刘瑞斌
parent a8ad0300c9
commit 13a2249239
1 changed files with 52 additions and 46 deletions

View File

@ -17,7 +17,6 @@
</a-form-item> </a-form-item>
<MsFormCreate <MsFormCreate
v-if="formRules.length" v-if="formRules.length"
ref="formCreateRef"
v-model:api="fApi" v-model:api="fApi"
v-model:form-item="formItem" v-model:form-item="formItem"
:form-rule="formRules" :form-rule="formRules"
@ -158,11 +157,7 @@
}; };
} }
function handleSave() { async function realSave() {
baseInfoFormRef.value?.validate((errors) => {
if (!errors) {
fApi.value?.validate(async (valid) => {
if (valid === true) {
try { try {
saveLoading.value = true; saveLoading.value = true;
const params = makeParams(); const params = makeParams();
@ -182,9 +177,8 @@
}); });
} }
const selectedNode: MinderJsonNode = window.minder.getSelectedNode(); const selectedNode: MinderJsonNode = window.minder.getSelectedNode();
const priority = (formItem.value.find( const priority = (formItem.value.find((item) => item.title === 'Case Priority' || item.title === '用例等级')
(item) => item.title === 'Case Priority' || item.title === '用例等级' ?.value || 'P0') as string;
)?.value || 'P0') as string;
const priorityNumber = Number(priority.match(/\d+/)?.[0]) || 0; const priorityNumber = Number(priority.match(/\d+/)?.[0]) || 0;
if (selectedNode?.data) { if (selectedNode?.data) {
selectedNode.data = { selectedNode.data = {
@ -206,7 +200,19 @@
saveLoading.value = false; saveLoading.value = false;
} }
} }
function handleSave() {
baseInfoFormRef.value?.validate((errors) => {
if (!errors) {
if (formRules.value.length > 0) {
fApi.value?.validate(async (valid) => {
if (valid === true) {
realSave();
}
}); });
} else {
realSave();
}
} }
}); });
} }