73 lines
2.7 KiB
JavaScript
73 lines
2.7 KiB
JavaScript
|
|
import React, { Fragment, useRef, useMemo,useEffect,useState } from 'react';
|
||
|
|
import BasicCrudModal from '../../../../components/crud/BasicCrudModal';
|
||
|
|
import { Table, Card,Modal,Form,Input,Button,Row,Col,message } from 'antd';
|
||
|
|
import { useSelector } from 'react-redux';
|
||
|
|
import ToolBar from './toolbar';
|
||
|
|
import apiurl from '../../../../service/apiurl';
|
||
|
|
import usePageTable from '../../../../components/crud/usePageTable2';
|
||
|
|
import { createCrudService } from '../../../../components/crud/_';
|
||
|
|
import { httppost2 } from '../../../../utils/request';
|
||
|
|
import "./index.less"
|
||
|
|
const Page = () => {
|
||
|
|
const role = useSelector(state => state.auth.role);
|
||
|
|
const refModal = useRef();
|
||
|
|
const [searchVal, setSearchVal] = useState(false)
|
||
|
|
const columns = [
|
||
|
|
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align:"center" },
|
||
|
|
{ title: '上报时间', key: 'tm', dataIndex: 'tm', width: 200, ellipsis: true, align:"center" },
|
||
|
|
{ title: '测点编号', key: 'stationCode', dataIndex: 'stationCode', width: 200, align:"center"},
|
||
|
|
{
|
||
|
|
title: '通道号', key: 'chan', dataIndex: 'chan', width: 200, align:"center",
|
||
|
|
},
|
||
|
|
{ title: '水深(mm)', key: 'l', dataIndex: 'l', width: 200, ellipsis: true,align:"center", },
|
||
|
|
|
||
|
|
{ title: '流量(L/s)', key: 'q', dataIndex: 'q', width: 250, ellipsis: true,align:"center", },
|
||
|
|
];
|
||
|
|
|
||
|
|
|
||
|
|
const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]);
|
||
|
|
|
||
|
|
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.gcaqjc.gcaqyj.yhyj.delete + `/${params.goodsId}`);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.gcaqjc.sjtjcx.slcx.page).find_noCode);
|
||
|
|
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%" }}>
|
||
|
|
<Card className='nonebox'>
|
||
|
|
<ToolBar
|
||
|
|
setSearchVal={setSearchVal}
|
||
|
|
onSave={command('save')}
|
||
|
|
role={role}
|
||
|
|
/>
|
||
|
|
</Card>
|
||
|
|
<div className="ant-card-body" style={{padding:"20px 0 0 0"}}>
|
||
|
|
<Table columns={columns} rowKey="inx" {...tableProps} scroll={{ x: width , y: "calc( 100vh - 400px )"}}/>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
export default Page;
|