diff --git a/frontend/src/components/business/ms-tree/index.vue b/frontend/src/components/business/ms-tree/index.vue index 54bfdf8a0f..60f525a1fd 100644 --- a/frontend/src/components/business/ms-tree/index.vue +++ b/frontend/src/components/business/ms-tree/index.vue @@ -35,7 +35,9 @@ , checkedNodes: MsTreeNodeData) { if (props.showContainChildModule) { + if (checkedNodes.node.disabled) return; const realNode = findNodeByKey(treeData.value, checkedNodes.node.id, 'id'); if (!realNode) return; if (checkedNodes.checked) { @@ -167,15 +170,20 @@ checkNode(_checkedKeys, checkedNodes); } + // 当前节点“包含新增子模块”取消勾选,下面一层的子级取消禁用 + function updateNodeState(nodeId: string | number) { + const realNode = findNodeByKey(treeData.value, nodeId, 'id'); + if (!realNode) return; + realNode.containChildModule = false; + realNode.children?.forEach((child) => { + child.disabled = false; + }); + } + function handleSelectCurrent(nodeData: MsTreeNodeData) { if (props.showContainChildModule && checkedKeys.value.includes(nodeData.id)) { - // 取消当前,“包含新增子模块”取消勾选,下面一层的子级取消禁用 - const realNode = findNodeByKey(treeData.value, nodeData.id, 'id'); - if (!realNode) return; - realNode.containChildModule = false; - realNode.children?.forEach((child) => { - child.disabled = false; - }); + // 取消当前 + updateNodeState(nodeData.id); } selectParent(nodeData, !!checkedKeys.value.includes(nodeData.id)); } @@ -294,11 +302,20 @@ } } } - function handleChange() { + function handleChange(val: string | number | LabelValue | Array | LabelValue[] | undefined) { if (props.multiple) { nextTick(() => { inputValue.value = tempInputValue.value; }); + if (props.showContainChildModule) { + const deletedIds = selectValue.value.filter( + (item: string | number) => !(val as (string | number)[]).includes(item) + ); + // 如果是输入框删除一个 + if (deletedIds.length === 1) { + updateNodeState(deletedIds[0]); + } + } } } function handleKeyup(e: KeyboardEvent) { diff --git a/frontend/src/views/project-management/environmental/components/envParams/HttpTab.vue b/frontend/src/views/project-management/environmental/components/envParams/HttpTab.vue index b1dda068db..45a6f18657 100644 --- a/frontend/src/views/project-management/environmental/components/envParams/HttpTab.vue +++ b/frontend/src/views/project-management/environmental/components/envParams/HttpTab.vue @@ -91,13 +91,7 @@ - +