From a28a9ed86cd49105732aa961665dcb593fdac2f9 Mon Sep 17 00:00:00 2001 From: weicw <594098497@qq.com> Date: Mon, 2 Nov 2026 13:56:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(tygl):=20=E5=B7=B2=E6=9C=89=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E6=97=B6=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E3=80=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A1=A3=E6=A1=88=E3=80=8D=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=88=90=E5=8A=9F=E5=90=8E=E8=BF=94=E5=9B=9E=E4=B8=8A?= =?UTF-8?q?=E4=B8=80=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/tygl/index.vue | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/pages/tygl/index.vue b/src/pages/tygl/index.vue index 470a106..00e4368 100644 --- a/src/pages/tygl/index.vue +++ b/src/pages/tygl/index.vue @@ -148,7 +148,7 @@ - + @@ -388,6 +388,10 @@ export default { } }, computed: { + // 已有档案(formId 来自 getCurrentTyglForm)时按钮切换为更新 + submitButtonText() { + return this.formId ? '更新档案' : '提交档案' + }, nationLabels() { return this.nationOptions.map((item) => item.label) }, @@ -1009,11 +1013,12 @@ export default { return } try { + const isUpdate = Boolean(this.formId) const payload = this.buildSubmitPayload() - const result = this.formId + const result = isUpdate ? await updateTyglForm(payload) : await saveTyglForm(payload) - if (!this.formId && result && result.id) { + if (!isUpdate && result && result.id) { this.formId = result.id } const savedAt = this.formatNow() @@ -1023,9 +1028,24 @@ export default { status: 'submitted' }) this.draftSavedAt = savedAt + if (isUpdate) { + // 更新成功:提示后返回上一页 + uni.showToast({ + title: '更新成功', + icon: 'success' + }) + setTimeout(() => { + uni.navigateBack({ + fail: () => { + uni.reLaunch({url: '/pages/index/index'}) + } + }) + }, 800) + return + } uni.showModal({ title: '提交成功', - content: this.formId ? '团员档案已更新。' : '团员档案已创建。', + content: '团员档案已创建。', showCancel: false }) } catch (error) {