2024-09-20 15:02:50 +08:00
|
|
|
|
import React, { Fragment, useRef, useMemo,useEffect,useState } from 'react';
|
|
|
|
|
|
import BasicCrudModal from '../../../../components/crud/BasicCrudModal';
|
2025-03-21 17:36:23 +08:00
|
|
|
|
import { Table, Card, Modal, Form, Input, Button, Row,Col, Timeline, message, Tabs,Image,Tag } from 'antd';
|
2024-09-20 15:02:50 +08:00
|
|
|
|
import {FileWordOutlined,FilePdfOutlined,FileZipOutlined,FileExcelOutlined } from '@ant-design/icons';
|
|
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
|
|
import ToolBar from './toolbar';
|
|
|
|
|
|
import ModalForm from './form';
|
|
|
|
|
|
import apiurl from '../../../../service/apiurl';
|
|
|
|
|
|
import usePageTable from '../../../../components/crud/usePageTable2';
|
|
|
|
|
|
import { createCrudService } from '../../../../components/crud/_';
|
2025-03-27 14:37:31 +08:00
|
|
|
|
import { httppost2 } from '../../../../utils/request';
|
2024-09-20 15:02:50 +08:00
|
|
|
|
import {CrudOpRender_text} from '../../../../components/crud/CrudOpRender';
|
2025-03-21 17:36:23 +08:00
|
|
|
|
import './index.less';
|
2025-04-07 09:16:20 +08:00
|
|
|
|
const url = "http://223.75.53.141:9100/gs-tsg"
|
2024-09-20 15:02:50 +08:00
|
|
|
|
const Page = () => {
|
|
|
|
|
|
const role = useSelector(state => state.auth.role);
|
2024-09-23 13:49:58 +08:00
|
|
|
|
const editBtn = role?.rule?.find(item => item.menuName == "编辑") || true;
|
|
|
|
|
|
const viewBtn = role?.rule?.find(item => item.menuName == "查看")|| true;
|
2025-03-21 17:36:23 +08:00
|
|
|
|
const delBtn = role?.rule?.find(item => item.menuName == "删除") || true;
|
|
|
|
|
|
|
|
|
|
|
|
const [stats, setStats] = useState({
|
|
|
|
|
|
total: 400,
|
|
|
|
|
|
withMosquito: 14,
|
|
|
|
|
|
withoutMosquito: 382,
|
|
|
|
|
|
noData: 4
|
|
|
|
|
|
});
|
2024-09-20 15:02:50 +08:00
|
|
|
|
const surveyType = {
|
|
|
|
|
|
1: "日常检查排查",
|
|
|
|
|
|
2: "定期普查",
|
|
|
|
|
|
3:"专项调查"
|
|
|
|
|
|
}
|
|
|
|
|
|
const surveyWay = {
|
|
|
|
|
|
1: "人工排查法",
|
|
|
|
|
|
2: "引诱法",
|
|
|
|
|
|
3: "仪器探测法",
|
|
|
|
|
|
4:"其他"
|
|
|
|
|
|
}
|
|
|
|
|
|
const isHarm = {
|
|
|
|
|
|
0: "无危害",
|
|
|
|
|
|
1: "有危害",
|
|
|
|
|
|
}
|
|
|
|
|
|
const refModal = useRef();
|
|
|
|
|
|
const [searchVal, setSearchVal] = useState({})
|
2025-03-27 14:37:31 +08:00
|
|
|
|
const [count, setCount] = useState({})
|
2025-03-21 17:36:23 +08:00
|
|
|
|
// const columns = [
|
|
|
|
|
|
// { title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center" },
|
|
|
|
|
|
// {title: '填报日期', key: 'reportDate', dataIndex: 'reportDate', width: 140,},
|
|
|
|
|
|
// {
|
|
|
|
|
|
// title: '普查类型', key: 'surveyType', dataIndex: 'surveyType', width: 200,
|
|
|
|
|
|
// render: (value) => <span>{value ? surveyType[value] : ''}</span>
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// title: '普查方式', key: 'surveyWay', dataIndex: 'surveyWay', width: 200,
|
|
|
|
|
|
// render: (value) => <span>{value ? surveyWay[value] : ''}</span>
|
|
|
|
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {
|
|
|
|
|
|
// title: '危害情况', key: 'isHarm', dataIndex: 'isHarm', width: 200,
|
|
|
|
|
|
// render: (value, row) =>(
|
|
|
|
|
|
// <span style={row.harmNum > 0 ? { color: "red" } : {}}>{isHarm[row.harmNum > 0 ? 1 : 0]}</span>)
|
|
|
|
|
|
// },
|
|
|
|
|
|
// {title: '白蚁危害处数', key: 'harmNum', dataIndex: 'harmNum', width: 100},
|
|
|
|
|
|
// {title: '已处置处数', key: 'handleNum', dataIndex: 'handleNum', width: 100},
|
|
|
|
|
|
// {title: '上报人', key: 'reportUserName', dataIndex: 'reportUserName', width: 100},
|
|
|
|
|
|
// {
|
|
|
|
|
|
// title: '操作', key: 'operation', width: 200, fixed: 'right',align: 'center',
|
|
|
|
|
|
// render: (value, row, index) => (
|
|
|
|
|
|
// <CrudOpRender_text
|
|
|
|
|
|
// edit={editBtn ? true : false}
|
|
|
|
|
|
// del={delBtn ? true : false}
|
|
|
|
|
|
// view={viewBtn ? true : false}
|
|
|
|
|
|
// command={(cmd) => () => command(cmd)(row)} />)
|
|
|
|
|
|
// },
|
|
|
|
|
|
// ];
|
|
|
|
|
|
|
2024-09-20 15:02:50 +08:00
|
|
|
|
const columns = [
|
|
|
|
|
|
{
|
2025-03-21 17:36:23 +08:00
|
|
|
|
title: '监测时间',
|
2025-09-01 17:55:23 +08:00
|
|
|
|
dataIndex: 'obDate',
|
|
|
|
|
|
key: 'obDate',
|
2025-03-27 14:37:31 +08:00
|
|
|
|
width: 180,
|
|
|
|
|
|
align:'center'
|
2024-09-20 15:02:50 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-03-21 17:36:23 +08:00
|
|
|
|
title: '测点编号',
|
2025-09-02 17:27:53 +08:00
|
|
|
|
dataIndex: 'order',
|
|
|
|
|
|
key: 'order',
|
2025-03-27 14:37:31 +08:00
|
|
|
|
width: 120,
|
|
|
|
|
|
align:'center'
|
2024-09-20 15:02:50 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-03-21 17:36:23 +08:00
|
|
|
|
title: '有无白蚁',
|
2025-09-01 17:55:23 +08:00
|
|
|
|
dataIndex: 'status',
|
2025-03-27 14:37:31 +08:00
|
|
|
|
align:'center',
|
2025-09-01 17:55:23 +08:00
|
|
|
|
key: 'status',
|
2025-03-21 17:36:23 +08:00
|
|
|
|
width: 100,
|
2025-03-27 14:37:31 +08:00
|
|
|
|
render:(text, record) => {
|
|
|
|
|
|
// 如果 isHarm 为 null 或 undefined,显示无
|
|
|
|
|
|
if (text == null) {
|
|
|
|
|
|
return <Tag color="#04d919" style={{borderRadius: '50%', padding: '4px 8px'}}>无</Tag>;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果 isHandle 为 null 或 undefined,当作 false 处理
|
|
|
|
|
|
const isHandle = record.isHandle ?? false;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<Tag
|
2025-09-01 17:55:23 +08:00
|
|
|
|
color={!text ?'#04d919' : '#d9001b'}
|
2025-03-27 14:37:31 +08:00
|
|
|
|
style={{borderRadius: '50%', padding: '4px 8px'}}
|
|
|
|
|
|
>
|
2025-09-01 17:55:23 +08:00
|
|
|
|
{!text ? '无' : '有'}
|
2025-03-27 14:37:31 +08:00
|
|
|
|
</Tag>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
2025-03-21 17:36:23 +08:00
|
|
|
|
}
|
2024-09-20 15:02:50 +08:00
|
|
|
|
];
|
|
|
|
|
|
const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]);
|
2025-03-27 14:37:31 +08:00
|
|
|
|
|
2024-09-20 15:02:50 +08:00
|
|
|
|
const command = (type) => (params) => {
|
|
|
|
|
|
if (type === 'save') {
|
|
|
|
|
|
refModal.current.showSave();
|
|
|
|
|
|
} else if (type === 'edit') {
|
|
|
|
|
|
refModal.current.showEdit({ ...params });
|
|
|
|
|
|
} else if (type === 'view') {
|
|
|
|
|
|
refModal.current.showView(params);
|
|
|
|
|
|
} else if (type === 'del') {
|
|
|
|
|
|
refModal.current.onDeleteGet(apiurl.rcgl.byfz.bypc.delete + `/${params.id}`);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.rcgl.byfz.bypc.page).find_noCode);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @description 处理成功的回调
|
|
|
|
|
|
*/
|
|
|
|
|
|
const successCallback = () => {
|
|
|
|
|
|
refresh()
|
2025-03-27 14:37:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取白蚁统计数量
|
|
|
|
|
|
const getCount = async () => {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
pageSo: {
|
|
|
|
|
|
pageNumber: 1,
|
|
|
|
|
|
pageSize: 99999,
|
2025-03-28 17:33:56 +08:00
|
|
|
|
},
|
2025-09-18 15:26:22 +08:00
|
|
|
|
...searchVal
|
2025-03-27 14:37:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await httppost2(apiurl.rcgl.byfz.bypc.count, params);
|
|
|
|
|
|
setCount(res.data);
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
getCount();
|
2025-03-28 17:33:56 +08:00
|
|
|
|
}, [searchVal])
|
2024-09-20 15:02:50 +08:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (searchVal) {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
search: {
|
|
|
|
|
|
...searchVal,
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
search(params)
|
|
|
|
|
|
}
|
|
|
|
|
|
}, [searchVal])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<div className='content-root clearFloat xybm' style={{paddingRight:"0",paddingBottom:"0"}}>
|
2025-03-21 17:36:23 +08:00
|
|
|
|
<div className='lf CrudAdcdTreeTableBox' style={{ width: "100%" }}>
|
|
|
|
|
|
<Row gutter={16} className='statsRow'>
|
|
|
|
|
|
<Col span={6}>
|
|
|
|
|
|
<div className='statItem'>
|
|
|
|
|
|
<div className='valueWrapper'>
|
2025-03-27 14:37:31 +08:00
|
|
|
|
<span className='number' style={{ color: '#722ed1' }}>{count.totalPoint}</span>
|
2025-03-21 17:36:23 +08:00
|
|
|
|
<span className="unit">个</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span className='label'>总监测点数</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col span={6}>
|
|
|
|
|
|
<div className='statItem'>
|
|
|
|
|
|
<div className='valueWrapper'>
|
2025-03-27 14:37:31 +08:00
|
|
|
|
<span className='number' style={{ color: '#f5222d' }}>{count.hasAnt}</span>
|
2025-03-21 17:36:23 +08:00
|
|
|
|
<span className="unit">个</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span className='label'>有白蚁</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col span={6}>
|
|
|
|
|
|
<div className='statItem'>
|
|
|
|
|
|
<div className='valueWrapper'>
|
2025-03-27 14:37:31 +08:00
|
|
|
|
<span className='number' style={{ color: '#52c41a' }}>{count.notAnt}</span>
|
2025-03-21 17:36:23 +08:00
|
|
|
|
<span className="unit">个</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<span className='label'>无白蚁</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
<Col span={6}>
|
|
|
|
|
|
<div className='statItem'>
|
|
|
|
|
|
<div className='valueWrapper'>
|
2025-03-27 14:37:31 +08:00
|
|
|
|
<span className='number' style={{ color: '#8c8c8c' }}>{count.noData}</span>
|
2025-03-21 17:36:23 +08:00
|
|
|
|
<span className="unit">个</span>
|
|
|
|
|
|
</div>
|
2025-04-09 17:43:19 +08:00
|
|
|
|
<span className='label'>离线</span>
|
2025-03-21 17:36:23 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
</Row>
|
2024-09-20 15:02:50 +08:00
|
|
|
|
<Card className='nonebox'>
|
|
|
|
|
|
<ToolBar
|
|
|
|
|
|
setSearchVal={setSearchVal}
|
2025-03-21 17:36:23 +08:00
|
|
|
|
// onSave={command('save')}
|
|
|
|
|
|
// role={role}
|
2024-09-20 15:02:50 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</Card>
|
2025-09-01 17:55:23 +08:00
|
|
|
|
<div className="ant-card-body" style={{ padding: "20px 0 0 0" ,marginRight:20}}>
|
2024-09-20 15:02:50 +08:00
|
|
|
|
<Table columns={columns} rowKey="inx" {...tableProps} scroll={{ x: width , y: "calc( 100vh - 400px )"}}/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<BasicCrudModal
|
|
|
|
|
|
width={1000}
|
|
|
|
|
|
ref={refModal}
|
|
|
|
|
|
title=""
|
|
|
|
|
|
component={ModalForm}
|
|
|
|
|
|
onCrudSuccess={successCallback}
|
|
|
|
|
|
// onCrudSuccess={()=>{refresh({addvcd:localStorage.getItem('ADCD6')})}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default Page;
|