Commit 4ff3e24f authored by 涂伟's avatar 涂伟

fix: '事件和流程审查添加快速搜索功能'

parent 2538feff
...@@ -58,6 +58,8 @@ import ProcessModal from './ProcessModal'; ...@@ -58,6 +58,8 @@ import ProcessModal from './ProcessModal';
import SortModal from './SortModal'; import SortModal from './SortModal';
import ViewModal from './ViewModal'; import ViewModal from './ViewModal';
const { Search } = Input;
const incident = () => { const incident = () => {
const history = useHistory(); const history = useHistory();
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
...@@ -84,6 +86,8 @@ const incident = () => { ...@@ -84,6 +86,8 @@ const incident = () => {
const [hoverItemIndex, setHoverItemIndex] = useState(0); // hover流程索引 const [hoverItemIndex, setHoverItemIndex] = useState(0); // hover流程索引
const [keepIdValue, setKeepIdValue] = useState([]); const [keepIdValue, setKeepIdValue] = useState([]);
const [editBusinessVisible, setEditBusinessVisible] = useState(false); const [editBusinessVisible, setEditBusinessVisible] = useState(false);
const [searchValue, setSearchValue] = useState('');
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [addForm] = Form.useForm(); const [addForm] = Form.useForm();
const [file, setFile] = useState(); // 上传文件信息 const [file, setFile] = useState(); // 上传文件信息
...@@ -95,7 +99,7 @@ const incident = () => { ...@@ -95,7 +99,7 @@ const incident = () => {
width: 150, width: 150,
render: (text,record) => ( render: (text,record) => (
<Tooltip placement="topLeft" title={text}> <Tooltip placement="topLeft" title={text}>
{text} {searchStyle(text)}
</Tooltip> </Tooltip>
), ),
}, },
...@@ -106,7 +110,7 @@ const incident = () => { ...@@ -106,7 +110,7 @@ const incident = () => {
width: 200, width: 200,
render: record => ( render: record => (
<Tooltip placement="topLeft" title={record}> <Tooltip placement="topLeft" title={record}>
{record} {searchStyle(record)}
</Tooltip> </Tooltip>
), ),
}, },
...@@ -316,7 +320,9 @@ const incident = () => { ...@@ -316,7 +320,9 @@ const incident = () => {
useEffect(() => { useEffect(() => {
setTreeLoading(true); setTreeLoading(true);
GetCM_Event_LoadEventTable().then(res => { GetCM_Event_LoadEventTable({
filter: searchValue
}).then(res => {
setTreeLoading(false); setTreeLoading(false);
if (res.code === 0) { if (res.code === 0) {
console.log(res.data); console.log(res.data);
...@@ -375,6 +381,11 @@ const incident = () => { ...@@ -375,6 +381,11 @@ const incident = () => {
console.log(rember); console.log(rember);
console.log(newArr[rember]); console.log(newArr[rember]);
console.log(newArr, 'newArr'); console.log(newArr, 'newArr');
if(!newArr[rember]){
setRember(0)
setPickItem(newArr[0]);
setRember1(newArr[0])
}
setTreeData(newArr); setTreeData(newArr);
} else { } else {
notification.error({ notification.error({
...@@ -582,6 +593,30 @@ const incident = () => { ...@@ -582,6 +593,30 @@ const incident = () => {
}); });
}; };
// 搜索
const handleSearch = text => {
setFlag(flag + 1);
setShowSearchStyle(true);
};
// 搜索框改变时存储输入的值
const handleChange = e => {
setSearchValue(e.target.value);
};
// 模糊查询匹配的样式
const searchStyle = val => {
let n;
if (showSearchStyle) {
n = val.replace(
new RegExp(searchValue, 'g'),
`<span style='color:red'>${searchValue}</span>`,
);
} else {
n = val;
}
return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
return ( return (
<div className={styles.incidentContainer}> <div className={styles.incidentContainer}>
<div className={styles.contentContainers}> <div className={styles.contentContainers}>
...@@ -678,14 +713,26 @@ const incident = () => { ...@@ -678,14 +713,26 @@ const incident = () => {
[styles.userContainerHide]: !treeVisible, [styles.userContainerHide]: !treeVisible,
})} })}
> >
<div style={{ height: '50px' }}> <div style={{ height: '50px', lineHeight: '50px' }}>
{pickItem?<span><span className={styles.titleName}>{pickItem}</span> {pickItem?<span><span className={styles.titleName}>{pickItem}</span>
<span> <span>
<Tooltip title="编辑业务类型名称"> <Tooltip title="编辑业务类型名称">
<FormOutlined className={styles.iconSize} onClick={editBusiness} /> <FormOutlined className={styles.iconSize} onClick={editBusiness} />
</Tooltip> </Tooltip>
</span></span>:null} </span></span>:null}
<span style={{ float: 'right', marginRight: '10px', marginTop: '10px' }}> <span>
<span style={{ marginLeft: '20px', marginRight: '5px' }}>快速检索</span>
<Search
allowClear
placeholder='请输入事件类型或事件主表'
onSearch={handleSearch}
onChange={handleChange}
value={searchValue}
enterButton
style={{ width: '300px',marginTop: '10px' }}
/>
</span>
<span className={styles.buttonList}>
<Upload showUploadList={false} accept=".json" beforeUpload={beforeUpload}> <Upload showUploadList={false} accept=".json" beforeUpload={beforeUpload}>
<Button style={{ marginLeft: '10px' }} type="primary" ghost> <Button style={{ marginLeft: '10px' }} type="primary" ghost>
<div style={{ display: 'flex', alignItems: 'center' }}> <div style={{ display: 'flex', alignItems: 'center' }}>
......
...@@ -421,6 +421,18 @@ ...@@ -421,6 +421,18 @@
line-height: 50px; line-height: 50px;
} }
.buttonList {
float: right;
margin-right: 10px;
margin-top: 10px;
display: flex;
align-items: center;
>span {
display: flex;
}
}
// .panda-pro-pages-platform-center-bsmanager-work-order-incident-filed_listItem { // .panda-pro-pages-platform-center-bsmanager-work-order-incident-filed_listItem {
// display: flex; // display: flex;
// } // }
\ No newline at end of file
...@@ -12,6 +12,7 @@ import { ...@@ -12,6 +12,7 @@ import {
notification, notification,
message, message,
Button, Button,
Input,
} from 'antd'; } from 'antd';
import { import {
DoubleLeftOutlined, DoubleLeftOutlined,
...@@ -30,6 +31,7 @@ import Order from './flowComponents/Order'; ...@@ -30,6 +31,7 @@ import Order from './flowComponents/Order';
import Timelimit from './flowComponents/Timelimit'; import Timelimit from './flowComponents/Timelimit';
import styles from './flow.less'; import styles from './flow.less';
const { Search } = Input;
const Flow = () => { const Flow = () => {
const history = useHistory(); const history = useHistory();
const [tableData, setTableData] = useState([]); // 流程对应的回显的表格 const [tableData, setTableData] = useState([]); // 流程对应的回显的表格
...@@ -40,6 +42,8 @@ const Flow = () => { ...@@ -40,6 +42,8 @@ const Flow = () => {
const [treeVisible, setTreeVisible] = useState(true); const [treeVisible, setTreeVisible] = useState(true);
const [pickItemIndex, setPickItemIndex] = useState(0); // 选中流程索引 const [pickItemIndex, setPickItemIndex] = useState(0); // 选中流程索引
const [hoverItemIndex, setHoverItemIndex] = useState(0); // hover流程索引 const [hoverItemIndex, setHoverItemIndex] = useState(0); // hover流程索引
const [searchValue, setSearchValue] = useState('');
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [visible, setVisible] = useState({ const [visible, setVisible] = useState({
processConfig: false, processConfig: false,
order: false, order: false,
...@@ -47,10 +51,12 @@ const Flow = () => { ...@@ -47,10 +51,12 @@ const Flow = () => {
}); // 弹窗显示 }); // 弹窗显示
// 初始化 // 初始化
useEffect(() => { useEffect(() => {
// 初始化流程列表 if (history.location.state && history.location.state.dataSource) {
getProcessData();
if (history.location.state && history.location.state.pickItemIndex) {
setDataSource('back'); setDataSource('back');
getProcessData(history.location.state.searchValue);
} else {
// 初始化流程列表
getProcessData();
} }
}, []); }, []);
// 表格数据改变后处理 // 表格数据改变后处理
...@@ -62,6 +68,8 @@ const Flow = () => { ...@@ -62,6 +68,8 @@ const Flow = () => {
if (dataSource === 'back') { if (dataSource === 'back') {
setPickItemIndex(history.location.state.pickItemIndex); setPickItemIndex(history.location.state.pickItemIndex);
setTableData(processData[history.location.state.pickItemIndex].root); setTableData(processData[history.location.state.pickItemIndex].root);
setSearchValue(history.location.state.searchValue);
setDataSource('');
} else { } else {
setTableData(processData[pickItemIndex].root); setTableData(processData[pickItemIndex].root);
} }
...@@ -71,13 +79,19 @@ const Flow = () => { ...@@ -71,13 +79,19 @@ const Flow = () => {
setVisible({ ...visible, [key]: value }); setVisible({ ...visible, [key]: value });
}; };
// 初始化流程列表 // 初始化流程列表
const getProcessData = () => { const getProcessData = (filter = '') => {
setTreeLoading(true); setTreeLoading(true);
reloadFlows() if (searchValue) {
setPickItemIndex(0);
}
reloadFlows({
filter,
})
.then(res => { .then(res => {
setTreeLoading(false); setTreeLoading(false);
if (res.code === 0) { if (res.code === 0) {
setProcessData(res.data); setProcessData(res.data);
setTableData(res.data);
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
...@@ -128,12 +142,22 @@ const Flow = () => { ...@@ -128,12 +142,22 @@ const Flow = () => {
console.log(flowName); console.log(flowName);
history.push({ history.push({
pathname: '/biz/workflow/caseNode', pathname: '/biz/workflow/caseNode',
state: { flowName, pickItemIndex, allDisabled: true }, state: { flowName, pickItemIndex, searchValue, allDisabled: true },
}); });
}; };
// 定义表格 // 定义表格
const columns = [ const columns = [
{ title: '名称', dataIndex: 'name', width: 150, align: 'center' }, {
title: '名称',
dataIndex: 'name',
width: 150,
align: 'center',
render: (text, record) => (
<Tooltip placement="topLeft" title={text}>
{searchStyle(text)}
</Tooltip>
),
},
{ {
title: '办理样式', title: '办理样式',
dataIndex: 'extendWebPage', dataIndex: 'extendWebPage',
...@@ -246,6 +270,33 @@ const Flow = () => { ...@@ -246,6 +270,33 @@ const Flow = () => {
), ),
}, },
]; ];
// 搜索
const handleSearch = text => {
// loadTable(text, 'search');
// setSelectTableName('');
// setPickIndex(0);
// setSelect(groupArr[0].type);
getProcessData(text);
setShowSearchStyle(true);
};
// 搜索框改变时存储输入的值
const handleChange = e => {
setSearchValue(e.target.value);
};
// 模糊查询匹配的样式
const searchStyle = val => {
let n;
if (showSearchStyle) {
n = val.replace(
new RegExp(searchValue, 'g'),
`<span style='color:red'>${searchValue}</span>`,
);
} else {
n = val;
}
return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
return ( return (
<PageContainer> <PageContainer>
<div className={styles.flowContainer}> <div className={styles.flowContainer}>
...@@ -305,6 +356,18 @@ const Flow = () => { ...@@ -305,6 +356,18 @@ const Flow = () => {
<div className={styles.processContainer}> <div className={styles.processContainer}>
<div className={styles.buttonList}> <div className={styles.buttonList}>
<span>
<span style={{ marginLeft: '20px', marginRight: '5px' }}>快速检索</span>
<Search
allowClear
placeholder="请输入流程名称"
onSearch={handleSearch}
onChange={handleChange}
value={searchValue}
enterButton
style={{ width: '300px' }}
/>
</span>
<Button <Button
onClick={() => { onClick={() => {
showModal('order', true); showModal('order', true);
......
...@@ -88,13 +88,17 @@ ...@@ -88,13 +88,17 @@
.buttonList { .buttonList {
display: flex; display: flex;
justify-content: flex-end; justify-content: space-between;
margin: 10px 10px 10px 0; margin: 10px 10px 10px 0;
.ant-btn { .ant-btn {
vertical-align: middle; vertical-align: middle;
line-height: 2px; line-height: 2px;
} }
span {
display: flex;
align-items: center;
}
} }
.ant-table-pagination { .ant-table-pagination {
......
...@@ -18,7 +18,7 @@ import end from '@/assets/images/icons/结束节点.png'; ...@@ -18,7 +18,7 @@ import end from '@/assets/images/icons/结束节点.png';
const FlowNode = () => { const FlowNode = () => {
const history = useHistory(); const history = useHistory();
const { flowName, pickItemIndex, allDisabled } = history.location.state; const { flowName, pickItemIndex, allDisabled, searchValue } = history.location.state;
const [visible, setVisible] = useState({ const [visible, setVisible] = useState({
nodeEdit: false, nodeEdit: false,
auxiliaryView: false, auxiliaryView: false,
...@@ -410,7 +410,7 @@ const FlowNode = () => { ...@@ -410,7 +410,7 @@ const FlowNode = () => {
const backFlow = () => { const backFlow = () => {
history.push({ history.push({
pathname: '/biz/workflow/case', pathname: '/biz/workflow/case',
state: { pickItemIndex }, state: { pickItemIndex, searchValue, dataSource: true },
}); });
}; };
// 定义表格 // 定义表格
......
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