| | |
| | | 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>(); |
| | | |
| | |
| | | return; |
| | | } |
| | | loading.value = true; |
| | | loadError.value = ""; |
| | | try { |
| | | let preset: Record<string, any> | undefined; |
| | | /** 流程实例所属流程定义的 key(重新发起时用于取「最新版本」定义) */ |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |