|
@@ -275,13 +275,36 @@ export function useAnalysis() {
|
|
|
try {
|
|
try {
|
|
|
definitionOptions.value = await listEnabled()
|
|
definitionOptions.value = await listEnabled()
|
|
|
if (definitionOptions.value.length > 0 && !query.processDefinitionId) {
|
|
if (definitionOptions.value.length > 0 && !query.processDefinitionId) {
|
|
|
- query.processDefinitionId = definitionOptions.value[definitionOptions.value.length - 1].id
|
|
|
|
|
|
|
+ const last = definitionOptions.value[definitionOptions.value.length - 1]
|
|
|
|
|
+ query.processDefinitionId = last.id
|
|
|
|
|
+ // 同步默认流程到明细卡片
|
|
|
|
|
+ instanceQuery.processDefinitionId = last.id
|
|
|
}
|
|
}
|
|
|
|
|
+ loadCurrentNodeOptions()
|
|
|
} catch {
|
|
} catch {
|
|
|
definitionOptions.value = []
|
|
definitionOptions.value = []
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function loadCurrentNodeOptions() {
|
|
|
|
|
+ if (!query.processDefinitionId) {
|
|
|
|
|
+ currentNodeOptions.value = []
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const def = definitionOptions.value.find((d) => d.id === query.processDefinitionId)
|
|
|
|
|
+ if (def?.flowJson) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ currentNodeOptions.value = JSON.parse(def.flowJson)
|
|
|
|
|
+ .nodes.filter((n: any) => n.type !== 'start' && n.type !== 'end' && n.type !== 'condition' && n.type !== 'cc')
|
|
|
|
|
+ .map((n: any) => n.name)
|
|
|
|
|
+ } catch {
|
|
|
|
|
+ currentNodeOptions.value = []
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ currentNodeOptions.value = []
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
async function loadOverview() {
|
|
async function loadOverview() {
|
|
|
loadingOverview.value = true
|
|
loadingOverview.value = true
|
|
|
try {
|
|
try {
|
|
@@ -355,6 +378,7 @@ export function useAnalysis() {
|
|
|
if (loadingAll.value) return
|
|
if (loadingAll.value) return
|
|
|
loadingAll.value = true
|
|
loadingAll.value = true
|
|
|
try {
|
|
try {
|
|
|
|
|
+ loadCurrentNodeOptions()
|
|
|
await Promise.all([loadOverview(), loadStatusDistribution(), loadEfficiency(), loadNodes(), loadNodeCount()])
|
|
await Promise.all([loadOverview(), loadStatusDistribution(), loadEfficiency(), loadNodes(), loadNodeCount()])
|
|
|
await loadStuck(1)
|
|
await loadStuck(1)
|
|
|
} finally {
|
|
} finally {
|
|
@@ -381,7 +405,11 @@ export function useAnalysis() {
|
|
|
|
|
|
|
|
function onInstanceProcessChange() {
|
|
function onInstanceProcessChange() {
|
|
|
instanceQuery.currentNodeName = ''
|
|
instanceQuery.currentNodeName = ''
|
|
|
|
|
+ // 按名称或 ID 查找定义(StuckInstanceTable 切换时传 processName,顶栏切换时传 processDefinitionId)
|
|
|
const def = definitionList.value.find((d) => d.name === instanceQuery.processName)
|
|
const def = definitionList.value.find((d) => d.name === instanceQuery.processName)
|
|
|
|
|
+ || definitionOptions.value.find((d) => d.name === instanceQuery.processName)
|
|
|
|
|
+ || definitionList.value.find((d) => d.id === instanceQuery.processDefinitionId)
|
|
|
|
|
+ || definitionOptions.value.find((d) => d.id === instanceQuery.processDefinitionId)
|
|
|
if (def?.flowJson) {
|
|
if (def?.flowJson) {
|
|
|
try {
|
|
try {
|
|
|
currentNodeOptions.value = JSON.parse(def.flowJson)
|
|
currentNodeOptions.value = JSON.parse(def.flowJson)
|
|
@@ -391,7 +419,7 @@ export function useAnalysis() {
|
|
|
currentNodeOptions.value = []
|
|
currentNodeOptions.value = []
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- currentNodeOptions.value = []
|
|
|
|
|
|
|
+ loadCurrentNodeOptions()
|
|
|
}
|
|
}
|
|
|
loadInstanceList()
|
|
loadInstanceList()
|
|
|
}
|
|
}
|
|
@@ -437,10 +465,10 @@ export function useAnalysis() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- onMounted(() => {
|
|
|
|
|
- loadDefinitions()
|
|
|
|
|
|
|
+ onMounted(async () => {
|
|
|
|
|
+ await loadDefinitions()
|
|
|
|
|
+ await loadDefinitionsFull()
|
|
|
loadAll()
|
|
loadAll()
|
|
|
- loadDefinitionsFull()
|
|
|
|
|
loadInstanceList()
|
|
loadInstanceList()
|
|
|
})
|
|
})
|
|
|
|
|
|