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

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

parent 2d1e0f78
......@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-07-12 11:20:29
* @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
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -87,7 +87,9 @@ const BatchNode = (props: IBatchNode) => {
})}
>
{title || ""}
{isCheck && <span className={styles.successDot}></span>}
{isCheck && flowType !== "edit" ? (
<span className={styles.successDot}></span>
) : null}
</div>
{outParamsArr?.length && flowType === "edit"
? outParamsArr.map((item, index) => {
......
......@@ -72,6 +72,7 @@ const Flow = (props: IProps) => {
const result =
(tasks?.length &&
tasks.map((item) => {
/** 删除batch起始的edges中的一项 === 等于删除了一根连线 */
if (item.id === connection.source && item.type === "BATCH") {
const newEdges =
(item.edges?.length &&
......@@ -79,10 +80,36 @@ const Flow = (props: IProps) => {
(every) => every.sourceHandle !== connection.sourceHandle
)) ||
[];
return {
...item,
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 {
return item;
}
......@@ -250,6 +277,7 @@ const Flow = (props: IProps) => {
return val;
}, [
tasks,
flowType,
isFlowNode,
selectedBatchNodeId,
inSideBatchNodeId,
......@@ -377,9 +405,12 @@ const Flow = (props: IProps) => {
const connectModifyParameters = useCallback(
(parameters: IParameter[], edgeItem: Connection) => {
return parameters.map((item) => {
const { error, helperText } =
getCustomTemplateParameterCheckResult(item);
if (item.name === edgeItem.targetHandle) {
const { error, helperText } = getCustomTemplateParameterCheckResult({
...item,
isLine: true,
});
return { ...item, isLine: true, helperText, error };
} else {
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