From dab35bff798cfce2ddf7e8a67e4e1cdb144f5b4c Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 02 十一月 2026 16:08:32 +0800
Subject: [PATCH] fix(bpm): 修复 App 发起流程表单加载异常
---
src/pages/bpm/process-instance/create/form.vue | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/pages/bpm/process-instance/create/form.vue b/src/pages/bpm/process-instance/create/form.vue
index d8d985a..507cc08 100644
--- a/src/pages/bpm/process-instance/create/form.vue
+++ b/src/pages/bpm/process-instance/create/form.vue
@@ -34,6 +34,19 @@
import type { SheetOption } from "../../../mes/process-design/shared";
const { state } = useAuth();
+ /**
+ * App 绔� onLoad 鍙兘淇濈暀 navigateTo 鍙傛暟涓殑鐧惧垎鍙风紪鐮侊紝H5 鍒欓�氬父宸茶嚜鍔ㄨВ鐮併��
+ * 娴佺▼瀹氫箟 id 鍚啋鍙凤紝鏈В鐮佷細瀵艰嚧缂撳瓨鍖归厤澶辫触骞舵妸閿欒 id 浼犵粰鍚庣銆�
+ */
+ function decodeRouteParam(value: unknown) {
+ const raw = value === undefined || value === null ? "" : String(value);
+ try {
+ return decodeURIComponent(raw);
+ } catch {
+ return raw;
+ }
+ }
+
const SELECTED_DEFINITION_KEY = "bpm_create_selected_definition";
const selectedDefinition = ref<BpmProcessDefinition>();
@@ -348,6 +361,7 @@
return;
}
loading.value = true;
+ loadError.value = "";
try {
let preset: Record<string, any> | undefined;
/** 娴佺▼瀹炰緥鎵�灞炴祦绋嬪畾涔夌殑 key锛堥噸鏂板彂璧锋椂鐢ㄤ簬鍙栥�屾渶鏂扮増鏈�嶅畾涔夛級 */
@@ -491,11 +505,17 @@
}
onLoad(query => {
- explicitDefinitionId.value = query?.id ? String(query.id) : "";
+ explicitDefinitionId.value = decodeRouteParam(query?.id);
definitionId.value = explicitDefinitionId.value;
- processInstanceId.value = query?.processInstanceId ? String(query.processInstanceId) : "";
+ processInstanceId.value = decodeRouteParam(query?.processInstanceId);
try {
- const cached = uni.getStorageSync(SELECTED_DEFINITION_KEY) as BpmProcessDefinition | undefined;
+ const cachedValue = uni.getStorageSync(SELECTED_DEFINITION_KEY) as
+ | BpmProcessDefinition
+ | string
+ | undefined;
+ const cached = typeof cachedValue === "string"
+ ? (JSON.parse(cachedValue) as BpmProcessDefinition)
+ : cachedValue;
if (cached?.id && String(cached.id) === explicitDefinitionId.value) {
selectedDefinition.value = cached;
}
--
Gitblit v1.9.3