Commit fd10e934 authored by 邓超's avatar 邓超

fix: 规则组件

parent 2f66a49f
Pipeline #62991 waiting for manual action with stages
/*
* @Author: dengchao 754083046@qq.com
* @Date: 2022-11-02 14:37:53
* @LastEditors: dengchao 754083046@qq.com
* @LastEditTime: 2022-11-02 14:40:57
* @FilePath: \maintenance\src\components\RuleConfig\index.jsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import React, { useEffect, useState, useRef } from 'react';
import { Modal, Input, Form } from 'antd';
import styles from './RuleConfig.less';
import styles from './index.less';
import Tree from '@/components/ExpendableTree';
const { TextArea } = Input;
const RuleConfig = props => {
......
import React, { useState, useEffect } from 'react';
import { Button, Modal, notification, Spin, Tooltip } from 'antd';
import lodash from 'lodash';
import { SaveNodeChange, GetFlowNode } from '@/services/workflow/workflow';
import { ExclamationCircleOutlined } from '@ant-design/icons';
......@@ -23,8 +24,8 @@ const nodeTypeList = [
{ nodeTypeName: '普通节点', NodeType: '0', src: imgGeneral },
{ nodeTypeName: '结束节点', NodeType: '2', src: imgEnd },
{ nodeTypeName: '条件网关', NodeType: '20', src: gatewayExclusive },
{ nodeTypeName: '汇合网关', NodeType: '21', src: gatewayInclude },
{ nodeTypeName: '并行网关', NodeType: '22', src: gatewayConfluence },
{ nodeTypeName: '汇合网关', NodeType: '21', src: gatewayInclude },
];
const FlowChart = props => {
const { flowData, flowID, chartLoading, leaveCallBack } = props;
......@@ -88,6 +89,12 @@ const FlowChart = props => {
showDeleteConfirm();
return false;
});
// diagram.addDiagramListener('SelectionDeleted', e => {
// });
console.log(diagram.model, 'diagram.model');
// 监听复制事件并修改复制内容
// setTimeout(() => {}, 1200);
}, []);
useEffect(() => {
if (flowData) {
......@@ -137,6 +144,18 @@ const FlowChart = props => {
nodeDataArray,
linkDataArray: currentFlowData.Lines,
});
// 修改复制后节点内容
diagram.model.copyNodeDataFunction = (obj, model) => {
let copyObj = JSON.parse(JSON.stringify(obj));
delete copyObj.ActivityId;
return copyObj;
};
// 修改复制后线内容
diagram.model.copyLinkDataFunction = (obj, model) => {
let copyObj = lodash.cloneDeep(obj);
delete copyObj.LineId;
return copyObj;
};
// diagram.model.linkKeyProperty = 'LineId';
// diagram.model.makeUniqueLinkKeyFunction = (model, data) => {
// let i = model.linkDataArray.length * 2 + 2;
......@@ -171,7 +190,7 @@ const FlowChart = props => {
'undoManager.isEnabled': true,
allowDragOut: false,
'dragSelectingTool.isEnabled': false, // 禁止多选
allowCopy: false, // 禁止复制
allowCopy: true, // 禁止复制
nodeSelectionAdornmentTemplate: objGo(
go.Adornment,
'Auto',
......@@ -259,7 +278,7 @@ const FlowChart = props => {
{ maxSize: new go.Size(130, NaN), wrap: go.TextBlock.WrapFit, font: 'normal 12pt serif' },
new go.Binding('text', 'nodeDetail', v => {
const obj = JSON.parse(v);
if (obj.NodeType === '20' || obj.NodeType === '21') {
if (obj.NodeType === '20' || obj.NodeType === '21' || obj.NodeType === '22') {
return '';
}
return obj.NodeName;
......@@ -292,6 +311,13 @@ const FlowChart = props => {
makePort('R', go.Spot.Right),
makePort('B', go.Spot.Bottom),
{
linkValidation(fromnode, fromport, tonode, toport, thisLink) {
console.log(fromnode.data, tonode.data, 'aaaaaa');
if (fromnode.data.NodeType === '20' && tonode.data.NodeType === '20') {
return false;
}
return true;
},
// 处理鼠标进入/离开事件以显示/隐藏端口
mouseEnter(e, node) {
showSmallPorts(node, true);
......
......@@ -21,10 +21,11 @@ import {
} from '@ant-design/icons';
import RoalChoose from './nodeModalComponents/RoalChoose';
import Undertaker from './nodeModalComponents/Undertaker';
import RuleConfig from './nodeModalComponents/RuleConfig';
import RuleConfig from '@/components/RuleConfig';
import styles from './NodeModal.less';
import { GetFormDataSource } from '@/services/workflow/workflow';
import { node } from 'prop-types';
const { Option } = Select;
let chnNumChar = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
......@@ -294,7 +295,9 @@ const NodeModal = props => {
// 配置当前规则
const editRule = (msg, index) => {
console.log(msg, 'masgasdg');
let listfleld = msg.TableNames.split(',');
// let listfleld = msg.TableNames.split(',');
let listfleld = talbeList.current;
let list = [
{
TableFieldNames: [
......@@ -310,7 +313,7 @@ const NodeModal = props => {
];
console.log(listfleld, allFieldList.current, 'listfleld1111');
allFieldList.current.forEach(item => {
if (listfleld.some(ele => ele === item.TableName)) {
if (listfleld.some(ele => ele !== item.TableName)) {
if (item.TableName && item.TableFieldNames?.length > 0) {
list.push({
TableFieldNames: item.TableFieldNames,
......
.titleBox {
color: #DCDCDC;
font-size: 14px;
padding-left: 20px;
}
.btnAddRule {
......@@ -26,7 +27,7 @@
.ruleBox {
margin-top: 5px;
margin-bottom: 15px;
.ruleTitle {
display: flex;
justify-content: space-between;
......@@ -34,8 +35,8 @@
align-items: center;
.textContet {
color: #FFA144;
font-size: 18px;
color: #1890ff;
font-size: 16px;
font-weight: 700;
}
......
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