Commit cafe7a48 authored by 吴永生#A02208's avatar 吴永生#A02208

feat: 连接线和删除线重置校验信息

parent 2d1e0f78
...@@ -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: 吴永生#A02208 yongsheng.wu@wholion.com * @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-14 10:14:15 * @LastEditTime: 2022-07-14 11:35:44
* @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
*/ */
...@@ -87,7 +87,9 @@ const BatchNode = (props: IBatchNode) => { ...@@ -87,7 +87,9 @@ const BatchNode = (props: IBatchNode) => {
})} })}
> >
{title || ""} {title || ""}
{isCheck && <span className={styles.successDot}></span>} {isCheck && flowType !== "edit" ? (
<span className={styles.successDot}></span>
) : null}
</div> </div>
{outParamsArr?.length && flowType === "edit" {outParamsArr?.length && flowType === "edit"
? outParamsArr.map((item, index) => { ? outParamsArr.map((item, index) => {
......
...@@ -72,6 +72,7 @@ const Flow = (props: IProps) => { ...@@ -72,6 +72,7 @@ const Flow = (props: IProps) => {
const result = const result =
(tasks?.length && (tasks?.length &&
tasks.map((item) => { tasks.map((item) => {
/** 删除batch起始的edges中的一项 === 等于删除了一根连线 */
if (item.id === connection.source && item.type === "BATCH") { if (item.id === connection.source && item.type === "BATCH") {
const newEdges = const newEdges =
(item.edges?.length && (item.edges?.length &&
...@@ -79,10 +80,36 @@ const Flow = (props: IProps) => { ...@@ -79,10 +80,36 @@ const Flow = (props: IProps) => {
(every) => every.sourceHandle !== connection.sourceHandle (every) => every.sourceHandle !== connection.sourceHandle
)) || )) ||
[]; [];
return { return {
...item, ...item,
edges: newEdges, edges: newEdges,
}; };
/** 选中batch结束位置&&更新校验值 */
} else if (item.id === connection.target && item.type === "BATCH") {
const newParameters =
(item.parameters?.length &&
item.parameters.map((every) => {
if (every.name === connection.targetHandle) {
const { error, helperText } =
getCustomTemplateParameterCheckResult({
...every,
isLine: false,
});
return {
...every,
error,
helperText,
};
} else {
return every;
}
})) ||
[];
return {
...item,
parameters: newParameters,
};
} else { } else {
return item; return item;
} }
...@@ -250,6 +277,7 @@ const Flow = (props: IProps) => { ...@@ -250,6 +277,7 @@ const Flow = (props: IProps) => {
return val; return val;
}, [ }, [
tasks, tasks,
flowType,
isFlowNode, isFlowNode,
selectedBatchNodeId, selectedBatchNodeId,
inSideBatchNodeId, inSideBatchNodeId,
...@@ -377,9 +405,12 @@ const Flow = (props: IProps) => { ...@@ -377,9 +405,12 @@ const Flow = (props: IProps) => {
const connectModifyParameters = useCallback( const connectModifyParameters = useCallback(
(parameters: IParameter[], edgeItem: Connection) => { (parameters: IParameter[], edgeItem: Connection) => {
return parameters.map((item) => { return parameters.map((item) => {
const { error, helperText } =
getCustomTemplateParameterCheckResult(item);
if (item.name === edgeItem.targetHandle) { if (item.name === edgeItem.targetHandle) {
const { error, helperText } = getCustomTemplateParameterCheckResult({
...item,
isLine: true,
});
return { ...item, isLine: true, helperText, error }; return { ...item, isLine: true, helperText, error };
} else { } else {
return item; return item;
......
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