Commit 018809d5 authored by 邓超's avatar 邓超

fix: 添加规则函数,修改时限配置限制

parent 1993ab59
Pipeline #64603 passed with stages
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!-- Generator: Adobe Illustrator 24.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="108px" height="42px" viewBox="0 0 108 42" style="enable-background:new 0 0 108 42;" xml:space="preserve">
<style type="text/css">
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#F5F7FB;}
.st1{fill:#DEE3EE;}
.st2{fill:url(#SVGID_1_);}
.st3{fill:#FFFFFF;}
.st4{fill:#9850F6;}
.st5{opacity:0.85;}
</style>
width="108px" height="42px" viewBox="0 0 108 42" enable-background="new 0 0 108 42" xml:space="preserve">
<g>
<path class="st0" d="M8.6,0.7h90.5c4.4,0,8,4.4,8,8.1v24.4c0,4.5-3.6,8.1-8,8.1H8.6c-3.7,0-8-3.6-8-8.1V8.8C0.6,5,4.9,0.7,8.6,0.7z
"/>
<path class="st1" d="M99.1,41.9H8.6c-4,0-8.5-3.8-8.5-8.6V8.8c0-4,4.6-8.6,8.5-8.6h90.5c4.8,0,8.5,4.6,8.5,8.6v24.4
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F5F7FB" d="M8.6,0.7h90.5c4.4,0,8,4.4,8,8.1v24.4c0,4.5-3.6,8.1-8,8.1H8.6
c-3.7,0-8-3.6-8-8.1V8.8C0.6,5,4.9,0.7,8.6,0.7z"/>
<path fill="#DEE3EE" d="M99.1,41.9H8.6c-4,0-8.5-3.8-8.5-8.6V8.8c0-4,4.6-8.6,8.5-8.6h90.5c4.8,0,8.5,4.6,8.5,8.6v24.4
C107.7,38,103.8,41.9,99.1,41.9z M8.6,1.2c-3.5,0-7.5,4.1-7.5,7.6v24.4c0,4.2,4.1,7.6,7.5,7.6h90.5c4.2,0,7.5-3.4,7.5-7.6V8.8
c0-3.5-3.4-7.6-7.5-7.6C99.1,1.2,8.6,1.2,8.6,1.2z"/>
</g>
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="3.6177" y1="20" x2="35.1177" y2="20">
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="13.8618" y1="22" x2="45.3618" y2="22" gradientTransform="matrix(1 0 0 -1 0 42)">
<stop offset="0" style="stop-color:#EEEEF1"/>
<stop offset="1" style="stop-color:#FEFFFF"/>
</linearGradient>
<path class="st2" d="M25.9,29.4H12.8c-5.1,0-9.2-4.1-9.2-9.2v-0.4c0-5.1,4.1-9.2,9.2-9.2h13.1c5.1,0,9.2,4.1,9.2,9.2v0.4
C35.1,25.3,31,29.4,25.9,29.4z"/>
<path class="st1" d="M25.9,29.9H12.8c-5.4,0-9.7-4.4-9.7-9.7v-0.4c0-5.4,4.4-9.7,9.7-9.7h13.1c5.4,0,9.7,4.4,9.7,9.7v0.4
C35.6,25.6,31.3,29.9,25.9,29.9z M12.8,11.1c-4.8,0-8.7,3.9-8.7,8.7v0.4c0,4.8,3.9,8.7,8.7,8.7h13.1c4.8,0,8.7-3.9,8.7-8.7v-0.4
c0-4.8-3.9-8.7-8.7-8.7H12.8z"/>
<path fill="url(#SVGID_1_)" d="M36.162,29.4h-13.1c-5.1,0-9.2-4.1-9.2-9.2v-0.4c0-5.1,4.1-9.2,9.2-9.2h13.1c5.1,0,9.2,4.1,9.2,9.2
v0.4C45.362,25.3,41.262,29.4,36.162,29.4z"/>
<path fill="#DEE3EE" d="M36.162,29.9h-13.1c-5.4,0-9.7-4.4-9.7-9.7v-0.4c0-5.4,4.4-9.7,9.7-9.7h13.1c5.4,0,9.7,4.4,9.7,9.7v0.4
C45.862,25.6,41.562,29.9,36.162,29.9z M23.062,11.1c-4.8,0-8.7,3.9-8.7,8.7v0.4c0,4.8,3.9,8.7,8.7,8.7h13.1c4.8,0,8.7-3.9,8.7-8.7
v-0.4c0-4.8-3.9-8.7-8.7-8.7C36.162,11.1,23.062,11.1,23.062,11.1z"/>
</g>
<g>
<path class="st3" d="M25.2,26.8H13.6c-3.7,0-6.8-3-6.8-6.8v0c0-3.7,3-6.8,6.8-6.8h11.6c3.7,0,6.8,3,6.8,6.8v0
C32,23.7,28.9,26.8,25.2,26.8z"/>
<path class="st4" d="M25.2,27.3H13.6c-4,0-7.3-3.3-7.3-7.3c0-4,3.3-7.3,7.3-7.3h11.6c4,0,7.3,3.3,7.3,7.3
C32.5,24,29.2,27.3,25.2,27.3z M13.6,13.7c-3.5,0-6.3,2.8-6.3,6.3s2.8,6.3,6.3,6.3h11.6c3.5,0,6.3-2.8,6.3-6.3s-2.8-6.3-6.3-6.3
H13.6z"/>
</g>
<g class="st5">
<path d="M37.7,20h5.7v-1.8c1.1-0.7,2.2-1.4,3.2-2.3h-7.4v-1.2h9.2V16c-1.1,1.1-2.3,2-3.6,2.9V20h5.1v1.3h-5.1v4.2
c0,0.9-0.4,1.4-1.3,1.4H41l-0.4-1.3c0.7,0,1.4,0,2.3,0c0.4,0,0.6-0.2,0.6-0.6v-3.8h-5.7V20z"/>
<path d="M51.6,17.7c0.9,0.7,1.6,1.4,2.2,2l-0.9,0.9c-0.5-0.6-1.2-1.3-2.2-2L51.6,17.7z M53.9,21.8c-0.5,1.8-1.1,3.5-1.8,5L51,26.3
c0.7-1.7,1.3-3.3,1.8-4.9L53.9,21.8z M52,14.4c0.9,0.6,1.6,1.2,2.1,1.8l-0.9,0.9c-0.6-0.6-1.3-1.2-2.2-1.8L52,14.4z M56.5,20.7
c-0.1,1.8-0.2,3.2-0.5,4c-0.3,0.9-0.9,1.6-1.7,2.3l-0.8-1c0.6-0.5,1.1-1.1,1.3-1.9c0.2-0.7,0.4-1.8,0.4-3.4H56.5z M54.5,19.1
l0.3-0.1c0.5-0.3,1.1-1,1.8-2.3h-2.2v-1.2h3.7c-0.2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0.4-1.4,0.4c-0.4,0-0.9,0-1.5,0l-0.4-1.3
c0.7,0,1.2,0,1.5,0c0.3,0,0.5-0.1,0.7-0.2c0.1-0.2,0.2-0.6,0.3-1.2c0-0.2,0.1-1,0.1-2.3h-4V27h-1.3V19.7z"/>
<path d="M92.9,23.9c-0.5,1.2-1.1,2.2-1.8,3.1L90,26.2c0.7-0.8,1.2-1.7,1.7-2.8L92.9,23.9z M95.5,14.3h1.3v1.2h5.3v1.2h-5.3v1.5h4.4
v4.7h-9.4v-4.7h3.7V14.3z M99.9,21.7v-2.2h-6.8v2.2H99.9z M95.1,23.8c0.3,0.9,0.5,1.8,0.7,2.9L94.5,27c-0.2-1.1-0.4-2.1-0.7-2.9
L95.1,23.8z M97.9,23.6c0.4,0.9,0.7,1.9,1.1,3L97.7,27c-0.3-1.2-0.6-2.2-1-3.1L97.9,23.6z M100.7,23.3c0.9,1.1,1.5,2.1,2,3
l-1.1,0.8c-0.5-1-1.2-2-2-3L100.7,23.3z"/>
<path fill="#FFFFFF" d="M35.462,26.8h-11.6c-3.7,0-6.8-3-6.8-6.8l0,0c0-3.7,3-6.8,6.8-6.8h11.6c3.7,0,6.8,3,6.8,6.8l0,0
C42.262,23.7,39.162,26.8,35.462,26.8z"/>
<path fill="#9850F6" d="M35.462,27.3h-11.6c-4,0-7.3-3.3-7.3-7.3s3.3-7.3,7.3-7.3h11.6c4,0,7.3,3.3,7.3,7.3
S39.462,27.3,35.462,27.3z M23.862,13.7c-3.5,0-6.3,2.8-6.3,6.3s2.8,6.3,6.3,6.3h11.6c3.5,0,6.3-2.8,6.3-6.3s-2.8-6.3-6.3-6.3
H23.862z"/>
</g>
<path d="M49.9,20h5.7v-1.8c1.1-0.7,2.2-1.4,3.2-2.3h-7.4v-1.2h9.2V16c-1.1,1.1-2.3,2-3.6,2.9V20h5.1v1.3H57v4.2
c0,0.9-0.4,1.4-1.3,1.4h-2.5l-0.4-1.3c0.7,0,1.4,0,2.3,0c0.4,0,0.6-0.2,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1.9,1.9l-0.7,1.1c-0.5-0.8-0.9-1.4-1.1-1.8v6h-1.3v-5.8c-0.5,1.2-1,2.3-1.7,3.2l-0.6-1.5
c1-1.1,1.7-2.3,2.1-3.7h-1.8V17.9z M84.368,20h7v1.2h-2.9v1.4h2.5v1.2h-2.5v1.5h3.2v1.2h-7.8v-1.2h3.3v-1.5h-2.4v-1.2h2.4v-1.4h-2.7
V20H84.368z M84.868,14.7h6.1v4.2h-6.1V14.7z M89.668,17.7v-1.9h-3.5v1.9H89.668z"/>
</svg>
/*
* @Author: dengchao 754083046@qq.com
* @Date: 2022-11-02 14:37:53
* @LastEditors: dengchao 754083046@qq.com
* @LastEditTime: 2022-11-09 15:36:19
* @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 { RuleValidation } from '@/services/workflow/workflow';
import { Modal, Input, Form, message } from 'antd';
import { Modal, Input, Form, message, Dropdown, Menu } from 'antd';
import styles from './index.less';
import Tree from '@/components/ExpendableTree';
const { TextArea } = Input;
const fnList = [{ label: '是否为工作日', value: '$fn.isWorkTime()' }];
const RuleConfig = props => {
const { visible, handleCancel, fieldList, onSubumit, RuleContent, flag } = props;
const [rule, setRule] = useState([]);
......@@ -51,12 +44,31 @@ const RuleConfig = props => {
});
const onSelect = (prop, treeNode) => {
console.log(prop, treeNode);
if (!treeNode.node.children) {
setRule(`${rule} {${treeNode.node.key}} `);
ruleText.current.focus();
insert(treeNode.node.key);
}
setCurrentSelectId(prop[0]);
};
const insert = text => {
let rangeIndex = document.getElementById('ruleText').selectionStart;
setRule(`${rule.slice(0, rangeIndex)} {${text}} ${rule.slice(rangeIndex)}`);
rangeIndex += text.toString().length;
ruleText.current.focus();
document.getElementById('ruleText').setSelectionRange(rangeIndex, rangeIndex); // 重新定位光标
};
const insertFn = value => {
insert(value);
};
const fnListRender = (
<Menu>
{fnList.map(item => (
<Menu.Item key={item.value} onClick={() => insertFn(item.value)}>
{item.label}
</Menu.Item>
))}
</Menu>
);
return (
<div>
<Modal
......@@ -83,7 +95,12 @@ const RuleConfig = props => {
<div className={styles.rightContent}>
{flag == 1 && <div className={styles.title}>符合以下条件时工单扭转到对应的节点</div>}
<div className={styles.textAreaBox}>
<Dropdown overlay={fnListRender} placement="bottom" arrow>
<div className={styles.insertFn}>插入函数</div>
</Dropdown>
<TextArea
id="ruleText"
autoSize={{ minRows: 19, maxRows: 19 }}
value={rule}
rows={4}
......@@ -91,6 +108,7 @@ const RuleConfig = props => {
onChange={e => setRule(e.target.value)}
/>
</div>
<ul className={styles.tipBox}>
<li>
<p>请从左侧面板选择字段或选项</p>
......
......@@ -22,6 +22,18 @@
.textAreaBox {
// height: 400px;
// overflow-y: scroll;
position: relative;
.insertFn {
position: absolute;
bottom: 10px;
right: 10px;
border: 1px solid #1890FF;
padding: 2px 15px;
border-radius: 5px;
z-index: 1;
cursor: pointer;
}
textArea {
// min-height: 200px;
......
......@@ -54,6 +54,7 @@ const FlowChart = props => {
const [flag, setFlag] = useState(0);
const currentNode = useRef();
const afterNodes = useRef(new Map([])); // 当前节点后所有节点
const limitFinshNodes = useRef([new Set([])]);
const objGo = go.GraphObject.make;
useEffect(() => {
if (treeVisible) {
......@@ -1070,9 +1071,16 @@ const FlowChart = props => {
if (key === 'roleList') {
diagram.model.setDataProperty(currentNode.current, 'nodeDetail', nodeDetail);
}
if (key === 'FlowTimerList') {
const list = value.map(item => item.EndNode);
limitFinshNodes.current = new Set(list);
setFlag(flag + 1);
// limitFinshNodes;
}
if (key === 'TableName') {
setFlag(flag + 1);
}
diagram.rebuildParts();
leaveCallBack(true);
};
......@@ -1209,6 +1217,7 @@ const FlowChart = props => {
modalType={modalType}
nodeChage={nodeChage}
currentNode={currentNode.current}
limitFinshNodes={[...limitFinshNodes.current]}
afterNodes={Object.fromEntries(afterNodes.current)}
handleCancel={() => setVisible(false)}
onSubumit={obj => nodeCallBack(obj)}
......
......@@ -15,7 +15,16 @@ import CongfigHeightMsg from './nodeModalComponents/CongfigHeightMsg';
import styles from './NodeModal.less';
const tabList = ['常用配置', '权限配置', '高级配置'];
const NodeModal = props => {
const { flowData, onSubumit, editMsg, flowID, nodeChage, currentNode, afterNodes } = props;
const {
flowData,
onSubumit,
editMsg,
flowID,
nodeChage,
currentNode,
afterNodes,
limitFinshNodes,
} = props;
const [activeConfig, setActiveConfig] = useState('常用配置');
const refConfigSubprocess = useRef();
......@@ -158,6 +167,7 @@ const NodeModal = props => {
nodeChage={nodeChage}
editMsg={currentNode}
afterNodes={afterNodes}
limitFinshNodes={limitFinshNodes}
flowID={flowID}
/>
{/* 辅助视图 */}
......
......@@ -14,6 +14,7 @@ const AddModal = props => {
afterNodes,
nodeMsg,
configList,
limitFinshNodes,
} = props;
const [timeLimitFlowNodes, setTimeLimitFlowNodes] = useState([]);
......@@ -152,7 +153,7 @@ const AddModal = props => {
<Option
value={item}
key={index}
disabled={configList?.some(ele => ele.EndNode === item)}
disabled={limitFinshNodes?.some(ele => ele === item)}
>
{item}
</Option>
......
......@@ -308,7 +308,7 @@ const ConfigNodeMsg = (props, ref) => {
<Form.Item label="工单主表" name="TableName">
<Select placeholder="请选择工单主表" onChange={changTable} showSearch>
{eventTable.map(item => (
<Option value={item.Name} key={item.ID}>
<Option value={item.Name} key={item.Name}>
{item.Name}
</Option>
))}
......
......@@ -198,7 +198,7 @@ const ConfigOperate = (props, ref) => {
>
<Select placeholder="请选择回退节点">
{backNodes.map(item => (
<Option value={item.Name} key={item.ID}>
<Option value={item.Name} key={item.Name}>
{item.Name}
</Option>
))}
......
......@@ -4,7 +4,7 @@ import { DeleteOutlined, EditTwoTone, PlusOutlined } from '@ant-design/icons';
import AddLimit from './AddLimit';
const ConfigTimeLimit = (props, ref) => {
const { editMsg, nodeChage, afterNodes } = props;
const { editMsg, nodeChage, afterNodes, limitFinshNodes } = props;
const [viewModal, setViewModal] = useState(false); // 编辑模态框
const [modalType, setModalType] = useState(''); // 模态框是编辑还是修改的状态
......@@ -117,7 +117,7 @@ const ConfigTimeLimit = (props, ref) => {
<Table
dataSource={tableData.current}
columns={columns}
rowKey={record => record.ID}
rowKey={record => record.key}
bordered
size="small"
onRow={record => ({
......@@ -136,6 +136,7 @@ const ConfigTimeLimit = (props, ref) => {
modalType={modalType}
handleCancel={() => setViewModal(false)}
afterNodes={afterNodes}
limitFinshNodes={limitFinshNodes}
configList={tableData.current}
onSubumit={saveView}
/>
......
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