Commit 64d50bfb authored by 涂伟's avatar 涂伟

fix: '运维中流程中心组名,流程名称等名称修改,快捷修改'

parent 77b4c432
Pipeline #69732 passed with stages
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import classnames from 'classnames'; import classnames from 'classnames';
import { Tabs, Input, message, Modal, Button, Anchor, Tooltip } from 'antd'; import { Tabs, Input, message, Modal, Button, Anchor, Tooltip, notification } from 'antd';
import { import {
PlusOutlined, PlusOutlined,
EditOutlined, EditOutlined,
...@@ -18,6 +18,7 @@ import FlowGroupModal from './workFlowComponents/FlowGroupModal'; ...@@ -18,6 +18,7 @@ import FlowGroupModal from './workFlowComponents/FlowGroupModal';
import Order from './workFlowComponents/Order'; import Order from './workFlowComponents/Order';
import styles from './WorkflowHomePage.less'; import styles from './WorkflowHomePage.less';
import { WFGetAllFlow, GetFlowNode, DeleteFlow } from '@/services/workflow/workflow'; import { WFGetAllFlow, GetFlowNode, DeleteFlow } from '@/services/workflow/workflow';
import { UpdateFlowGroup } from '@/services/workflow/workflow';
const plugins = [ScrollToPlugin]; const plugins = [ScrollToPlugin];
const { Search } = Input; const { Search } = Input;
const { Link } = Anchor; const { Link } = Anchor;
...@@ -289,6 +290,30 @@ const WorkflowHomePage = () => { ...@@ -289,6 +290,30 @@ const WorkflowHomePage = () => {
console.log(`.${styles.flowTable}`); console.log(`.${styles.flowTable}`);
TweenMax.to(`.${styles.flowTable}`, 1, { scrollTo: val.href }); TweenMax.to(`.${styles.flowTable}`, 1, { scrollTo: val.href });
}; };
const updateFlowGroup = (oldName, newName) => {
if (oldName === newName) {
return;
}
UpdateFlowGroup({
oldName,
newName,
}).then(res => {
if (res.code === 0) {
notification.success({
message: '提示',
duration: 3,
description: '编辑成功',
});
getFlowList();
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
};
return ( return (
<div <div
className={classnames(styles.pageContent, { className={classnames(styles.pageContent, {
...@@ -380,8 +405,26 @@ const WorkflowHomePage = () => { ...@@ -380,8 +405,26 @@ const WorkflowHomePage = () => {
style={{ display: item.children.length > 0 ? 'flex' : 'none' }} style={{ display: item.children.length > 0 ? 'flex' : 'none' }}
> >
<div className={styles.line} /> <div className={styles.line} />
<div className={styles.name} onClick={() => eiditFlowGroup(item, index)}> <div className={styles.name} contenteditable="true">
{item.name} <Input
style={{
width: item.name.length*14 + 'px',
fontSize: '14px',
padding: '0'
}}
placeholder="请输入分组名称"
onBlur={e => {
updateFlowGroup(item.name, e.currentTarget.value);
}}
bordered={false}
defaultValue={item.name}
onInput= {e=> {
e.currentTarget.style.width = (e.currentTarget.value.length) * 14 + "px";
}}
// onPressEnter={e => {
// console.log(e, '触发咯');
// }}
/>
</div> </div>
<EditOutlined <EditOutlined
style={{ marginLeft: '5px' }} style={{ marginLeft: '5px' }}
......
...@@ -203,7 +203,8 @@ ...@@ -203,7 +203,8 @@
.name { .name {
font-size: 14px; font-size: 14px;
color: #2A4260; color: #2A4260;
cursor: pointer; margin: 0 10px;
// cursor: pointer;
} }
} }
......
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