From 4a630310f59e9e2fe321d9e56c3f8b46523d03e5 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Mon, 23 Dec 2024 11:01:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9E=B6=E6=9E=84=E5=9B=BE?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E7=89=88=E6=9C=AC=E5=A2=9E=E5=8A=A0=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/timeline/index.jsx | 27 ++++++++++++++++++++++++--- src/components/timeline/index.less | 5 +++++ src/pages/company.jsx | 5 +---- src/pages/user.jsx | 2 +- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/components/timeline/index.jsx b/src/components/timeline/index.jsx index 3c2bbb6..b5267de 100644 --- a/src/components/timeline/index.jsx +++ b/src/components/timeline/index.jsx @@ -7,7 +7,7 @@ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ import React from 'react'; -import { Timeline, Drawer, Popconfirm, message } from 'antd'; +import { Timeline, Drawer, Popconfirm, message, Input } from 'antd'; import styles from './index.less'; import leftTreeShow from './img/leftTree-show.png'; import leftHide from './img/leftTree-hide.png'; @@ -20,6 +20,8 @@ export default class TimeLine extends React.Component { this.state = { timelineList: [], open: true, + timeName: '', + fclass: 0, }; } @@ -53,10 +55,16 @@ export default class TimeLine extends React.Component { } componentDidMount() { - this.searchTimeLines(this.props.url); + this.searchTimeLines(); } - searchTimeLines(url) { + searchTimeLines(fclass = 0) { + const { timeName } = this.state; + this.setState({ fclass: fclass }); + if (fclass != 0) { + this.setState({ timeName: '' }); + } + let url = `/api/bs/hrmorganization/orgchart/timeLines?fclass=${fclass}&timeName=${timeName}`; fetch(url) .then((res) => res.json()) .then((data) => { @@ -72,6 +80,13 @@ export default class TimeLine extends React.Component { }); }; + handleEnterPress = (e) => { + if (e.key === 'Enter') { + // 当按下回车键时触发搜索操作 + this.searchTimeLines(this.state.fclass); + } + }; + render() { const { labelData } = this.props; @@ -103,6 +118,12 @@ export default class TimeLine extends React.Component { onClick={this.setOpen} >