|
|
|
|
@ -922,7 +922,7 @@ export default { |
|
|
|
|
|
|
|
|
|
if (node.level !== 2) { |
|
|
|
|
this.$message.warning('仅工艺节点支持右键操作'); |
|
|
|
|
this.contextMenuVisible = false |
|
|
|
|
this.contextMenuVisible = false; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -945,6 +945,38 @@ export default { |
|
|
|
|
this.contextNodeData = null; |
|
|
|
|
this.contextTreeNode = null; |
|
|
|
|
}, |
|
|
|
|
async handleDeleteNode() { |
|
|
|
|
if (!this.contextTreeNode) { |
|
|
|
|
this.closeContextMenu(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const node = this.contextTreeNode; |
|
|
|
|
const nodeId = node.data.id; |
|
|
|
|
console.log('删除的节点ID:', node, nodeId); |
|
|
|
|
try { |
|
|
|
|
// 弹出确认框 |
|
|
|
|
await this.$confirm('此操作将删除该工艺及所有子工序,是否继续?', '警告', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}); |
|
|
|
|
let deleteIds = node.childNodes.map(child => child.id); |
|
|
|
|
console.log('需要删除的子工序ID列表:', deleteIds); |
|
|
|
|
// 调用删除API(替换为你的实际API) |
|
|
|
|
// await deleteCraft({ id: deleteIds.join(',') }).then(res => { |
|
|
|
|
// this.$message.success('删除成功'); |
|
|
|
|
// this.getDetails(); |
|
|
|
|
// }); |
|
|
|
|
} catch (error) { |
|
|
|
|
if (error !== 'cancel') { |
|
|
|
|
console.error('删除失败:', error); |
|
|
|
|
this.$message.error('删除失败,请重试'); |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
this.closeContextMenu(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 右侧tab切换 |
|
|
|
|
handleClick(value) { |
|
|
|
|
|