|
@@ -127,10 +127,9 @@ const edgeData = ref(useAnalyzeInfo.analyzeInfo.value.edgeFile)
|
|
|
const mission = ref(useAnalyzeInfo.analyzeInfo.value.mission)
|
|
|
// 算法列表
|
|
|
const algorithms = ref([
|
|
|
- { label: '算法A', value: 'algA', level: 0 },
|
|
|
- { label: '算法B', value: 'algB', level: 1 },
|
|
|
- { label: '算法C', value: 'algC', level: 2 },
|
|
|
- { label: '算法D', value: 'algD', level: 3 }
|
|
|
+ { label: '拓扑优化算法', value: 'algA', level: 0 },
|
|
|
+ { label: '功能体发现算法', value: 'algB', level: 1 },
|
|
|
+ { label: '网络演化算法', value: 'algC', level: 2 },
|
|
|
])
|
|
|
|
|
|
// 流程规划与开始计算的控制
|
|
@@ -184,7 +183,6 @@ const fetchData = async () => {
|
|
|
// 如果当前没有保存的节点和边的数据,则尝试获取任务数据
|
|
|
// 如果已经保存了节点和边的数据,则省略获取数据
|
|
|
// 更新节点、边、任务数据
|
|
|
- console.log(useAnalyzeInfo.analyzeInfo.value)
|
|
|
if (nodeData.value.amound == 0 || edgeData.value.amound == 0 || mission.value.id == null) {
|
|
|
const recoveryData = JSON.parse(sessionStorage.getItem('analyze-info'))
|
|
|
if (recoveryData == null) {
|
|
@@ -233,7 +231,6 @@ const calculateLayout = () => {
|
|
|
// 第一代按钮布局
|
|
|
let currentRow = 0
|
|
|
let currentCol = 0
|
|
|
-
|
|
|
buttons.value.forEach((btn) => {
|
|
|
// 仅处理根节点按钮
|
|
|
if (!btn.parentId) {
|
|
@@ -292,7 +289,6 @@ const getButtonCenter = (btn) => {
|
|
|
|
|
|
const containerRect = flowContainer.value.getBoundingClientRect()
|
|
|
const btnRect = el.getBoundingClientRect()
|
|
|
- console.log(btn.id, containerRect, btnRect)
|
|
|
return {
|
|
|
x: btnRect.left - containerRect.left + el.offsetWidth / 2,
|
|
|
y: btnRect.top - containerRect.top + el.offsetHeight / 2,
|
|
@@ -310,7 +306,6 @@ const updateConnections = () => {
|
|
|
|
|
|
connections.value = []
|
|
|
// 遍历所有按钮建立连接关系
|
|
|
- console.log(buttons)
|
|
|
buttons.value.forEach(btn => {
|
|
|
if (btn.parentId) {
|
|
|
const parent = buttons.value.find(b => b.id === btn.parentId)
|
|
@@ -366,8 +361,6 @@ const deleteChildren = (btn) => {
|
|
|
const handleDelete = (btn) => {
|
|
|
// 处理删除逻辑
|
|
|
const parent = buttons.value.find(b => b.id === btn.parentId)
|
|
|
- console.log('btn', btn)
|
|
|
- console.log('parent', parent)
|
|
|
deleteChildren(btn)
|
|
|
parent.children = parent.children.filter(b => b.id !== btn.id)
|
|
|
parent.algorithms = algorithms.value.filter(al => al.level >= parent.algorithm.level)
|
|
@@ -438,6 +431,8 @@ const addButton = (parentIndex, direction, button = null) => {
|
|
|
// 初始节点有更上一级
|
|
|
if (parent.parentId) {
|
|
|
parent = buttons.value.find(b => b.id === parent.parentId)
|
|
|
+ } else {
|
|
|
+ // 父节点没有父节点,则本节点应与父节点并列
|
|
|
}
|
|
|
colRecord.value.forEach((col, index) => {
|
|
|
if (findEmptyCol) {
|
|
@@ -497,6 +492,7 @@ const addButton = (parentIndex, direction, button = null) => {
|
|
|
}
|
|
|
|
|
|
buttons.value.push(newBtn)
|
|
|
+
|
|
|
parent.children.push(newBtn)
|
|
|
|
|
|
// 添加防抖调用
|
|
@@ -510,7 +506,6 @@ const selectAlgorithm = (index, algorithm) => {
|
|
|
selectedAlgorithms.value[index] = algorithm.value
|
|
|
buttons.value[index].label = algorithm.label
|
|
|
buttons.value[index].algorithm = algorithm
|
|
|
- console.log(buttons.value[index])
|
|
|
menuVisible.value[index] = false
|
|
|
}
|
|
|
|
|
@@ -588,7 +583,6 @@ const submitPlan = async () => {
|
|
|
|
|
|
// 初始化
|
|
|
onMounted(async () => {
|
|
|
- console.log("Mounted")
|
|
|
try {
|
|
|
await fetchData()
|
|
|
} finally {
|
|
@@ -621,7 +615,7 @@ watch(
|
|
|
if (mission.value.id === null) {
|
|
|
// 从sessionstorage中仍未获取到数据,则需要继续跳回
|
|
|
router.push("/dashboard")
|
|
|
- return
|
|
|
+ return
|
|
|
}
|
|
|
const response = await getData('/plan/', { mission: mission.value.id })
|
|
|
const rootBtn = response.data.find(p => p.parent === null)
|
|
@@ -650,9 +644,17 @@ watch(
|
|
|
// 后续节点,同一个parent,在panrent的下方水平扩展
|
|
|
if (col == 0) {
|
|
|
// 子节点中第一个,在parent的下方扩展
|
|
|
+ if (p.parent === rootBtn.id) {
|
|
|
+ // 以虚拟根节点为父节点的节点要删去父节点
|
|
|
+ p.parent = null
|
|
|
+ }
|
|
|
addButton(p.parent, 'bottom', p)
|
|
|
} else {
|
|
|
// 子节点的后续,在第一个子节点的水平扩展
|
|
|
+ if (p.parent === rootBtn.id) {
|
|
|
+ // 以虚拟根节点为父节点的节点要删去父节点
|
|
|
+ p.parent = null
|
|
|
+ }
|
|
|
addButton(pre.id, 'right', p)
|
|
|
}
|
|
|
}
|
|
@@ -738,11 +740,11 @@ watch(
|
|
|
.left-panel {
|
|
|
flex: 1;
|
|
|
padding: 20px;
|
|
|
- margin-right: 20px;
|
|
|
+ /* margin-right: 20px; */
|
|
|
}
|
|
|
|
|
|
.right-panel {
|
|
|
- flex: 3;
|
|
|
+ flex: 4;
|
|
|
padding: 20px;
|
|
|
position: relative;
|
|
|
}
|