Commit 37bbc3ba authored by 皮倩雯's avatar 皮倩雯

fix: '巡检反馈增加搜索'

parent ec1d80be
Pipeline #77000 waiting for manual action with stages
/* eslint-disable react-hooks/rules-of-hooks */ /* eslint-disable react-hooks/rules-of-hooks */
/* eslint-disable camelcase */ /* eslint-disable camelcase */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Space, Table, Popconfirm, Tooltip, Button, notification, Spin, Card } from 'antd'; import { Space, Table, Popconfirm, Tooltip, Button, notification, Spin, Card, Input } from 'antd';
import { import {
CM_Feedback_LoadPatrolFeedbacks, CM_Feedback_LoadPatrolFeedbacks,
CM_Feedback_RemovePatrolFeedback, CM_Feedback_RemovePatrolFeedback,
...@@ -20,6 +20,8 @@ import AddModal from './AddModal'; ...@@ -20,6 +20,8 @@ import AddModal from './AddModal';
import SortModal from './SortModal'; import SortModal from './SortModal';
import DragTable from '@/components/DragTable/DragTable'; import DragTable from '@/components/DragTable/DragTable';
const { Search } = Input;
const patrolFeedback = () => { const patrolFeedback = () => {
const [addVisible, setAddVisible] = useState(false); const [addVisible, setAddVisible] = useState(false);
const [type, setType] = useState(''); const [type, setType] = useState('');
...@@ -34,6 +36,7 @@ const patrolFeedback = () => { ...@@ -34,6 +36,7 @@ const patrolFeedback = () => {
const [treeVisible, setTreeVisible] = useState(true); // 左边列表是否可见 const [treeVisible, setTreeVisible] = useState(true); // 左边列表是否可见
const [pickItem, setPickItem] = useState('区域巡检'); const [pickItem, setPickItem] = useState('区域巡检');
const [hoverItemIndex, setHoverItemIndex] = useState(''); const [hoverItemIndex, setHoverItemIndex] = useState('');
const [searchValue, setSearchValue] = useState('');
const columns = [ const columns = [
{ {
...@@ -201,7 +204,8 @@ const patrolFeedback = () => { ...@@ -201,7 +204,8 @@ const patrolFeedback = () => {
useEffect(() => { useEffect(() => {
setTreeLoading(true); setTreeLoading(true);
CM_Feedback_LoadPatrolFeedbacks({ pageIndex: 0, pageSize: 0 }).then(res => { CM_Feedback_LoadPatrolFeedbacks({ pageIndex: 1, pageSize: 20, keyword: searchValue }).then(
res => {
setTreeLoading(false); setTreeLoading(false);
if (res.code === 0) { if (res.code === 0) {
let data = {}; let data = {};
...@@ -240,7 +244,8 @@ const patrolFeedback = () => { ...@@ -240,7 +244,8 @@ const patrolFeedback = () => {
}); });
setKeepTableData(list); setKeepTableData(list);
} }
}); },
);
}, [flag]); }, [flag]);
const add = () => { const add = () => {
...@@ -314,6 +319,15 @@ const patrolFeedback = () => { ...@@ -314,6 +319,15 @@ const patrolFeedback = () => {
} }
}; };
// 搜索
const handleSearch = text => {
setFlag(flag + 1);
};
// 搜索框改变时存储输入的值
const handleChange = e => {
setSearchValue(e.target.value);
};
return ( return (
<div className={styles.PatrolFeedbackContainer}> <div className={styles.PatrolFeedbackContainer}>
<div className={styles.contentContainers}> <div className={styles.contentContainers}>
...@@ -398,8 +412,28 @@ const patrolFeedback = () => { ...@@ -398,8 +412,28 @@ const patrolFeedback = () => {
[styles.userContainerHide]: !treeVisible, [styles.userContainerHide]: !treeVisible,
})} })}
> >
<div style={{ height: '50px', backgroundColor: 'white' }}> <div
<span style={{ float: 'right', marginRight: '10px' }}> style={{
height: '50px',
backgroundColor: 'white',
display: 'flex',
justifyContent: 'space-between',
}}
>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span style={{ marginLeft: '20px', marginRight: '5px' }}>快速检索:</span>
<Search
allowClear
placeholder="请输入巡检对象名称"
onSearch={handleSearch}
onChange={handleChange}
value={searchValue}
enterButton
style={{ width: '300px' }}
/>
</div>
<div style={{ marginRight: '10px' }}>
<Button <Button
icon={<PlusOutlined className={styles.icon} />} icon={<PlusOutlined className={styles.icon} />}
onClick={add} onClick={add}
...@@ -432,7 +466,7 @@ const patrolFeedback = () => { ...@@ -432,7 +466,7 @@ const patrolFeedback = () => {
> >
<span style={{ marginTop: '-2px' }}>批量删除</span> <span style={{ marginTop: '-2px' }}>批量删除</span>
</Button> </Button>
</span> </div>
</div> </div>
<Table <Table
// rowClassName={setRowClassName} // rowClassName={setRowClassName}
......
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