refactor(accident): 重构事故管理页面组件
- 替换 div 包装器为 Page 组件以统一页面布局 - 移除 HeaderBack 组件并集成到 Page 组件中 - 调整搜索表单项顺序,将日期范围和地点字段位置优化 - 更新导出按钮样式,添加 ghost 属性并修改文本为全部导出 - 为批量删除按钮添加 ghost 属性并优化提示信息 - 修复表单字段间距和组件属性配置 - 移除事故性质字段并添加填报人字段 - 更新模态框确认按钮的 loading 属性为 confirmLoading - 在表单构建器中添加 loading 属性 - 调整详情页面字段显示顺序并添加填报人信息 - 修复附件标签文本格式 - 在监管事故列表中使用 Page 组件替代master
parent
2b9b7dee4e
commit
917145833b
|
|
@ -6,7 +6,7 @@ import "dayjs/locale/zh-cn";
|
||||||
import "../blessed_by_buddha";
|
import "../blessed_by_buddha";
|
||||||
|
|
||||||
require("antd/dist/reset.css");
|
require("antd/dist/reset.css");
|
||||||
|
require("zy-react-library/css/common.less");
|
||||||
dayjs.locale("zh-cn");
|
dayjs.locale("zh-cn");
|
||||||
setJJBCommonAntdMessage(message);
|
setJJBCommonAntdMessage(message);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,13 @@ import { NS_ACCIDENT } from "~/enumerate/namespace";
|
||||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||||
import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon";
|
import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon";
|
||||||
import ExportIcon from "zy-react-library/components/Icon/ExportIcon";
|
import ExportIcon from "zy-react-library/components/Icon/ExportIcon";
|
||||||
import HeaderBack from "zy-react-library/components/HeaderBack";
|
|
||||||
import DictionarySelect from "zy-react-library/components/Select/Dictionary";
|
import DictionarySelect from "zy-react-library/components/Select/Dictionary";
|
||||||
import useDownloadBlob from "zy-react-library/hooks/useDownloadBlob";
|
import useDownloadBlob from "zy-react-library/hooks/useDownloadBlob";
|
||||||
import useUrlQueryCriteria from "zy-react-library/hooks/useUrlQueryCriteria";
|
import useUrlQueryCriteria from "zy-react-library/hooks/useUrlQueryCriteria";
|
||||||
import PreviewImg from "zy-react-library/components/PreviewImg";
|
import PreviewImg from "zy-react-library/components/PreviewImg";
|
||||||
import useDownloadFile from "zy-react-library/hooks/useDownloadFile";
|
import useDownloadFile from "zy-react-library/hooks/useDownloadFile";
|
||||||
import { Permission } from "@cqsjjb/jjb-common-decorator/permission";
|
import { Permission } from "@cqsjjb/jjb-common-decorator/permission";
|
||||||
|
import Page from "zy-react-library/components/Page";
|
||||||
|
|
||||||
|
|
||||||
function Accident(props) {
|
function Accident(props) {
|
||||||
|
|
@ -47,17 +47,19 @@ function Accident(props) {
|
||||||
});
|
});
|
||||||
const typeName = props.type === 1 ? "事件" : "事故";
|
const typeName = props.type === 1 ? "事件" : "事故";
|
||||||
return (
|
return (
|
||||||
<div style={{ padding: 10 }}>
|
<Page
|
||||||
{props.isSupervise && <HeaderBack title={`${typeName}管理`} />}
|
isShowAllAction={!!props.isSupervise}
|
||||||
|
headerTitle={`${typeName}管理`}
|
||||||
|
>
|
||||||
<Search
|
<Search
|
||||||
form={form}
|
form={form}
|
||||||
onFinish={getData}
|
onFinish={getData}
|
||||||
options={[
|
options={[
|
||||||
{ name: "likeIncidentName", label: `${typeName}名称` },
|
{ name: "likeIncidentName", label: `${typeName}名称` },
|
||||||
|
{ name: "incidentDate", label: `${typeName}发生时间`, render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
||||||
|
{ name: "likeLocation", label: `${typeName}发生地点` },
|
||||||
{ name: "eqIncidentType", label: `${typeName}类型`, render: <DictionarySelect dictValue="accidentType" /> },
|
{ name: "eqIncidentType", label: `${typeName}类型`, render: <DictionarySelect dictValue="accidentType" /> },
|
||||||
{ name: "eqIncidentLevel", label: `${typeName}等级`, render: <DictionarySelect dictValue="accidentLevel" /> },
|
{ name: "eqIncidentLevel", label: `${typeName}等级`, render: <DictionarySelect dictValue="accidentLevel" /> },
|
||||||
{ name: "likeLocation", label: `${typeName}发生地点` },
|
|
||||||
{ name: "incidentDate", label: `${typeName}发生时间`, render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<Table
|
<Table
|
||||||
|
|
@ -69,34 +71,35 @@ function Accident(props) {
|
||||||
toolBarRender={() => (
|
toolBarRender={() => (
|
||||||
<Space>
|
<Space>
|
||||||
{props.permission(props.exportPermission) &&
|
{props.permission(props.exportPermission) &&
|
||||||
<Button loading={loading} icon={<ExportIcon />} onClick={async () => {
|
<Button type="primary" loading={loading} icon={<ExportIcon />} ghost onClick={async () => {
|
||||||
const exportParams = getUrlCriteriaQuery("searchFormKeys", "searchFormValues");
|
const exportParams = getUrlCriteriaQuery("searchFormKeys", "searchFormValues");
|
||||||
|
|
||||||
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) &&
|
{!props.isSupervise && props.permission(props.addPermission) &&
|
||||||
<Button type="primary" icon={<AddIcon />} onClick={() => setAddModalVisible(true)}>新增</Button>
|
<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 />}
|
||||||
type="primary"
|
ghost
|
||||||
danger
|
type="primary"
|
||||||
onClick={() => {
|
danger
|
||||||
if (!selectedRowKeys.length)
|
onClick={() => {
|
||||||
return message.warning("请选择要删除的行");
|
if (!selectedRowKeys.length)
|
||||||
Modal.confirm({
|
return message.warning("请选择要删除的项");
|
||||||
title: "确定删除吗?",
|
Modal.confirm({
|
||||||
onOk: async () => {
|
title: "确定删除吗?",
|
||||||
await props["accidentBatchDelete"]({ids: selectedRowKeys});
|
onOk: async () => {
|
||||||
message.success("删除成功");
|
await props["accidentBatchDelete"]({ ids: selectedRowKeys });
|
||||||
getData();
|
message.success("删除成功");
|
||||||
},
|
getData();
|
||||||
});
|
},
|
||||||
}}
|
});
|
||||||
>
|
}}
|
||||||
批量删除
|
>
|
||||||
</Button>
|
批量删除
|
||||||
|
</Button>
|
||||||
}
|
}
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
|
|
@ -105,8 +108,8 @@ function Accident(props) {
|
||||||
{ dataIndex: "corpinfoName", title: `所属公司` },
|
{ dataIndex: "corpinfoName", title: `所属公司` },
|
||||||
{ dataIndex: "incidentDate", title: `${typeName}发生时间` },
|
{ dataIndex: "incidentDate", title: `${typeName}发生时间` },
|
||||||
{ dataIndex: "location", title: `${typeName}发生地点` },
|
{ dataIndex: "location", title: `${typeName}发生地点` },
|
||||||
{ dataIndex: "incidentTypeName", title: `${typeName}类型`},
|
{ dataIndex: "incidentTypeName", title: `${typeName}类型` },
|
||||||
{ dataIndex: "incidentLevelName", title: `${typeName}等级`},
|
{ dataIndex: "incidentLevelName", title: `${typeName}等级` },
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
align: "center",
|
align: "center",
|
||||||
|
|
@ -183,7 +186,7 @@ function Accident(props) {
|
||||||
typeName={typeName}
|
typeName={typeName}
|
||||||
getData={getData}
|
getData={getData}
|
||||||
/>}
|
/>}
|
||||||
</div>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -300,7 +303,7 @@ function AddModalComponent(props) {
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
onOk={form.submit}
|
onOk={form.submit}
|
||||||
title={props.currentId ? "编辑" : "新增"}
|
title={props.currentId ? "编辑" : "新增"}
|
||||||
loading={props.accident.accidentLoading || uploadLoading || deleteLoading}
|
confirmLoading={props.accident.accidentLoading || uploadLoading || deleteLoading}
|
||||||
width={800}
|
width={800}
|
||||||
>
|
>
|
||||||
<FormBuilder
|
<FormBuilder
|
||||||
|
|
@ -309,23 +312,24 @@ function AddModalComponent(props) {
|
||||||
span={24}
|
span={24}
|
||||||
onFinish={submit}
|
onFinish={submit}
|
||||||
showActionButtons={false}
|
showActionButtons={false}
|
||||||
|
loading={props.accident.accidentLoading || uploadLoading || deleteLoading}
|
||||||
options={[
|
options={[
|
||||||
{ name: "incidentNumber", label: `${typeName}案号` },
|
{ name: "incidentNumber", label: `${typeName}案号` },
|
||||||
{ name: "incidentName", label: `${typeName}名称` },
|
{ name: "incidentName", label: `${typeName}名称` },
|
||||||
{ name: "incidentType", label: `${typeName}类型`, render: <DictionarySelect dictValue="accidentType" onGetLabel={(label) => setDicNames({ ...dicNames, incidentTypeName: label })} /> },
|
{ name: "incidentType", label: `${typeName}类型`, render: <DictionarySelect dictValue="accidentType" onGetLabel={(label) => setDicNames({ ...dicNames, incidentTypeName: label })} /> },
|
||||||
{ name: "incidentLevel", label: `${typeName}等级`, render: <DictionarySelect dictValue="accidentLevel" onGetLabel={(label) => setDicNames({ ...dicNames, incidentLevelName: label })} /> },
|
{ name: "incidentLevel", label: `${typeName}等级`, render: <DictionarySelect dictValue="accidentLevel" onGetLabel={(label) => setDicNames({ ...dicNames, incidentLevelName: label })} /> },
|
||||||
{ name: "incidentNature", label: `${typeName}性质` },
|
|
||||||
{ name: "location", label: `${typeName}发生地点` },
|
{ name: "location", label: `${typeName}发生地点` },
|
||||||
{ name: "incidentDate", label: `${typeName}发生时间`, render: FORM_ITEM_RENDER_ENUM.DATETIME },
|
{ name: "incidentDate", label: `${typeName}发生时间`, render: FORM_ITEM_RENDER_ENUM.DATETIME },
|
||||||
{ name: "directLoss", label: "直接经济损失(万元)", render: FORM_ITEM_RENDER_ENUM.NUMBER,componentProps: { precision: 2,min: 0 }, required: false },
|
{ name: "directLoss", label: "直接经济损失(万元)", render: FORM_ITEM_RENDER_ENUM.NUMBER, componentProps: { precision: 2, min: 0 }, required: false },
|
||||||
{ name: "injured", label: "受伤人数", render: FORM_ITEM_RENDER_ENUM.NUMBER,componentProps: { precision: 0,min: 0 }, required: false },
|
{ name: "injured", label: "受伤人数", render: FORM_ITEM_RENDER_ENUM.NUMBER, componentProps: { precision: 0, min: 0 }, required: false },
|
||||||
{ name: "fatalities", label: "死亡人数", render: FORM_ITEM_RENDER_ENUM.NUMBER,componentProps: { precision: 0,min: 0 }, required: false },
|
{ name: "fatalities", label: "死亡人数", render: FORM_ITEM_RENDER_ENUM.NUMBER, componentProps: { precision: 0, min: 0 }, required: false },
|
||||||
{ name: "seriouslyInjured", label: "重伤人数", render: FORM_ITEM_RENDER_ENUM.NUMBER,componentProps: { precision: 0,min: 0 }, required: false },
|
{ name: "seriouslyInjured", label: "重伤人数", render: FORM_ITEM_RENDER_ENUM.NUMBER, componentProps: { precision: 0, min: 0 }, required: false },
|
||||||
{ name: "cause", label: `${typeName}起因`, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
{ name: "cause", label: `${typeName}起因`, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||||
{ name: "summary", label: `${typeName}概述`, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
{ name: "summary", label: `${typeName}概述`, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||||
{ name: "analysis", label: "原因分析及责任认定", render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
{ name: "analysis", label: "原因分析及责任认定", render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||||
{ name: "suggestions", label: "考核建议", render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
{ name: "suggestions", label: "考核建议", render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||||
{ name: "measures", label: "整改措施", render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
{ name: "measures", label: "整改措施", render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||||
|
{ name: "reportUser", label: `填报人` },
|
||||||
{ name: "reportDate", label: "报出日期", render: FORM_ITEM_RENDER_ENUM.DATETIME },
|
{ name: "reportDate", label: "报出日期", render: FORM_ITEM_RENDER_ENUM.DATETIME },
|
||||||
// 添加图片上传
|
// 添加图片上传
|
||||||
{
|
{
|
||||||
|
|
@ -407,7 +411,6 @@ function InfoModalComponent(props) {
|
||||||
{ children: info.incidentName, label: `${typeName}名称` },
|
{ children: info.incidentName, label: `${typeName}名称` },
|
||||||
{ children: info.incidentTypeName, label: `${typeName}类型` },
|
{ children: info.incidentTypeName, label: `${typeName}类型` },
|
||||||
{ children: info.incidentLevelName, label: `${typeName}等级` },
|
{ children: info.incidentLevelName, label: `${typeName}等级` },
|
||||||
{ children: info.incidentNature, label: `${typeName}性质` },
|
|
||||||
{ children: info.location, label: `${typeName}发生地点` },
|
{ children: info.location, label: `${typeName}发生地点` },
|
||||||
{ children: info.incidentDate, label: `${typeName}发生时间` },
|
{ children: info.incidentDate, label: `${typeName}发生时间` },
|
||||||
{ children: info.directLoss || 0, label: "直接经济损失(万元)" },
|
{ children: info.directLoss || 0, label: "直接经济损失(万元)" },
|
||||||
|
|
@ -419,6 +422,7 @@ function InfoModalComponent(props) {
|
||||||
{ children: info.analysis, label: "原因分析及责任认定" },
|
{ children: info.analysis, label: "原因分析及责任认定" },
|
||||||
{ children: info.suggestions, label: "考核建议" },
|
{ children: info.suggestions, label: "考核建议" },
|
||||||
{ children: info.measures, label: "整改措施" },
|
{ children: info.measures, label: "整改措施" },
|
||||||
|
{ children: info.reportUser, label: "填表人" },
|
||||||
{ children: info.reportDate, label: "报出日期" },
|
{ children: info.reportDate, label: "报出日期" },
|
||||||
// 显示图片
|
// 显示图片
|
||||||
{
|
{
|
||||||
|
|
@ -429,7 +433,7 @@ function InfoModalComponent(props) {
|
||||||
},
|
},
|
||||||
// 显示附件
|
// 显示附件
|
||||||
{
|
{
|
||||||
label: `${typeName}附件`,
|
label: `${typeName}附件`,
|
||||||
children: (
|
children: (
|
||||||
<div>
|
<div>
|
||||||
{attachmentFiles.map((file, index) => (
|
{attachmentFiles.map((file, index) => (
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import {NS_ACCIDENT} from "~/enumerate/namespace";
|
||||||
import useDictionary from "zy-react-library/hooks/useDictionary";
|
import useDictionary from "zy-react-library/hooks/useDictionary";
|
||||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||||
import useUrlQueryCriteria from "zy-react-library/hooks/useUrlQueryCriteria";
|
import useUrlQueryCriteria from "zy-react-library/hooks/useUrlQueryCriteria";
|
||||||
|
import Page from "zy-react-library/components/Page";
|
||||||
|
|
||||||
|
|
||||||
const TYPE = [
|
const TYPE = [
|
||||||
|
|
@ -36,7 +37,7 @@ function SuperviseAccident(props) {
|
||||||
const {tableProps, getData} = useTable(props["getCorpInfoList"], {
|
const {tableProps, getData} = useTable(props["getCorpInfoList"], {
|
||||||
form,
|
form,
|
||||||
params: {
|
params: {
|
||||||
inType: "0,1",
|
inType: [0,1],
|
||||||
},
|
},
|
||||||
onSuccess: ({data}) => {
|
onSuccess: ({data}) => {
|
||||||
getAccidentCountByCorpinfoAndType(data.map(item => item.id),form.getFieldValue("eqAccidentType"))
|
getAccidentCountByCorpinfoAndType(data.map(item => item.id),form.getFieldValue("eqAccidentType"))
|
||||||
|
|
@ -48,7 +49,7 @@ function SuperviseAccident(props) {
|
||||||
const searchType = getUrlCriteriaQuery("searchFormKeys","searchFormValues").eqAccidentType;
|
const searchType = getUrlCriteriaQuery("searchFormKeys","searchFormValues").eqAccidentType;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{padding: 10}}>
|
<Page isShowAllAction={false}>
|
||||||
<Search
|
<Search
|
||||||
form={form}
|
form={form}
|
||||||
values={{
|
values={{
|
||||||
|
|
@ -66,7 +67,7 @@ function SuperviseAccident(props) {
|
||||||
onChange: selectedRowKeys => setSelectedRowKeys(selectedRowKeys),
|
onChange: selectedRowKeys => setSelectedRowKeys(selectedRowKeys),
|
||||||
}}
|
}}
|
||||||
columns={[
|
columns={[
|
||||||
{dataIndex: "corpName", title: `所属公司`},
|
{dataIndex: "corpName", title: `公司名称`},
|
||||||
...accidentType.map(item => ({
|
...accidentType.map(item => ({
|
||||||
dataIndex: `countByCorpinfoAndType_${item.dictValue}`,
|
dataIndex: `countByCorpinfoAndType_${item.dictValue}`,
|
||||||
title: `${item.dictLabel}`,
|
title: `${item.dictLabel}`,
|
||||||
|
|
@ -94,7 +95,7 @@ function SuperviseAccident(props) {
|
||||||
]}
|
]}
|
||||||
{...tableProps}
|
{...tableProps}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue