Commit 9bd9cfdb authored by wuyongsheng's avatar wuyongsheng

feat: 应用环境创建不能连接线

parent ee3425e2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-07-12 11:20:29 * @Date: 2022-07-12 11:20:29
* @LastEditors: 吴永生 15770852798@163.com * @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-09-07 10:06:13 * @LastEditTime: 2022-11-10 17:40:11
* @FilePath: /bkunyun/src/views/Project/components/Flow/components/BatchNode.tsx * @FilePath: /bkunyun/src/views/Project/components/Flow/components/BatchNode.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -73,7 +73,7 @@ const BatchNode = (props: IBatchNode) => { ...@@ -73,7 +73,7 @@ const BatchNode = (props: IBatchNode) => {
? "1px solid #FF4E4E" ? "1px solid #FF4E4E"
: "1px solid #fff", : "1px solid #fff",
left: index * 24 + 20, left: index * 24 + 20,
top: '-47px', top: isFlowNode ? '-47px' : '-3px',
}} }}
type="target" type="target"
position={Position.Top} position={Position.Top}
......
...@@ -269,22 +269,23 @@ const Flow = (props: IProps) => { ...@@ -269,22 +269,23 @@ const Flow = (props: IProps) => {
positionYArr.sort((a, b) => { positionYArr.sort((a, b) => {
return a - b; return a - b;
}); });
const initialHeight = isFlowNode(value.id) ? 66 : 12;
let width = 176, let width = 176,
height = 66; height = initialHeight
if (positionXArr?.length) { if (positionXArr?.length) {
const val = positionXArr[positionXArr.length - 1] + 144; const val = positionXArr[positionXArr.length - 1] + 144;
width = val > 176 ? val : width; width = val > 176 ? val : width;
} }
if (positionYArr?.length) { if (positionYArr?.length) {
const val = positionYArr[positionYArr.length - 1] + 74; const val = positionYArr[positionYArr.length - 1] + 74;
height = val > 66 ? val : height; height = val > initialHeight ? val : height;
} }
return { return {
width, width,
height, height,
}; };
}, },
[tasks] [isFlowNode, tasks]
); );
/** 生成初始化node节点 */ /** 生成初始化node节点 */
...@@ -322,7 +323,7 @@ const Flow = (props: IProps) => { ...@@ -322,7 +323,7 @@ const Flow = (props: IProps) => {
/** 样式 */ /** 样式 */
style: { style: {
...getBatchStyle(item), ...getBatchStyle(item),
marginTop: "-44px", marginTop: isFlowNode(item.id) ? "-44px": '0px',
padding: "12px 20px 20px 20px", padding: "12px 20px 20px 20px",
visibility: 'visible', visibility: 'visible',
}, },
...@@ -495,7 +496,7 @@ const Flow = (props: IProps) => { ...@@ -495,7 +496,7 @@ const Flow = (props: IProps) => {
const getClassType = useCallback( const getClassType = useCallback(
(connection: Connection) => { (connection: Connection) => {
let inputClassType = "", let inputClassType = "",
outClassType: string | undefined = undefined; outClassType: string | undefined = '';
tasks?.length && tasks?.length &&
tasks.forEach((item) => { tasks.forEach((item) => {
if ([connection.source, connection.target].includes(item.id)) { if ([connection.source, connection.target].includes(item.id)) {
...@@ -613,7 +614,7 @@ const Flow = (props: IProps) => { ...@@ -613,7 +614,7 @@ const Flow = (props: IProps) => {
getTaskType(connection.target as string) === "FLOW" getTaskType(connection.target as string) === "FLOW"
) { ) {
return; return;
} else if (inputClassType === outClassType) { } else if (outClassType && (inputClassType.includes(outClassType) || outClassType.includes(inputClassType))) {
result = connectCheck(connection) as ITask[]; result = connectCheck(connection) as ITask[];
} else { } else {
Message.error("端口数据类型不一致,无法连接!"); Message.error("端口数据类型不一致,无法连接!");
......
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