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 camelcase */
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 {
CM_Feedback_LoadPatrolFeedbacks,
CM_Feedback_RemovePatrolFeedback,
......@@ -20,6 +20,8 @@ import AddModal from './AddModal';
import SortModal from './SortModal';
import DragTable from '@/components/DragTable/DragTable';
const { Search } = Input;
const patrolFeedback = () => {
const [addVisible, setAddVisible] = useState(false);
const [type, setType] = useState('');
......@@ -34,6 +36,7 @@ const patrolFeedback = () => {
const [treeVisible, setTreeVisible] = useState(true); // 左边列表是否可见
const [pickItem, setPickItem] = useState('区域巡检');
const [hoverItemIndex, setHoverItemIndex] = useState('');
const [searchValue, setSearchValue] = useState('');
const columns = [
{
......@@ -201,7 +204,8 @@ const patrolFeedback = () => {
useEffect(() => {
setTreeLoading(true);
CM_Feedback_LoadPatrolFeedbacks({ pageIndex: 0, pageSize: 0 }).then(res => {
CM_Feedback_LoadPatrolFeedbacks({ pageIndex: 1, pageSize: 20, keyword: searchValue }).then(
res => {
setTreeLoading(false);
if (res.code === 0) {
let data = {};
......@@ -240,7 +244,8 @@ const patrolFeedback = () => {
});
setKeepTableData(list);
}
});
},
);
}, [flag]);
const add = () => {
......@@ -314,6 +319,15 @@ const patrolFeedback = () => {
}
};
// 搜索
const handleSearch = text => {
setFlag(flag + 1);
};
// 搜索框改变时存储输入的值
const handleChange = e => {
setSearchValue(e.target.value);
};
return (
<div className={styles.PatrolFeedbackContainer}>
<div className={styles.contentContainers}>
......@@ -398,8 +412,28 @@ const patrolFeedback = () => {
[styles.userContainerHide]: !treeVisible,
})}
>
<div style={{ height: '50px', backgroundColor: 'white' }}>
<span style={{ float: 'right', marginRight: '10px' }}>
<div
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
icon={<PlusOutlined className={styles.icon} />}
onClick={add}
......@@ -432,7 +466,7 @@ const patrolFeedback = () => {
>
<span style={{ marginTop: '-2px' }}>批量删除</span>
</Button>
</span>
</div>
</div>
<Table
// 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