diff --git a/src/assets/images/zcd.png b/src/assets/images/zcd.png new file mode 100644 index 0000000..66e3e9d Binary files /dev/null and b/src/assets/images/zcd.png differ diff --git a/src/assets/images/zcdSelect.png b/src/assets/images/zcdSelect.png new file mode 100644 index 0000000..0f14129 Binary files /dev/null and b/src/assets/images/zcdSelect.png differ diff --git a/src/components/DashboardLayout/SiderMenu.tsx b/src/components/DashboardLayout/SiderMenu.tsx index f8ed96d..4ec60d4 100644 --- a/src/components/DashboardLayout/SiderMenu.tsx +++ b/src/components/DashboardLayout/SiderMenu.tsx @@ -26,6 +26,7 @@ const SiderMenu: React.FC<{ const [openKeys, setOpenKeys] = useState([`${menuIndexes[1]}`]); console.log('openKeys', openKeys) console.log(subMenu); + const [irSelect,setIr] =useState('') const location = useLocation(); const pathname = location.pathname; @@ -33,11 +34,22 @@ const SiderMenu: React.FC<{ const navigate = useNavigate(); function goto(url: string) { + setIr(url) if (pathname !== url) { navigate(url); } } + const getIcon = (item: any) => { + + const idx = item.children?.findIndex((item:any)=>irSelect == item.path) + if(item.path == irSelect || (idx !== -1&&idx !== undefined)){ + return 'zcdSelect' + }else{ + return 'zcd' + } + } + // useEffect(() => { // if (openKeys?.[0] === 'undefined') { @@ -93,7 +105,7 @@ const SiderMenu: React.FC<{ { subMenu.map((o: any) => ( o.children && o.children.length > 0 ? ( - : } + } title={ {o.title} {renderPop(o.title) && goto(oo.path)} - key={oo.id}>{oo.title} + key={oo.id} + icon={} + >{oo.title} {renderPop(oo.title) &&
: } + icon={} onClick={() => goto(o.path)} key={o.id}>
{o.title} diff --git a/src/components/DashboardLayout/index.tsx b/src/components/DashboardLayout/index.tsx index 81445cb..a1021c6 100644 --- a/src/components/DashboardLayout/index.tsx +++ b/src/components/DashboardLayout/index.tsx @@ -17,55 +17,6 @@ import { httppost2 } from '../../utils/request'; import apiurl from '../../service/apiurl'; const { Header, Content, Sider } = Layout; -const meunObj:any = { - 'home':'基本情况', - 'fxzb':'防汛准备', - 'sxfd':'思想发动', - 'fxkhgzh':'防汛抗旱工作会', - 'fbzrh':'防办主任会', - 'fxpxb':'防汛培训班', - 'fxtj':'防汛图件', - 'zzjg':'组织机构', - 'zq':'政区', - 'gc':'工程', - 'gczx':'工程整修', - 'ytygc':'已投运工程', - 'zjgc':'在建工程', - 'hdqz':'河道清障', - 'yaxb':'预案修编', - 'zqya':'政区预案', - 'ytygcya':'已投运工程预案', - 'zjgcya':'在建工程预案', - 'hsddya':'洪水调度方案', - 'qxdw':'抢险队伍', - 'qxwl':'抢险物料', - 'jczw':'检测站网', - 'yqz':'雨情站', - 'sqz':'水情站', - 'zbb':'值班表', - 'txl':'通讯录', - 'ysgzq':'雨水工灾情', - 'ssyq':'实时雨情', - 'sssq':'实时水情', - 'ssgq':'实时工情', - 'yxqk':'运行情况', - 'gcxq':'工程险情', - 'dbaq':'大坝安全监测数据', - 'sszq':'实时灾情', - 'fxdd':'防汛调度', - 'dqxsfx':'当前形势分析', - 'tqyb':'天气预报', - 'hsyb':'洪水预报', - 'skhs':'水库洪水', - 'hdhs':'河道洪水', - 'ddjc':'调度决策', - 'yjxy':'应急响应', - 'ddzl':'调度指令', - 'videoSurveillance':'视频监控', - 'fxdp':'防汛大屏', -} - - const DashboardLayout: React.FC = () => { @@ -110,34 +61,7 @@ const DashboardLayout: React.FC = () => { setRefresh(true); }; - - // 这个方法是统计菜单点击情况的 - // useEffect(()=>{ - // (async()=>{ - // const list = location.pathname.split('/') - // let menu1:any = meunObj?.[list[2]] - // let menu2:any = meunObj?.[list[3]] - // let menu3:any = meunObj?.[list[4]] - // if(menu1==='基本情况'){ - // menu2 = '基本情况' - // } - // if(menu1==='视频监控'){ - // menu2 = '视频监控' - // } - // if(menu1==='防汛大屏'){ - // menu2 = '防汛大屏' - // } - - // const res = await httppost2(apiurl.setMenu,{ - // createId:localStorage.getItem('userId'), - // loginType:0, - // menu1:menu1, - // menu2:menu2, - // menu3:menu3 - // }) - // })() - // },[location.pathname]) const menuIndexes = useMemo(() => findMenu(menu, pathname), [menu, pathname]); diff --git a/src/components/fileUpload/index.js b/src/components/fileUpload/index.js index 8592b6c..436cf5c 100644 --- a/src/components/fileUpload/index.js +++ b/src/components/fileUpload/index.js @@ -1,68 +1,71 @@ -import React,{useState,useEffect} from 'react' -import { Upload, Row, Col,Image,message,Modal } from "antd" -import { DeleteOutlined, FileWordOutlined, FilePdfOutlined,FileJpgOutlined, FileZipOutlined, FilePptOutlined, FileExcelOutlined } from '@ant-design/icons'; +import React, { useState, useEffect } from 'react' +import { Upload, Row, Col, Image, message, Modal } from "antd" +import { DeleteOutlined, FileWordOutlined, FilePdfOutlined, FileJpgOutlined, FileZipOutlined, FilePptOutlined, FileExcelOutlined } from '@ant-design/icons'; import './index.less' import { httpget, httpGetFile, httppost } from '../../utils/request'; import apiurl from '../../service/apiurl'; const { Dragger } = Upload; -export default function FileUpload({ mode,setFileIds,files }) { - const [fileList, setFileList] = useState([]) //上传文件列表 - const [iframeSrc, setIframeSrc] = useState('') - const [pdfViewOPen, setPdfViewOPen] = useState(false) - const [loading, setLoading] = useState(false) - /** - * @description 删除上传的图片 - * @param {string} id 删除的id - */ - const deleteFile = async(fileId) => { + +export default function FileUpload({ mode, setFileIds, files, downloadUrl, uploadUrl }) { + const url = "http://223.75.53.141:9102/test.by-lyf.tmp" + const [fileList, setFileList] = useState([]) //上传文件列表 + const [iframeSrc, setIframeSrc] = useState('') + const [pdfViewOPen, setPdfViewOPen] = useState(false) + const [loading, setLoading] = useState(false) + /** +* @description 删除上传的图片 +* @param {string} id 删除的id +*/ + const deleteFile = async (fileId) => { let filterFile = fileList.filter(item => item.response?.data?.fileId !== fileId); setFileList(filterFile) - setFileIds(filterFile.map(item => item.response?.data?.fileId)) + setFileIds(filterFile.map(item => ({fileId:item.response?.data?.fileId}))) } - - const fileChange = (info) => { - if (info.file.status === "done") { - setLoading(false); - } - if (info.file.status === "uploading") { - setLoading(true); - } - if (info.file.status === "error") { - message.error("文件上传失败") - setLoading(false); - } - let fileIds = info.fileList.map(file => { - return file.response?.data?.fileId - }) - setFileIds(fileIds) - setFileList(info.fileList) - console.log("info.fileList",info.fileList); - - } - - - /** - * @description 文件下载 - * @param {String} params 文件fileId - */ + const fileChange = (info) => { + if (info.file.status === "done") { + setLoading(false); + } + if (info.file.status === "uploading") { + setLoading(true); + } + if (info.file.status === "error") { + message.error("文件上传失败") + setLoading(false); + } + let fileIds = info.fileList.map(file => { + return { + fileId:file.response?.data?.fileId + } + }) + setFileIds(fileIds) + setFileList(info.fileList) + console.log("info.fileList", info.fileList); + + } + + + + /** +* @description 文件下载 +* @param {String} params 文件fileId +*/ const download = (params) => { let downloadLink = document.createElement("a"); - // downloadLink.href = `http://192.168.66.7:20010/fileAssociations/downloadFile/${params?.fileId}`; - downloadLink.href = `http://223.75.53.141:81/shzh/jcsj/fileAssociations/downloadFile/${params?.fileId}`; - downloadLink.download = `${params.fileName}`; - downloadLink.style.display = "none"; - // 将链接添加到页面中 - document.body.appendChild(downloadLink); + downloadLink.href = `${downloadUrl}/${params?.fileId}`; + downloadLink.download = `${params.fileName}`; + downloadLink.style.display = "none"; + // 将链接添加到页面中 + document.body.appendChild(downloadLink); - // 模拟点击事件,开始下载 - downloadLink.click(); - } - - /** - * @description pdf文件预览 - * @param {String} params 文件预览url - */ + // 模拟点击事件,开始下载 + downloadLink.click(); + } + + /** +* @description pdf文件预览 +* @param {String} params 文件预览url +*/ const viewPdf = (params) => { setIframeSrc(params.fileId) setPdfViewOPen(true) @@ -70,113 +73,113 @@ export default function FileUpload({ mode,setFileIds,files }) { useEffect(() => { if (mode != "save" && files) { - setFileList(files.map(file => ({...file,name:file.fileName,response:{data:{name:file.fileName,fileId:file.fileId}}}))) - setFileIds(files.map(item => item.response?.data?.fileId)) + setFileList(files.map(file => ({ ...file, name: file.fileName, response: { data: { name: file.fileName, fileId: file.fileId,filePath:file.filePath } } }))) + setFileIds(files.map(item => ({fileId:item.response?.data?.fileId}))) } - }, [mode,files]) - + }, [mode, files]) + return ( -
- {mode !== "view" && - { console.log(info.dataTransfer.files); }} - fileList={fileList} - disabled={loading} - showUploadList={false} - // onSuccess={handleSuccess} - > -

点击或拖拽文件到此区域上传

-

- 支持扩展名:.rar .zip .doc .docx .pdf .jpg .png .ppt -

-
- } - - { - loading ? 文件正在上传中,请等待 : - fileList.length > 0 && fileList.map(file => { - return ( - -
-
- {file.name.indexOf('.docx') > -1 ? +
+ {mode !== "view" && + { console.log(info.dataTransfer.files); }} + fileList={fileList} + disabled={loading} + showUploadList={false} + // onSuccess={handleSuccess} + > +

点击或拖拽文件到此区域上传

+

+ 支持扩展名:.rar .zip .doc .docx .pdf .jpg .png .ppt +

+
+ } + + { + loading ? 文件正在上传中,请等待 : + fileList.length > 0 && fileList.map(file => { + return ( + +
+
+ {file.name.indexOf('.docx') > -1 ? +
{ download(file.response?.data) }} + style={{ cursor: 'pointer' }} + > + +
+ : + file.name.indexOf('.pdf') > -1 ? +
{ viewPdf(file.response?.data) }} + style={{ cursor: 'pointer' }} + > + +
+ : + file.name.indexOf('.zip') > -1 ?
{ download(file.response?.data) }} style={{ cursor: 'pointer' }} > - +
- : - file.name.indexOf('.pdf') > -1 ? + : + file.name.indexOf('.ppt') > -1 ?
{ download(file.response?.data) }} style={{ cursor: 'pointer' }} > - -
- : - file.name.indexOf('.zip') > -1 ? + +
: + file.name.indexOf('.xlsx') > -1 ?
{ download(file.response?.data) }} style={{ cursor: 'pointer' }} > - +
: - file.name.indexOf('.ppt') > -1 ? -
{ viewPdf(file.response?.data) }} - style={{ cursor: 'pointer' }} - > - -
: - file.name.indexOf('.xlsx') > -1 ? -
{ download(file.response?.data) }} - style={{ cursor: 'pointer' }} - > - -
- : - - { download(file.response?.data) }} /> - } - {file.name} -
-
deleteFile(file.response?.data?.fileId)}> - -
-
- - ) - }) - } + + + } + {file.name} +
+
deleteFile(file.response?.data?.fileId)}> + +
+
+ + ) + }) + }
- - { setPdfViewOPen(false) }} > -