diff --git a/src/models/auth/_.ts b/src/models/auth/_.ts index 8e8a19ca5..0e9eb07e5 100644 --- a/src/models/auth/_.ts +++ b/src/models/auth/_.ts @@ -193,31 +193,153 @@ export async function loadMenu(): Promise { const id = idgen() return [ { id: id(), title: '水库一张图', path: '/mgr/home', icon: 'jbqk' }, - + { + id: id(), title: '四制', redirect: '/mgr/sz/gltx/zzjgck', icon: 'jbqk', + children: [ + { + id: id(), title: '管理体系', redirect: '/mgr/sz/gltx/zzjgck', + children: [ + { + id: id(), title: '管理体系', path: '/mgr/sz/gltx/zzjgck', + }, + { + id: id(), title: '责任人管理', path: '/mgr/sz/gltx/zrrgl', + } + ] + }, + { + id: id(), title: '监督考核', redirect: '/mgr/sz/jdkh/khtj', + children: [ + { + id: id(), title: '考核统计', path: '/mgr/sz/jdkh/khtj', + }, + { + id: id(), title: '考核任务管理', path: '/mgr/sz/jdkh/khrwgl', + }, + { + id: id(), title: '考核问题整改', path: '/mgr/sz/jdkh/khwtzg', + }, + { + id: id(), title: '考核指标管理', path: '/mgr/sz/jdkh/khzbgl', + }, + { + id: id(), title: '考核模板管理', path: '/mgr/sz/jdkh/khmbgl', + } + ] + } + ] + }, { id: id(), title: '四预', redirect: '/mgr/sy/fhxzfx', icon: 'fxzb', children: [ { id: id(), title: '防洪形势', path: '/mgr/sy/fhxzfx'}, - // { id: id(), title: '天气预报', path: '/mgr/fxzb/tqyb'}, - // { - // id: id(), title: '洪水预报', redirect: '/mgr/fxzb/hsyb/hyybjs', - // children: [ - // { id: id(), title: '洪水预报计算', path: '/mgr/fxzb/hsyb/hyybjs' }, - // { id: id(), title: '预报方案管理', path: '/mgr/fxzb/hsyb/ybfagl' }, - // { id: id(), title: '参数管理', path: '/mgr/fxzb/hsyb/csgl' }, - // ] - // }, - // { id: id(), title: '调度规程', path: '/mgr/fxzb/ddgc'}, - // { id: id(), title: '防汛预案', path: '/mgr/fxzb/fxya'}, - // { - // id: id(), - // title: '抢险物料', - // path: '/mgr/fxzb/qxwl', - // }, - // { - // id: id(), - // title: '抢险队伍', - // path: '/mgr/fxzb/qxdw', - // }, + { id: id(), title: '天气预报', path: '/mgr/fxzb/tqyb'}, + { + id: id(), title: '洪水预报', redirect: '/mgr/fxzb/hsyb/hyybjs', + children: [ + { id: id(), title: '洪水预报计算', path: '/mgr/fxzb/hsyb/hyybjs' }, + { id: id(), title: '预报方案管理', path: '/mgr/fxzb/hsyb/ybfagl' }, + { id: id(), title: '参数管理', path: '/mgr/fxzb/hsyb/csgl' }, + ] + }, + { id: id(), title: '防汛预案', path: '/mgr/sy/fxya'}, + { id: id(), title: '调度规程', path: '/mgr/sy/ddgc'}, + { + id: id(), + title: '抢险物料', + path: '/mgr/sy/qxwl', + }, + { + id: id(), + title: '抢险队伍', + path: '/mgr/sy/qxdw', + }, + ], + }, + { id: id(), title: '四管', redirect: '/mgr/sg/xcxj/xcrw', icon: 'fxzb', + children: [ + { + id: id(), title: '巡查巡检', redirect: '/mgr/sg/xcxj/xcrw', + children: [ + { id: id(), title: '巡检任务', path: '/mgr/sg/xcxj/xcrw' }, + { id: id(), title: '巡检问题处理', path: '/mgr/sg/xcxj/xjwtcl' }, + { id: id(), title: '巡检项配置', path: '/mgr/sg/xcxj/xjxpz' }, + ] + }, + { + id: id(), title: '安全管理', redirect: '/mgr/sg/aqgl/fxgkqd', + children: [ + { id: id(), title: '风险管控清单', path: '/mgr/sg/aqgl/fxgkqd' }, + { id: id(), title: '安全隐患排查', path: '/mgr/sg/aqgl/aqyhpc' }, + { id: id(), title: '安全检查管理', path: '/mgr/sg/aqgl/aqjcgl' }, + { id: id(), title: '安全事故登记', path: '/mgr/sg/aqgl/aqsgdj' }, + { id: id(), title: '安全鉴定台帐', path: '/mgr/sg/aqgl/aqjdtz' }, + { id: id(), title: '除险加固台帐', path: '/mgr/sg/aqgl/cxjgtz' }, + ] + }, + { + id: id(), title: '白蚁防治', redirect: '/mgr/sg/byfz/bypc', + children: [ + { id: id(), title: '白蚁普查', path: '/mgr/sg/byfz/bypc' }, + { id: id(), title: '防治宣传', path: '/mgr/sg/byfz/byxc' }, + ] + }, + { + id: id(), title: '维修养护', path: '/mgr/sg/wxyh', + }, + { + id: id(), title: '值班管理', redirect: '/mgr/sg/zbgl/zbb', + children: [ + { id: id(), title: '值班表', path: '/mgr/sg/zbgl/zbb' }, + { id: id(), title: '值班日志', path: '/mgr/sg/zbgl/zbrz' }, + ] + }, + { + id: id(), title: '报表管理', redirect: '/mgr/sg/btbb/sdjyrbb', + children: [ + { id: id(), title: '时段降雨日报表', path: '/mgr/sg/btbb/sdjyrbb' }, + { id: id(), title: '日降雨量年报表', path: '/mgr/sg/btbb/rjylnbb' }, + { id: id(), title: '时段水位日报表', path: '/mgr/sg/btbb/sdswbb' }, + { id: id(), title: '日均水位年报表', path: '/mgr/sg/btbb/rjswbb' }, + ] + }, + { + id: id(), title: '告警管理', redirect: '/mgr/sg/gjgl/aigj', + children: [ + { id: id(), title: 'AI告警', path: '/mgr/sg/gjgl/aigj' }, + { id: id(), title: '广播预警', path: '/mgr/sg/gjgl/gbyj' }, + ] + }, + ], + }, + { id: id(), title: '工程安全监测', redirect: '/mgr/gcaqjc/gcaqyj/bzt', icon: 'fxzb', + children: [ + { + id: id(), title: '布置图', path: '/mgr/gcaqjc/gcaqyj/bzt', + }, + { + id: id(), title: '工程安全分析', redirect: '/mgr/gcaqjc/gcaqfx/jrx', + children: [ + { id: id(), title: '浸润线', path: '/mgr/gcaqjc/gcaqfx/jrx'}, + ] + }, + { + id: id(), title: '工程安全预警', redirect: '/mgr/gcaqjc/gcaqyj/yhyj', + children: [ + { id: id(), title: '隐患预警', path: '/mgr/gcaqjc/gcaqyj/yhyj' }, + { id: id(), title: '预警规则配置', path: '/mgr/gcaqjc/gcaqyj/yjgzpz' }, + ] + }, + { + id: id(), title: '数据统计查询', redirect: '/mgr/gcaqjc/sjtjcx/czcx', + children: [ + { id: id(), title: '测值查询', path: '/mgr/gcaqjc/sjtjcx/czcx' }, + { id: id(), title: '渗压监测', path: '/mgr/gcaqjc/sjtjcx/syjx' }, + { id: id(), title: '渗流监测 ', path: '/mgr/gcaqjc/sjtjcx/sljx' }, + { id: id(), title: '位移监测 ', path: '/mgr/gcaqjc/sjtjcx/wyjx' }, + { id: id(), title: '年度渗压统计表', path: '/mgr/gcaqjc/sjtjcx/ndsytjb' }, + { id: id(), title: '年度渗流统计表', path: '/mgr/gcaqjc/sjtjcx/ndsltjb' }, + ] + }, ], }, { id:id(),title:'四全',redirect:'/mgr/sq/qfg/zcdjxx', @@ -245,7 +367,7 @@ export async function loadMenu(): Promise { }, - // { id: id(), title: '基本2情况', path: '/mgr/home', icon: 'jbqk' }, + // { id: id(), title: '基本情况', path: '/mgr/home', icon: 'jbqk' }, // { // id: id(), // title: '防汛调度', diff --git a/src/models/map/index.ts b/src/models/map/index.ts index 64d2a7fc0..1c9d7050d 100644 --- a/src/models/map/index.ts +++ b/src/models/map/index.ts @@ -6,7 +6,7 @@ import { parseGeoJSONFeature } from "../../utils/tools"; function initState() { return { layerVisible: { - AdcdLayer: true,//行政区划 + AdcdLayer: false,//行政区划 AdcdBorderInLayer: true,//乡镇边界 AdcdAllLayer: false,//县行政区划图层 HeLiuZhuJiLayer:true,//12条河流注记 diff --git a/src/service/apiurl.js b/src/service/apiurl.js index 058492be4..0a4f2a2ea 100644 --- a/src/service/apiurl.js +++ b/src/service/apiurl.js @@ -7,6 +7,13 @@ const zdkapi = 'https://slt-sh.chutianyun.gov.cn:8002' //中电科的市级平 const service_fxdd = '/gunshiApp/xyt' const service_shzh = '/shzh' const apiurl = { + fxya: { + page: service_fxdd + "/resPlanB/list", + update: service_fxdd + "/resPlanB/update", + save: service_fxdd + "/resPlanB/insert", + delete:service_fxdd + "/resPlanB/del", + getFile:service_fxdd + "/resPlanB/file/get" + }, setMenu: service_fxdd + '/visitMenuLog/insert', setPassword: service_fxdd + '/user/updateSecretKey', xytlogin: { @@ -414,11 +421,10 @@ const apiurl = { controler:service_fxdd + "/attCctvBase/control" } }, - sdz:{ + sdz: { zrrByCode:service_fxdd + '/hEHystSafePerson/hystCode', gctp:service_fxdd + '/attHystBase/projectImgList', sjzl:service_fxdd + '/attHystBase/desFileList', - fxya:service_fxdd + '/attHystBase/planList', delGctp:service_fxdd + '/hEHystProjectImg/delete', filedNameById:service_fxdd + '/hEHystProjectImg/file/get/' }, diff --git a/src/views/AppRouters.tsx b/src/views/AppRouters.tsx index 188bf5c8d..2672dbb40 100644 --- a/src/views/AppRouters.tsx +++ b/src/views/AppRouters.tsx @@ -92,6 +92,8 @@ import Gcdsj from './sq/qzq/gcdsj' // import Zcdjxx from './sq/qfg/zcdjxx' // import Zcdjxx from './sq/qfg/zcdjxx' +// 四制 - 组织机构查看 +import Zzjgck from './sz/zzjgck' const HomePage = lazy(() => import('./Home')) @@ -122,25 +124,26 @@ const AppRouters: React.FC = () => { children: [ { path: 'home', element: }, - // 防汛调度 + //四预 { path: 'sy/fhxzfx', element: }, - { path: 'fxzb/tqyb', element: }, - //洪水预报 - { path: 'fxzb/hsyb/hyybjs', element: }, - { path: 'fxzb/hsyb/ybfagl', element: }, - { path: 'fxzb/hsyb/csgl', element: }, + { path: 'sy/tqyb', element: }, + + //四预-洪水预报 + { path: 'sy/hsyb/hyybjs', element: }, + { path: 'sy/hsyb/ybfagl', element: }, + { path: 'sy/hsyb/csgl', element: }, // 调度规程 - { path: 'fxzb/ddgc', element: }, + { path: 'sy/ddgc', element: }, // 防汛预案 - { path: 'fxzb/fxya', element: }, + { path: 'sy/fxya', element: }, // 抢险物料 - { path: 'fxzb/qxwl', element: }, + { path: 'sy/qxwl', element: }, // 抢险队伍 - { path: 'fxzb/qxdw', element: }, + { path: 'sy/qxdw', element: }, // 工程安全监测 @@ -162,33 +165,33 @@ const AppRouters: React.FC = () => { { path: 'gcaqjc/gcaqfx/jrx', element: }, // 日常管理-水质整编 - { path: 'rcgl/btbb/rjswbb', element: }, - { path: 'rcgl/btbb/rjylnbb', element: }, - { path: 'rcgl/btbb/sdswbb', element: }, - { path: 'rcgl/btbb/sdjyrbb', element: }, - { path: 'rcgl/xcxj/xcrw', element: }, - { path: 'rcgl/xcxj/xjwtcl', element: }, - { path: 'rcgl/xcxj/xjxpz', element: }, - { path: 'byfz/fzxc', element: }, - { path: 'byfz/bypc', element: }, - { path: 'rcgl/wxyh', element: }, - { path: 'rcgl/aqgl/aqjcgl', element: }, - { path: 'rcgl/aqgl/fxgkqd', element: }, - { path: 'rcgl/aqgl/cxjbtz', element: }, - { path: 'rcgl/aqgl/aqjdtz', element: }, - { path: 'rcgl/aqgl/aqyhpc', element: }, - { path: 'rcgl/aqgl/aqsgdj', element: }, - { path: 'rcgl/gcdsj', element: }, - { path: 'rcgl/szzb', element: }, + { path: 'sg/btbb/rjswbb', element: }, + { path: 'sg/btbb/rjylnbb', element: }, + { path: 'sg/btbb/sdswbb', element: }, + { path: 'sg/btbb/sdjyrbb', element: }, + { path: 'sg/xcxj/xcrw', element: }, + { path: 'sg/xcxj/xjwtcl', element: }, + { path: 'sg/xcxj/xjxpz', element: }, + { path: 'sg/byfz/byxc', element: }, + { path: 'sg/byfz/bypc', element: }, + { path: 'sg/wxyh', element: }, + { path: 'sg/aqgl/aqjcgl', element: }, + { path: 'sg/aqgl/fxgkqd', element: }, + { path: 'sg/aqgl/cxjgtz', element: }, + { path: 'sg/aqgl/aqjdtz', element: }, + { path: 'sg/aqgl/aqyhpc', element: }, + { path: 'sg/aqgl/aqsgdj', element: }, + { path: 'sg/gcdsj', element: }, + { path: 'sg/szzb', element: }, { path: 'rcgl/stlljc', element: }, - { path: 'rcgl/zbgl/zbb', element: }, - { path: 'rcgl/zbgl/zbrz', element: }, + { path: 'sg/zbgl/zbb', element: }, + { path: 'sg/zbgl/zbrz', element: }, // 日常管理-监督考核 - { path: 'rcgl/jdkh/khtj', element: }, - { path: 'rcgl/jdkh/khzbgl', element: }, - { path: 'rcgl/jdkh/khmbgl', element: }, - { path: 'rcgl/jdkh/khwtzg', element: }, - { path: 'rcgl/jdkh/khrwgl', element: }, + { path: 'sz/jdkh/khtj', element: }, + { path: 'sz/jdkh/khzbgl', element: }, + { path: 'sz/jdkh/khmbgl', element: }, + { path: 'sz/jdkh/khwtzg', element: }, + { path: 'sz/jdkh/khrwgl', element: }, // 供水兴利 @@ -201,7 +204,7 @@ const AppRouters: React.FC = () => { { path: 'fxzb/jczw/sqz', element: }, // 视频监控 { path: 'spjk/spjk', element: }, - { path: 'spjk/aiWarn', element: }, + { path: 'sg/gjgl/aigj', element: }, // { path: 'fxzb/zbb', element: }, // { path: 'fxzb/txl', element: }, @@ -229,6 +232,8 @@ const AppRouters: React.FC = () => { { path: 'sq/qys/xyys', element: }, { path: 'sq/qys/gcys', element: }, { path: 'sq/qzq/Gcdsj', element: }, + // 四制-组织机构查看 + { path: 'sz/gltx/zzjgck', element: }, ], }, { path: '/login', element: }, diff --git a/src/views/Home/homePanelsLayoutPage/index.js b/src/views/Home/homePanelsLayoutPage/index.js index 438aef663..b3079f5ec 100644 --- a/src/views/Home/homePanelsLayoutPage/index.js +++ b/src/views/Home/homePanelsLayoutPage/index.js @@ -37,27 +37,34 @@ const { Panel } = Collapse; const { RangePicker } = DatePicker; const items = [ - { key:'1', label:'实时监测', children:[ + { key:'1', label:'综合监视', children:[ { key:'11', label:'预警', labelRight:'预警', icon:'yujing' }, { key:'12', label:'雨情', labelRight:'统计', icon:'yuqing' }, - { key:'13', label:'水库水情', labelRight:'实时水情', icon:'shuikushuiqing' }, - { key:'14', label:'供水', labelRight:'今日供水实况', icon:'gongshui' }, + { key:'13', label:'水情', labelRight:'实时水情', icon:'shuikushuiqing' }, { key:'15', label:'工程安全', labelRight:'工程安全监测', icon:'gongchenganquan' }, { key:'16', label:'监测设备状态', labelRight:'监测设备运行', icon:'jianceshebeizhuangtai' }, { key:'17', label:'水质', labelRight:'水质', icon:'shuizhi' }, { key:'18', label:'视频点', labelRight:'视频点', icon:'shipindian' }, ] }, - { key:'2', label:'水库工程', children:[ - { key:'21', label:'水库', labelRight:'基本信息', icon:'shuiku' }, - { key:'22', label:'大坝', labelRight:'基本信息', icon:'daba' }, - { key:'23', label:'溢洪道', labelRight:'基本信息', icon:'yihongdao' }, + // { key:'2', label:'水库工程', children:[ + // { key:'21', label:'水库', labelRight:'基本信息', icon:'shuiku' }, + // { key:'22', label:'大坝', labelRight:'基本信息', icon:'daba' }, + // { key:'23', label:'溢洪道', labelRight:'基本信息', icon:'yihongdao' }, + // ] }, + { key:'2', label:'巡查巡检', children:[ + { key:'21', label:'巡查巡检', labelRight:'工程巡检', icon:'shuiku' }, + // { key:'22', label:'大坝', labelRight:'基本信息', icon:'daba' }, + // { key:'23', label:'溢洪道', labelRight:'基本信息', icon:'yihongdao' }, ] }, - { key:'3', label:'洪水影响范围', children:[ + { key:'3', label:'洪水防御', children:[ { key:'31', label:'危险区', labelRight:'危险区列表', icon:'weixianqu' }, { key:'32', label:'安置点', labelRight:'安置点列表', icon:'anzhidian' }, { key:'33', label:'企事业单位', labelRight:'企事业单位列表', icon:'qishiyedanwei' }, { key:'34', label:'沿河居民户', labelRight:'沿河居民户列表', icon:'yanhejuminhu' }, ] }, + { key:'4', label:'水资源调度', children:[ + { key:'41', label:'供水', labelRight:'今日供水实况', icon:'gongshui' }, + ] }, ] @@ -118,9 +125,9 @@ const HomePage = ({showPanels}) => { dispatch.runtime.setHome() setCheckedObj({ key:'11', label:'预警', labelRight:'预警', icon:'yujing' }) }else if(a==='2'){ - setShowTable(true) - dispatch.runtime.setHome() - setCheckedObj({ key:'21', label:'水库', labelRight:'基本信息', icon:'shuiku' }) + // setShowTable(true) + // dispatch.runtime.setHome() + setCheckedObj({ key:'21', label:'巡查巡检', labelRight:'工程巡检', icon:'shuiku' }) }else if(a==='3'){ dispatch.runtime.setCameraTarget({ center: [114.96, 31.453], @@ -129,8 +136,9 @@ const HomePage = ({showPanels}) => { }) setShowTable(true) setCheckedObj({ key:'31', label:'危险区', labelRight:'危险区列表', icon:'weixianqu' }) + }else if(a==='4'){ + setCheckedObj({ key:'41', label:'供水', labelRight:'今日供水实况', icon:'gongshui' }) }else{ - } }} expandIconPosition="end" accordion={true} bordered={false}> { @@ -191,7 +199,7 @@ const HomePage = ({showPanels}) => { } { checkedObj.label === '预警' ? <>:null } { checkedObj.label === '雨情' ? :null } - { checkedObj.label === '水库水情' ? :null } + { checkedObj.label === '水情' ? :null } { checkedObj.label === '供水' ? :null } { checkedObj.label === '工程安全' ? :null } { checkedObj.label === '监测设备状态' ? :null } @@ -221,7 +229,7 @@ const HomePage = ({showPanels}) => {
{ checkedObj.label==='雨情'?:null } - { checkedObj.label==='水库水情'?:null } + { checkedObj.label==='水情'?:null } { checkedObj.label==='供水'?:null } { (checkedObj.label==='水库'||checkedObj.label==='大坝'||checkedObj.label==='溢洪道'||checkedObj.label==='视频点')?:null } { (checkedObj.label==='危险区'||checkedObj.label==='安置点'||checkedObj.label==='企事业单位'||checkedObj.label==='沿河居民户')?:null } diff --git a/src/views/Home/index.tsx b/src/views/Home/index.tsx index bacfd6f71..bbd39d234 100644 --- a/src/views/Home/index.tsx +++ b/src/views/Home/index.tsx @@ -190,13 +190,13 @@ const HomePage = () => { ) : null} - {/*防汛调度-防洪形势*/} - {pathname === '/mgr/fxzb/fhxs' ? ( + {/*四预-防洪形势*/} + {pathname === '/mgr/sy/fhxzfx' ? ( ) : null} - {/*防汛调度-天气预报*/} - {pathname === '/mgr/fxzb/tqyb' ? ( + {/*四预-天气预报*/} + {pathname === '/mgr/sy/tqyb' ? ( ) : null} diff --git a/src/views/fxzb/csgl/index.js b/src/views/fxzb/csgl/index.js index 3dd7eae7d..112c089a7 100644 --- a/src/views/fxzb/csgl/index.js +++ b/src/views/fxzb/csgl/index.js @@ -16,7 +16,7 @@ const Page = () => { const refModal2 = useRef(); const refModal3 = useRef(); const role = useSelector(state => state.auth.role); - const editBtn = (role?.rule?.find(item => item.menuName == "编辑"))?true:false; + const editBtn = (role?.rule?.find(item => item.menuName == "编辑"))?true:true; const [searchVal, setSearchVal] = useState(false) const columns = [ { title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align:"center" }, diff --git a/src/views/fxzb/ddgc/form.js b/src/views/fxzb/ddgc/form.js index f9d3777eb..8770a8a5a 100644 --- a/src/views/fxzb/ddgc/form.js +++ b/src/views/fxzb/ddgc/form.js @@ -1,38 +1,96 @@ -import React,{useEffect,useState} from 'react'; -import { Form, Button, Input, message,Row, Col, DatePicker,Upload,Image,Modal } from 'antd'; -import { DeleteOutlined,FileWordOutlined,FilePdfOutlined,FilePptOutlined,FileZipOutlined,FileExcelOutlined } from '@ant-design/icons'; +import React,{useEffect,useState,useRef} from 'react'; +import { Form, Button, Input, Row, Col,Upload,DatePicker,Modal,message,Image } from 'antd'; +import {PaperClipOutlined,DeleteOutlined,FileWordOutlined,FilePdfOutlined,FilePptOutlined,FileZipOutlined,FileExcelOutlined} from '@ant-design/icons'; import { formItemLayout, btnItemLayout } from '../../../components/crud/FormLayoutProps'; import apiurl from '../../../service/apiurl'; -import { createCrudService } from '../../../components/crud/_'; +import { httpget2 } from '../../../utils/request'; import moment from 'moment'; -const { Dragger } = Upload; +import "./index.less"; const url = "http://223.75.53.141:9102/test.by-lyf.tmp" -const ModalForm = ({ mode, record,onEdit,onSave }) => { - if(record.prodDate){ - record.myTm = moment(record.prodDate) - } +const ModalForm = ({ mode, record,onEdit,onSave,onCrudSuccess }) => { const [form] = Form.useForm(); const [fileList, setFileList] = useState([]) //上传文件列表 - const [fileIds, setFileIds] = useState([]) - const [flag, setFlag] = useState(true) - const [iframeSrc, setIframeSrc] = useState('') - const [pdfViewOPen, setPdfViewOPen] = useState(false) const [loading, setLoading] = useState(false) - /** - * @description 删除上传的图片 - * @param {string} id 删除的id - */ - const deleteFile = (fileId) => { - let filterFile = fileList.filter(item => item.response?.data?.fileId !== fileId); - setFileList(filterFile) + const [iframeId, setIframeId] = useState('') + const [perviewOpen, setPerviewOpen] = useState(false) + + const fileChange = (info) => { + console.log("file",info); + + if (info.file.status === "done") { + setLoading(false); + setFileList(info.fileList) + + } + if (info.file.status === "uploading") { + setLoading(true); + } + if (info.file.status === "error") { + message.error("文件上传失败") + setLoading(false); + } + if (fileList.length > 0) { + return + } + setFileList(info.fileList) } - /** - * @description 文件下载 - * @param {String} params 文件fileId - */ - const download = (params) => { + + const deleteFile = (fileId) => { + let filterFile = fileList.filter(item => item.response?.data?.fileId !== fileId); + setFileList(filterFile) +} + const onFinish = async (values) => { + if (fileList.length <= 0) { + message.error("请上传预案文件") + return + } + let oldFiles = fileList.map(item => ({ fileId: item.response?.data?.fileId })) + values.resCode = "42120250085" + values.type = 2 + values.files = oldFiles; + values.prepTime = moment(values.prepTime).format("YYYY-MM-DD 00:00:00") + values.apprTime = moment(values.apprTime).format("YYYY-MM-DD 00:00:00") + if (mode === 'edit') { + values.id = record?.id; + onEdit(apiurl.fxya.update,values) + } + if (mode === 'save') { + onSave(apiurl.fxya.save,values) + } + } + + const viewPdf = (params) => { + setIframeId(params) + setPerviewOpen(true) + } + const beforeUpload = () => { + if (fileList.length > 0) { + message.error("只能上传一个附件"); + return false; + } + } + const getFileInfo = async(id) => { + try { + const res = await httpget2(`${apiurl.dataResourcesCenter.projectAndWater.fxya.getFile}/${id}`) + let obj ={ + name: res.data.fileName, + response: { + data: { + filePath: res.data.filePath, + fileId:res.data.fileId + } + }, + } + setFileList([obj]) + } catch (error) { + console.log(error); + + } + } + + const download = (params) => { let downloadLink = document.createElement("a"); - downloadLink.href = `http://local.gunshiiot.com:18083/gunshiApp/xfflood/xfIdeoImgB/file/download/${params}`; + downloadLink.href = `http://local.gunshiiot.com:18083/gunshiApp/xyt/resPlanB/file/download/${params}`; downloadLink.download = `${params.fileName}`; downloadLink.style.display = "none"; // 将链接添加到页面中 @@ -41,153 +99,120 @@ const ModalForm = ({ mode, record,onEdit,onSave }) => { // 模拟点击事件,开始下载 downloadLink.click(); } - /** - * @description 上传图片 - * @param {string} file 上传的文件 - */ - 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) - setFlag(false) - } - const onFinish = (values) => { - if(values.myTm){ - values.prodDate = moment(values.myTm).format('YYYY-MM-DD') - delete values.myTm - } - if (mode === 'edit') { - let oldFiles = fileList.map(item => item.response?.data?.fileId ) - values.id = record.id - values.fileIds = oldFiles; - onEdit(apiurl.fxzb.sxfd.fxtj.edit,values) - } - if (mode === 'save') { - values.fileIds = fileIds - onSave(apiurl.fxzb.sxfd.fxtj.save,values) - } - } - /** - * @description 获取查看时文件 - * @param {*} type - * @returns - */ - const getFileInfo = (params) => { - let fetchArr = params?.attachList.map(item => { - return createCrudService(apiurl.fxzb.gczx.ytygc.getFile + `/${item.fileId}`) - .delGet() - } - ); - Promise.all(fetchArr).then(res => { - let fileArr = res.map(item => { - return { - name: item.data.fileName, - response: { - data: { - filePath: item.data.filePath, - fileId:item.data.fileId - } - }, - } - }) - setFlag(true) - setFileList(fileArr) - }).catch(err => console.log(err)) - } - /** - * @description pdf文件预览 - * @param {String} params 文件预览url - */ - const viewPdf = (params) => { - if (params) { - setIframeSrc(params) - setPdfViewOPen(true) - } - } useEffect(() => { - console.log(record); - if ((mode === "view" || mode === "edit") && record.attachList?.length) { - getFileInfo(record) - } - }, [record, mode]) + if (record && mode != "save") { + getFileInfo(record?.files[0]?.fileId) + } + }, [record,mode]) + return ( <>
- + + - - + + + - + - - - + dateString} + getValueProps={value => ({ + value: value ? moment(value) : undefined + })} rules={[{ required: true }]} > - + - - - - + + + - {mode !== "view" && - + + + + dateString} + getValueProps={value => ({ + value: value ? moment(value) : undefined + })} + rules={[{ required: true }]} + > + + + + + + + + { console.log(info.dataTransfer.files); }} - fileList={fileList} - disabled={loading} - // onSuccess={handleSuccess} + fileList={fileList} + maxCount={1} + disabled={loading} + showUploadList={false} + beforeUpload={beforeUpload} > -

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

-

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

- - } - + {mode == "view" ? null : + + } +
+
+ + +
+ { loading ? 文件正在上传中,请等待 : fileList.length > 0 && fileList.map(file => { @@ -239,25 +264,28 @@ const ModalForm = ({ mode, record,onEdit,onSave }) => { } {file.name} -
-
deleteFile(file.response?.data?.fileId)}> +
+ {mode !== "view" && +
deleteFile(file.response?.data?.fileId)} + >
+ } ) }) } - - - - + + { mode==='view'?null:( <> @@ -265,13 +293,13 @@ const ModalForm = ({ mode, record,onEdit,onSave }) => { } { - setPdfViewOPen(false) + setPerviewOpen(false) }} >