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 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 [loading, setLoading] = useState(false)
console.log(1111111,fileList);
@ -19,13 +19,17 @@ const FileUpload = ({mode, fileNum=1, value, onChange,uploadUrl}) => {
const fileChange = (info) => {
if (info.file.status === "done") {
setLoading(false);
if(onLoadingChange) onLoadingChange(false);
}
if (info.file.status === "uploading") {
setLoading(true);
if(onLoadingChange) onLoadingChange(true);
}
if (info.file.status === "error") {
message.error("文件上传失败")
setLoading(false);
if(onLoadingChange) onLoadingChange(false);
}
setFileList(info.fileList)
}

View File

@ -1,6 +1,7 @@
import React, { useEffect } from 'react';
import { Table, Tabs,Modal,message,Tooltip } from 'antd';
import { zindexmarker } from '../zindex';
import {useDispatch, useSelector} from "react-redux";
const {
css,
@ -35,7 +36,7 @@ const dist2 = 8000 * 8000;
function PicStMarker({ data, dispatch, setting, zoom, distSq }) {
const getLayerVisible = useSelector((s) => s.map.layerVisible)
const highlight = setting;
let zindexOffset = 1;
@ -171,6 +172,30 @@ function PicStMarker({ data, dispatch, setting, zoom, distSq }) {
// </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 dispatch = useDispatch();
const [checkedObj, setCheckedObj] = useState({})
const [searchVal, setSearchVal] = useState('')
const [searchVal, setSearchVal] = useState()
const [showTable, setShowTable] = useState(false)
const [wxqData, setWxqData] = useState({})
const [tms, setTms] = useState([
moment(moment().add(-1, 'days').format('YYYY-MM-DD 08:00:00')),
moment(moment().format('YYYY-MM-DD 08:00:00')),
@ -607,6 +608,7 @@ const HomePage = ({ showPanels }) => {
useEffect(() => {
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 [loading, setLoading] = useState(false)
const [filesParams, setFilesParams] = useState([])
const [fileUploading, setFileUploading] = useState(false) // 新增文件上传状态
const onfinish = (values) => {
const userId = localStorage.getItem("userId");
const userName = localStorage.getItem("userName");
@ -120,7 +120,9 @@ useEffect(() => {
<FileUpload
uploadUrl={apiurl.zsk.ddfa.upload}
mode={mode}
fileNum={3}
fileNum={999}
onChange={(v) => { setFilesParams(v); }}
onLoadingChange={(isLoading) => setFileUploading(isLoading)}
/>
</Form.Item>
</Col>
@ -129,8 +131,13 @@ useEffect(() => {
mode === 'view' ? null : (
<>
<Form.Item {...btnItemLayout}>
<Button type="primary" htmlType="submit" loading={loading}>
{mode === 'save' ? '提交' : '修改'}
<Button
type="primary"
htmlType="submit"
loading={loading}
disabled={fileUploading} // 文件上传中时禁用按钮
>
{fileUploading ? '文件上传中...' : (mode === 'save' ? '提交' : '修改')}
</Button>
</Form.Item>
</>

View File

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

View File

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

View File

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

View File

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