Compare commits
No commits in common. "394cb3cc18bb558b0c37ec8ff7be23388b66b9e1" and "cd4529567e37ad54a30df0091cb33f7c734ac8fc" have entirely different histories.
394cb3cc18
...
cd4529567e
|
|
@ -638,22 +638,35 @@ const operationDialog = ref({
|
||||||
show: false,
|
show: false,
|
||||||
mode: 'copy' as 'copy' | 'clone' | 'branch',
|
mode: 'copy' as 'copy' | 'clone' | 'branch',
|
||||||
sourceNodeId: '',
|
sourceNodeId: '',
|
||||||
selectedSourceIds: [] as string[],
|
selectedSourceIds: [] as string[]
|
||||||
owner: 'admin' // default owner
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const toggleSourceSelection = (node: TreeNode) => {
|
const toggleSourceSelection = (node: TreeNode) => {
|
||||||
// Only allow terminal nodes
|
|
||||||
if (!isTerminalNode(node)) return
|
|
||||||
|
|
||||||
const ids = operationDialog.value.selectedSourceIds
|
const ids = operationDialog.value.selectedSourceIds
|
||||||
|
|
||||||
if (ids.includes(node.id)) {
|
// Collect ALL terminal descendant IDs (exclude folders from selection list)
|
||||||
// Toggle off if already selected
|
let terminalsToToggle: string[] = []
|
||||||
operationDialog.value.selectedSourceIds = []
|
|
||||||
|
if (isTerminalNode(node)) {
|
||||||
|
terminalsToToggle = [node.id]
|
||||||
} else {
|
} else {
|
||||||
// Single select: replace any existing selection
|
terminalsToToggle = getAllTerminalDescendants(node)
|
||||||
operationDialog.value.selectedSourceIds = [node.id]
|
}
|
||||||
|
|
||||||
|
// If node is a folder with no terminal children, do nothing or just ignore
|
||||||
|
if (terminalsToToggle.length === 0) return
|
||||||
|
|
||||||
|
const allSelected = terminalsToToggle.every(id => ids.includes(id))
|
||||||
|
|
||||||
|
if (allSelected) {
|
||||||
|
operationDialog.value.selectedSourceIds = ids.filter(id => !terminalsToToggle.includes(id))
|
||||||
|
} else {
|
||||||
|
// Add missing
|
||||||
|
const newIds = [...ids]
|
||||||
|
terminalsToToggle.forEach(id => {
|
||||||
|
if (!newIds.includes(id)) newIds.push(id)
|
||||||
|
})
|
||||||
|
operationDialog.value.selectedSourceIds = newIds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -903,15 +916,11 @@ const closeContextMenu = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const openOperationDialog = (mode: 'copy' | 'clone' | 'branch') => {
|
const openOperationDialog = (mode: 'copy' | 'clone' | 'branch') => {
|
||||||
const currentSourceNodeId = contextMenu.value?.nodeId || ''
|
|
||||||
const currentNode = findNode(mockTreeData.value, currentSourceNodeId)
|
|
||||||
|
|
||||||
operationDialog.value = {
|
operationDialog.value = {
|
||||||
show: true,
|
show: true,
|
||||||
mode,
|
mode,
|
||||||
sourceNodeId: currentSourceNodeId,
|
sourceNodeId: contextMenu.value?.nodeId || '',
|
||||||
selectedSourceIds: [],
|
selectedSourceIds: []
|
||||||
owner: currentNode?.owner || 'admin'
|
|
||||||
}
|
}
|
||||||
dialogExpandedIds.value = new Set(expandedIds.value)
|
dialogExpandedIds.value = new Set(expandedIds.value)
|
||||||
closeContextMenu()
|
closeContextMenu()
|
||||||
|
|
@ -1190,7 +1199,6 @@ const executeOperation = () => {
|
||||||
if (mode === 'copy') {
|
if (mode === 'copy') {
|
||||||
const newNode = cloneNode(sourceNode, `${destinationNode.id}-${Date.now()}-${processedCount}`)
|
const newNode = cloneNode(sourceNode, `${destinationNode.id}-${Date.now()}-${processedCount}`)
|
||||||
newNode.label = `${newNode.label} (Copy)`
|
newNode.label = `${newNode.label} (Copy)`
|
||||||
newNode.owner = operationDialog.value.owner
|
|
||||||
addChildNode(targetParent, newNode)
|
addChildNode(targetParent, newNode)
|
||||||
} else if (mode === 'clone') {
|
} else if (mode === 'clone') {
|
||||||
const newNode: TreeNode = {
|
const newNode: TreeNode = {
|
||||||
|
|
@ -1198,15 +1206,13 @@ const executeOperation = () => {
|
||||||
id: `${destinationNode.id}-${Date.now()}-${processedCount}`,
|
id: `${destinationNode.id}-${Date.now()}-${processedCount}`,
|
||||||
label: `${sourceNode.label} (Clone)`,
|
label: `${sourceNode.label} (Clone)`,
|
||||||
isClone: true,
|
isClone: true,
|
||||||
cloneSourceId: sourceNode.id,
|
cloneSourceId: sourceNode.id
|
||||||
owner: operationDialog.value.owner
|
|
||||||
}
|
}
|
||||||
addChildNode(targetParent, newNode)
|
addChildNode(targetParent, newNode)
|
||||||
} else if (mode === 'branch') {
|
} else if (mode === 'branch') {
|
||||||
// Even if source is terminal, "Branch" op might function like copy
|
// Even if source is terminal, "Branch" op might function like copy
|
||||||
const newNode = cloneNode(sourceNode, `${destinationNode.id}-${Date.now()}-${processedCount}`)
|
const newNode = cloneNode(sourceNode, `${destinationNode.id}-${Date.now()}-${processedCount}`)
|
||||||
newNode.label = `${newNode.label} (Branch)`
|
newNode.label = `${newNode.label} (Branch)`
|
||||||
newNode.owner = operationDialog.value.owner
|
|
||||||
addChildNode(targetParent, newNode)
|
addChildNode(targetParent, newNode)
|
||||||
}
|
}
|
||||||
processedCount++
|
processedCount++
|
||||||
|
|
@ -1505,7 +1511,6 @@ defineExpose({
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:checked="isIdsSelected(node)"
|
:checked="isIdsSelected(node)"
|
||||||
:indeterminate.prop="isIdsIndeterminate(node)"
|
:indeterminate.prop="isIdsIndeterminate(node)"
|
||||||
:disabled="!isTerminalNode(node)"
|
|
||||||
@change="toggleSourceSelection(node)"
|
@change="toggleSourceSelection(node)"
|
||||||
style="margin-right: 6px;"
|
style="margin-right: 6px;"
|
||||||
/>
|
/>
|
||||||
|
|
@ -1523,16 +1528,10 @@ defineExpose({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<div class="owner-input-group">
|
<button class="btn btn-secondary" @click="operationDialog.show = false">Cancel</button>
|
||||||
<label>Owner:</label>
|
<button class="btn btn-primary" @click="executeOperation" :disabled="operationDialog.selectedSourceIds.length === 0">
|
||||||
<input type="text" v-model="operationDialog.owner" class="dialog-input" />
|
{{ operationDialog.mode === 'copy' ? 'Copy' : operationDialog.mode === 'clone' ? 'Clone' : 'Branch' }}
|
||||||
</div>
|
</button>
|
||||||
<div class="dialog-actions">
|
|
||||||
<button class="btn btn-secondary" @click="operationDialog.show = false">Cancel</button>
|
|
||||||
<button class="btn btn-primary" @click="executeOperation" :disabled="operationDialog.selectedSourceIds.length === 0">
|
|
||||||
{{ operationDialog.mode === 'copy' ? 'Copy' : operationDialog.mode === 'clone' ? 'Clone' : 'Branch' }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1974,43 +1973,12 @@ defineExpose({
|
||||||
|
|
||||||
.dialog-footer {
|
.dialog-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: flex-end;
|
||||||
align-items: center;
|
gap: 12px;
|
||||||
padding: 16px 20px;
|
padding: 16px 20px;
|
||||||
border-top: 1px solid #e0e0e0;
|
border-top: 1px solid #e0e0e0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.owner-input-group {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.owner-input-group label {
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dialog-input {
|
|
||||||
padding: 6px 8px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-size: 13px;
|
|
||||||
width: 150px;
|
|
||||||
outline: none;
|
|
||||||
transition: border-color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dialog-input:focus {
|
|
||||||
border-color: #0078d4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dialog-actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ const nodeForModal = computed(() => {
|
||||||
return {
|
return {
|
||||||
...props.selectedNode,
|
...props.selectedNode,
|
||||||
version: selectedVersionDetail.value.version,
|
version: selectedVersionDetail.value.version,
|
||||||
status: 'Accepted',
|
status: 'Approved',
|
||||||
lastChangedBy: selectedVersionDetail.value.reviewer,
|
lastChangedBy: selectedVersionDetail.value.reviewer,
|
||||||
lastChangedDate: selectedVersionDetail.value.approvedDate,
|
lastChangedDate: selectedVersionDetail.value.approvedDate,
|
||||||
comment: selectedVersionDetail.value.comment,
|
comment: selectedVersionDetail.value.comment,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue