fix(脑图): 无自定义字段保存无响应修复
This commit is contained in:
parent
a8ad0300c9
commit
13a2249239
|
@ -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,55 +157,62 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function realSave() {
|
||||||
|
try {
|
||||||
|
saveLoading.value = true;
|
||||||
|
const params = makeParams();
|
||||||
|
if (props.activeCase.isNew !== false) {
|
||||||
|
const res = await createCaseRequest({
|
||||||
|
request: params,
|
||||||
|
fileList: [],
|
||||||
|
});
|
||||||
|
const selectedNode: MinderJsonNode = window.minder.getSelectedNode();
|
||||||
|
if (selectedNode?.data) {
|
||||||
|
selectedNode.data.id = res.data.id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await updateCaseRequest({
|
||||||
|
request: params,
|
||||||
|
fileList: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const selectedNode: MinderJsonNode = window.minder.getSelectedNode();
|
||||||
|
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 = {
|
||||||
|
...selectedNode.data,
|
||||||
|
text: baseInfoForm.value.name,
|
||||||
|
priority: priorityNumber,
|
||||||
|
isNew: false,
|
||||||
|
};
|
||||||
|
window.minder.execCommand('priority', priorityNumber + 1);
|
||||||
|
setPriorityView(true, 'P');
|
||||||
|
selectedNode.data.changed = false;
|
||||||
|
}
|
||||||
|
Message.success(t('common.saveSuccess'));
|
||||||
|
emit('saved');
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error);
|
||||||
|
} finally {
|
||||||
|
saveLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleSave() {
|
function handleSave() {
|
||||||
baseInfoFormRef.value?.validate((errors) => {
|
baseInfoFormRef.value?.validate((errors) => {
|
||||||
if (!errors) {
|
if (!errors) {
|
||||||
fApi.value?.validate(async (valid) => {
|
if (formRules.value.length > 0) {
|
||||||
if (valid === true) {
|
fApi.value?.validate(async (valid) => {
|
||||||
try {
|
if (valid === true) {
|
||||||
saveLoading.value = true;
|
realSave();
|
||||||
const params = makeParams();
|
|
||||||
if (props.activeCase.isNew !== false) {
|
|
||||||
const res = await createCaseRequest({
|
|
||||||
request: params,
|
|
||||||
fileList: [],
|
|
||||||
});
|
|
||||||
const selectedNode: MinderJsonNode = window.minder.getSelectedNode();
|
|
||||||
if (selectedNode?.data) {
|
|
||||||
selectedNode.data.id = res.data.id;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
await updateCaseRequest({
|
|
||||||
request: params,
|
|
||||||
fileList: [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const selectedNode: MinderJsonNode = window.minder.getSelectedNode();
|
|
||||||
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 = {
|
|
||||||
...selectedNode.data,
|
|
||||||
text: baseInfoForm.value.name,
|
|
||||||
priority: priorityNumber,
|
|
||||||
isNew: false,
|
|
||||||
};
|
|
||||||
window.minder.execCommand('priority', priorityNumber + 1);
|
|
||||||
setPriorityView(true, 'P');
|
|
||||||
selectedNode.data.changed = false;
|
|
||||||
}
|
|
||||||
Message.success(t('common.saveSuccess'));
|
|
||||||
emit('saved');
|
|
||||||
} catch (error) {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(error);
|
|
||||||
} finally {
|
|
||||||
saveLoading.value = false;
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
} else {
|
||||||
|
realSave();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue