[Fix-10829][UI] display real workflow relation in WorkFlow Relation page (#10836)

This commit is contained in:
rockfang 2022-07-08 00:19:13 -05:00 committed by caishunfeng
parent 3f8f878a93
commit d8ee6c915c
4 changed files with 33 additions and 7 deletions

View File

@ -43,7 +43,7 @@ const props = {
}, },
contentStyle: { contentStyle: {
type: String as PropType<string | CSSProperties>, type: String as PropType<string | CSSProperties>,
default: defaultContentStyle default: JSON.stringify(defaultContentStyle)
} }
} }

View File

@ -33,6 +33,9 @@ const props = {
type: Array as PropType<Array<any>>, type: Array as PropType<Array<any>>,
default: () => [] default: () => []
}, },
links: {
default: () => []
},
labelShow: { labelShow: {
type: Boolean as PropType<boolean>, type: Boolean as PropType<boolean>,
default: true default: true
@ -117,7 +120,7 @@ const GraphChart = defineComponent({
draggable: true, draggable: true,
force: { force: {
repulsion: 300, repulsion: 300,
edgeLength: 100 edgeLength: 200
}, },
symbol: 'roundRect', symbol: 'roundRect',
symbolSize: 70, symbolSize: 70,
@ -136,6 +139,11 @@ const GraphChart = defineComponent({
return newStr.length > 60 ? newStr.slice(0, 60) + '...' : newStr return newStr.length > 60 ? newStr.slice(0, 60) + '...' : newStr
} }
}, },
edgeSymbol: ['circle', 'arrow'],
edgeSymbolSize: [4, 10],
edgeLabel: {
fontSize: 20
},
data: props.seriesData.map((item) => { data: props.seriesData.map((item) => {
const category = getCategory( const category = getCategory(
Number(item.schedulePublishStatus), Number(item.schedulePublishStatus),
@ -175,6 +183,14 @@ const GraphChart = defineComponent({
itemStyle itemStyle
} }
}), }),
links: props.links,
lineStyle: {
opacity: 0.9,
width: 2,
curveness: 0
},
nodeScaleRatio: 0,
zoom: 1,
categories: legendData categories: legendData
} }
] ]

View File

@ -79,6 +79,7 @@ const workflowRelation = defineComponent({
<Graph <Graph
seriesData={this.seriesData} seriesData={this.seriesData}
labelShow={this.labelShow} labelShow={this.labelShow}
links={this.links}
/> />
), ),
'header-extra': () => ( 'header-extra': () => (

View File

@ -32,19 +32,28 @@ export function useRelation() {
workflowOptions: [], workflowOptions: [],
workflow: ref(null), workflow: ref(null),
seriesData: [], seriesData: [],
labelShow: ref(true) labelShow: ref(true),
links: []
}) })
const formatWorkflow = (obj: Array<WorkFlowListRes>) => { const formatWorkflow = (obj: WorkflowRes) => {
variables.seriesData = [] variables.seriesData = []
variables.links = []
variables.seriesData = obj.map((item) => { variables.seriesData = obj.workFlowList.map((item) => {
return { return {
name: item.workFlowName, name: item.workFlowName,
id: item.workFlowCode, id: item.workFlowCode,
...item ...item
} }
}) as any }) as any
variables.links = obj.workFlowRelationList.map((item) => {
return {
source: String(item.sourceWorkFlowCode),
target: String(item.targetWorkFlowCode)
}
}) as any
} }
const getWorkflowName = (projectCode: number) => { const getWorkflowName = (projectCode: number) => {
@ -71,7 +80,7 @@ export function useRelation() {
{ workFlowCode: workflowCode }, { workFlowCode: workflowCode },
{ projectCode } { projectCode }
).then((res: WorkflowRes) => { ).then((res: WorkflowRes) => {
formatWorkflow(res.workFlowList) formatWorkflow(res)
}), }),
{} {}
) )
@ -84,7 +93,7 @@ export function useRelation() {
queryWorkFlowList({ queryWorkFlowList({
projectCode projectCode
}).then((res: WorkflowRes) => { }).then((res: WorkflowRes) => {
formatWorkflow(res.workFlowList) formatWorkflow(res)
}), }),
{} {}
) )