feat(): 知识库附件新增loading

qzc-dev
李神峰 2025-08-08 15:05:05 +08:00
parent a2b0d00cfb
commit 77e9dede45
8 changed files with 52 additions and 11 deletions

View File

@ -10,7 +10,7 @@ const { RangePicker } = DatePicker
const { Dragger } = Upload; const { Dragger } = Upload;
const url = "http://223.75.53.141:9100/gs-tsg" const url = "http://223.75.53.141:9100/gs-tsg"
const FileUpload = ({mode, fileNum=1, value, onChange,uploadUrl}) => { const FileUpload = ({mode, fileNum=1, value, onChange,uploadUrl,onLoadingChange}) => {
const [fileList, setFileList] = useState([]) //上传文件列表 const [fileList, setFileList] = useState([]) //上传文件列表
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
console.log(1111111,fileList); console.log(1111111,fileList);
@ -19,13 +19,17 @@ const FileUpload = ({mode, fileNum=1, value, onChange,uploadUrl}) => {
const fileChange = (info) => { const fileChange = (info) => {
if (info.file.status === "done") { if (info.file.status === "done") {
setLoading(false); setLoading(false);
if(onLoadingChange) onLoadingChange(false);
} }
if (info.file.status === "uploading") { if (info.file.status === "uploading") {
setLoading(true); setLoading(true);
if(onLoadingChange) onLoadingChange(true);
} }
if (info.file.status === "error") { if (info.file.status === "error") {
message.error("文件上传失败") message.error("文件上传失败")
setLoading(false); setLoading(false);
if(onLoadingChange) onLoadingChange(false);
} }
setFileList(info.fileList) setFileList(info.fileList)
} }

View File

@ -1,6 +1,7 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { Table, Tabs,Modal,message,Tooltip } from 'antd'; import { Table, Tabs,Modal,message,Tooltip } from 'antd';
import { zindexmarker } from '../zindex'; import { zindexmarker } from '../zindex';
import {useDispatch, useSelector} from "react-redux";
const { const {
css, css,
@ -35,7 +36,7 @@ const dist2 = 8000 * 8000;
function PicStMarker({ data, dispatch, setting, zoom, distSq }) { function PicStMarker({ data, dispatch, setting, zoom, distSq }) {
const getLayerVisible = useSelector((s) => s.map.layerVisible)
const highlight = setting; const highlight = setting;
let zindexOffset = 1; let zindexOffset = 1;
@ -171,6 +172,30 @@ function PicStMarker({ data, dispatch, setting, zoom, distSq }) {
// </div> // </div>
// ) // )
} }
{
(zoom > 12 || distSq < dist2 || highlight) && (
<div
className="markerLabel"
style={{
// backgroundColor: '#0008',
padding: 4,
borderRadius: 4,
fontSize: 10,
lineHeight: 1,
bottom: -14 * markerZoom,
left: 0,
transform: 'translateX(-50%)',
zIndex: zindexmarker.tuxiangLabel + zindexOffset + (highlight ? zindexmarker.hilightPlus : 0),
color: !getLayerVisible.SatelliteImage?'#0008':'#fff',
// textShadow: '2px 2px 4px #000000',
minWidth: "20px",
textAlign: "center"
}}>
{data?.name}
</div>
)
}
</> </>
) )
} }

View File

@ -104,8 +104,9 @@ const HomePage = ({ showPanels }) => {
const searchInputRef = useRef(null); const searchInputRef = useRef(null);
const dispatch = useDispatch(); const dispatch = useDispatch();
const [checkedObj, setCheckedObj] = useState({}) const [checkedObj, setCheckedObj] = useState({})
const [searchVal, setSearchVal] = useState('') const [searchVal, setSearchVal] = useState()
const [showTable, setShowTable] = useState(false) const [showTable, setShowTable] = useState(false)
const [wxqData, setWxqData] = useState({})
const [tms, setTms] = useState([ const [tms, setTms] = useState([
moment(moment().add(-1, 'days').format('YYYY-MM-DD 08:00:00')), moment(moment().add(-1, 'days').format('YYYY-MM-DD 08:00:00')),
moment(moment().format('YYYY-MM-DD 08:00:00')), moment(moment().format('YYYY-MM-DD 08:00:00')),
@ -607,6 +608,7 @@ const HomePage = ({ showPanels }) => {
useEffect(() => { useEffect(() => {
setCheckedObj({ key: '12', label: '雨情', labelRight: '统计', icon: 'yuqing' }) setCheckedObj({ key: '12', label: '雨情', labelRight: '统计', icon: 'yuqing' })
getGeoJsonData()
}, []) }, [])

View File

@ -26,7 +26,7 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [filesParams, setFilesParams] = useState([]) const [filesParams, setFilesParams] = useState([])
const [fileUploading, setFileUploading] = useState(false) // 新增文件上传状态
const onfinish = (values) => { const onfinish = (values) => {
const userId = localStorage.getItem("userId"); const userId = localStorage.getItem("userId");
const userName = localStorage.getItem("userName"); const userName = localStorage.getItem("userName");
@ -120,7 +120,9 @@ useEffect(() => {
<FileUpload <FileUpload
uploadUrl={apiurl.zsk.ddfa.upload} uploadUrl={apiurl.zsk.ddfa.upload}
mode={mode} mode={mode}
fileNum={3} fileNum={999}
onChange={(v) => { setFilesParams(v); }}
onLoadingChange={(isLoading) => setFileUploading(isLoading)}
/> />
</Form.Item> </Form.Item>
</Col> </Col>
@ -129,8 +131,13 @@ useEffect(() => {
mode === 'view' ? null : ( mode === 'view' ? null : (
<> <>
<Form.Item {...btnItemLayout}> <Form.Item {...btnItemLayout}>
<Button type="primary" htmlType="submit" loading={loading}> <Button
{mode === 'save' ? '提交' : '修改'} type="primary"
htmlType="submit"
loading={loading}
disabled={fileUploading} // 文件上传中时禁用按钮
>
{fileUploading ? '文件上传中...' : (mode === 'save' ? '提交' : '修改')}
</Button> </Button>
</Form.Item> </Form.Item>
</> </>

View File

@ -103,7 +103,7 @@ useEffect(() => {
> >
<FileUpload <FileUpload
mode={mode} mode={mode}
fileNum={3} fileNum={999}
uploadUrl={apiurl.zsk.gcaq.upload} uploadUrl={apiurl.zsk.gcaq.upload}
onChange={(v) => { setFilesParams(v)}} onChange={(v) => { setFilesParams(v)}}
value={filesParams} value={filesParams}

View File

@ -34,6 +34,9 @@ const ToolBar = ({ setSearchVal, onSave, storeData, role }) => {
<Form.Item> <Form.Item>
<Button type="primary" htmlType="submit">查询</Button> <Button type="primary" htmlType="submit">查询</Button>
</Form.Item> </Form.Item>
<Form.Item>
<Button onClick={() => form.resetFields()}>重置</Button>
</Form.Item>
{ {
(onSave) ? (onSave) ?

View File

@ -119,7 +119,7 @@ useEffect(() => {
> >
<FileUpload <FileUpload
mode={mode} mode={mode}
fileNum={3} fileNum={999}
uploadUrl={apiurl.zsk.ywgz.upload} uploadUrl={apiurl.zsk.ywgz.upload}
onChange={(v) => { setFilesParams(v);console.log("vvvv",v); onChange={(v) => { setFilesParams(v);console.log("vvvv",v);
}} }}

View File

@ -21,8 +21,8 @@ const Page = () => {
const [searchVal, setSearchVal] = useState(false) const [searchVal, setSearchVal] = useState(false)
const columns = [ const columns = [
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center" }, { title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center" },
{ title: '方案名称', key: 'name', dataIndex: 'name', ellipsis: true }, { title: '规则名称', key: 'name', dataIndex: 'name', ellipsis: true },
{ title: '调度类型', key: 'type', dataIndex: 'type',render:(v)=><>{obj[v]}</>}, { title: '规则类型', key: 'type', dataIndex: 'type',render:(v)=><>{obj[v]}</>},
{ title: '简介', key: 'content', dataIndex: 'content'}, { title: '简介', key: 'content', dataIndex: 'content'},
{ title: '编制时间', key: 'tm', dataIndex: 'tm'}, { title: '编制时间', key: 'tm', dataIndex: 'tm'},
{ title: '附件数', key: 'fileCount', dataIndex: 'fileCount'}, { title: '附件数', key: 'fileCount', dataIndex: 'fileCount'},