Compare commits

..

3 Commits
dev ... master

Author SHA1 Message Date
fangjiakai e007fdbce2 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	jjb.config.js
#	src/main.js
2026-05-26 17:33:36 +08:00
fangjiakai acf96ba96d Merge remote-tracking branch 'origin/master'
# Conflicts:
#	jjb.config.js
#	package.json
2026-03-11 15:45:22 +08:00
fangjiakai ed38e8c510 feat(config): 更新项目配置和依赖库版本
- 添加 getFileUrlFromServer 初始化调用
- 配置百度地图API密钥到全局窗口对象
- 更新 zy-react-library 从 1.0.127 到 1.2.3 版本
- 修改 API_HOST 配置为空字符串并注释原地址
- 更新文件服务器地址为生产环境URL
- 配置eslint格式化器支持css格式化
2026-03-11 15:44:51 +08:00
8 changed files with 219 additions and 300 deletions

View File

@ -10,7 +10,6 @@ module.exports = {
javaGitBranch: "<branch-name>",
// 接口服务地址
API_HOST: "https://gbs-gateway.qhdsafety.com",
},
production: {
// 应用后端分支名称,部署上线需要
@ -45,7 +44,7 @@ module.exports = {
// 开发服务
server: {
// 监听端口号
port: "8030",
port: "8080",
// 服务地址
host: "127.0.0.1",
// 是否自动打开浏览器

View File

@ -30,7 +30,7 @@
"lodash-es": "^4.17.21",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"zy-react-library": "^1.3.15"
"zy-react-library": "latest"
},
"devDependencies": {
"@antfu/eslint-config": "^5.4.1",

View File

@ -1,42 +1,38 @@
import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
import { declareRequest } from '@cqsjjb/jjb-dva-runtime';
export const accidentList = declareRequest(
"accidentLoading",
"Post > @/accident/accident/list",
'accidentLoading',
'Post > @/accident/accident/list',
);
export const accidentAdd = declareRequest(
"accidentLoading",
"Post > @/accident/accident/save",
'accidentLoading',
'Post > @/accident/accident/save'
);
export const accidentEdit = declareRequest(
"accidentLoading",
"Put > @/accident/accident/edit",
'accidentLoading',
'Put > @/accident/accident/edit'
);
export const accidentDelete = declareRequest(
"accidentLoading",
"Delete > @/accident/accident/{id}",
'accidentLoading',
'Delete > @/accident/accident/{id}'
);
export const accidentBatchDelete = declareRequest(
"accidentLoading",
"Delete > @/accident/accident/ids?ids={ids}",
'accidentLoading',
'Delete > @/accident/accident/ids?ids={ids}'
);
export const accidentInfo = declareRequest("accidentLoading", "Get > /accident/accident/{id}");
export const accidentInfo = declareRequest('accidentLoading', 'Get > /accident/accident/{id}');
export const accidentCountByCorpinfoAndType = declareRequest(
"accidentLoading",
"Post > @/accident/accident/countByCorpinfoAndType",
'accidentLoading',
'Post > @/accident/accident/countByCorpinfoAndType'
);
export const getCorpInfoList = declareRequest(
"accidentLoading",
"Post > @/basicInfo/corpInfo/list",
'accidentLoading',
'Post > @/basicInfo/corpInfo/list'
);
export const accidentExport = declareRequest(
"accidentLoading",
"Post > @/accident/accident/export",
);
export const countByIncidentType = declareRequest(
"accidentLoading",
"Post > @/accident/accident/countByIncidentType",
'accidentLoading',
'Post > @/accident/accident/export'
);

View File

@ -1,27 +1,29 @@
import { Permission } from "@cqsjjb/jjb-common-decorator/permission";
import React, { useEffect, useState } from "react";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Button, Descriptions, Form, message, Modal, Space } from "antd";
import { useEffect, useState } from "react";
import FormBuilder from "zy-react-library/components/FormBuilder";
import AddIcon from "zy-react-library/components/Icon/AddIcon";
import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon";
import ExportIcon from "zy-react-library/components/Icon/ExportIcon";
import Page from "zy-react-library/components/Page";
import PreviewImg from "zy-react-library/components/PreviewImg";
import Search from "zy-react-library/components/Search";
import DictionarySelect from "zy-react-library/components/Select/Dictionary";
import Table from "zy-react-library/components/Table";
import Upload from "zy-react-library/components/Upload";
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
import useDeleteFile from "zy-react-library/hooks/useDeleteFile";
import useDownloadBlob from "zy-react-library/hooks/useDownloadBlob";
import useDownloadFile from "zy-react-library/hooks/useDownloadFile";
import useGetFile from "zy-react-library/hooks/useGetFile";
import { TWO_DECIMAL_PLACES } from "zy-react-library/regular";
import useTable from "zy-react-library/hooks/useTable";
import useDeleteFile from "zy-react-library/hooks/useDeleteFile";
import useGetFile from "zy-react-library/hooks/useGetFile";
import useUploadFile from "zy-react-library/hooks/useUploadFile";
import useUrlQueryCriteria from "zy-react-library/hooks/useUrlQueryCriteria";
import { NS_ACCIDENT } from "~/enumerate/namespace";
import AddIcon from "zy-react-library/components/Icon/AddIcon";
import DeleteIcon from "zy-react-library/components/Icon/DeleteIcon";
import ExportIcon from "zy-react-library/components/Icon/ExportIcon";
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";
import Page from "zy-react-library/components/Page";
function Accident(props) {
const [addModalVisible, setAddModalVisible] = useState(false);
@ -37,11 +39,10 @@ function Accident(props) {
params: {
eqType: props.type,
eqCorpinfoId: props.corpinfoId,
eqIncidentType: props.eqIncidentType,
},
transform: data => ({
geIncidentDate: data.incidentDate?.[0] ? (`${data.incidentDate[0]} 00:00:00`) : "",
leIncidentDate: data.incidentDate?.[1] ? (`${data.incidentDate[1]} 23:59:59`) : "",
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 ? "事件" : "事故";
@ -49,7 +50,7 @@ function Accident(props) {
<Page
isShowAllAction={!!props.isSupervise}
headerTitle={`${typeName}管理`}
>
>
<Search
form={form}
onFinish={getData}
@ -69,48 +70,38 @@ function Accident(props) {
}}
toolBarRender={() => (
<Space>
{!props.isSupervise && props.permission(props.addPermission)
&& <Button type="primary" icon={<AddIcon />} onClick={() => setAddModalVisible(true)}>新增</Button>}
{props.permission(props.exportPermission)
&& (
<Button
type="primary"
loading={loading}
icon={<ExportIcon />}
ghost
onClick={async () => {
const exportParams = getUrlCriteriaQuery("searchFormKeys", "searchFormValues");
{!props.isSupervise && props.permission(props.addPermission) &&
<Button type="primary" icon={<AddIcon />} onClick={() => setAddModalVisible(true)}>新增</Button>
}
{props.permission(props.exportPermission) &&
<Button type="primary" loading={loading} icon={<ExportIcon />} ghost onClick={async () => {
const exportParams = getUrlCriteriaQuery("searchFormKeys", "searchFormValues");
await downloadBlob("/accident/accident/export", { params: { ...exportParams, eqType: props.type } });
}}
>
全部导出
</Button>
)}
{!props.isSupervise && props.permission(props.deleteBatchPermission)
&& (
<Button
icon={<DeleteIcon />}
ghost
type="primary"
danger
onClick={() => {
if (!selectedRowKeys.length)
return message.warning("请选择要删除的项");
Modal.confirm({
title: "确定删除吗?",
onOk: async () => {
await props["accidentBatchDelete"]({ ids: selectedRowKeys });
message.success("删除成功");
setSelectedRowKeys([]);
getData();
},
});
}}
>
批量删除
</Button>
)}
await downloadBlob("/accident/accident/export", { params: { ...exportParams, eqType: props.type } })
}}>全部导出</Button>
}
{!props.isSupervise && props.permission(props.deleteBatchPermission) &&
<Button icon={<DeleteIcon />}
ghost
type="primary"
danger
onClick={() => {
if (!selectedRowKeys.length)
return message.warning("请选择要删除的项");
Modal.confirm({
title: "确定删除吗?",
onOk: async () => {
await props["accidentBatchDelete"]({ ids: selectedRowKeys });
message.success("删除成功");
setSelectedRowKeys([]);
getData();
},
});
}}
>
批量删除
</Button>
}
</Space>
)}
columns={[
@ -136,72 +127,66 @@ function Accident(props) {
>
查看
</Button>
{!props.isSupervise && props.permission(props.editPermission)
&& (
<Button
type="link"
onClick={() => {
setCurrentId(record.id);
setAccidentId(record.accidentId);
setAddModalVisible(true);
}}
>
编辑
</Button>
)}
{!props.isSupervise && props.permission(props.deletePermission)
&& (
<Button
type="link"
danger
onClick={() => {
Modal.confirm({
title: "确定删除吗?",
onOk: async () => {
await props["accidentDelete"]({ id: record.id });
message.success("删除成功");
getData();
},
});
}}
>
删除
</Button>
)}
{!props.isSupervise && props.permission(props.editPermission) &&
<Button
type="link"
onClick={() => {
setCurrentId(record.id);
setAccidentId(record.accidentId);
setAddModalVisible(true);
}}
>
编辑
</Button>
}
{!props.isSupervise && props.permission(props.deletePermission) &&
<Button
type="link"
danger
onClick={() => {
Modal.confirm({
title: "确定删除吗?",
onOk: async () => {
await props["accidentDelete"]({ id: record.id });
message.success("删除成功");
getData();
},
});
}}
>
删除
</Button>
}
</Space>
),
},
]}
{...tableProps}
/>
{addModalVisible && (
<AddModal
currentId={currentId}
accidentId={accidentId}
onCancel={() => {
setAddModalVisible(false);
setCurrentId("");
setAccidentId("");
}}
type={props.type}
typeName={typeName}
getData={getData}
/>
)}
{addModalVisible && <AddModal
currentId={currentId}
accidentId={accidentId}
onCancel={() => {
setAddModalVisible(false);
setCurrentId("");
setAccidentId("");
}}
type={props.type}
typeName={typeName}
getData={getData}
/>}
{infoModalVisible && (
<InfoModal
currentId={currentId}
accidentId={accidentId}
onCancel={() => {
setInfoModalVisible(false);
setCurrentId("");
setAccidentId("");
}}
typeName={typeName}
getData={getData}
/>
)}
{infoModalVisible && <InfoModal
currentId={currentId}
accidentId={accidentId}
onCancel={() => {
setInfoModalVisible(false);
setCurrentId("");
setAccidentId("");
}}
typeName={typeName}
getData={getData}
/>}
</Page>
);
}
@ -233,7 +218,7 @@ function AddModalComponent(props) {
const values = {
...data,
imageFiles,
attachmentFiles,
attachmentFiles
};
form.setFieldsValue(values);
@ -270,32 +255,31 @@ function AddModalComponent(props) {
await uploadFile({
single: false,
files: values.imageFiles,
params: { type: UPLOAD_FILE_TYPE_ENUM["136"], foreignKey: accidentId },
params: { type: UPLOAD_FILE_TYPE_ENUM["136"], foreignKey: accidentId }
});
}
if (values.attachmentFiles && values.attachmentFiles.length > 0) {
await uploadFile({
single: false,
files: values.attachmentFiles,
params: { type: UPLOAD_FILE_TYPE_ENUM["137"], foreignKey: accidentId },
params: { type: UPLOAD_FILE_TYPE_ENUM["137"], foreignKey: accidentId }
});
}
// 保存基本信息
await props["accidentEdit"]({ ...values, ...dicNames, id: props.currentId });
}
else {
} else {
// 上传文件
const { id } = await uploadFile({
single: false,
files: values.imageFiles,
params: { type: UPLOAD_FILE_TYPE_ENUM["136"], foreignKey: "" },
params: { type: UPLOAD_FILE_TYPE_ENUM["136"], foreignKey: "" }
});
if (values.attachmentFiles && values.attachmentFiles.length > 0) {
await uploadFile({
single: false,
files: values.attachmentFiles,
params: { type: UPLOAD_FILE_TYPE_ENUM["137"], foreignKey: id },
params: { type: UPLOAD_FILE_TYPE_ENUM["137"], foreignKey: id }
});
}
@ -310,8 +294,7 @@ function AddModalComponent(props) {
onCancel();
props.getData();
message.success("操作成功");
}
catch (error) {
} catch (error) {
message.error("操作失败,请重试");
}
};
@ -335,8 +318,8 @@ function AddModalComponent(props) {
options={[
{ name: "incidentNumber", label: `${typeName}案号` },
{ name: "incidentName", label: `${typeName}名称` },
{ 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: "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: "location", label: `${typeName}发生地点` },
{ 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 },
@ -361,7 +344,7 @@ function AddModalComponent(props) {
}}
/>
),
span: 24,
span: 24
},
// 添加附件上传
{
@ -376,7 +359,7 @@ function AddModalComponent(props) {
}}
/>
),
span: 24,
span: 24
},
]}
/>
@ -388,7 +371,7 @@ function InfoModalComponent(props) {
const [info, setInfo] = useState({});
const [imageFiles, setImageFiles] = useState([]);
const [attachmentFiles, setAttachmentFiles] = useState([]);
const { loading, downloadFile } = useDownloadFile();
const { loading, downloadFile } = useDownloadFile()
const typeName = props.typeName;
const { getFile } = useGetFile();
@ -449,7 +432,7 @@ function InfoModalComponent(props) {
label: `${typeName}图片`,
children: (
<PreviewImg files={imageFiles} />
),
)
},
// 显示附件
{
@ -465,7 +448,7 @@ function InfoModalComponent(props) {
))}
{attachmentFiles.length === 0 && <span></span>}
</div>
),
)
},
]}
/>

