|
|
@ -8,7 +8,7 @@ import { getCoursePath } from '@/api/course' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import { proxrequest } from '@/api/configuration'; |
|
|
|
import { proxrequest } from '@/api/configuration'; |
|
|
|
const Router = useRouter() |
|
|
|
const Router = useRouter() |
|
|
|
const props = defineProps(['corseId']); |
|
|
|
const props = defineProps(['corseId','options']); |
|
|
|
const nodeList = ref({ nodes: [], edges: [] }) |
|
|
|
const nodeList = ref({ nodes: [], edges: [] }) |
|
|
|
watch(() => props.corseId, () => getCoursePathEvent()); |
|
|
|
watch(() => props.corseId, () => getCoursePathEvent()); |
|
|
|
let prOpt: any; |
|
|
|
let prOpt: any; |
|
|
@ -36,7 +36,39 @@ const getCoursePathEvent = async () => { |
|
|
|
console.log(nodeList.value) |
|
|
|
console.log(nodeList.value) |
|
|
|
init() |
|
|
|
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 = () => { |
|
|
|
const init = () => { |
|
|
|
var colorMap = { |
|
|
|
var colorMap = { |
|
|
|
凭证开立: '#72CC4A', |
|
|
|
凭证开立: '#72CC4A', |
|
|
@ -46,6 +78,8 @@ const init = () => { |
|
|
|
第二阶段: '#1A91FF', |
|
|
|
第二阶段: '#1A91FF', |
|
|
|
第三阶段: '#FFAA15', |
|
|
|
第三阶段: '#FFAA15', |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #region |
|
|
|
// var data = { |
|
|
|
// var data = { |
|
|
|
// nodes: [ |
|
|
|
// nodes: [ |
|
|
|
// { |
|
|
|
// { |
|
|
@ -186,6 +220,7 @@ const init = () => { |
|
|
|
// }, |
|
|
|
// }, |
|
|
|
// ], |
|
|
|
// ], |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
// #endregion |
|
|
|
|
|
|
|
|
|
|
|
G6.registerNode( |
|
|
|
G6.registerNode( |
|
|
|
'round-rect', |
|
|
|
'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.data(nodeList.value) |
|
|
|
graph.render() |
|
|
|
graph.render() |
|
|
|
graph.on('node:click', ev => { |
|
|
|
graph.on('node:click', ev => { |
|
|
|
console.log(ev.item._cfg.id); |
|
|
|
console.log(ev, ev.item._cfg.id); |
|
|
|
Router.push({ |
|
|
|
Router.push({ |
|
|
|
path: '/knowledge', |
|
|
|
path: '/knowledge', |
|
|
|
query: { id: ev.item._cfg.id } |
|
|
|
query: { id: ev.item._cfg.id,title:ev.item._cfg.model.label } |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
var edges = graph.getEdges() |
|
|
|
var edges = graph.getEdges() |
|
|
|
edges.forEach(function (edge: any) { |
|
|
|
edges.forEach(function (edge: any) { |
|
|
|