From 2b9b7dee4ec5e0d8ed382003cadd05c74f423c4a Mon Sep 17 00:00:00 2001 From: fangjiakai <450850793@qq.com> Date: Mon, 22 Dec 2025 10:23:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(accident):=20=E4=BC=98=E5=8C=96=E4=BA=8B?= =?UTF-8?q?=E6=95=85=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改事故批量删除接口路径参数格式 - 更新企业信息列表接口路径 - 添加权限控制装饰器和权限配置 - 优化事故查询条件时间范围处理 - 调整事故等级字段显示为"等级"而非"级别" - 增加表格行选择保持功能 - 完善导出按钮 --- src/api/accident/index.js | 6 +- .../Accident/components/Accident/index.js | 104 +++++++++--------- src/pages/Container/Accident/index.js | 5 + src/pages/Container/Event/index.js | 5 + .../Container/SuperviseAccident/Info/index.js | 1 + .../Container/SuperviseAccident/List/index.js | 3 + 6 files changed, 69 insertions(+), 55 deletions(-) diff --git a/src/api/accident/index.js b/src/api/accident/index.js index 6f85108..4f306a7 100644 --- a/src/api/accident/index.js +++ b/src/api/accident/index.js @@ -18,7 +18,7 @@ export const accidentDelete = declareRequest( ); export const accidentBatchDelete = declareRequest( 'accidentLoading', - 'Delete > @/accident/accident/ids/{ids}' + 'Delete > @/accident/accident/ids?ids={ids}' ); export const accidentInfo = declareRequest('accidentLoading', 'Get > /accident/accident/{id}'); @@ -29,10 +29,10 @@ export const accidentCountByCorpinfoAndType = declareRequest( export const getCorpInfoList = declareRequest( 'accidentLoading', - 'Post > @/basic-info/corpInfo/list' + 'Post > @/basicInfo/corpInfo/list' ); export const accidentExport = declareRequest( 'accidentLoading', 'Post > @/accident/accident/export' -); \ No newline at end of file +); diff --git a/src/pages/Container/Accident/components/Accident/index.js b/src/pages/Container/Accident/components/Accident/index.js index c9603d9..88ec4c2 100644 --- a/src/pages/Container/Accident/components/Accident/index.js +++ b/src/pages/Container/Accident/components/Accident/index.js @@ -20,6 +20,9 @@ import HeaderBack from "zy-react-library/components/HeaderBack"; import DictionarySelect from "zy-react-library/components/Select/Dictionary"; import useDownloadBlob from "zy-react-library/hooks/useDownloadBlob"; import useUrlQueryCriteria from "zy-react-library/hooks/useUrlQueryCriteria"; +import PreviewImg from "zy-react-library/components/PreviewImg"; +import useDownloadFile from "zy-react-library/hooks/useDownloadFile"; +import { Permission } from "@cqsjjb/jjb-common-decorator/permission"; function Accident(props) { @@ -29,7 +32,7 @@ function Accident(props) { const [accidentId, setAccidentId] = useState(""); const [selectedRowKeys, setSelectedRowKeys] = useState([]); const { loading, downloadBlob } = useDownloadBlob(); - const {getUrlCriteriaQuery} = useUrlQueryCriteria(); + const { getUrlCriteriaQuery } = useUrlQueryCriteria(); const [form] = Form.useForm(); const { tableProps, getData } = useTable(props["accidentList"], { form, @@ -38,8 +41,8 @@ function Accident(props) { eqCorpinfoId: props.corpinfoId, }, transform: data => ({ - geIncidentDate: data.incidentDate?.[0], - leIncidentDate: data.incidentDate?.[1], + geIncidentDate: data.incidentDate?.[0] ? (data.incidentDate[0] + " 00:00:00") : "", + leIncidentDate: data.incidentDate?.[1] ? (data.incidentDate[1] + " 23:59:59") : "", }), }); const typeName = props.type === 1 ? "事件" : "事故"; @@ -52,7 +55,7 @@ function Accident(props) { options={[ { name: "likeIncidentName", label: `${typeName}名称` }, { name: "eqIncidentType", label: `${typeName}类型`, render: }, - { name: "eqIncidentLevel", label: `${typeName}级别`, render: }, + { name: "eqIncidentLevel", label: `${typeName}等级`, render: }, { name: "likeLocation", label: `${typeName}发生地点` }, { name: "incidentDate", label: `${typeName}发生时间`, render: FORM_ITEM_RENDER_ENUM.DATE_RANGE }, ]} @@ -61,17 +64,21 @@ function Accident(props) { rowSelection={{ selectedRowKeys, onChange: selectedRowKeys => setSelectedRowKeys(selectedRowKeys), + preserveSelectedRowKeys: true, }} toolBarRender={() => ( - - {!props.isSupervise && ( - + {props.permission(props.exportPermission) && + + } + {!props.isSupervise && props.permission(props.addPermission) && + } + {!props.isSupervise && props.permission(props.deleteBatchPermission) && - - )} + } )} columns={[ @@ -99,6 +105,8 @@ function Accident(props) { { dataIndex: "corpinfoName", title: `所属公司` }, { dataIndex: "incidentDate", title: `${typeName}发生时间` }, { dataIndex: "location", title: `${typeName}发生地点` }, + { dataIndex: "incidentTypeName", title: `${typeName}类型`}, + { dataIndex: "incidentLevelName", title: `${typeName}等级`}, { title: "操作", align: "center", @@ -115,7 +123,7 @@ function Accident(props) { > 查看 - {!props.isSupervise && + {!props.isSupervise && props.permission(props.editPermission) && } - {!props.isSupervise && + {!props.isSupervise && props.permission(props.deletePermission) &&