View File

@ -2,13 +2,12 @@ import Accident from "../Accident/components/Accident";
function AccidentContainer(props) {
return (
<Accident
type={1}
addPermission="zcloud-event-add"
editPermission="zcloud-event-edit"
deletePermission="zcloud-event-delete"
deleteBatchPermission="zcloud-event-delete-batch"
exportPermission="zcloud-event-export"
<Accident type={1}
addPermission={"zcloud-event-add"}
editPermission={"zcloud-event-edit"}
deletePermission={"zcloud-event-delete"}
deleteBatchPermission={"zcloud-event-delete-batch"}
exportPermission={"zcloud-event-export"}
{...props}
/>
);

View File

@ -1,71 +1,16 @@
import { Permission } from "@cqsjjb/jjb-common-decorator/permission";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Button, Form } from "antd";
import { useEffect, useState } from "react";
import Page from "zy-react-library/components/Page";
import Table from "zy-react-library/components/Table";
import useDictionary from "zy-react-library/hooks/useDictionary";
import Accident from "../../Accident/components/Accident";
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
import useTable from "zy-react-library/hooks/useTable";
import { NS_ACCIDENT } from "~/enumerate/namespace";
function Bulletin(props) {
const [form] = Form.useForm();
const query = useGetUrlQuery();
const { getDictionary } = useDictionary();
const [accidentType, setAccidentType] = useState([]);
const [countByIncidentType, setCountByIncidentType] = useState([]);
useEffect(() => {
getDictionary({ dictValue: "accidentType" }).then((res) => {
setAccidentType(res);
});
}, []);
const { tableProps } = useTable(props["countByIncidentType"], {
form,
usePagination: false,
params: {
eqAccidentType: query.eqAccidentType,
corpinfoIds: [query.corpinfoId],
},
onSuccess: ({ data }) => {
setCountByIncidentType(data);
},
});
const getAccidentCount = (corpinfoId, incidentType) => {
return countByIncidentType.find(item => item.corpinfoId === corpinfoId && item.incidentType === incidentType)?.count || 0;
};
function AccidentContainer(props) {
const {corpinfoId,eqAccidentType} = useGetUrlQuery();
return (
<Page headerTitle="查看">
<Table
options={false}
columns={[
...accidentType.map(item => ({
dataIndex: `countByCorpinfoAndType_${item.dictValue}`,
title: `${item.dictLabel}`,
render: (_, record) => (
<Button
type="link"
onClick={() => {
props.history.push(`./View?corpinfoId=${record.corpinfoId}&eqAccidentType=${query.eqAccidentType}&eqIncidentType=${item.dictValue}`);
}}
>
{getAccidentCount(record.corpinfoId, item.dictValue)}
</Button>
),
})),
]}
{...tableProps}
dataSource={[{ corpinfoId: query.corpinfoId || countByIncidentType[0]?.corpinfoId }]}
/>
</Page>
<Accident type={Number(eqAccidentType)}
isSupervise={true}
corpinfoId={corpinfoId}
exportPermission = { "zcloud-accident-supervise-export" }
{...props}
/>
);
}
export default Connect([NS_ACCIDENT], true)(Permission(Bulletin));
export default AccidentContainer;

View File

@ -1,81 +1,97 @@
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Button, Form } from "antd";
import { useState } from "react";
import Page from "zy-react-library/components/Page";
import {Connect} from "@cqsjjb/jjb-dva-runtime";
import {Button, Form, Space} from "antd";
import {useEffect, useState} from "react";
import Search from "zy-react-library/components/Search";
import Table from "zy-react-library/components/Table";
import useTable from "zy-react-library/hooks/useTable";
import { NS_ACCIDENT } from "~/enumerate/namespace";
import {NS_ACCIDENT} from "~/enumerate/namespace";
import useDictionary from "zy-react-library/hooks/useDictionary";
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
import useUrlQueryCriteria from "zy-react-library/hooks/useUrlQueryCriteria";
import Page from "zy-react-library/components/Page";
const TYPE = [
{name: "事件", bianma: "1"},
{name: "事故", bianma: "2"},
]
function SuperviseAccident(props) {
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
const [form] = Form.useForm();
const {getDictionary} = useDictionary();
const [accidentType, setAccidentType] = useState([]);
const {getUrlCriteriaQuery} = useUrlQueryCriteria();
const [accidentCountByCorpinfoAndType, setAccidentCountByCorpinfoAndType] = useState([]);
useEffect(() => {
getDictionary({dictValue: "accidentType"}).then(res => {
setAccidentType(res);
});
}, []);
const getAccidentCountByCorpinfoAndType = async (corpinfoIds, type) => {
const { data } = await props["accidentCountByCorpinfoAndType"]({ corpinfoIds, eqAccidentType: type });
setAccidentCountByCorpinfoAndType(data);
};
const getAccidentCountByCorpinfoAndType=async (corpinfoIds,type)=>{
const {data} = await props["accidentCountByCorpinfoAndType"]({corpinfoIds,eqAccidentType:type})
setAccidentCountByCorpinfoAndType(data)
}
const { tableProps, getData } = useTable(props["getCorpInfoList"], {
const {tableProps, getData} = useTable(props["getCorpInfoList"], {
form,
params: {
inType: [0, 1, 6],
inType: [0,1,6],
},
onSuccess: ({ data }) => {
getAccidentCountByCorpinfoAndType(data.map(item => item.id), form.getFieldValue("eqAccidentType"));
onSuccess: ({data}) => {
getAccidentCountByCorpinfoAndType(data.map(item => item.id),form.getFieldValue("eqAccidentType"))
},
});
const getAccidentTotal = (id, key) => {
return accidentCountByCorpinfoAndType.find(item => item.corpinfoId === id)?.[key] || 0;
};
const getAccidentCount=(id,type)=>{
return accidentCountByCorpinfoAndType.find(item => item.corpinfoId === id && item.incidentType === type)?.[`count`] || 0;
}
const searchType = getUrlCriteriaQuery("searchFormKeys","searchFormValues").eqAccidentType;
return (
<Page isShowAllAction={false}>
<Search
form={form}
values={{
eqAccidentType: "1",
}}
onFinish={getData}
options={[
{ name: "likecorpName", label: `公司名称` },
{name: "likecorpName", label: `公司名称`},
{name: "eqAccidentType", label: `类型`, render: FORM_ITEM_RENDER_ENUM.SELECT, items: TYPE,componentProps: {allowClear: false }},
]}
/>
<Table
rowSelection={{
selectedRowKeys,
onChange: selectedRowKeys => setSelectedRowKeys(selectedRowKeys),
}}
columns={[
{ dataIndex: "corpName", title: `公司名称` },
{
dataIndex: "eventCount",
title: "事件总数",
width: 180,
{dataIndex: "corpName", title: `公司名称`},
...accidentType.map(item => ({
dataIndex: `countByCorpinfoAndType_${item.dictValue}`,
title: `${item.dictLabel}`,
render: (_, record) => (
<Button
type="link"
onClick={() => {
props.history.push(`./info?corpinfoId=${record.id}&eqAccidentType=1`);
}}
>
{getAccidentTotal(record.id, "eventCount")}
</Button>
getAccidentCount(record.id,item.dictValue)
),
})),
{
title: "操作",
width: 160,
fixed: "right",
render: (_, record) => (
<Space>
<Button
type="link"
onClick={() => {
props.history.push(`./info?corpinfoId=${record.id}&eqAccidentType=${searchType}`)
}}
>
查看
</Button>
</Space>
),
},
{
dataIndex: "accidentCount",
title: "事故总数",
width: 180,
render: (_, record) => (
<Button
type="link"
onClick={() => {
props.history.push(`./info?corpinfoId=${record.id}&eqAccidentType=2`);
}}
>
{ getAccidentTotal(record.id, "accidentCount")}
</Button>
),
},
]}
{...tableProps}
/>

View File

@ -1,19 +0,0 @@
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
import Accident from "../../Accident/components/Accident";
function AccidentContainer(props) {
const { corpinfoId, eqAccidentType, eqIncidentType } = useGetUrlQuery();
return (
<Accident
type={Number(eqAccidentType)}
isSupervise={true}
corpinfoId={corpinfoId}
eqIncidentType={eqIncidentType}
exportPermission="zcloud-accident-supervise-export"
{...props}
/>
);
}
export default AccidentContainer;