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