From 3c5bd3ac4ec2d3ac261b2905db3e6b327a2ba2a4 Mon Sep 17 00:00:00 2001 From: lishenfeng Date: Wed, 11 Dec 2024 17:56:03 +0800 Subject: [PATCH] =?UTF-8?q?feat():=20=E8=AE=BE=E5=A4=87=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/fileUpload/index.js | 184 ++++++++ src/components/fileUpload/index.less | 23 + src/models/auth/_.ts | 12 +- src/service/apiurl.js | 11 +- src/views/AppRouters.tsx | 31 +- .../InformationSearch/BasicSituation/index.js | 445 ++++++++++++++++++ .../BasicSituation/index.less | 8 + .../InformationSearch/OperateLog/index.js | 73 +++ .../InformationSearch/OperateLog/index.less | 0 .../InformationSearch/OperateLog/toolbar.js | 63 +++ .../InformationSearch/RunSituation/index.js | 65 +++ .../InformationSearch/RunSituation/index.less | 9 + .../InformationSearch/StaticTable/index.js | 110 +++++ .../InformationSearch/StaticTable/index.less | 0 .../InformationSearch/StaticTable/toolbar.js | 119 +++++ src/views/Sbwh/Cgtzgl/form.js | 178 +++++++ src/views/Sbwh/Cgtzgl/index.js | 126 +++++ src/views/Sbwh/Cgtzgl/index.less | 0 src/views/Sbwh/Cgtzgl/toolbar.js | 89 ++++ src/views/Sbwh/Kchsgl/form.js | 189 ++++++++ src/views/Sbwh/Kchsgl/index.js | 132 ++++++ src/views/Sbwh/Kchsgl/index.less | 0 src/views/Sbwh/Kchsgl/toolbar.js | 94 ++++ src/views/Sbwh/Ssgcjl/form.js | 167 +++++++ src/views/Sbwh/Ssgcjl/index.js | 102 ++++ src/views/Sbwh/Ssgcjl/index.less | 0 src/views/Sbwh/Ssgcjl/toolbar.js | 58 +++ src/views/Sbwh/Whfabz/form.js | 178 +++++++ src/views/Sbwh/Whfabz/index.js | 106 +++++ src/views/Sbwh/Whfabz/index.less | 0 src/views/Sbwh/Whfabz/toolbar.js | 75 +++ src/views/Sbwh/Whxmys/form.js | 160 +++++++ src/views/Sbwh/Whxmys/index.js | 102 ++++ src/views/Sbwh/Whxmys/index.less | 0 src/views/Sbwh/Whxmys/toolbar.js | 72 +++ src/views/WatchData/Jcsj/index.js | 7 + .../PoliceMangant/PoliceRecord/index.js | 83 ++++ .../PoliceMangant/PoliceRecord/index.less | 0 .../PoliceMangant/PoliceRecord/toolbar.js | 83 ++++ .../PoliceMangant/PoliceRuleConfig/form.js | 108 +++++ .../PoliceMangant/PoliceRuleConfig/index.js | 110 +++++ .../PoliceMangant/PoliceRuleConfig/index.less | 0 .../PoliceMangant/PoliceRuleConfig/toolbar.js | 65 +++ 43 files changed, 3425 insertions(+), 12 deletions(-) create mode 100644 src/components/fileUpload/index.js create mode 100644 src/components/fileUpload/index.less create mode 100644 src/views/Gcyx/InformationSearch/BasicSituation/index.js create mode 100644 src/views/Gcyx/InformationSearch/BasicSituation/index.less create mode 100644 src/views/Gcyx/InformationSearch/OperateLog/index.js create mode 100644 src/views/Gcyx/InformationSearch/OperateLog/index.less create mode 100644 src/views/Gcyx/InformationSearch/OperateLog/toolbar.js create mode 100644 src/views/Gcyx/InformationSearch/RunSituation/index.js create mode 100644 src/views/Gcyx/InformationSearch/RunSituation/index.less create mode 100644 src/views/Gcyx/InformationSearch/StaticTable/index.js create mode 100644 src/views/Gcyx/InformationSearch/StaticTable/index.less create mode 100644 src/views/Gcyx/InformationSearch/StaticTable/toolbar.js create mode 100644 src/views/Sbwh/Cgtzgl/form.js create mode 100644 src/views/Sbwh/Cgtzgl/index.js create mode 100644 src/views/Sbwh/Cgtzgl/index.less create mode 100644 src/views/Sbwh/Cgtzgl/toolbar.js create mode 100644 src/views/Sbwh/Kchsgl/form.js create mode 100644 src/views/Sbwh/Kchsgl/index.js create mode 100644 src/views/Sbwh/Kchsgl/index.less create mode 100644 src/views/Sbwh/Kchsgl/toolbar.js create mode 100644 src/views/Sbwh/Ssgcjl/form.js create mode 100644 src/views/Sbwh/Ssgcjl/index.js create mode 100644 src/views/Sbwh/Ssgcjl/index.less create mode 100644 src/views/Sbwh/Ssgcjl/toolbar.js create mode 100644 src/views/Sbwh/Whfabz/form.js create mode 100644 src/views/Sbwh/Whfabz/index.js create mode 100644 src/views/Sbwh/Whfabz/index.less create mode 100644 src/views/Sbwh/Whfabz/toolbar.js create mode 100644 src/views/Sbwh/Whxmys/form.js create mode 100644 src/views/Sbwh/Whxmys/index.js create mode 100644 src/views/Sbwh/Whxmys/index.less create mode 100644 src/views/Sbwh/Whxmys/toolbar.js create mode 100644 src/views/WatchData/Jcsj/index.js create mode 100644 src/views/WatchData/PoliceMangant/PoliceRecord/index.js create mode 100644 src/views/WatchData/PoliceMangant/PoliceRecord/index.less create mode 100644 src/views/WatchData/PoliceMangant/PoliceRecord/toolbar.js create mode 100644 src/views/WatchData/PoliceMangant/PoliceRuleConfig/form.js create mode 100644 src/views/WatchData/PoliceMangant/PoliceRuleConfig/index.js create mode 100644 src/views/WatchData/PoliceMangant/PoliceRuleConfig/index.less create mode 100644 src/views/WatchData/PoliceMangant/PoliceRuleConfig/toolbar.js diff --git a/src/components/fileUpload/index.js b/src/components/fileUpload/index.js new file mode 100644 index 0000000..8592b6c --- /dev/null +++ b/src/components/fileUpload/index.js @@ -0,0 +1,184 @@ +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) => { + let filterFile = fileList.filter(item => item.response?.data?.fileId !== fileId); + setFileList(filterFile) + setFileIds(filterFile.map(item => 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 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.click(); + } + + /** + * @description pdf文件预览 + * @param {String} params 文件预览url + */ + const viewPdf = (params) => { + setIframeSrc(params.fileId) + setPdfViewOPen(true) + } + + 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)) + } + }, [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 ? +
{ download(file.response?.data) }} + style={{ cursor: 'pointer' }} + > + +
+ : + file.name.indexOf('.pdf') > -1 ? +
{ download(file.response?.data) }} + style={{ cursor: 'pointer' }} + > + +
+ : + file.name.indexOf('.zip') > -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)}> + +
+
+ + ) + }) + } +
+ + { + setPdfViewOPen(false) + }} + > +