Commit 9816e413 authored by 邓超's avatar 邓超

fix: 修改规则点击新增、线条根据节点颜色修改

parent b611058d
Pipeline #62817 passed with stages
......@@ -194,6 +194,8 @@ const FlowChart = props => {
case '20':
return gatewayExclusive;
case '21':
return gatewayInclude;
case '22':
return gatewayConfluence;
default:
return null;
......@@ -213,6 +215,8 @@ const FlowChart = props => {
return 52;
case '21':
return 52;
case '22':
return 52;
default:
return null;
}
......@@ -232,6 +236,8 @@ const FlowChart = props => {
return 52;
case '21':
return 52;
case '22':
return 52;
default:
return null;
}
......@@ -264,6 +270,8 @@ const FlowChart = props => {
return null;
case '21':
return null;
case '22':
return null;
default:
return null;
......@@ -316,11 +324,39 @@ const FlowChart = props => {
new go.Binding('points').makeTwoWay(),
objGo(
go.Shape, // 链接路径形状
{ isPanelMain: true, strokeWidth: 2, stroke: '#1685FF' },
{
isPanelMain: true,
strokeWidth: 2,
},
new go.Binding('stroke', 'from', v => {
console.log(diagram.model.findNodeDataForKey(v));
const msg = diagram.model.findNodeDataForKey(v);
if (msg.NodeType === '20' || msg.NodeType === '22') {
return 'red';
}
return '#1685FF';
}),
),
objGo(
go.Shape, // 箭头
{ toArrow: 'Standard', stroke: '#1685FF', fill: '#1685FF' },
{ toArrow: 'Standard' },
new go.Binding('stroke', 'from', v => {
console.log(diagram.model.findNodeDataForKey(v));
const msg = diagram.model.findNodeDataForKey(v);
if (msg.NodeType === '20' || msg.NodeType === '22') {
return 'red';
}
return '#1685FF';
}),
new go.Binding('fill', 'from', v => {
console.log(diagram.model.findNodeDataForKey(v));
const msg = diagram.model.findNodeDataForKey(v);
if (msg.NodeType === '20' || msg.NodeType === '22') {
return 'red';
}
return '#1685FF';
}),
),
// {
// // 处理双击
......
......@@ -24,7 +24,6 @@ import Undertaker from './nodeModalComponents/Undertaker';
import RuleConfig from './nodeModalComponents/RuleConfig';
import styles from './NodeModal.less';
import { GetFormDataSource } from '@/services/workflow/workflow';
import { log } from '@antv/g2plot/lib/utils';
const { Option } = Select;
let chnNumChar = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
......@@ -75,7 +74,7 @@ const NodeModal = props => {
// 获取网关连接的节点
if (editMsg.NodeType === '21' || editMsg.NodeType === '20') {
getNextLinkNodes(editMsg.key);
getPreviousLinkNodes(editMsg.key);
// getPreviousLinkNodes(editMsg.key);
setRuleList(editMsg.RuleList);
// 获取表数据
GetFormDataSource({ flowID }).then(res => {
......@@ -88,9 +87,10 @@ const NodeModal = props => {
TableName: item.TableName,
});
}
if (previousLinkNodes.current.some(ele => ele.NodeName === item.NodeName)) {
list.add(item.TableName);
}
list.add(item.TableName);
// if (previousLinkNodes.current.some(ele => ele.NodeName === item.NodeName)) {
// list.add(item.TableName);
// }
});
talbeList.current = [...list];
setFlag(flag + 1);
......@@ -311,7 +311,7 @@ const NodeModal = props => {
'更新时间',
'上报时间',
],
TableName: '默认字段',
TableName: '内部字段',
},
];
console.log(listfleld, allFieldList.current, 'listfleld1111');
......
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, useRef } from 'react';
import { Modal, Input, Form } from 'antd';
import styles from './RuleConfig.less';
import Tree from '@/components/ExpendableTree';
......@@ -8,7 +8,7 @@ const RuleConfig = props => {
const [rule, setRule] = useState([]);
const [expandedKey, setExpandedKey] = useState(''); // 默认展开项
const [currentSelectId, setCurrentSelectId] = useState(''); // 选中得节点
const ruleText = useRef();
const [form] = Form.useForm();
useEffect(() => {
if (visible) {
......@@ -27,18 +27,21 @@ const RuleConfig = props => {
};
// 处理树数据
const mapTree = (val, index) => {
console.log(val, 'val');
return {
title: val.TableName,
key: val.TableName,
children: val.TableFieldNames.map(item => ({
title: item,
key: `${val.TableName}&${item}`,
key: `${val.TableName}.${item}`,
})),
};
};
const onSelect = (prop, treeNode) => {
console.log(prop, treeNode);
if (!treeNode.node.children) {
setRule(`${rule} {${treeNode.node.key}} `);
ruleText.current.focus();
}
setCurrentSelectId(prop[0]);
};
return (
......@@ -71,6 +74,7 @@ const RuleConfig = props => {
autoSize={{ minRows: 19, maxRows: 19 }}
value={rule}
rows={4}
ref={ruleText}
onChange={e => setRule(e.target.value)}
/>
</div>
......
.configContent {
height: 600px;
display: flex;
.leftTree {
width: 250px;
height: 100%;
margin-right: 10px;
overflow-y: scroll;
}
.rightContent {
.textAreaBox {
// height: 400px;
// overflow-y: scroll;
.textArea {
min-height: 400px;
border: 1px solid #ccc;
}
}
}
}
\ 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