pref(componentTest): 优化测试用例界面和节点选择逻辑

master
钟良源 2 months ago
parent 2dabe0fa88
commit 7bb321ffb4

@ -103,9 +103,19 @@ const SideBar = ({ onNodeSelect, getCount }) => {
// 处理节点选择 // 处理节点选择
const handleTreeSelect = (selectedKeys: any[], info: any) => { const handleTreeSelect = (selectedKeys: any[], info: any) => {
// 判断是否为子节点(不是分类节点)
const selectedKey = selectedKeys[0]; const selectedKey = selectedKeys[0];
if (selectedKey && !selectedKey.startsWith('classify-')) {
// 如果是父节点(分类节点),切换展开/收起状态
if (selectedKey && selectedKey.startsWith('classify-')) {
const isExpanded = expandedKeys.includes(selectedKey);
if (isExpanded) {
setExpandedKeys(expandedKeys.filter(key => key !== selectedKey));
}
else {
setExpandedKeys([...expandedKeys, selectedKey]);
}
}
else if (selectedKey) {
// 子节点的key就是identifier // 子节点的key就是identifier
onNodeSelect(selectedKey); onNodeSelect(selectedKey);
} }

@ -20,12 +20,13 @@
.tab-center { .tab-center {
flex: 1; flex: 1;
display: flex; display: flex;
margin-left: 20%; justify-content: flex-end;
gap: 8px; gap: 8px;
} }
.tab-right { .tab-right {
display: flex; display: flex;
justify-content: flex-end;
gap: 8px; gap: 8px;
} }
} }
@ -118,10 +119,11 @@
// 中间流程图区域 // 中间流程图区域
.center-panel { .center-panel {
flex: 1.5;
display: flex; display: flex;
align-items: center; align-items: flex-start;
justify-content: center; justify-content: center;
padding: 16px 120px; padding: 40px 80px;
overflow: auto; overflow: auto;
.flow-wrapper { .flow-wrapper {
@ -137,31 +139,31 @@
.node-box { .node-box {
background: #fff; background: #fff;
border-radius: 6px; border-radius: 10px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
min-width: 160px; min-width: 280px;
.node-header { .node-header {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 6px; gap: 10px;
padding: 6px 10px; padding: 14px 18px;
border-bottom: 1px solid #e5e6eb; border-bottom: 1px solid #e5e6eb;
.node-icon { .node-icon {
font-size: 12px; font-size: 20px;
} }
.node-title { .node-title {
font-size: 12px; font-size: 17px;
font-weight: 500; font-weight: 500;
color: #1d2129; color: #1d2129;
} }
} }
.node-label { .node-label {
padding: 4px 10px; padding: 10px 18px;
font-size: 10px; font-size: 14px;
color: #86909c; color: #86909c;
text-align: center; text-align: center;
} }
@ -170,7 +172,7 @@
.node-header { .node-header {
background: #5a6c7d; background: #5a6c7d;
color: #fff; color: #fff;
border-radius: 6px 6px 0 0; border-radius: 10px 10px 0 0;
.node-title { .node-title {
color: #fff; color: #fff;
@ -182,7 +184,7 @@
.node-header { .node-header {
background: #5a6c7d; background: #5a6c7d;
color: #fff; color: #fff;
border-radius: 6px 6px 0 0; border-radius: 10px 10px 0 0;
.node-title { .node-title {
color: #fff; color: #fff;
@ -194,7 +196,7 @@
.node-header { .node-header {
background: #ffb800; background: #ffb800;
color: #fff; color: #fff;
border-radius: 6px 6px 0 0; border-radius: 10px 10px 0 0;
.node-title { .node-title {
color: #fff; color: #fff;
@ -202,35 +204,35 @@
} }
.node-body { .node-body {
padding: 8px; padding: 16px;
.node-function { .node-function {
font-size: 11px; font-size: 15px;
font-weight: 500; font-weight: 500;
color: #1d2129; color: #1d2129;
margin-bottom: 6px; margin-bottom: 10px;
} }
.node-params { .node-params {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 3px; gap: 7px;
margin-bottom: 4px; margin-bottom: 8px;
.param-item { .param-item {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 4px; gap: 8px;
.param-dot { .param-dot {
width: 5px; width: 8px;
height: 5px; height: 8px;
border-radius: 50%; border-radius: 50%;
background: #86909c; background: #86909c;
} }
.param-label { .param-label {
font-size: 10px; font-size: 14px;
color: #4e5969; color: #4e5969;
} }
} }
@ -240,17 +242,17 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
gap: 4px; gap: 8px;
.param-dot { .param-dot {
width: 5px; width: 8px;
height: 5px; height: 8px;
border-radius: 50%; border-radius: 50%;
background: #86909c; background: #86909c;
} }
.param-label { .param-label {
font-size: 10px; font-size: 14px;
color: #4e5969; color: #4e5969;
} }
} }
@ -265,17 +267,17 @@
margin: 0; margin: 0;
.connector-line { .connector-line {
width: 24px; width: 40px;
height: 2px; height: 2px;
background: #d9d9d9; background: #d9d9d9;
} }
.connector-dot { .connector-dot {
width: 5px; width: 8px;
height: 5px; height: 8px;
border-radius: 50%; border-radius: 50%;
background: #d9d9d9; background: #d9d9d9;
margin-left: -2px; margin-left: -4px;
} }
} }
} }

@ -37,25 +37,25 @@ const TestInstance = ({ instance, onBack }: { instance: any; onBack: () => void
type="outline" type="outline"
onClick={() => setActiveTab('template')} onClick={() => setActiveTab('template')}
> >
</Button> </Button>
<Button <Button
type="outline" type="outline"
onClick={() => setActiveTab('add')} onClick={() => setActiveTab('add')}
> >
</Button> </Button>
<Button <Button
type="outline" type="outline"
onClick={() => setActiveTab('batch')} onClick={() => setActiveTab('batch')}
> >
</Button> </Button>
<Button <Button
type="outline" type="outline"
onClick={() => setActiveTab('single')} onClick={() => setActiveTab('single')}
> >
</Button> </Button>
</div> </div>
<div className={styles['tab-right']}></div> <div className={styles['tab-right']}></div>

Loading…
Cancel
Save