safety-eval-service-frontend/src/api/staffCertificate/index.js

53 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-06-23 18:07:30 +08:00
import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
2026-07-07 09:07:19 +08:00
import { Get } from "@cqsjjb/jjb-common-lib/http";
2026-06-23 18:07:30 +08:00
2026-07-07 09:07:19 +08:00
export const staffCertificateList = declareRequest(
"staffCertificateLoading",
"Get > /safetyEval/org-personnel-cert/page",
"staffCertificateList: [] | res.data || [] & staffCertificateTotal: 0 | res.data?.total || 0",
);
2026-06-23 18:07:30 +08:00
2026-07-07 09:07:19 +08:00
export const staffCertificateInfo = declareRequest(
"staffCertificateLoading",
"Get > /safetyEval/org-personnel-cert/get",
"staffCertificateDetail: {} | res.data || {}",
);
2026-06-23 18:07:30 +08:00
2026-07-07 09:07:19 +08:00
export const staffCertificateAdd = declareRequest(
"staffCertificateLoading",
"Post > @/safetyEval/org-personnel-cert/save",
);
2026-06-23 18:07:30 +08:00
2026-07-07 09:07:19 +08:00
export const staffCertificateEdit = declareRequest(
"staffCertificateLoading",
"Post > @/safetyEval/org-personnel-cert/modify",
);
2026-06-23 18:07:30 +08:00
2026-07-07 09:07:19 +08:00
export const staffCertificateRemove = declareRequest(
"staffCertificateLoading",
"Post > @/safetyEval/org-personnel-cert/delete",
);
2026-06-26 17:28:06 +08:00
2026-07-07 09:07:19 +08:00
/** StaffViewModal 直接调用的辅助函数 — 获取人员下所有证书列表 */
2026-06-26 17:28:06 +08:00
export async function fetchStaffCertListByPersonnelId(personnelId) {
2026-07-07 09:07:19 +08:00
try {
const res = await Get("/safetyEval/org-personnel-cert/page", {
current: 1,
size: 999,
personnelId,
});
return res?.data || [];
} catch {
return [];
}
2026-06-26 17:28:06 +08:00
}
2026-07-07 09:07:19 +08:00
/** StaffViewModal 直接调用的辅助函数 — 获取证书详情 */
2026-06-26 17:28:06 +08:00
export async function fetchStaffCertDetail({ id }) {
2026-07-07 09:07:19 +08:00
try {
const res = await Get("/safetyEval/org-personnel-cert/get", { id });
return res?.data || null;
} catch {
return null;
}
}