Commit 462206d8 by zhaochengxiang

默认显示2层

parent 453d6ca3
......@@ -73,7 +73,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
});
const calcRaduis = (node) => {
if (!node?.levelId) return { innerRaduis: minInnerRaduis, raduis: minInnerRaduis+40 };
if (!node?.levelId) return { innerRaduis: minInnerRaduis, raduis: minInnerRaduis+30 };
const nodeLevel = node?.levelId.split('-').length;
let innerRaduis = minInnerRaduis;
......@@ -83,7 +83,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
innerRaduis = minInnerRaduis + 10*(totalLevel - nodeLevel);
}
return { innerRaduis, raduis: (innerRaduis+40) };
return { innerRaduis, raduis: (innerRaduis+30) };
}
const calcSecondaryNodeColor = (node) => {
......@@ -264,6 +264,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
draggable: true,
});
} else {
group.addShape('circle', {
attrs: {
x: raduis,
......
......@@ -71,7 +71,7 @@ const RelationContainer = (props) => {
function recursion(data, parentId, parentLevelId) {
(data||[]).forEach((item, index) => {
let currentLevelId = `${parentLevelId}-${index}`;
newNodes.push({ id: item.nodeId, pid: parentId, levelId: currentLevelId, simple: (currentLevelId.split('-').length>=3)?true: false, show: (currentLevelId.split('-').length>3)?false:true, text: item.text });
newNodes.push({ id: item.nodeId, pid: parentId, levelId: currentLevelId, simple: (currentLevelId.split('-').length>=3)?true: false, show: (currentLevelId.split('-').length>2)?false:true, text: item.text });
recursion(item.children, item.nodeId, currentLevelId);
})
......@@ -102,14 +102,15 @@ const RelationContainer = (props) => {
function recursion(subData, parentId) {
(data||[]).forEach(node => {
if (totalLevel < node.levelId.split('-').length) {
totalLevel = node.levelId.split('-').length;
}
if (!node.show) return;
if (node.pid === parentId) {
let newNode = { ...node, children: [] };
if (totalLevel < node.levelId.split('-').length) {
totalLevel = node.levelId.split('-').length;
}
(subData||[]).push(newNode);
recursion(newNode.children, newNode.id);
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1646807065346" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4669" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M991.524094 479.528025h-29.8706c-2.097935 0-3.796264-1.598427-3.996066-3.696361C940.374438 256.747297 765.346709 82.019273 546.162441 65.235792c-2.097935-0.199803-3.696362-1.898132-3.696362-3.996067V33.167355C542.466079 15.484759 527.980336 0.59941 510.397642 0.999017c-17.083186 0.299705-30.869617 14.285939-30.869617 31.469026v28.871584c0 2.097935-1.598427 3.796264-3.696361 3.996066-218.784662 17.282989-393.212981 191.711309-410.495971 410.495971-0.199803 2.097935-1.898132 3.696362-3.996066 3.696361H31.469027C14.086136 479.528025 0 493.614161 0 510.997052v0.899115C0 529.37896 14.086136 543.465096 31.469027 543.465096h29.8706c2.097935 0 3.796264 1.598427 3.996066 3.696361 17.282989 218.784662 191.711309 393.212981 410.495971 410.495971 2.097935 0.199803 3.696362 1.898132 3.696361 3.996066v30.170305c0 17.682596 14.485742 32.567945 32.068437 32.168339 17.083186-0.299705 30.869617-14.285939 30.869617-31.469027v-30.869617c0-2.097935 1.598427-3.796264 3.696362-3.996066 219.184268-16.783481 394.211998-191.511505 411.494987-410.595872 0.199803-2.097935 1.898132-3.696362 3.996066-3.696362h29.8706c17.382891 0 31.469027-14.086136 31.469027-31.469027v-0.899115c0-17.382891-14.086136-31.469027-31.469027-31.469027z m-860.4531-17.9823c4.395674-34.166372 13.386824-67.433629 26.873549-99.302262 19.281023-45.655064 46.953786-86.714651 82.219076-121.979942s76.324877-62.938053 121.979942-82.219076c31.868633-13.486726 65.13589-22.477876 99.302262-26.87355 9.590561-1.19882 18.082203 6.193904 18.082202 15.884366 0 3.996067-1.498525 7.692429-3.896165 10.489676-2.497542 2.797247-5.894199 4.79528-9.890265 5.294788C308.096756 183.319568 183.319568 308.096756 162.839725 465.641693c-0.999017 7.892232-7.79233 13.886332-15.884366 13.886332-8.891249 0-15.984268-7.292822-15.984267-15.984267 0-0.699312 0-1.398623 0.099902-1.998033zM463.543758 892.022029c-0.699312 0-1.398623 0-2.097935-0.099902-34.166372-4.395674-67.433629-13.386824-99.302262-26.873549-45.655064-19.281023-86.714651-46.953786-121.979942-82.219076s-62.938053-76.324877-82.219076-121.979942c-13.486726-31.868633-22.477876-65.13589-26.873549-99.302262-1.19882-9.590561 6.193904-17.982301 15.884365-17.982301 3.996067 0 7.692429 1.498525 10.489676 3.996067s4.79528 5.894199 5.294789 9.890266c20.579744 157.445035 145.356933 282.222223 302.901869 302.702066 7.992134 0.999017 13.886332 7.892232 13.886332 15.884366 0 8.891249-7.292822 15.984268-15.984267 15.984267zM511.596462 672.338252c-17.682596-0.399607-32.068437 14.485742-32.068437 32.168339v74.526647c0 9.990167-9.091052 17.482793-18.881416 15.684563-20.979351-3.696362-41.359292-9.790364-61.139823-18.082203-34.266273-14.485742-65.035988-35.26529-91.509931-61.639332-26.473943-26.473943-47.153589-57.243658-61.639332-91.509931-8.39174-19.780531-14.385841-40.160472-18.182104-61.139823-1.79823-9.790364 5.694395-18.881416 15.684562-18.881416h76.224976c17.382891 0 31.469027-14.086136 31.469027-31.469027v-0.899115c0-17.382891-14.086136-31.469027-31.469027-31.469027h-76.224976c-9.990167 0-17.482793-9.091052-15.684562-18.881416 3.696362-20.979351 9.790364-41.359292 18.182104-61.139823 14.485742-34.266273 35.26529-65.035988 61.639332-91.509932 26.473943-26.473943 57.243658-47.153589 91.509931-61.639331 19.780531-8.39174 40.160472-14.385841 61.139823-18.182105 9.790364-1.79823 18.881416 5.694395 18.881416 15.684563v76.524681c0 17.682596 14.485742 32.567945 32.068437 32.168338 17.083186-0.299705 30.869617-14.285939 30.869617-31.469027V243.76008c0-9.990167 8.99115-17.382891 18.881416-15.684563 21.279056 3.696362 42.058604 9.790364 62.13884 18.282006 34.266273 14.485742 65.035988 35.26529 91.509931 61.639332 26.473943 26.473943 47.153589 57.243658 61.639332 91.509931 8.39174 19.780531 14.385841 40.160472 18.082203 61.139823 1.79823 9.790364-5.694395 18.881416-15.684563 18.881416h-76.224976c-17.382891 0-31.469027 14.086136-31.469026 31.469027v0.899115c0 17.382891 14.086136 31.469027 31.469026 31.469027h76.224976c9.990167 0 17.482793 9.091052 15.684563 18.881416-3.696362 20.979351-9.790364 41.359292-18.082203 61.139823-14.485742 34.266273-35.26529 65.035988-61.639332 91.509932-26.473943 26.473943-57.243658 47.153589-91.509931 61.639331-20.080236 8.491642-40.859784 14.585644-62.13884 18.282006C551.457229 796.615932 542.466079 789.223209 542.466079 779.233041v-75.425762c0-17.183088-13.686529-31.169322-30.869617-31.469027z m380.325665-110.890856c-4.395674 34.166372-13.386824 67.433629-26.873549 99.302262-19.281023 45.655064-46.953786 86.714651-82.219076 121.979942s-76.324877 62.938053-121.979942 82.219076c-32.168338 13.586627-65.835202 22.67768-100.301279 27.073353-9.590561 1.19882-17.982301-6.293805-17.982301-15.884366 0-3.996067 1.498525-7.692429 3.996067-10.589577 2.497542-2.797247 5.9941-4.79528 9.890266-5.294789C714.396856 840.173061 839.673553 715.19607 860.153396 557.251526c0.999017-7.892232 7.892232-13.786431 15.884366-13.78643 8.891249 0 15.984268 7.292822 15.984267 15.984267 0 0.699312 0 1.298722-0.099902 1.998033z m1.79823-81.919371h-31.968535c-14.885349-164.33825-142.759489-296.108556-305.399411-316.788201-7.992134-0.999017-13.886332-7.79233-13.886332-15.884366 0-8.891249 7.292822-15.984268 15.984267-15.984268 0.699312 0 1.398623 0 1.998034 0.099902 34.565979 4.395674 68.13294 13.386824 100.301278 27.073353 45.655064 19.281023 86.714651 46.953786 121.979942 82.219076s62.938053 76.324877 82.219076 121.979942c15.884366 37.363225 25.574828 76.724484 28.771681 117.284562 0.099902 0 0.099902 0 0 0z" p-id="4670"></path><path d="M511.496561 511.496561m-111.889873 0a111.889873 111.889873 0 1 0 223.779745 0 111.889873 111.889873 0 1 0-223.779745 0Z" p-id="4671"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1646807143562" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6872" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M688 240c-138 0-252 102.8-269.6 236H249c-14.2-35.2-48.7-60-89-60-53 0-96 43-96 96s43 96 96 96c40.3 0 74.8-24.8 89-60h169.3C436 681.2 550 784 688 784c150.2 0 272-121.8 272-272S838.2 240 688 240z m128 298c0 4.4-3.6 8-8 8h-86v86c0 4.4-3.6 8-8 8h-52c-4.4 0-8-3.6-8-8v-86h-86c-4.4 0-8-3.6-8-8v-52c0-4.4 3.6-8 8-8h86v-86c0-4.4 3.6-8 8-8h52c4.4 0 8 3.6 8 8v86h86c4.4 0 8 3.6 8 8v52z" p-id="6873"></path></svg>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment