页面优化
This commit is contained in:
BIN
rc_autoplc_front/src/assets/image/plc.jpg
Normal file
BIN
rc_autoplc_front/src/assets/image/plc.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 299 KiB |
@@ -374,6 +374,7 @@ const chineseNumbers = ['一', '二', '三', '四', '五', '六', '七', '八',
|
||||
// 功能岛描述映射
|
||||
const islandDescriptions: Record<string, string> = {
|
||||
加液: '加液',
|
||||
加样: '加液',
|
||||
水浴: '水浴',
|
||||
恒温: '水浴',
|
||||
震荡: '震荡',
|
||||
@@ -385,6 +386,21 @@ const islandDescriptions: Record<string, string> = {
|
||||
过膜: '过膜',
|
||||
过滤: '过膜',
|
||||
人工: '人工加液',
|
||||
涡旋: '涡旋',
|
||||
进样: '进样',
|
||||
分液: '分液',
|
||||
浓缩: '浓缩',
|
||||
移上清: '移上清',
|
||||
取液: '取液',
|
||||
金属浴: '金属浴',
|
||||
金属: '金属浴',
|
||||
干燥: '干燥',
|
||||
硫酸钠: '干燥',
|
||||
温室: '温室',
|
||||
静置: '温室',
|
||||
ph: 'ph',
|
||||
酸碱: 'ph',
|
||||
出样: '出样',
|
||||
}
|
||||
|
||||
// 功能岛添加次数限制映射(根据描述关键词)
|
||||
@@ -399,6 +415,17 @@ const islandLimitMap: Record<string, number> = {
|
||||
氮吹: 3,
|
||||
过膜: 10,
|
||||
人工加液: 10,
|
||||
涡旋: 10,
|
||||
进样: 10,
|
||||
分液: 10,
|
||||
浓缩: 10,
|
||||
移上清: 10,
|
||||
取液: 10,
|
||||
金属浴: 3,
|
||||
干燥: 10,
|
||||
温室: 10,
|
||||
ph: 10,
|
||||
出样: 10,
|
||||
}
|
||||
|
||||
// 获取功能岛的最大添加次数
|
||||
@@ -647,20 +674,17 @@ const handleDrop = (event: DragEvent) => {
|
||||
return
|
||||
}
|
||||
|
||||
const descriptionKey = getIslandDescriptionKey(dragItemData.islandName || dragItemData.name)
|
||||
const count = workflowItems.value.filter((item) => {
|
||||
const key = getIslandDescriptionKey(item.islandName || item.name)
|
||||
return key === descriptionKey
|
||||
}).length
|
||||
|
||||
const newItem = {
|
||||
...dragItemData,
|
||||
description: `第${chineseNumbers[count]}次${descriptionKey}`,
|
||||
description: '', // 临时描述,后续统一更新
|
||||
sort: 0,
|
||||
instanceId: generateInstanceId(dragItemData.id),
|
||||
}
|
||||
|
||||
workflowItems.value.push(newItem)
|
||||
// 统一更新所有功能岛的描述
|
||||
updateIslandDescriptions()
|
||||
|
||||
dragItemData = null
|
||||
isExternalDrag.value = false
|
||||
}
|
||||
@@ -697,16 +721,10 @@ const handleContainerDrop = (event: DragEvent) => {
|
||||
return
|
||||
}
|
||||
|
||||
const descriptionKey = getIslandDescriptionKey(dragItemData.islandName || dragItemData.name)
|
||||
const count = workflowItems.value.filter((item) => {
|
||||
const key = getIslandDescriptionKey(item.islandName || item.name)
|
||||
return key === descriptionKey
|
||||
}).length
|
||||
|
||||
dragItemData = {
|
||||
...dragItemData,
|
||||
description: `第${chineseNumbers[count]}次${descriptionKey}`,
|
||||
sort: count,
|
||||
description: '', // 临时描述,后续统一更新
|
||||
sort: 0,
|
||||
instanceId: generateInstanceId(dragItemData.id),
|
||||
}
|
||||
|
||||
@@ -732,6 +750,7 @@ const handleContainerDrop = (event: DragEvent) => {
|
||||
selectedItemIndex.value = insertIndex
|
||||
|
||||
// 优化:使用 Map 减少嵌套循环,从 O(n²) 降到 O(n)
|
||||
// 统一更新所有功能岛的描述
|
||||
updateIslandDescriptions()
|
||||
}
|
||||
|
||||
@@ -1092,19 +1111,8 @@ const handleDelete = (index: number, item: any) => {
|
||||
selectedItemIndex.value--
|
||||
}
|
||||
|
||||
// 更新描述
|
||||
workflowItems.value.forEach((item, i) => {
|
||||
const key = getIslandDescriptionKey(item.islandName || item.name)
|
||||
const sameItems = workflowItems.value.filter((it) => {
|
||||
const k = getIslandDescriptionKey(it.islandName || it.name)
|
||||
return k === key
|
||||
})
|
||||
const index = sameItems.findIndex((it) => it === item)
|
||||
if (index !== -1) {
|
||||
item.description = `第${chineseNumbers[index]}次${key}`
|
||||
item.sort = index
|
||||
}
|
||||
})
|
||||
// 统一更新所有功能岛的描述
|
||||
updateIslandDescriptions()
|
||||
|
||||
ElMessage.success('删除成功')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user