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

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

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