Merge remote-tracking branch 'origin/dev' into dev
commit
0784830acb
|
|
@ -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();
|
||||
}, []);
|
||||
|
||||
|
|
@ -79,7 +95,7 @@ function QualificationCertPage(props) {
|
|||
okText: "是",
|
||||
cancelText: "否",
|
||||
onOk: async () => {
|
||||
const res = await props.orgQualificationCertRemove({ id });
|
||||
const res = await props.orgQualificationCertRemove({ data: id });
|
||||
if (res?.success !== false) {
|
||||
message.success("删除成功");
|
||||
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({ data: 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,21 +234,13 @@ 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>
|
||||
)}
|
||||
|
||||
</TableAction>
|
||||
),
|
||||
},
|
||||
]}
|
||||
dataSource={dataSource}
|
||||
scroll={{ y: props.scrollY }}
|
||||
scroll={{ y: props.scrollY , x: 1400}}
|
||||
loading={loading}
|
||||
pagination={{
|
||||
total,
|
||||
|
|
@ -301,56 +297,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 = 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 +334,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 = values.certImageUrl?.map((item) => item.url).join(",");
|
||||
if (currentId) values.id = currentId;
|
||||
const request = currentId ? requestEdit : requestAdd;
|
||||
const res = await request(values);
|
||||
if (res?.success !== false) {
|
||||
|
|
@ -394,66 +363,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" accept="image/*" label="证书图片" maxCount={3} />
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
|
@ -461,7 +427,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 +437,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 +462,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 +472,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>
|
||||
|
|
|
|||
|
|
@ -10,10 +10,9 @@ import {
|
|||
Select,
|
||||
Table,
|
||||
Tag,
|
||||
Upload,
|
||||
} from "antd";
|
||||
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
|
||||
import { UploadOutlined } from "@ant-design/icons";
|
||||
import AttachmentUpload from "~/components/AttachmentUpload";
|
||||
import { useEffect, useState } from "react";
|
||||
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
|
||||
import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm";
|
||||
|
|
@ -212,7 +211,6 @@ function ResignationApplyPage(props) {
|
|||
function AddModal({ open, staffOptions, requestAdd, onCancel, onSuccess }) {
|
||||
const [form] = Form.useForm();
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [uploading, setUploading] = useState(false);
|
||||
|
||||
const handleCancel = () => {
|
||||
form.resetFields();
|
||||
|
|
@ -228,6 +226,7 @@ function AddModal({ open, staffOptions, requestAdd, onCancel, onSuccess }) {
|
|||
values.expectedResignDate =
|
||||
values.expectedResignDate?.format?.("YYYY-MM-DD") ||
|
||||
values.expectedResignDate;
|
||||
values.reportFileUrl = values.reportFileUrl?.map?.((f) => f.url).filter(Boolean).join(",") || undefined;
|
||||
const res = await requestAdd(values);
|
||||
if (res?.success !== false) {
|
||||
message.success("提交成功");
|
||||
|
|
@ -290,35 +289,7 @@ function AddModal({ open, staffOptions, requestAdd, onCancel, onSuccess }) {
|
|||
<Form.Item name="remark" label="备注">
|
||||
<Input.TextArea rows={2} placeholder="请输入备注" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="reportFileUrl"
|
||||
label="离职通知报告"
|
||||
rules={[{ required: true, message: "请上传离职通知报告" }]}
|
||||
>
|
||||
<Upload
|
||||
action={`${window.process.env.app.API_HOST}/safetyEval/file/upload`}
|
||||
showUploadList={false}
|
||||
maxCount={1}
|
||||
accept=".pdf"
|
||||
onChange={(info) => {
|
||||
if (info.file.status === "uploading") {
|
||||
setUploading(true);
|
||||
} else {
|
||||
setUploading(false);
|
||||
if (info.file.status === "done") {
|
||||
const data = info.file.response?.data;
|
||||
if (data) {
|
||||
form.setFieldsValue({ reportFileUrl: data.url || data });
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Button loading={uploading} icon={<UploadOutlined />}>
|
||||
上传文件
|
||||
</Button>
|
||||
</Upload>
|
||||
</Form.Item>
|
||||
<AttachmentUpload name="reportFileUrl" label="离职通知报告" maxCount={1} accept=".pdf" />
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ function OrgPersonnelSelectModalInner(props) {
|
|||
onChange: (page, pageSize) => getData(page, pageSize),
|
||||
}}
|
||||
columns={[
|
||||
{ title: "人员姓名", dataIndex: "staffName" },
|
||||
{ title: "类型", dataIndex: "personType" },
|
||||
{ title: "人员姓名", dataIndex: "userName" },
|
||||
{ title: "类型", dataIndex: "personTypeName" },
|
||||
{ title: "职务", dataIndex: "positionName" },
|
||||
{ title: "职称", dataIndex: "titleName" },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ export default function PersonnelStep({
|
|||
const [viewId, setViewId] = useState("");
|
||||
|
||||
const existingIds = personnelList.map((item) => String(item.sourcePersonnelId || ""));
|
||||
console.log(personnelList);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -35,7 +36,7 @@ export default function PersonnelStep({
|
|||
dataSource={personnelList}
|
||||
columns={[
|
||||
{ title: "序号", width: 60, render: (_, __, index) => index + 1 },
|
||||
{ title: "人员姓名", dataIndex: "personName" },
|
||||
{ title: "人员姓名", dataIndex: "userName" },
|
||||
{ title: "类型", dataIndex: "personTypeName" },
|
||||
{ title: "职务", dataIndex: "positionName" },
|
||||
{ title: "职称", dataIndex: "titleName" },
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ function FilingFormPage(props) {
|
|||
const detailRef = useRef(null);
|
||||
const readOnly = query.readOnly;
|
||||
|
||||
|
||||
|
||||
const saveActionHint =
|
||||
mode === FILING_FORM_MODE.FILED
|
||||
? "请点击提交后保存"
|
||||
|
|
@ -138,7 +136,7 @@ function FilingFormPage(props) {
|
|||
setSubmitting(true);
|
||||
|
||||
const currentDetail = collectCurrentDetail();
|
||||
const word= mode === "change" ? "Change" : "";
|
||||
const word = mode === "change" ? "Change" : "";
|
||||
const body = {
|
||||
[`qualFiling${word}AddCmd`]: {
|
||||
...currentDetail,
|
||||
|
|
@ -165,9 +163,9 @@ function FilingFormPage(props) {
|
|||
delete params.commitment;
|
||||
}
|
||||
|
||||
let action=props.submitQualFiling;
|
||||
let action = props.submitQualFiling;
|
||||
if (mode === FILING_FORM_MODE.CHANGE) {
|
||||
action=props.submitQualFilingChange;
|
||||
action = props.submitQualFilingChange;
|
||||
}
|
||||
const result = await action(body);
|
||||
|
||||
|
|
@ -213,9 +211,7 @@ function FilingFormPage(props) {
|
|||
const rowMap = new Map((rows || []).map((row) => [String(row.id), row]));
|
||||
const newRows = idsToAdd.map((id) => {
|
||||
const row = rowMap.get(String(id));
|
||||
return row
|
||||
? mapStaffRowToFilingPersonnel(row)
|
||||
: mapStaffRowToFilingPersonnel({ id });
|
||||
return row;
|
||||
});
|
||||
setDetail((prev) => ({
|
||||
...prev,
|
||||
|
|
@ -227,7 +223,7 @@ function FilingFormPage(props) {
|
|||
const handlePersonnelRemove = (record) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: `确认删除人员「${record.personName}」?`,
|
||||
content: `确认删除人员「${record.userName}」?`,
|
||||
onOk: () => {
|
||||
setDetail((prev) => ({
|
||||
...prev,
|
||||
|
|
@ -354,7 +350,6 @@ function FilingFormPage(props) {
|
|||
title={MODE_TITLE[mode] || "资质备案表单"}
|
||||
history={props.history}
|
||||
previous
|
||||
|
||||
>
|
||||
<Spin spinning={loading || submitting}>
|
||||
<Tabs
|
||||
|
|
@ -372,43 +367,41 @@ function FilingFormPage(props) {
|
|||
}}
|
||||
/>
|
||||
|
||||
|
||||
<Space>
|
||||
{stepIndex > 0 && (
|
||||
<Button
|
||||
onClick={async () => {
|
||||
setActiveStep(STEP_ITEMS[stepIndex - 1].key);
|
||||
}}
|
||||
>
|
||||
上一步
|
||||
</Button>
|
||||
)}
|
||||
{!isLastStep && (
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={async () => {
|
||||
setActiveStep(STEP_ITEMS[stepIndex + 1].key);
|
||||
}}
|
||||
>
|
||||
下一步
|
||||
</Button>
|
||||
)}
|
||||
{!readOnly && isLastStep && (
|
||||
<>
|
||||
{mode !== FILING_FORM_MODE.FILED && (
|
||||
<Button
|
||||
onClick={() => handleVerifyConfirm({ isSaveDraft: true })}
|
||||
>
|
||||
暂存
|
||||
</Button>
|
||||
)}
|
||||
<Button type="primary" onClick={handleSubmitRequest}>
|
||||
{mode === FILING_FORM_MODE.FILED ? "提交填报" : "提交申请"}
|
||||
<Space>
|
||||
{stepIndex > 0 && (
|
||||
<Button
|
||||
onClick={async () => {
|
||||
setActiveStep(STEP_ITEMS[stepIndex - 1].key);
|
||||
}}
|
||||
>
|
||||
上一步
|
||||
</Button>
|
||||
)}
|
||||
{!isLastStep && (
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={async () => {
|
||||
setActiveStep(STEP_ITEMS[stepIndex + 1].key);
|
||||
}}
|
||||
>
|
||||
下一步
|
||||
</Button>
|
||||
)}
|
||||
{!readOnly && isLastStep && (
|
||||
<>
|
||||
{mode !== FILING_FORM_MODE.FILED && (
|
||||
<Button
|
||||
onClick={() => handleVerifyConfirm({ isSaveDraft: true })}
|
||||
>
|
||||
暂存
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</Space>
|
||||
|
||||
)}
|
||||
<Button type="primary" onClick={handleSubmitRequest}>
|
||||
{mode === FILING_FORM_MODE.FILED ? "提交填报" : "提交申请"}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</Space>
|
||||
</Spin>
|
||||
<PrerequisiteVerifyModal
|
||||
open={verifyOpen}
|
||||
|
|
|
|||
Loading…
Reference in New Issue