2026-07-14 16:38:57 +08:00
|
|
|
import { fromPageResponse, toPageQuery } from "~/utils/enterpriseInfo/adapter";
|
2026-07-07 17:13:33 +08:00
|
|
|
import { apiGet } from "~/utils/enterpriseInfo/http";
|
|
|
|
|
import { asId } from "~/utils/enterpriseInfo/idUtil";
|
2026-06-30 17:32:29 +08:00
|
|
|
|
|
|
|
|
export async function fetchOrgPersonnelOptions() {
|
|
|
|
|
const query = toPageQuery({ current: 1, size: 500 }, { likeStaffName: "userName" });
|
2026-07-02 14:51:26 +08:00
|
|
|
const res = await apiGet("/safetyEval/org-personnel/page", query);
|
2026-07-14 16:38:57 +08:00
|
|
|
const page = fromPageResponse(res);
|
|
|
|
|
return (page?.data || []).map((data) => ({
|
|
|
|
|
label: data.userName,
|
|
|
|
|
value: String(data.id),
|
|
|
|
|
staffName: data.userName,
|
|
|
|
|
positionName: data.postName ?? data.positionName,
|
|
|
|
|
titleName: data.titleName,
|
|
|
|
|
personType: data.personTypeName ?? "基础人员",
|
|
|
|
|
registerEngineerFlag: data.registerEngineerFlag ?? 2,
|
|
|
|
|
workExperience: data.workExperience,
|
2026-06-30 17:32:29 +08:00
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function mapEquipRowToFilingEquipment(row = {}) {
|
|
|
|
|
const id = asId(row.id);
|
|
|
|
|
return {
|
|
|
|
|
id: `local-equip-${id}`,
|
|
|
|
|
sourceEquipmentId: id,
|
|
|
|
|
deviceName: row.deviceName,
|
|
|
|
|
deviceModel: row.deviceModel,
|
|
|
|
|
manufacturer: row.manufacturer,
|
|
|
|
|
calibrationReportUrl: row.calibrationReportUrl || "",
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function mergeDetailFromForms(detail, { basicValues, commitmentValues }) {
|
2026-07-01 17:57:42 +08:00
|
|
|
|
2026-06-30 17:32:29 +08:00
|
|
|
return {
|
|
|
|
|
...detail,
|
|
|
|
|
...basicValues,
|
2026-07-09 17:00:19 +08:00
|
|
|
attachmentUrl: Array.isArray(basicValues?.attachmentUrl) ? JSON.stringify(basicValues?.attachmentUrl) : basicValues?.attachmentUrl,
|
2026-06-30 17:32:29 +08:00
|
|
|
materials: detail.materials,
|
|
|
|
|
personnelList: detail.personnelList,
|
|
|
|
|
equipmentList: detail.equipmentList,
|
|
|
|
|
commitment: {
|
|
|
|
|
...detail.commitment,
|
|
|
|
|
...commitmentValues,
|
2026-07-09 17:00:19 +08:00
|
|
|
legalRepSignatureUrl: Array.isArray(commitmentValues?.legalRepSignatureUrl) ? commitmentValues?.legalRepSignatureUrl[0]?.url : commitmentValues?.legalRepSignatureUrl,
|
2026-06-30 17:32:29 +08:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|