38 lines
1.6 KiB
JavaScript
38 lines
1.6 KiB
JavaScript
|
|
import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
|
||
|
|
import {
|
||
|
|
fromPageResponse,
|
||
|
|
fromSingleResponse,
|
||
|
|
fromStaffCertForm,
|
||
|
|
toPageQuery,
|
||
|
|
toStaffCertForm,
|
||
|
|
} from "../enterpriseInfo/adapter";
|
||
|
|
import { apiGet, apiPost, apiPostDelete, safeAction, safePageResult } from "../enterpriseInfo/http";
|
||
|
|
|
||
|
|
export const staffCertificateList = declareRequest("staffCertificateLoading", safePageResult(async (params) => {
|
||
|
|
const query = toPageQuery(params, {
|
||
|
|
eqStaffId: "personnelId",
|
||
|
|
likeCertNo: "certNo",
|
||
|
|
});
|
||
|
|
const res = await apiGet("/safety-eval/org-personnel-cert/page", query);
|
||
|
|
return fromPageResponse(res, toStaffCertForm);
|
||
|
|
}));
|
||
|
|
|
||
|
|
export const staffCertificateInfo = declareRequest("staffCertificateLoading", safeAction(async (params) => {
|
||
|
|
const res = await apiGet("/safety-eval/org-personnel-cert/get", { id: params.id });
|
||
|
|
return fromSingleResponse(res, toStaffCertForm);
|
||
|
|
}));
|
||
|
|
|
||
|
|
export const staffCertificateAdd = declareRequest("staffCertificateLoading", safeAction(async (values) => {
|
||
|
|
const res = await apiPost("/safety-eval/org-personnel-cert/save", fromStaffCertForm(values));
|
||
|
|
return fromSingleResponse(res, toStaffCertForm);
|
||
|
|
}));
|
||
|
|
|
||
|
|
export const staffCertificateEdit = declareRequest("staffCertificateLoading", safeAction(async (values) => {
|
||
|
|
const res = await apiPost("/safety-eval/org-personnel-cert/modify", fromStaffCertForm(values));
|
||
|
|
return fromSingleResponse(res, toStaffCertForm);
|
||
|
|
}));
|
||
|
|
|
||
|
|
export const staffCertificateRemove = declareRequest("staffCertificateLoading", safeAction(async ({ id }) => {
|
||
|
|
return apiPostDelete("/safety-eval/org-personnel-cert/delete", id);
|
||
|
|
}));
|