feat():开发知识检索功能
parent
1b55cb5435
commit
ce1be1eec6
|
|
@ -17,6 +17,8 @@ const apiurl = {
|
||||||
edit: service_fxdd + "/dispatchScheme/update",
|
edit: service_fxdd + "/dispatchScheme/update",
|
||||||
del: service_fxdd + "/dispatchScheme/delete",
|
del: service_fxdd + "/dispatchScheme/delete",
|
||||||
upload: service_fxdd + "/dispatchScheme/file/upload/singleSimple",
|
upload: service_fxdd + "/dispatchScheme/file/upload/singleSimple",
|
||||||
|
getOne:service_fxdd + "/dispatchScheme/getById/"
|
||||||
|
|
||||||
},
|
},
|
||||||
ywgz: {
|
ywgz: {
|
||||||
page: service_fxdd + "/businessRule/pageByTm",
|
page: service_fxdd + "/businessRule/pageByTm",
|
||||||
|
|
@ -24,6 +26,7 @@ const apiurl = {
|
||||||
edit: service_fxdd + "/businessRule/update",
|
edit: service_fxdd + "/businessRule/update",
|
||||||
del: service_fxdd + "/businessRule/delete",
|
del: service_fxdd + "/businessRule/delete",
|
||||||
upload: service_fxdd + "/businessRule/file/upload/singleSimple",
|
upload: service_fxdd + "/businessRule/file/upload/singleSimple",
|
||||||
|
getOne:service_fxdd + "/businessRule/getById/"
|
||||||
},
|
},
|
||||||
gcaq: {
|
gcaq: {
|
||||||
page: service_fxdd + "/projectSafety/pageByTm",
|
page: service_fxdd + "/projectSafety/pageByTm",
|
||||||
|
|
@ -35,6 +38,8 @@ const apiurl = {
|
||||||
saveTree: service_fxdd + "/projectSafety/addCategory",
|
saveTree: service_fxdd + "/projectSafety/addCategory",
|
||||||
editTree: service_fxdd + "/projectSafety/updateCategory",
|
editTree: service_fxdd + "/projectSafety/updateCategory",
|
||||||
deleteTree: service_fxdd + "/projectSafety/delCategory",
|
deleteTree: service_fxdd + "/projectSafety/delCategory",
|
||||||
|
getOne:service_fxdd + "/projectSafety/getById/"
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
file:{
|
file:{
|
||||||
|
|
@ -111,6 +116,7 @@ const apiurl = {
|
||||||
|
|
||||||
// 基本情况
|
// 基本情况
|
||||||
home: {
|
home: {
|
||||||
|
globalSearch:service_fxdd +"/globalSearch/findByName",
|
||||||
yq: service_fxdd + '/real/rain/list',//'/stStbprpB/rainfallStationDetails/rainfallList',//雨情
|
yq: service_fxdd + '/real/rain/list',//'/stStbprpB/rainfallStationDetails/rainfallList',//雨情
|
||||||
sk: service_fxdd + '/stStbprpB/reservoirStationDetails/realTimeWaterLevelList',//水库
|
sk: service_fxdd + '/stStbprpB/reservoirStationDetails/realTimeWaterLevelList',//水库
|
||||||
skjbxx: service_fxdd+ '/attResBase/list',//水库基本信息
|
skjbxx: service_fxdd+ '/attResBase/list',//水库基本信息
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const SearchResultList = ({ data = [], onItemClick, title = "搜索结果" }) =>
|
||||||
>
|
>
|
||||||
<div className="search-result-table-cell name-cell">{item.name}</div>
|
<div className="search-result-table-cell name-cell">{item.name}</div>
|
||||||
<div className="search-result-table-cell type-cell">
|
<div className="search-result-table-cell type-cell">
|
||||||
{appconsts.GlobalSearch_Type[item.type] || item.type}
|
{item.type}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { useLocation } from 'react-router'
|
import { useLocation } from 'react-router'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import { Collapse, DatePicker, Input } from 'antd';
|
import { Collapse, DatePicker, Input, Modal,message } from 'antd';
|
||||||
import './index.less'
|
import './index.less'
|
||||||
import Yujing from './item_yujing/index.js'
|
import Yujing from './item_yujing/index.js'
|
||||||
import Yuqing from './item_yuqing'
|
import Yuqing from './item_yuqing'
|
||||||
|
|
@ -31,7 +31,8 @@ import Tuli3 from '../TuLi/Tuli3.js'
|
||||||
import Tuli4 from '../TuLi/Tuli4.js'
|
import Tuli4 from '../TuLi/Tuli4.js'
|
||||||
import Tuli5 from '../TuLi/Tuli5.js'
|
import Tuli5 from '../TuLi/Tuli5.js'
|
||||||
import SearchResultList from './SearchResultList';
|
import SearchResultList from './SearchResultList';
|
||||||
|
import { httpget } from '../../../utils/request';
|
||||||
|
import apiurl from '../../../service/apiurl';
|
||||||
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
|
|
@ -93,7 +94,7 @@ const HomePage = ({ showPanels }) => {
|
||||||
|
|
||||||
// 在 globalSearch 函数中添加搜索结果状态
|
// 在 globalSearch 函数中添加搜索结果状态
|
||||||
const [searchResults, setSearchResults] = useState([]);
|
const [searchResults, setSearchResults] = useState([]);
|
||||||
const globalSearch = (e) => {
|
const globalSearch = async (e) => {
|
||||||
if (e && e.trim() !== '') {
|
if (e && e.trim() !== '') {
|
||||||
// 设置为空白状态
|
// 设置为空白状态
|
||||||
setShowTable(true);
|
setShowTable(true);
|
||||||
|
|
@ -104,32 +105,61 @@ const HomePage = ({ showPanels }) => {
|
||||||
labelRight: `搜索:${e}`,
|
labelRight: `搜索:${e}`,
|
||||||
icon: 'search'
|
icon: 'search'
|
||||||
});
|
});
|
||||||
|
const res = await httpget(apiurl.home.globalSearch, { name: e })
|
||||||
// 模拟数据
|
if (res.code == 200) {
|
||||||
setTimeout(() => {
|
setSearchResults(res.data);
|
||||||
const mockResults = [
|
|
||||||
{ id: '1', name: '檀树岗水情站', type: 'swst', lgtd: 114.75, lttd: 31.493 },
|
|
||||||
{ id: '2', name: '檀树岗雨情站', type: 'qxst', lgtd: 114.76, lttd: 31.495 },
|
|
||||||
{ id: '3', name: '檀树岗渗压站', type: 'shst', lgtd: 114.77, lttd: 31.497 },
|
|
||||||
{ id: '4', name: '檀树岗位移站', type: 'shst', lgtd: 114.78, lttd: 31.499 },
|
|
||||||
{ id: '5', name: '檀树岗渗流站', type: 'shst', lgtd: 114.79, lttd: 31.501 },
|
|
||||||
{ id: '6', name: '檀树岗土壤墒情站', type: 'stinfo', lgtd: 114.80, lttd: 31.503 },
|
|
||||||
{ id: '7', name: '檀树岗流量站', type: 'swst', lgtd: 114.81, lttd: 31.505 },
|
|
||||||
{ id: '8', name: '檀树岗视频站', type: 'picst', lgtd: 114.82, lttd: 31.507 },
|
|
||||||
{ id: '9', name: '檀树岗湾', type: 'danad', lgtd: 114.83, lttd: 31.509 },
|
|
||||||
{ id: '10', name: '檀树湾', type: 'placement', lgtd: 114.84, lttd: 31.511 },
|
|
||||||
{ id: '11', name: '七里坪镇檀树中学', type: 'bsnssinfo', lgtd: 114.85, lttd: 31.513 },
|
|
||||||
{ id: '12', name: '檀某某', type: 'flrvvlg', lgtd: 114.86, lttd: 31.515 },
|
|
||||||
{ id: '13', name: '檀树岗调度方案', type: 'reservoir', lgtd: 114.87, lttd: 31.517 },
|
|
||||||
{ id: '14', name: '檀树岗调度规则', type: 'reservoir', lgtd: 114.88, lttd: 31.519 },
|
|
||||||
{ id: '15', name: '檀树岗工程安全知识', type: 'daminfo', lgtd: 114.89, lttd: 31.521 },
|
|
||||||
];
|
|
||||||
setSearchResults(mockResults);
|
|
||||||
}, 500);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
const importMap = {
|
||||||
|
'业务规则库': () => import('../../sz/ywgz/form'),
|
||||||
|
'调度方案库': () => import('../../sz/ddfa/form'),
|
||||||
|
'工程安全知识库': () => import('../../sz/khzbgl/form')
|
||||||
|
};
|
||||||
|
// 业务规则库弹框
|
||||||
|
const regularOpen = async (record) => {
|
||||||
|
debugger
|
||||||
|
const id = record?.id.split('-')[0]
|
||||||
|
const com = record.type == '业务规则库' ?
|
||||||
|
{ url: apiurl.zsk.ywgz.getOne } :
|
||||||
|
record.type == '调度方案库' ?
|
||||||
|
{ url: apiurl.zsk.ddfa.getOne } :
|
||||||
|
{ url: apiurl.zsk.gcaq.getOne };
|
||||||
|
const res = await httpget(com.url + id)
|
||||||
|
// 导入业务规则库的Modal组件
|
||||||
|
// 使用映射函数进行导入
|
||||||
|
try {
|
||||||
|
const ModalForm = await importMap[record.type]();
|
||||||
|
|
||||||
|
Modal.destroyAll(); // 先销毁可能存在的其他Modal
|
||||||
|
const modal = Modal.confirm({
|
||||||
|
title: `${record.name}详情`,
|
||||||
|
width: 1000,
|
||||||
|
content: (
|
||||||
|
<ModalForm.default
|
||||||
|
mode="view"
|
||||||
|
record={res}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
icon: null,
|
||||||
|
okButtonProps: { style: { display: 'none' } },
|
||||||
|
cancelButtonProps: { style: { display: 'none' } },
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('模块导入失败:', error);
|
||||||
|
message.error(`无法加载${record.type}详情,请稍后再试`);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const clickItem = (item) => {
|
const clickItem = (item) => {
|
||||||
|
|
||||||
|
//业务规则库
|
||||||
|
if (item.type == '业务规则库' || item.type == '调度方案库' || item.type == '工程安全知识库') {
|
||||||
|
regularOpen(item)
|
||||||
|
}
|
||||||
|
|
||||||
// 判断是否为知识库或安全监测站类型
|
// 判断是否为知识库或安全监测站类型
|
||||||
const isKnowledgeOrMonitoringStation = item.type === 'daminfo' || item.type === 'stinfo';
|
const isKnowledgeOrMonitoringStation = item.type === 'daminfo' || item.type === 'stinfo';
|
||||||
// 如果有经纬度信息,则进行处理
|
// 如果有经纬度信息,则进行处理
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ useEffect(() => {
|
||||||
const tm = record?.tm ? moment(record?.tm) : '';
|
const tm = record?.tm ? moment(record?.tm) : '';
|
||||||
form.setFieldValue('bzsj', tm)
|
form.setFieldValue('bzsj', tm)
|
||||||
if (record?.files.length > 0) {
|
if (record?.files.length > 0) {
|
||||||
setFilesParams(record?.files.split(','))
|
setFilesParams(record?.files)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [mode])
|
}, [mode])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue