2024-09-23 18:03:30 +08:00
|
|
|
import React, { Fragment, useRef, useMemo, useEffect, useState } from 'react';
|
|
|
|
|
import BasicCrudModal from '../../../../components/crud/BasicCrudModal';
|
|
|
|
|
import { Table, Card, Modal, Form, Input, Button, Row, Col, Timeline, message, Tabs, Image } from 'antd';
|
|
|
|
|
import { FileWordOutlined, FilePdfOutlined, FileZipOutlined, FileExcelOutlined } from '@ant-design/icons';
|
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
|
import ToolBar from './toolbar';
|
|
|
|
|
import ModalForm from './editTabs';
|
|
|
|
|
import apiurl from '../../../../service/apiurl';
|
|
|
|
|
import usePageTable from '../../../../components/crud/usePageTable2';
|
|
|
|
|
import { createCrudService } from '../../../../components/crud/_';
|
|
|
|
|
import { CrudOpRender_text } from '../../../../components/crud/CrudOpRender';
|
2024-09-26 17:59:26 +08:00
|
|
|
import dayjs from 'dayjs'
|
2024-09-23 18:03:30 +08:00
|
|
|
|
2025-04-07 09:16:20 +08:00
|
|
|
const url = "http://223.75.53.141:9100/gs-tsg"
|
2024-09-26 17:59:26 +08:00
|
|
|
const caseTypeOb = {
|
|
|
|
|
0: '违建', 1: '毁林垦荒', 2: '筑坝拦汊', 3: '填占库容', 4: '违法取水', 5: '其他'
|
|
|
|
|
}
|
|
|
|
|
const caseSourceOb = {
|
|
|
|
|
0: '巡查上报', 1: '自主发现', 2: '公共举报', 3: '电话举报', 4: '其他'
|
|
|
|
|
}
|
2024-09-23 18:03:30 +08:00
|
|
|
const Page = () => {
|
|
|
|
|
const role = useSelector(state => state.auth.role);
|
|
|
|
|
const editBtn = role?.rule?.find(item => item.menuName == "编辑");
|
|
|
|
|
const viewBtn = role?.rule?.find(item => item.menuName == "查看");
|
|
|
|
|
const delBtn = role?.rule?.find(item => item.menuName == "删除");
|
|
|
|
|
const refModal = useRef();
|
|
|
|
|
const [searchVal, setSearchVal] = useState(false)
|
|
|
|
|
const [iframeSrc, setIframeSrc] = useState('')
|
|
|
|
|
const [pdfViewOPen, setPdfViewOPen] = useState(false)
|
|
|
|
|
const [isFetch, setIsFetch] = useState(false)
|
|
|
|
|
const columns = [
|
|
|
|
|
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center" },
|
2024-10-18 13:29:56 +08:00
|
|
|
{ title: '填报时间', key: 'createTime', dataIndex: 'createTime', ellipsis: true,render: (value) => <span>{dayjs(value).format('YYYY-MM-DD HH:mm')}</span>, },
|
2024-09-23 18:03:30 +08:00
|
|
|
{
|
2024-09-27 14:38:23 +08:00
|
|
|
title: '案件名称', key: 'caseName', dataIndex: 'caseName',
|
2024-09-23 18:03:30 +08:00
|
|
|
},
|
|
|
|
|
{
|
2024-09-27 14:38:23 +08:00
|
|
|
title: '案件编号', key: 'caseId', dataIndex: 'caseId',
|
2024-09-26 17:59:26 +08:00
|
|
|
|
2024-09-23 18:03:30 +08:00
|
|
|
},
|
|
|
|
|
{
|
2024-09-27 14:38:23 +08:00
|
|
|
title: '发现时间', key: 'caseDate', dataIndex: 'caseDate',
|
2024-10-18 13:29:56 +08:00
|
|
|
render: (value) => <span>{dayjs(value).format('YYYY-MM-DD')}</span>,
|
2024-09-26 17:59:26 +08:00
|
|
|
|
2024-09-23 18:03:30 +08:00
|
|
|
},
|
|
|
|
|
{
|
2024-09-27 14:38:23 +08:00
|
|
|
title: '案件类型', key: 'caseType', dataIndex: 'caseType',
|
2024-09-26 17:59:26 +08:00
|
|
|
render: (value) => <span>{caseTypeOb[value]}</span>,
|
2024-09-23 18:03:30 +08:00
|
|
|
},
|
|
|
|
|
{
|
2024-09-27 14:38:23 +08:00
|
|
|
title: '案件来源', key: 'caseSource', dataIndex: 'caseSource',
|
2024-09-26 17:59:26 +08:00
|
|
|
render: (value) => <span>{caseSourceOb[value]}</span>,
|
2024-09-23 18:03:30 +08:00
|
|
|
},
|
|
|
|
|
{
|
2024-09-27 14:38:23 +08:00
|
|
|
title: '操作', key: 'operation', width: 240,
|
2024-09-23 18:03:30 +08:00
|
|
|
render: (value, row, index) => (
|
|
|
|
|
<CrudOpRender_text
|
|
|
|
|
edit={true}
|
|
|
|
|
del={true}
|
|
|
|
|
view={true}
|
|
|
|
|
command={(cmd) => () => command(cmd)(row)} />)
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]);
|
|
|
|
|
|
|
|
|
|
const command = (type) => (params) => {
|
|
|
|
|
if (type === 'save') {
|
2024-09-26 17:59:26 +08:00
|
|
|
|
2024-09-23 18:03:30 +08:00
|
|
|
refModal.current.showSave();
|
|
|
|
|
} else if (type === 'edit') {
|
2024-09-26 17:59:26 +08:00
|
|
|
let obj={}
|
2025-04-09 17:43:19 +08:00
|
|
|
if (params.caseDate) {
|
|
|
|
|
obj.caseDate = params.caseDate ? dayjs(params.caseDate) :undefined
|
2024-09-26 17:59:26 +08:00
|
|
|
}
|
|
|
|
|
if(params.IllegalDate){
|
|
|
|
|
obj.IllegalDate= dayjs(params.IllegalDate)
|
|
|
|
|
}
|
|
|
|
|
refModal.current.showEdit({ ...params,...obj });
|
2024-09-23 18:03:30 +08:00
|
|
|
} else if (type === 'view') {
|
|
|
|
|
refModal.current.showView(params);
|
|
|
|
|
} else if (type === 'del') {
|
2024-09-26 17:59:26 +08:00
|
|
|
refModal.current.onDeleteGet(apiurl.szzf.ajdj.del + `/${params.id}`);
|
2024-09-23 18:03:30 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-09-26 17:59:26 +08:00
|
|
|
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.szzf.ajdj.list).find_noCode);
|
2024-09-23 18:03:30 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description 处理成功的回调
|
|
|
|
|
*/
|
|
|
|
|
const successCallback = () => {
|
|
|
|
|
refresh()
|
|
|
|
|
setIsFetch(!isFetch)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const viewPdf = (params) => {
|
|
|
|
|
setIframeSrc(params)
|
|
|
|
|
setPdfViewOPen(true)
|
2024-09-26 17:59:26 +08:00
|
|
|
}
|
2024-09-23 18:03:30 +08:00
|
|
|
useEffect(() => {
|
|
|
|
|
const params = {
|
|
|
|
|
search: {
|
|
|
|
|
...searchVal,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
search(params)
|
|
|
|
|
}, [searchVal])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className='content-root clearFloat xybm' style={{ paddingRight: "0", paddingBottom: "0" }}>
|
|
|
|
|
<div className='lf CrudAdcdTreeTableBox' style={{ width: "100%", overflowY: "auto" }}>
|
|
|
|
|
<Card className='nonebox'>
|
|
|
|
|
<ToolBar
|
|
|
|
|
setSearchVal={setSearchVal}
|
|
|
|
|
onSave={command('save')}
|
|
|
|
|
role={role}
|
|
|
|
|
/>
|
|
|
|
|
</Card>
|
|
|
|
|
<div className="ant-card-body" style={{ padding: "20px 0 0 0" }}>
|
2024-09-27 14:38:23 +08:00
|
|
|
<Table columns={columns} rowKey="inx" {...tableProps} />
|
2024-09-23 18:03:30 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<BasicCrudModal
|
|
|
|
|
width={1000}
|
|
|
|
|
ref={refModal}
|
|
|
|
|
title=""
|
|
|
|
|
component={ModalForm}
|
|
|
|
|
onCrudSuccess={successCallback}
|
|
|
|
|
// onCrudSuccess={()=>{refresh({addvcd:localStorage.getItem('ADCD6')})}}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Modal
|
|
|
|
|
open={pdfViewOPen}
|
|
|
|
|
width={1000}
|
|
|
|
|
title=""
|
|
|
|
|
footer={null}
|
|
|
|
|
style={{ marginTop: "-5%" }}
|
|
|
|
|
onCancel={() => {
|
|
|
|
|
setPdfViewOPen(false)
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<iframe
|
|
|
|
|
style={{
|
|
|
|
|
height: '80vh',
|
|
|
|
|
width: '100%',
|
|
|
|
|
border: 0,
|
|
|
|
|
marginTop: 20,
|
|
|
|
|
}}
|
2024-09-30 10:24:35 +08:00
|
|
|
src={`${process.env.PUBLIC_URL}/static/pdf/web/viewer.html?file=${encodeURIComponent(`/gunshiApp/tsg/projectEvents/file/download/${iframeSrc}`)}`}
|
2024-09-23 18:03:30 +08:00
|
|
|
/>
|
|
|
|
|
</Modal>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Page;
|