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

53 lines
1.5 KiB
JavaScript

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