From 13a2249239da01b7a12afa0db3e2e94bf8bd70eb Mon Sep 17 00:00:00 2001 From: baiqi Date: Wed, 26 Jun 2024 16:28:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=91=E5=9B=BE):=20=E6=97=A0=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=AD=97=E6=AE=B5=E4=BF=9D=E5=AD=98=E6=97=A0?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms-minders/featureCaseMinder/basInfo.vue | 98 ++++++++++--------- 1 file changed, 52 insertions(+), 46 deletions(-) diff --git a/frontend/src/components/business/ms-minders/featureCaseMinder/basInfo.vue b/frontend/src/components/business/ms-minders/featureCaseMinder/basInfo.vue index 6d81d02201..eaa9bd88d5 100644 --- a/frontend/src/components/business/ms-minders/featureCaseMinder/basInfo.vue +++ b/frontend/src/components/business/ms-minders/featureCaseMinder/basInfo.vue @@ -17,7 +17,6 @@ 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() { baseInfoFormRef.value?.validate((errors) => { if (!errors) { - fApi.value?.validate(async (valid) => { - if (valid === true) { - 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; + if (formRules.value.length > 0) { + fApi.value?.validate(async (valid) => { + if (valid === true) { + realSave(); } - } - }); + }); + } else { + realSave(); + } } }); }