|
|
|
@ -8,7 +8,7 @@ import { getCoursePath } from '@/api/course' |
|
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
|
import { proxrequest } from '@/api/configuration'; |
|
|
|
|
const Router = useRouter() |
|
|
|
|
const props = defineProps(['corseId']); |
|
|
|
|
const props = defineProps(['corseId','options']); |
|
|
|
|
const nodeList = ref({ nodes: [], edges: [] }) |
|
|
|
|
watch(() => props.corseId, () => getCoursePathEvent()); |
|
|
|
|
let prOpt: any; |
|
|
|
@ -36,7 +36,39 @@ const getCoursePathEvent = async () => { |
|
|
|
|
console.log(nodeList.value) |
|
|
|
|
init() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var graph:any; |
|
|
|
|
onMounted(()=>{ |
|
|
|
|
graph = new G6.Graph({ |
|
|
|
|
container: 'mountNode', |
|
|
|
|
width: window.innerWidth - 19, |
|
|
|
|
height: 600, |
|
|
|
|
layout: { |
|
|
|
|
type: 'dagre', |
|
|
|
|
rankdir: 'LR', |
|
|
|
|
nodesep: 30, |
|
|
|
|
ranksep: 100, |
|
|
|
|
}, |
|
|
|
|
modes: { |
|
|
|
|
default: ['drag-canvas'], |
|
|
|
|
}, |
|
|
|
|
defaultNode: { |
|
|
|
|
shape: 'round-rect', |
|
|
|
|
labelCfg: { |
|
|
|
|
style: { |
|
|
|
|
fill: '#000000A6', |
|
|
|
|
fontSize: 10, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
style: { |
|
|
|
|
stroke: '#72CC4A', |
|
|
|
|
width: 150, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
defaultEdge: { |
|
|
|
|
shape: 'polyline', |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
const init = () => { |
|
|
|
|
var colorMap = { |
|
|
|
|
凭证开立: '#72CC4A', |
|
|
|
@ -46,6 +78,8 @@ const init = () => { |
|
|
|
|
第二阶段: '#1A91FF', |
|
|
|
|
第三阶段: '#FFAA15', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// #region |
|
|
|
|
// var data = { |
|
|
|
|
// nodes: [ |
|
|
|
|
// { |
|
|
|
@ -186,6 +220,7 @@ const init = () => { |
|
|
|
|
// }, |
|
|
|
|
// ], |
|
|
|
|
// } |
|
|
|
|
// #endregion |
|
|
|
|
|
|
|
|
|
G6.registerNode( |
|
|
|
|
'round-rect', |
|
|
|
@ -357,46 +392,14 @@ const init = () => { |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
var graph = new G6.Graph({ |
|
|
|
|
container: 'mountNode', |
|
|
|
|
width: window.innerWidth - 19, |
|
|
|
|
height: 600, |
|
|
|
|
layout: { |
|
|
|
|
type: 'dagre', |
|
|
|
|
rankdir: 'LR', |
|
|
|
|
nodesep: 30, |
|
|
|
|
ranksep: 100, |
|
|
|
|
}, |
|
|
|
|
modes: { |
|
|
|
|
default: ['drag-canvas'], |
|
|
|
|
}, |
|
|
|
|
defaultNode: { |
|
|
|
|
shape: 'round-rect', |
|
|
|
|
labelCfg: { |
|
|
|
|
style: { |
|
|
|
|
fill: '#000000A6', |
|
|
|
|
fontSize: 10, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
style: { |
|
|
|
|
stroke: '#72CC4A', |
|
|
|
|
width: 150, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
defaultEdge: { |
|
|
|
|
shape: 'polyline', |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
graph.data(nodeList.value) |
|
|
|
|
graph.render() |
|
|
|
|
graph.on('node:click', ev => { |
|
|
|
|
console.log(ev.item._cfg.id); |
|
|
|
|
console.log(ev, ev.item._cfg.id); |
|
|
|
|
Router.push({ |
|
|
|
|
path: '/knowledge', |
|
|
|
|
query: { id: ev.item._cfg.id } |
|
|
|
|
query: { id: ev.item._cfg.id,title:ev.item._cfg.model.label } |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
var edges = graph.getEdges() |
|
|
|
|
edges.forEach(function (edge: any) { |
|
|
|
|