tangjie 2026-07-07 13:54:56 +08:00
commit 4950605bff
1 changed files with 56 additions and 20 deletions

View File

@ -2,6 +2,7 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Button, DatePicker, Descriptions, Form, Input, message, Modal, Select, Table, Upload } from "antd";
import { UploadOutlined } from "@ant-design/icons";
import { useEffect, useState } from "react";
import dayjs from "dayjs";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm";
import ControlWrapper from "@cqsjjb/jjb-react-admin-component/ControlWrapper";
@ -60,21 +61,29 @@ function StaffCertificatePage(props) {
};
return (
<PageLayout title={`人员证书 - ${staffName || ""}`}>
<PageLayout
title={`人员证书 - ${staffName || ""}`}
extra={
<Button type="primary" onClick={() => { setCurrentId(""); setAddModalOpen(true); }}>新增证书</Button>
}
>
<Button style={{ marginBottom: 16 }} onClick={goBack}>返回</Button>
<SearchForm
style={{ marginBottom: 24 }}
form={searchForm}
loading={loading}
formLine={[
<Form.Item key="certName" name="certName">
<ControlWrapper.Input label="证照名称" placeholder="请输入证照名称" allowClear />
</Form.Item>,
<Form.Item key="certNo" name="certNo">
<ControlWrapper.Input label="证书编号" placeholder="请输入证书编号" allowClear />
</Form.Item>,
<Form.Item key="certCategory" name="certCategory">
<ControlWrapper.Input label="证书类别" placeholder="请输入证书类别" allowClear />
<Form.Item key="certCategoryName" name="certCategoryName">
<ControlWrapper.Input label="证书类别名称" placeholder="请输入证书类别名称" allowClear />
</Form.Item>,
<Form.Item key="certWorkCategory" name="certWorkCategory">
<ControlWrapper.Input label="证书作业类别" placeholder="请输入证书作业类别" allowClear />
<Form.Item key="operationCategoryName" name="operationCategoryName">
<ControlWrapper.Input label="证书作业类别名称" placeholder="请输入证书作业类别名称" allowClear />
</Form.Item>,
]}
onReset={() => {
@ -89,8 +98,10 @@ function StaffCertificatePage(props) {
<Table
rowKey="id"
columns={[
{ title: "证书类型", dataIndex: "certCategory" },
{ title: "证书作业类别", dataIndex: "certWorkCategory" },
{ title: "证照名称", dataIndex: "certName" },
{ title: "证书类型", dataIndex: "certTypeName" },
{ title: "证书类别", dataIndex: "certCategoryName" },
{ title: "证书作业类别", dataIndex: "operationCategoryName" },
{ title: "证书编号", dataIndex: "certNo" },
{
title: "操作",
@ -177,9 +188,16 @@ function CertModal({
const res = await staffCertificateInfo({ id: currentId });
if (cancelled || !res?.data) return;
const data = { ...res.data };
// 将 validStartDate/validEndDate 合并为 validDateRangePicker
// 将 validStartDate/validEndDate 合并为 validDateRangePicker 需要 dayjs 对象
if (data.validStartDate || data.validEndDate) {
data.validDate = [data.validStartDate, data.validEndDate];
data.validDate = [
data.validStartDate ? dayjs(data.validStartDate) : undefined,
data.validEndDate ? dayjs(data.validEndDate) : undefined,
];
}
// 复核日期需要转为 dayjs 对象
if (data.reviewDate) {
data.reviewDate = dayjs(data.reviewDate);
}
// 处理证书附件 fileList
let fileList = [];
@ -222,8 +240,9 @@ function CertModal({
const payload = {
...values,
personnelId: staffId,
validStartDate: values.validDate?.[0],
validEndDate: values.validDate?.[1],
validStartDate: values.validDate?.[0] ? dayjs(values.validDate[0]).format("YYYY-MM-DD") : undefined,
validEndDate: values.validDate?.[1] ? dayjs(values.validDate[1]).format("YYYY-MM-DD") : undefined,
reviewDate: values.reviewDate ? dayjs(values.reviewDate).format("YYYY-MM-DD") : undefined,
certAttachmentUrl: Array.isArray(values.certAttachmentUrl)
? values.certAttachmentUrl.map((f) => f.url || f.response?.url).filter(Boolean).join(",")
: "",
@ -260,12 +279,6 @@ function CertModal({
<Form.Item name="certName" label="证照名称" rules={[{ required: true, message: "请输入证照名称" }]}>
<Input placeholder="请输入证照名称" />
</Form.Item>
<Form.Item name="certCategory" label="证书类别" rules={[{ required: true, message: "请选择证书类别" }]}>
<Input placeholder="请输入证书类别" />
</Form.Item>
<Form.Item name="certWorkCategory" label="证书作业类别">
<Input placeholder="请输入证书作业类别" />
</Form.Item>
<Form.Item name="certNo" label="证书编号" rules={[{ required: true, message: "请输入证书编号" }]}>
<Input placeholder="请输入证书编号" />
</Form.Item>
@ -279,7 +292,25 @@ function CertModal({
>
<DatePicker.RangePicker style={{ width: "100%" }} />
</Form.Item>
<Form.Item name="reviewDate" label="复合日期">
<Form.Item name="certTypeCode" label="证书类型编码">
<Input placeholder="请输入证书类型编码" />
</Form.Item>
<Form.Item name="certTypeName" label="证书类型名称">
<Input placeholder="请输入证书类型名称" />
</Form.Item>
<Form.Item name="certCategoryCode" label="证书类别编码">
<Input placeholder="请输入证书类别编码" />
</Form.Item>
<Form.Item name="certCategoryName" label="证书类别名称">
<Input placeholder="请输入证书类别名称" />
</Form.Item>
<Form.Item name="operationCategoryCode" label="证书作业类别编码">
<Input placeholder="请输入证书作业类别编码" />
</Form.Item>
<Form.Item name="operationCategoryName" label="证书作业类别名称">
<Input placeholder="请输入证书作业类别名称" />
</Form.Item>
<Form.Item name="reviewDate" label="复核日期">
<DatePicker style={{ width: "100%" }} />
</Form.Item>
<AttachmentUpload name="certAttachmentUrl" label="证书附件" maxCount={3} />
@ -340,12 +371,17 @@ function ViewModal({ open, currentId, staffCertificateInfo, onCancel }) {
>
<Descriptions bordered column={1} labelStyle={{ width: 160 }}>
<Descriptions.Item label="证照名称">{info.certName}</Descriptions.Item>
<Descriptions.Item label="证书类别">{info.certCategory}</Descriptions.Item>
<Descriptions.Item label="证书类型编码">{info.certTypeCode}</Descriptions.Item>
<Descriptions.Item label="证书类型名称">{info.certTypeName}</Descriptions.Item>
<Descriptions.Item label="证书类别编码">{info.certCategoryCode}</Descriptions.Item>
<Descriptions.Item label="证书类别名称">{info.certCategoryName}</Descriptions.Item>
<Descriptions.Item label="证书作业类别编码">{info.operationCategoryCode}</Descriptions.Item>
<Descriptions.Item label="证书作业类别名称">{info.operationCategoryName}</Descriptions.Item>
<Descriptions.Item label="证书编号">{info.certNo}</Descriptions.Item>
<Descriptions.Item label="发证机关">{info.issueOrg}</Descriptions.Item>
<Descriptions.Item label="证书有效开始日期">{info.validStartDate}</Descriptions.Item>
<Descriptions.Item label="证书有效结束日期">{info.validEndDate}</Descriptions.Item>
<Descriptions.Item label="复合日期">{info.reviewDate}</Descriptions.Item>
<Descriptions.Item label="复日期">{info.reviewDate}</Descriptions.Item>
<Descriptions.Item label="证书图片"><CertPreviewImg files={info.certDisplayFiles} /></Descriptions.Item>
</Descriptions>
</Modal>