feat
parent
430b13872f
commit
7ffd8a0217
|
|
@ -10,9 +10,9 @@ module.exports = {
|
|||
javaGitBranch: "dev",
|
||||
// 本地联调 safetyEval-service(context-path: /safetyEval,默认端口 8095)
|
||||
// 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095
|
||||
API_HOST: "https://gbs-gateway.qhdsafety.com",
|
||||
// API_HOST: "https://gbs-gateway.qhdsafety.com",
|
||||
|
||||
//API_HOST: "http://192.168.0.152",
|
||||
API_HOST: "http://192.168.0.134",
|
||||
//API_HOST: "http://192.168.0.150", //太浅
|
||||
// API_HOST: "http://192.168.0.152",
|
||||
//API_HOST: "http://192.168.0.103", //huwei
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ import {
|
|||
fetchStaffCertListByPersonnelId,
|
||||
} from "~/api/staffCertificate";
|
||||
import { fetchOrgPersonnelDetail } from "~/utils/qualFiling/personnelHelper";
|
||||
import { QUALIFICATION_INDUSTRY_OPTIONS_MAP, TITLE_LEVEL_MAP } from "~/enumerate/enterpriseOptions";
|
||||
import {
|
||||
QUALIFICATION_INDUSTRY_OPTIONS_MAP,
|
||||
TITLE_LEVEL_MAP,
|
||||
} from "~/enumerate/enterpriseOptions";
|
||||
|
||||
const GENDER_MAP = { 1: "男", 2: "女" };
|
||||
const REGISTER_ENGINEER_MAP = { 1: "是", 2: "否" };
|
||||
|
|
@ -182,45 +185,30 @@ export default function StaffViewModal({
|
|||
<Descriptions.Item label="账号">{info.account}</Descriptions.Item>
|
||||
<Descriptions.Item label="部门">{info.deptName}</Descriptions.Item>
|
||||
<Descriptions.Item label="岗位">{info.postName}</Descriptions.Item>
|
||||
<Descriptions.Item label="资质范围">
|
||||
{QUALIFICATION_INDUSTRY_OPTIONS_MAP[info.qualScope] || info.qualScope || "-"}
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label="学历类型">
|
||||
{info.educationTypeName || "-"}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="学历层次">
|
||||
{info.educationLevelName || "-"}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="职称信息" span={2}>
|
||||
{titleCodeArr.length ? (
|
||||
<Table
|
||||
size="small"
|
||||
bordered
|
||||
pagination={false}
|
||||
rowKey={(_, idx) => idx}
|
||||
dataSource={titleCodeArr}
|
||||
columns={[
|
||||
{ title: "行业", dataIndex: "industryName", width: 150 },
|
||||
{ title: "职称", dataIndex: "titleName", width: 100 },
|
||||
{
|
||||
title: "证明材料",
|
||||
dataIndex: "proveUrlList",
|
||||
render: renderFileList,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label="是否注册安全工程师">
|
||||
{REGISTER_ENGINEER_MAP[info.registerEngineerFlag] ?? "-"}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="是否技术负责人">
|
||||
{info.technicalDirectorFlag === true ? "是" : info.technicalDirectorFlag === false ? "否" : "-"}
|
||||
{info.technicalDirectorFlag === true
|
||||
? "是"
|
||||
: info.technicalDirectorFlag === false
|
||||
? "否"
|
||||
: "-"}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="是否过程控制负责人">
|
||||
{info.processControlLeaderFlag === true ? "是" : info.processControlLeaderFlag === false ? "否" : "-"}
|
||||
{info.processControlLeaderFlag === true
|
||||
? "是"
|
||||
: info.processControlLeaderFlag === false
|
||||
? "否"
|
||||
: "-"}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="身份证号">
|
||||
{info.idCardNo}
|
||||
|
|
@ -277,6 +265,25 @@ export default function StaffViewModal({
|
|||
: "-"}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
<div style={{ marginTop: 16, marginBottom: 8, fontWeight: 600 }}>
|
||||
职称信息
|
||||
</div>
|
||||
<Table
|
||||
size="small"
|
||||
bordered
|
||||
pagination={false}
|
||||
rowKey={(_, idx) => idx}
|
||||
dataSource={titleCodeArr}
|
||||
columns={[
|
||||
{ title: "行业", dataIndex: "industryName", width: 150 },
|
||||
{ title: "职称", dataIndex: "titleName", width: 100 },
|
||||
{
|
||||
title: "证明材料",
|
||||
dataIndex: "proveUrlList",
|
||||
render: renderFileList,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<div style={{ marginTop: 16, marginBottom: 8, fontWeight: 600 }}>
|
||||
证照信息
|
||||
|
|
@ -372,11 +379,16 @@ export default function StaffViewModal({
|
|||
<Descriptions.Item label="查看证书">
|
||||
{certPreviewInfo.certAttachmentUrl &&
|
||||
certPreviewInfo.certAttachmentUrl.split(",").map((item) => {
|
||||
const isImage = /\.(png|jpe?g|gif|bmp|webp|svg)(\?|#|$)/i.test(item);
|
||||
const isImage =
|
||||
/\.(png|jpe?g|gif|bmp|webp|svg)(\?|#|$)/i.test(item);
|
||||
return (
|
||||
<div key={item} style={{ marginBottom: 4 }}>
|
||||
{isImage ? (
|
||||
<Image src={item} width={100} style={{ cursor: "pointer" }} />
|
||||
<Image
|
||||
src={item}
|
||||
width={100}
|
||||
style={{ cursor: "pointer" }}
|
||||
/>
|
||||
) : (
|
||||
<a onClick={() => window.open(item)}>{item}</a>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -482,34 +482,4 @@ export const NATIONAL_COUNTIES = (() => {
|
|||
return result;
|
||||
})();
|
||||
|
||||
/** 专业学科 */
|
||||
export const DISCIPLINE_OPTIONS = [
|
||||
{ label: "安全", value: "SAFETY" },
|
||||
{ label: "机械", value: "MECHANICAL" },
|
||||
{ label: "电气", value: "ELECTRICAL" },
|
||||
{ label: "采矿", value: "MINING" },
|
||||
{ label: "通风", value: "VENTILATION" },
|
||||
{ label: "矿建", value: "MINE_CONSTRUCTION" },
|
||||
{ label: "地质", value: "GEOLOGY" },
|
||||
{ label: "水工结构", value: "HYDRAULIC_STRUCTURE" },
|
||||
{ label: "采油", value: "OIL_PRODUCTION" },
|
||||
{ label: "储运", value: "STORAGE_AND_TRANSPORT" },
|
||||
{ label: "油气储运", value: "OIL_GAS_STORAGE_TRANSPORT" },
|
||||
{ label: "工艺设备与控制", value: "PROCESS_EQUIPMENT_CONTROL" },
|
||||
{ label: "自动化(仪表)", value: "AUTOMATION_INSTRUMENT" },
|
||||
{ label: "防腐", value: "ANTICORROSION" },
|
||||
{ label: "化工工艺", value: "CHEMICAL_PROCESS" },
|
||||
{ label: "化工机械", value: "CHEMICAL_MECHANICAL" },
|
||||
{ label: "自动化", value: "AUTOMATION" },
|
||||
{ label: "火炸药", value: "EXPLOSIVES" },
|
||||
{ label: "爆炸技术", value: "EXPLOSION_TECHNOLOGY" },
|
||||
{ label: "冶金", value: "METALLURGY" },
|
||||
{ label: "有色金属", value: "NONFERROUS_METAL" },
|
||||
{ label: "设备", value: "EQUIPMENT" },
|
||||
{ label: "仪表", value: "INSTRUMENT" },
|
||||
];
|
||||
|
||||
export const DISCIPLINE_MAP = DISCIPLINE_OPTIONS.reduce((acc, cur) => {
|
||||
acc[cur.value] = cur.label;
|
||||
return acc;
|
||||
}, {});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
DatePicker,
|
||||
Form,
|
||||
|
|
@ -9,9 +10,12 @@ import {
|
|||
Row,
|
||||
Col,
|
||||
Select,
|
||||
Space,
|
||||
Table,
|
||||
TreeSelect,
|
||||
Upload,
|
||||
} from "antd";
|
||||
import { InboxOutlined } from "@ant-design/icons";
|
||||
import { Get } from "@cqsjjb/jjb-common-lib/http";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import dayjs from "dayjs";
|
||||
|
|
@ -29,17 +33,18 @@ import {
|
|||
REGISTER_ENGINEER_OPTIONS,
|
||||
TITLE_LEVEL_OPTIONS,
|
||||
} from "~/enumerate/enterpriseOptions";
|
||||
import { DISCIPLINE_MAP } from "~/enumerate/constant";
|
||||
import { getBirthDateFromIdCard } from "~/utils";
|
||||
import { idCardRule, mobileRule } from "~/utils/validators";
|
||||
import AttachmentUpload from "~/components/AttachmentUpload";
|
||||
import StaffViewModal from "~/components/StaffViewModal";
|
||||
|
||||
const { router } = tools;
|
||||
const API_HOST = window.process?.env?.app?.API_HOST || "";
|
||||
|
||||
function PersonnelInfoPage(props) {
|
||||
const [formModalOpen, setFormModalOpen] = useState(false);
|
||||
const [viewModalOpen, setViewModalOpen] = useState(false);
|
||||
const [importModalOpen, setImportModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [searchForm] = Form.useForm();
|
||||
const [deptOptions, setDeptOptions] = useState([]);
|
||||
|
|
@ -135,6 +140,8 @@ function PersonnelInfoPage(props) {
|
|||
</div>
|
||||
}
|
||||
extra={
|
||||
<Space>
|
||||
<Button onClick={() => setImportModalOpen(true)}>导入人员</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
|
|
@ -144,6 +151,7 @@ function PersonnelInfoPage(props) {
|
|||
>
|
||||
新增人员
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<SearchForm
|
||||
|
|
@ -321,6 +329,13 @@ function PersonnelInfoPage(props) {
|
|||
}}
|
||||
/>
|
||||
)}
|
||||
{importModalOpen && (
|
||||
<StaffImportModal
|
||||
open={importModalOpen}
|
||||
onCancel={() => setImportModalOpen(false)}
|
||||
onSuccess={handleSearch}
|
||||
/>
|
||||
)}
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
|
@ -378,13 +393,14 @@ function StaffFormModal({
|
|||
}
|
||||
};
|
||||
|
||||
const loadBasicDisciplineMajors = async (industryCode) => {
|
||||
if (!industryCode) return;
|
||||
await queryBasicDisciplineMajor({ industryCode, pageSize: 999 });
|
||||
const loadBasicDisciplineMajors = async () => {
|
||||
|
||||
await queryBasicDisciplineMajor({ pageSize: 999 });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (open && !wasOpenRef.current) {
|
||||
loadBasicDisciplineMajors();
|
||||
if (!currentId) {
|
||||
form.resetFields();
|
||||
setDeptPositionOptions([]);
|
||||
|
|
@ -434,7 +450,7 @@ function StaffFormModal({
|
|||
}
|
||||
|
||||
form.setFieldsValue(setFields);
|
||||
loadBasicDisciplineMajors(data.qualScope);
|
||||
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setDetailLoading(false);
|
||||
|
|
@ -463,7 +479,7 @@ function StaffFormModal({
|
|||
}
|
||||
if ("qualScope" in changed) {
|
||||
form.setFieldValue("basicDisciplineMajorId", undefined);
|
||||
loadBasicDisciplineMajors(changed.qualScope);
|
||||
loadBasicDisciplineMajors();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -629,15 +645,7 @@ function StaffFormModal({
|
|||
<Input placeholder="请输入身份证号" maxLength={18} />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item name="qualScope" label="资质范围">
|
||||
<Select
|
||||
placeholder="请选择资质范围"
|
||||
allowClear
|
||||
options={QUALIFICATION_INDUSTRY_OPTIONS}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
|
||||
<Col span={12}>
|
||||
<Form.Item name="basicDisciplineMajorId" label="基础学科专业">
|
||||
<Select
|
||||
|
|
@ -647,7 +655,7 @@ function StaffFormModal({
|
|||
optionFilterProp="label"
|
||||
options={(staffInfo?.basicDisciplineMajorList || []).map(
|
||||
(item) => ({
|
||||
label: `${item.professionalName}(${DISCIPLINE_MAP[item.professionalCapabilityCode]})`,
|
||||
label: `${item.professionalName}`,
|
||||
value: item.id,
|
||||
}),
|
||||
)}
|
||||
|
|
@ -909,6 +917,151 @@ function StaffFormModal({
|
|||
);
|
||||
}
|
||||
|
||||
function StaffImportModal({ open, onCancel, onSuccess }) {
|
||||
const [result, setResult] = useState(null);
|
||||
const [errorMsg, setErrorMsg] = useState("");
|
||||
const [uploading, setUploading] = useState(false);
|
||||
|
||||
const handleDownloadTemplate = async () => {
|
||||
try {
|
||||
const res = await Get("/safetyEval/org-personnel/import/template");
|
||||
const url = res?.data ;
|
||||
if (!url) {
|
||||
message.warning("未获取到模板下载地址");
|
||||
return;
|
||||
}
|
||||
const resolved = /^https?:\/\//i.test(url)
|
||||
? url
|
||||
: `${window.fileUrl || API_HOST}${url}`;
|
||||
const response = await fetch(resolved);
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
const blob = await response.blob();
|
||||
const blobUrl = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = blobUrl;
|
||||
link.download = "人员导入模板.xlsx";
|
||||
link.style.display = "none";
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(blobUrl);
|
||||
} catch (err) {
|
||||
message.error(err?.message || "下载模板失败");
|
||||
}
|
||||
};
|
||||
|
||||
const customRequest = async (options) => {
|
||||
const { file, onSuccess: onDone, onError } = options;
|
||||
setUploading(true);
|
||||
setResult(null);
|
||||
setErrorMsg("");
|
||||
try {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
const headers = { token: sessionStorage.getItem("token") || "" };
|
||||
const orgInfoId = sessionStorage.getItem("orgInfoId");
|
||||
if (orgInfoId) headers.orgInfoId = String(orgInfoId);
|
||||
const resp = await fetch(
|
||||
`${API_HOST}/safetyEval/org-personnel/import`,
|
||||
{ method: "POST", headers, body: formData },
|
||||
);
|
||||
const json = await resp.json();
|
||||
if (json && json.success !== false) {
|
||||
onDone(json.data, file);
|
||||
setResult(json.data || {});
|
||||
if ((json.data?.successCount || 0) > 0) onSuccess?.();
|
||||
} else {
|
||||
onError(new Error(json?.errMessage || json?.message || "导入失败"));
|
||||
setErrorMsg(json?.errMessage || json?.message || "导入失败");
|
||||
}
|
||||
} catch (err) {
|
||||
onError(err);
|
||||
setErrorMsg(err?.message || "导入失败");
|
||||
} finally {
|
||||
setUploading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const errorList = result?.errors || [];
|
||||
|
||||
return (
|
||||
<Modal
|
||||
open={open}
|
||||
title="导入人员"
|
||||
width={680}
|
||||
onCancel={onCancel}
|
||||
footer={<Button onClick={onCancel}>关闭</Button>}
|
||||
>
|
||||
<div style={{ marginBottom: 8 }}>
|
||||
<Button type="link" size="small" onClick={handleDownloadTemplate}>
|
||||
下载导入模板
|
||||
</Button>
|
||||
</div>
|
||||
<Upload.Dragger
|
||||
accept=".xlsx,.xls"
|
||||
maxCount={1}
|
||||
multiple={false}
|
||||
customRequest={customRequest}
|
||||
disabled={uploading}
|
||||
beforeUpload={(file) => {
|
||||
const ext =
|
||||
"." + (file.name.split(".").pop() || "").toLowerCase();
|
||||
if (![".xlsx", ".xls"].includes(ext)) {
|
||||
message.error("仅支持 .xlsx / .xls 格式文件");
|
||||
return Upload.LIST_IGNORE;
|
||||
}
|
||||
return true;
|
||||
}}
|
||||
onRemove={() => {
|
||||
setResult(null);
|
||||
setErrorMsg("");
|
||||
return true;
|
||||
}}
|
||||
>
|
||||
<p className="ant-upload-drag-icon">
|
||||
<InboxOutlined />
|
||||
</p>
|
||||
<p className="ant-upload-text">点击或拖拽文件到此区域上传</p>
|
||||
<p className="ant-upload-hint">仅支持 .xlsx / .xls 格式文件</p>
|
||||
</Upload.Dragger>
|
||||
|
||||
{errorMsg && (
|
||||
<Alert
|
||||
style={{ marginTop: 12 }}
|
||||
type="error"
|
||||
showIcon
|
||||
message="导入失败"
|
||||
description={errorMsg}
|
||||
/>
|
||||
)}
|
||||
{result && (
|
||||
<Alert
|
||||
style={{ marginTop: 12 }}
|
||||
type={result.failCount > 0 ? "warning" : "success"}
|
||||
showIcon
|
||||
message={`成功导入 ${result.successCount || 0} 条,失败 ${result.failCount || 0} 条`}
|
||||
/>
|
||||
)}
|
||||
{errorList.length > 0 && (
|
||||
<Table
|
||||
style={{ marginTop: 12 }}
|
||||
size="small"
|
||||
rowKey={(r, i) => i}
|
||||
pagination={false}
|
||||
scroll={{ y: 240 }}
|
||||
dataSource={errorList}
|
||||
columns={[
|
||||
{ title: "行号", dataIndex: "rowIndex", width: 70 },
|
||||
{ title: "账号", dataIndex: "account", ellipsis: true },
|
||||
{ title: "姓名", dataIndex: "userName", ellipsis: true },
|
||||
{ title: "异常原因", dataIndex: "errorMessage", ellipsis: true },
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export default Connect(
|
||||
[NS_STAFF_INFO, NS_ORG_DEPARTMENT],
|
||||
true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue