Compare commits
2 Commits
9073e492bc
...
4950605bff
| Author | SHA1 | Date |
|---|---|---|
|
|
4950605bff | |
|
|
db9dfb2c29 |
|
|
@ -1,54 +1,45 @@
|
|||
import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
|
||||
import {
|
||||
fromPageResponse,
|
||||
fromQualificationForm,
|
||||
fromSingleResponse,
|
||||
toPageQuery,
|
||||
toQualificationForm,
|
||||
} from "../enterpriseInfo/adapter";
|
||||
import { apiGet, apiPost, apiPostDelete, safeAction, safePageResult } from "../enterpriseInfo/http";
|
||||
|
||||
export const orgQualificationCertList = declareRequest("orgQualificationCertLoading", safePageResult(async (params) => {
|
||||
const query = toPageQuery(params, { likeCertName: "certName" });
|
||||
const res = await apiGet("/safetyEval/org-qualification/page", query);
|
||||
return fromPageResponse(res, toQualificationForm);
|
||||
}));
|
||||
// 分页查询
|
||||
export const orgQualificationCertList = declareRequest(
|
||||
"orgQualificationCertLoading",
|
||||
"Get > /safetyEval/org-qualification/page",
|
||||
"orgQualificationCertList: [] | res.data?.records || res.data || [] & orgQualificationCertTotal: 0 | res.data?.total || 0",
|
||||
);
|
||||
|
||||
export const orgQualificationCertInfo = declareRequest("orgQualificationCertLoading", safeAction(async (params) => {
|
||||
const res = await apiGet("/safetyEval/org-qualification/get", { id: params.id });
|
||||
return fromSingleResponse(res, toQualificationForm);
|
||||
}));
|
||||
// 新增
|
||||
export const orgQualificationCertAdd = declareRequest(
|
||||
"orgQualificationCertLoading",
|
||||
"Post > @/safetyEval/org-qualification/save",
|
||||
);
|
||||
|
||||
export const orgQualificationCertAdd = declareRequest("orgQualificationCertLoading", safeAction(async (values) => {
|
||||
const res = await apiPost("/safetyEval/org-qualification/save", fromQualificationForm(values));
|
||||
return fromSingleResponse(res, toQualificationForm);
|
||||
}));
|
||||
// 查询详情
|
||||
export const orgQualificationCertInfo = declareRequest(
|
||||
"orgQualificationCertLoading",
|
||||
"Get > /safetyEval/org-qualification/get",
|
||||
"orgQualificationCertDetail: {} | res.data || {}",
|
||||
);
|
||||
|
||||
export const orgQualificationCertEdit = declareRequest("orgQualificationCertLoading", safeAction(async (values) => {
|
||||
const res = await apiPost("/safetyEval/org-qualification/modify", fromQualificationForm(values));
|
||||
return fromSingleResponse(res, toQualificationForm);
|
||||
}));
|
||||
// 修改
|
||||
export const orgQualificationCertEdit = declareRequest(
|
||||
"orgQualificationCertLoading",
|
||||
"Post > @/safetyEval/org-qualification/modify",
|
||||
);
|
||||
|
||||
export const orgQualificationCertRemove = declareRequest("orgQualificationCertLoading", safeAction(async ({ id }) => {
|
||||
return apiPostDelete("/safetyEval/org-qualification/delete", id);
|
||||
}));
|
||||
// 删除
|
||||
export const orgQualificationCertRemove = declareRequest(
|
||||
"orgQualificationCertLoading",
|
||||
"Post > @/safetyEval/org-qualification/delete",
|
||||
);
|
||||
|
||||
export const orgQualificationCertDisable = declareRequest("orgQualificationCertLoading", safeAction(async ({ id }) => {
|
||||
const res = await apiGet("/safetyEval/org-qualification/get", { id });
|
||||
const data = res?.data || {};
|
||||
return apiPost("/safetyEval/org-qualification/modify", {
|
||||
...data,
|
||||
id,
|
||||
enableFlag: 2,
|
||||
});
|
||||
}));
|
||||
// 禁用
|
||||
export const orgQualificationCertDisable = declareRequest(
|
||||
"orgQualificationCertLoading",
|
||||
"Post > @/safetyEval/org-qualification/disable",
|
||||
);
|
||||
|
||||
export const orgQualificationCertEnable = declareRequest("orgQualificationCertLoading", safeAction(async ({ id }) => {
|
||||
const res = await apiGet("/safetyEval/org-qualification/get", { id });
|
||||
const data = res?.data || {};
|
||||
return apiPost("/safetyEval/org-qualification/modify", {
|
||||
...data,
|
||||
id,
|
||||
enableFlag: 1,
|
||||
});
|
||||
}));
|
||||
// 启用
|
||||
export const orgQualificationCertEnable = declareRequest(
|
||||
"orgQualificationCertLoading",
|
||||
"Post > @/safetyEval/org-qualification/enable",
|
||||
);
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
import { Image, Tooltip, Tag } from "antd";
|
||||
import { getFileUrl } from "zy-react-library/utils";
|
||||
|
||||
/** 解析附件对象的可访问地址,兼容 filePath(相对路径)与 url(绝对/相对) */
|
||||
export function resolvePreviewSrc(file = {}) {
|
||||
const base = getFileUrl?.() || window.fileUrl || "";
|
||||
const base = window.fileUrl || "";
|
||||
const path = file.filePath;
|
||||
const url = file.url;
|
||||
if (path) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import { NS_EQUIP_INFO } from "~/enumerate/namespace";
|
|||
import { positiveNumberRule } from "~/utils/validators";
|
||||
|
||||
const { router } = tools;
|
||||
const DUAL_CHANNEL_MAP = { 1: "是", 0: "否" };
|
||||
const DUAL_CHANNEL_MAP = { 1: "是", 2: "否" };
|
||||
|
||||
function EquipInfoPage(props) {
|
||||
const [formModalOpen, setFormModalOpen] = useState(false);
|
||||
|
|
@ -58,7 +58,7 @@ function EquipInfoPage(props) {
|
|||
okText: "是",
|
||||
cancelText: "否",
|
||||
onOk: async () => {
|
||||
const res = await props.equipInfoRemove({ id });
|
||||
const res = await props.equipInfoRemove({ data: id });
|
||||
if (res?.success !== false) {
|
||||
message.success("删除成功");
|
||||
handleSearch();
|
||||
|
|
@ -111,7 +111,7 @@ function EquipInfoPage(props) {
|
|||
form={searchForm}
|
||||
loading={loading}
|
||||
formLine={[
|
||||
<Form.Item key="likeDeviceName" name="likeDeviceName">
|
||||
<Form.Item key="likeDeviceName" name="deviceName">
|
||||
<ControlWrapper.Input
|
||||
label="设备名称"
|
||||
placeholder="请输入"
|
||||
|
|
@ -473,7 +473,7 @@ function EquipFormModal({
|
|||
placeholder="请选择"
|
||||
options={[
|
||||
{ label: "是", value: 1 },
|
||||
{ label: "否", value: 0 },
|
||||
{ label: "否", value: 2 },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/antd";
|
|||
import { tools } from "@cqsjjb/jjb-common-lib";
|
||||
import { NS_STAFF_CERTIFICATE } from "~/enumerate/namespace";
|
||||
import CertPreviewImg from "~/components/CertPreviewImg";
|
||||
import AttachmentUpload from "~/components/AttachmentUpload";
|
||||
import { dateRangeRule } from "~/utils/validators";
|
||||
|
||||
const { router } = tools;
|
||||
|
|
@ -312,26 +313,8 @@ function CertModal({
|
|||
<Form.Item name="reviewDate" label="复核日期">
|
||||
<DatePicker style={{ width: "100%" }} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="certAttachmentUrl"
|
||||
label="证书附件"
|
||||
valuePropName="fileList"
|
||||
getValueFromEvent={(e) => {
|
||||
if (Array.isArray(e)) return e;
|
||||
return e?.fileList;
|
||||
}}
|
||||
>
|
||||
<Upload
|
||||
action="/api/upload"
|
||||
maxCount={3}
|
||||
fileList={uploadFileList}
|
||||
onChange={(info) => {
|
||||
setUploadFileList(info.fileList);
|
||||
}}
|
||||
>
|
||||
<Button icon={<UploadOutlined />}>上传文件</Button>
|
||||
</Upload>
|
||||
</Form.Item>
|
||||
<AttachmentUpload name="certAttachmentUrl" label="证书附件" maxCount={3} />
|
||||
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,37 +1,47 @@
|
|||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||
import {
|
||||
Button,
|
||||
DatePicker,
|
||||
Descriptions,
|
||||
Form,
|
||||
Image,
|
||||
Input,
|
||||
message,
|
||||
Modal,
|
||||
Select,
|
||||
Table,
|
||||
Upload,
|
||||
|
||||
} from "antd";
|
||||
import AttachmentUpload from "~/components/AttachmentUpload";
|
||||
import { PlusOutlined } from "@ant-design/icons";
|
||||
import { useEffect, useState } from "react";
|
||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
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";
|
||||
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
|
||||
import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/antd";
|
||||
import { tools } from "@cqsjjb/jjb-common-lib";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import CertPreviewImg, {
|
||||
CertTooltipPreviewImg,
|
||||
} from "~/components/CertPreviewImg";
|
||||
import { NS_ORG_QUALIFICATION_CERT } from "~/enumerate/namespace";
|
||||
import { QUALIFICATION_INDUSTRY_OPTIONS } from "~/enumerate/enterpriseOptions";
|
||||
import { formSelectField } from "~/utils/enterpriseForm";
|
||||
import { isQualificationEnabled } from "~/api/enterpriseInfo/adapter";
|
||||
import { safeGetFiles, safeRequest } from "~/utils";
|
||||
import { toDayjs } from "~/utils/dateFormat";
|
||||
import { mockUploadFileList, resolveUploadFileId } from "~/utils/mockUpload";
|
||||
import { dateRangeRule } from "~/utils/validators";
|
||||
|
||||
const { router } = tools;
|
||||
const { TextArea } = Input;
|
||||
const { RangePicker } = DatePicker;
|
||||
|
||||
/** certImageUrl(逗号分隔URL)↔ 文件列表({ url }[]) */
|
||||
function parseCertImageUrl(str) {
|
||||
if (!str) return [];
|
||||
return String(str).split(",").filter(Boolean).map((url, i) => ({
|
||||
url: url.trim(),
|
||||
name: `证书图片${i + 1}.jpg`,
|
||||
}));
|
||||
}
|
||||
function stringifyCertImageUrl(files) {
|
||||
if (!files?.length) return undefined;
|
||||
return files.map((f) => f.url || f.response?.data?.url).filter(Boolean).join(",");
|
||||
}
|
||||
|
||||
function QualificationCertPage(props) {
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
|
|
@ -52,8 +62,8 @@ function QualificationCertPage(props) {
|
|||
};
|
||||
const res = await props.orgQualificationCertList(params);
|
||||
if (res?.success !== false) {
|
||||
setDataSource(res?.data?.records || res?.data || []);
|
||||
setTotal(res?.data?.total || 0);
|
||||
setDataSource(res?.data || []);
|
||||
setTotal(res?.total || 0);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("[QualificationCert] list failed:", err);
|
||||
|
|
@ -63,12 +73,18 @@ function QualificationCertPage(props) {
|
|||
};
|
||||
|
||||
const handleReset = (values) => {
|
||||
router.query = { ...router.query, ...values, current: 1, pageSize: 10 };
|
||||
router.query = { ...values, validStartDate: undefined, validEndDate: undefined, current: 1, pageSize: 10 };
|
||||
getData();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
form.setFieldsValue(router.query);
|
||||
const params = {
|
||||
...router.query
|
||||
};
|
||||
if (params.validStartDate && params.validEndDate) {
|
||||
params.validDate = [toDayjs(params.validStartDate), toDayjs(params.validEndDate)];
|
||||
}
|
||||
form.setFieldsValue(params);
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
|
|
@ -88,32 +104,16 @@ function QualificationCertPage(props) {
|
|||
});
|
||||
};
|
||||
|
||||
const onDisable = (id) => {
|
||||
const onToggleStatus = (record) => {
|
||||
const enabled = record.enableFlag === 1;
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "是否停用该证书?",
|
||||
content: enabled ? "是否停用该证书?" : "是否启用该证书?",
|
||||
okText: "是",
|
||||
cancelText: "否",
|
||||
onOk: async () => {
|
||||
const res = await props.orgQualificationCertDisable({ id });
|
||||
if (res?.success !== false) {
|
||||
message.success("操作成功");
|
||||
await getData();
|
||||
} else {
|
||||
message.error(res?.message || "操作失败");
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const onEnable = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "是否启用该证书?",
|
||||
okText: "是",
|
||||
cancelText: "否",
|
||||
onOk: async () => {
|
||||
const res = await props.orgQualificationCertEnable({ id });
|
||||
const action = enabled ? props.orgQualificationCertDisable : props.orgQualificationCertEnable;
|
||||
const res = await action({ id: record.id });
|
||||
if (res?.success !== false) {
|
||||
message.success("操作成功");
|
||||
await getData();
|
||||
|
|
@ -137,7 +137,7 @@ function QualificationCertPage(props) {
|
|||
extra={
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon />}
|
||||
icon={<PlusOutlined />}
|
||||
onClick={() => {
|
||||
setCurrentId("");
|
||||
setAddModalOpen(true);
|
||||
|
|
@ -165,8 +165,12 @@ function QualificationCertPage(props) {
|
|||
]}
|
||||
onReset={handleReset}
|
||||
onFinish={(values) => {
|
||||
if (values.validDate) {
|
||||
values.validStartDate = values.validDate?.[0]?.format("YYYY-MM-DD");
|
||||
values.validEndDate = values.validDate?.[1]?.format("YYYY-MM-DD");
|
||||
delete values.validDate;
|
||||
}
|
||||
router.query = {
|
||||
...router.query,
|
||||
...values,
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
|
|
@ -178,7 +182,7 @@ function QualificationCertPage(props) {
|
|||
<Table
|
||||
rowKey="id"
|
||||
columns={[
|
||||
{ title: "证照类别", dataIndex: "certType" },
|
||||
{ title: "证照类别", dataIndex: "licenseTypeName" },
|
||||
{ title: "证书名称", dataIndex: "certName" },
|
||||
{
|
||||
title: "证书有效期",
|
||||
|
|
@ -191,14 +195,14 @@ function QualificationCertPage(props) {
|
|||
title: "状态",
|
||||
width: 80,
|
||||
render: (_, record) =>
|
||||
isQualificationEnabled(record) ? "启用" : "禁用",
|
||||
record.enableFlag === 1 ? "启用" : "禁用",
|
||||
},
|
||||
{
|
||||
title: "照片",
|
||||
width: 100,
|
||||
render: (_, record) =>
|
||||
record.certImgFiles?.length ? (
|
||||
<CertTooltipPreviewImg files={record.certImgFiles} />
|
||||
record.certImageUrl ? (
|
||||
<Image width={60} height={60} style={{ objectFit: "cover" }} src={record.certImageUrl.split(",")[0]?.trim()} preview={{ mask: "查看" }} />
|
||||
) : (
|
||||
<span>无</span>
|
||||
),
|
||||
|
|
@ -230,15 +234,9 @@ function QualificationCertPage(props) {
|
|||
<Button danger type="link" onClick={() => onDelete(record.id)}>
|
||||
删除
|
||||
</Button>
|
||||
{isQualificationEnabled(record) ? (
|
||||
<Button type="link" onClick={() => onDisable(record.id)}>
|
||||
禁用
|
||||
</Button>
|
||||
) : (
|
||||
<Button type="link" onClick={() => onEnable(record.id)}>
|
||||
启用
|
||||
</Button>
|
||||
)}
|
||||
<Button type="link" onClick={() => onToggleStatus(record)}>
|
||||
{record.enableFlag === 1 ? "禁用" : "启用"}
|
||||
</Button>
|
||||
</TableAction>
|
||||
),
|
||||
},
|
||||
|
|
@ -301,56 +299,31 @@ function CertFormModal({
|
|||
const [form] = Form.useForm();
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [detailLoading, setDetailLoading] = useState(false);
|
||||
const { getFile } = useGetFile();
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
return;
|
||||
}
|
||||
if (!open) return;
|
||||
if (!currentId) {
|
||||
form.resetFields();
|
||||
form.setFieldsValue({ certImgs: mockUploadFileList("证书图片.jpg") });
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
(async () => {
|
||||
setDetailLoading(true);
|
||||
try {
|
||||
const res = await safeRequest(requestDetails, { id: currentId });
|
||||
if (cancelled || !res?.data) {
|
||||
return;
|
||||
}
|
||||
const res = await requestDetails({ id: currentId });
|
||||
if (cancelled || !res?.data) return;
|
||||
const data = { ...res.data };
|
||||
data.issueDate = toDayjs(data.issueDate);
|
||||
data.validDate = [
|
||||
toDayjs(data.validStartDate),
|
||||
toDayjs(data.validEndDate),
|
||||
];
|
||||
data.certImgs = data.certImgFiles?.length
|
||||
? data.certImgFiles
|
||||
: mockUploadFileList("证书图片.jpg");
|
||||
data.validDate = [toDayjs(data.validStartDate), toDayjs(data.validEndDate)];
|
||||
data.certImageUrl = parseCertImageUrl(data.certImageUrl);
|
||||
form.setFieldsValue(data);
|
||||
setDetailLoading(false);
|
||||
|
||||
const files = await safeGetFiles(
|
||||
getFile,
|
||||
{ eqType: "org_cert", eqForeignKey: data.id },
|
||||
data.certImgFiles || [],
|
||||
);
|
||||
if (!cancelled && files.length) {
|
||||
form.setFieldValue("certImgs", files);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("[QualificationCert] load detail failed:", err);
|
||||
} finally {
|
||||
if (!cancelled) {
|
||||
setDetailLoading(false);
|
||||
}
|
||||
if (!cancelled) setDetailLoading(false);
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
return () => { cancelled = true; };
|
||||
}, [open, currentId]);
|
||||
|
||||
const handleCancel = () => {
|
||||
|
|
@ -363,10 +336,8 @@ function CertFormModal({
|
|||
setSubmitting(true);
|
||||
values.validStartDate = values.validDate?.[0];
|
||||
values.validEndDate = values.validDate?.[1];
|
||||
values.certImageUrl = resolveUploadFileId(values.certImgs);
|
||||
if (currentId) {
|
||||
values.id = currentId;
|
||||
}
|
||||
values.certImageUrl = stringifyCertImageUrl(values.certImageUrl);
|
||||
if (currentId) values.id = currentId;
|
||||
const request = currentId ? requestEdit : requestAdd;
|
||||
const res = await request(values);
|
||||
if (res?.success !== false) {
|
||||
|
|
@ -394,66 +365,63 @@ function CertFormModal({
|
|||
<div style={{ color: "#999", marginBottom: 16, fontSize: 12 }}>
|
||||
严谨在本互联网非涉密平台处理、传输国家秘密和工作秘密,请确认扫描、传输的文件资料不涉及国家秘密和工作秘密
|
||||
</div>
|
||||
<FormBuilder
|
||||
form={form}
|
||||
span={24}
|
||||
showActionButtons={false}
|
||||
onFinish={handleSubmit}
|
||||
options={[
|
||||
formSelectField(
|
||||
"certType",
|
||||
"证照类型",
|
||||
QUALIFICATION_INDUSTRY_OPTIONS,
|
||||
{
|
||||
rules: [{ required: true, message: "请选择证照类型" }],
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
),
|
||||
{
|
||||
name: "certName",
|
||||
label: "证书名称",
|
||||
rules: [{ required: true, message: "请输入证书名称" }],
|
||||
},
|
||||
{
|
||||
name: "certNo",
|
||||
label: "证明编号",
|
||||
rules: [{ required: true, message: "请输入证明编号" }],
|
||||
},
|
||||
{
|
||||
name: "issueOrg",
|
||||
label: "发证机关",
|
||||
rules: [{ required: true, message: "请输入发证机关" }],
|
||||
},
|
||||
{
|
||||
name: "issueDate",
|
||||
label: "发证日期",
|
||||
render: FORM_ITEM_RENDER_ENUM.DATE,
|
||||
rules: [{ required: true, message: "请选择发证日期" }],
|
||||
},
|
||||
{
|
||||
name: "validDate",
|
||||
label: "证书有效期",
|
||||
render: FORM_ITEM_RENDER_ENUM.DATE_RANGE,
|
||||
rules: [
|
||||
{ required: true, message: "请选择证书有效期" },
|
||||
dateRangeRule(),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "remark",
|
||||
label: "备注",
|
||||
required: false,
|
||||
render: FORM_ITEM_RENDER_ENUM.TEXTAREA,
|
||||
},
|
||||
{
|
||||
name: "certImgs",
|
||||
label: "证书图片",
|
||||
rules: [{ required: true, message: "请上传证书图片" }],
|
||||
render: <Upload maxCount={3} />,
|
||||
},
|
||||
]}
|
||||
labelCol={{ span: 8 }}
|
||||
/>
|
||||
<Form form={form} layout="horizontal" onFinish={handleSubmit} labelCol={{ span: 4 }}>
|
||||
<Form.Item
|
||||
name="licenseTypeName"
|
||||
label="证照类型"
|
||||
rules={[{ required: true, message: "请选择证照类型" }]}
|
||||
>
|
||||
<Select placeholder="请选择证照类型">
|
||||
{QUALIFICATION_INDUSTRY_OPTIONS.map((opt) => (
|
||||
<Select.Option key={opt.value} value={opt.label}>
|
||||
{opt.label}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="certName"
|
||||
label="证书名称"
|
||||
rules={[{ required: true, message: "请输入证书名称" }]}
|
||||
>
|
||||
<Input placeholder="请输入证书名称" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="certNo"
|
||||
label="证明编号"
|
||||
rules={[{ required: true, message: "请输入证明编号" }]}
|
||||
>
|
||||
<Input placeholder="请输入证明编号" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="issueOrg"
|
||||
label="发证机关"
|
||||
rules={[{ required: true, message: "请输入发证机关" }]}
|
||||
>
|
||||
<Input placeholder="请输入发证机关" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="issueDate"
|
||||
label="发证日期"
|
||||
rules={[{ required: true, message: "请选择发证日期" }]}
|
||||
>
|
||||
<DatePicker style={{ width: "100%" }} placeholder="请选择发证日期" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="validDate"
|
||||
label="证书有效期"
|
||||
rules={[
|
||||
{ required: true, message: "请选择证书有效期" },
|
||||
dateRangeRule(),
|
||||
]}
|
||||
>
|
||||
<RangePicker style={{ width: "100%" }} />
|
||||
</Form.Item>
|
||||
<Form.Item name="remark" label="备注">
|
||||
<TextArea rows={3} placeholder="请输入备注" />
|
||||
</Form.Item>
|
||||
<AttachmentUpload name="certImageUrl" label="证书图片" maxCount={3} />
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
|
@ -461,7 +429,6 @@ function CertFormModal({
|
|||
function CertViewModal({ open, currentId, requestDetails, onCancel }) {
|
||||
const [info, setInfo] = useState({});
|
||||
const [detailLoading, setDetailLoading] = useState(false);
|
||||
const { getFile } = useGetFile();
|
||||
|
||||
useEffect(() => {
|
||||
if (!open || !currentId) {
|
||||
|
|
@ -472,34 +439,16 @@ function CertViewModal({ open, currentId, requestDetails, onCancel }) {
|
|||
(async () => {
|
||||
setDetailLoading(true);
|
||||
try {
|
||||
const res = await safeRequest(requestDetails, { id: currentId });
|
||||
if (cancelled || !res?.data) {
|
||||
return;
|
||||
}
|
||||
const data = { ...res.data };
|
||||
data.certImgs = data.certImgFiles || [];
|
||||
setInfo(data);
|
||||
setDetailLoading(false);
|
||||
|
||||
const files = await safeGetFiles(
|
||||
getFile,
|
||||
{ eqType: "org_cert", eqForeignKey: data.id },
|
||||
data.certImgFiles || [],
|
||||
);
|
||||
if (!cancelled && files.length) {
|
||||
setInfo((prev) => ({ ...prev, certImgs: files }));
|
||||
}
|
||||
const res = await requestDetails({ id: currentId });
|
||||
if (cancelled || !res?.data) return;
|
||||
setInfo({ ...res.data, certImageUrlList: parseCertImageUrl(res.data.certImageUrl) });
|
||||
} catch (err) {
|
||||
console.warn("[QualificationCert] load view failed:", err);
|
||||
} finally {
|
||||
if (!cancelled) {
|
||||
setDetailLoading(false);
|
||||
}
|
||||
if (!cancelled) setDetailLoading(false);
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
return () => { cancelled = true; };
|
||||
}, [open, currentId]);
|
||||
|
||||
return (
|
||||
|
|
@ -515,7 +464,7 @@ function CertViewModal({ open, currentId, requestDetails, onCancel }) {
|
|||
onCancel={onCancel}
|
||||
>
|
||||
<Descriptions bordered column={1} labelStyle={{ width: 160 }}>
|
||||
<Descriptions.Item label="证照类型">{info.certType}</Descriptions.Item>
|
||||
<Descriptions.Item label="证照类型">{info.licenseTypeName}</Descriptions.Item>
|
||||
<Descriptions.Item label="证书名称">{info.certName}</Descriptions.Item>
|
||||
<Descriptions.Item label="证明编号">{info.certNo}</Descriptions.Item>
|
||||
<Descriptions.Item label="发证机关">{info.issueOrg}</Descriptions.Item>
|
||||
|
|
@ -525,7 +474,22 @@ function CertViewModal({ open, currentId, requestDetails, onCancel }) {
|
|||
</Descriptions.Item>
|
||||
<Descriptions.Item label="备注">{info.remark || "-"}</Descriptions.Item>
|
||||
<Descriptions.Item label="证书图片">
|
||||
<CertPreviewImg files={info.certImgs} />
|
||||
{info.certImageUrlList?.length ? (
|
||||
<Image.PreviewGroup>
|
||||
{info.certImageUrlList.map((file, idx) => (
|
||||
<Image
|
||||
key={idx}
|
||||
src={file.url}
|
||||
alt="证书图片"
|
||||
width={100}
|
||||
height={100}
|
||||
style={{ objectFit: "cover", marginRight: 8 }}
|
||||
/>
|
||||
))}
|
||||
</Image.PreviewGroup>
|
||||
) : (
|
||||
<span>暂无图片</span>
|
||||
)}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</Modal>
|
||||
|
|
@ -535,4 +499,4 @@ function CertViewModal({ open, currentId, requestDetails, onCancel }) {
|
|||
export default Connect(
|
||||
[NS_ORG_QUALIFICATION_CERT],
|
||||
true,
|
||||
)(AntdTableFuncControl(QualificationCertPage));
|
||||
)(AntdTableFuncControl(QualificationCertPage));
|
||||
Loading…
Reference in New Issue