fix(accident): 修复事故管理页面权限控制和数据处理问题

- 修复新增按钮权限控制逻辑错误
- 添加批量删除后选中行状态重置功能
- 修复列定义顺序导致的显示问题
- 添加弹窗遮罩点击关闭限制防止误操作
- 修复监管部门事故列表企业类型筛选条件
- 修复详情查看弹窗加载状态显示位置
master
fangjiakai 2026-02-06 13:35:49 +08:00
parent 0b971f39b9
commit 2c35e03824
2 changed files with 10 additions and 7 deletions

View File

@ -47,7 +47,7 @@ function Accident(props) {
}); });
const typeName = props.type === 1 ? "事件" : "事故"; const typeName = props.type === 1 ? "事件" : "事故";
return ( return (
<Page <Page
isShowAllAction={!!props.isSupervise} isShowAllAction={!!props.isSupervise}
headerTitle={`${typeName}管理`} headerTitle={`${typeName}管理`}
> >
@ -70,6 +70,9 @@ function Accident(props) {
}} }}
toolBarRender={() => ( toolBarRender={() => (
<Space> <Space>
{!props.isSupervise && props.permission(props.addPermission) &&
<Button type="primary" icon={<AddIcon />} onClick={() => setAddModalVisible(true)}>新增</Button>
}
{props.permission(props.exportPermission) && {props.permission(props.exportPermission) &&
<Button type="primary" loading={loading} icon={<ExportIcon />} ghost onClick={async () => { <Button type="primary" loading={loading} icon={<ExportIcon />} ghost onClick={async () => {
const exportParams = getUrlCriteriaQuery("searchFormKeys", "searchFormValues"); const exportParams = getUrlCriteriaQuery("searchFormKeys", "searchFormValues");
@ -77,9 +80,6 @@ function Accident(props) {
await downloadBlob("/accident/accident/export", { params: { ...exportParams, eqType: props.type } }) await downloadBlob("/accident/accident/export", { params: { ...exportParams, eqType: props.type } })
}}>全部导出</Button> }}>全部导出</Button>
} }
{!props.isSupervise && props.permission(props.addPermission) &&
<Button type="primary" icon={<AddIcon />} onClick={() => setAddModalVisible(true)}>新增</Button>
}
{!props.isSupervise && props.permission(props.deleteBatchPermission) && {!props.isSupervise && props.permission(props.deleteBatchPermission) &&
<Button icon={<DeleteIcon />} <Button icon={<DeleteIcon />}
ghost ghost
@ -93,6 +93,7 @@ function Accident(props) {
onOk: async () => { onOk: async () => {
await props["accidentBatchDelete"]({ ids: selectedRowKeys }); await props["accidentBatchDelete"]({ ids: selectedRowKeys });
message.success("删除成功"); message.success("删除成功");
setSelectedRowKeys([]);
getData(); getData();
}, },
}); });
@ -104,8 +105,8 @@ function Accident(props) {
</Space> </Space>
)} )}
columns={[ columns={[
{ dataIndex: "incidentName", title: `${typeName}名称` },
{ dataIndex: "corpinfoName", title: `所属公司` }, { dataIndex: "corpinfoName", title: `所属公司` },
{ dataIndex: "incidentName", title: `${typeName}名称` },
{ dataIndex: "incidentDate", title: `${typeName}发生时间` }, { dataIndex: "incidentDate", title: `${typeName}发生时间` },
{ dataIndex: "location", title: `${typeName}发生地点` }, { dataIndex: "location", title: `${typeName}发生地点` },
{ dataIndex: "incidentTypeName", title: `${typeName}类型` }, { dataIndex: "incidentTypeName", title: `${typeName}类型` },
@ -302,6 +303,7 @@ function AddModalComponent(props) {
open open
onCancel={onCancel} onCancel={onCancel}
onOk={form.submit} onOk={form.submit}
maskClosable={false}
title={props.currentId ? "编辑" : "新增"} title={props.currentId ? "编辑" : "新增"}
confirmLoading={props.accident.accidentLoading || uploadLoading || deleteLoading} confirmLoading={props.accident.accidentLoading || uploadLoading || deleteLoading}
width={800} width={800}
@ -398,12 +400,13 @@ function InfoModalComponent(props) {
open open
onCancel={props.onCancel} onCancel={props.onCancel}
footer={<Button onClick={props.onCancel}>关闭</Button>} footer={<Button onClick={props.onCancel}>关闭</Button>}
maskClosable={false}
title={`查看${typeName}`} title={`查看${typeName}`}
loading={props.accident.accidentLoading}
width={800} width={800}
> >
<Descriptions <Descriptions
labelStyle={{ width: 200 }} labelStyle={{ width: 200 }}
loading={props.accident.accidentLoading}
column={1} column={1}
bordered bordered
items={[ items={[

View File

@ -37,7 +37,7 @@ function SuperviseAccident(props) {
const {tableProps, getData} = useTable(props["getCorpInfoList"], { const {tableProps, getData} = useTable(props["getCorpInfoList"], {
form, form,
params: { params: {
enterpriseType: [2], inType: [0,1,6],
}, },
onSuccess: ({data}) => { onSuccess: ({data}) => {
getAccidentCountByCorpinfoAndType(data.map(item => item.id),form.getFieldValue("eqAccidentType")) getAccidentCountByCorpinfoAndType(data.map(item => item.id),form.getFieldValue("eqAccidentType"))