tsg-web/src/views/rcgl/zmjk/ModalContent.js

83 lines
2.1 KiB
JavaScript
Raw Normal View History

2025-03-21 17:36:23 +08:00
import React,{useState,useEffect} from 'react'
import {Card,Table} from 'antd'
import ModalToolBar from './ModalToolBar';
import { httppost5 } from '../../../utils/request';
import { exportFile } from '../../../utils/tools';
import apiurl from '../../../service/apiurl';
2025-03-28 17:33:56 +08:00
import usePageTable from '../../../components/crud/usePageTable2';
import { createCrudService } from '../../../components/crud/_';
export default function ModalContent({zfjkData}) {
2025-03-21 17:36:23 +08:00
const columns = [
{
title: '序号',
key: 'inx',
2025-03-28 17:33:56 +08:00
dataIndex:'inx',
2025-03-21 17:36:23 +08:00
width: 80,
},
{
2025-03-28 17:33:56 +08:00
title: '闸阀名称',
key: 'valveName',
dataIndex:'valveName',
2025-03-21 17:36:23 +08:00
width: 150,
},
{
title: '操作内容',
2025-03-28 17:33:56 +08:00
dataIndex:'opContent',
key: 'opContent',
2025-03-21 17:36:23 +08:00
width: 150,
},
{
title: '操作结果',
2025-03-28 17:33:56 +08:00
dataIndex:'status',
key: 'status',
2025-03-21 17:36:23 +08:00
width: 150,
2025-03-28 17:33:56 +08:00
},
2025-03-21 17:36:23 +08:00
{
title: '操作时间',
2025-03-28 17:33:56 +08:00
dataIndex:'tm',
key: 'tm',
2025-03-21 17:36:23 +08:00
width: 150,
}
]
const [searchVal, setSearchVal] = useState(false)
2025-03-28 17:33:56 +08:00
// 闸阀弹框更多数据
const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.gsxl.zfzl.historypage).find_noCode);
2025-03-21 17:36:23 +08:00
const exportExcel = () => {
let params = {
...searchVal,
2025-03-28 17:33:56 +08:00
pageSo: {
pageNumber: tableProps.pagination.current,
pageSize:tableProps.pagination.pageSize
}
2025-03-21 17:36:23 +08:00
}
2025-03-28 17:33:56 +08:00
httppost5(apiurl.gsxl.zfzl.historyPageExport, params).then(res => {
2025-03-21 17:36:23 +08:00
exportFile(`闸门操作记录.xlsx`,res.data)
})
}
2025-03-28 17:33:56 +08:00
useEffect(() => {
if (searchVal) {
const params = {
search: {
...searchVal,
}
}
search(params)
}
}, [searchVal])
2025-03-21 17:36:23 +08:00
return (
<div>
<Card className='nonebox'>
<ModalToolBar
2025-03-24 18:00:36 +08:00
setSearchVal={setSearchVal}
exportFile={exportExcel}
2025-03-28 17:33:56 +08:00
list={zfjkData}
2025-03-21 17:36:23 +08:00
/>
</Card>
<div className="ant-card-body" style={{ padding: "20px 0 0 0" }}>
2025-03-28 17:33:56 +08:00
<Table columns={columns} rowKey="inx" {...tableProps} />
2025-03-21 17:36:23 +08:00
</div>
</div>
)
}