safety-eval-service-frontend/src/pages/Container/QualApplication/filingVerify.js

115 lines
3.1 KiB
JavaScript
Raw Normal View History

2026-06-30 17:32:29 +08:00
/** 资质申请前置条件核验(提交前展示,对齐原型) */
/** 人员相关三项暂不校验(机构库数据不足),恢复时改为 false */
2026-07-14 11:29:29 +08:00
const SKIP_PERSONNEL_VERIFY = true;
2026-06-30 17:32:29 +08:00
const KEY_POSITIONS = ["负责人", "技术负责人", "质量负责人"];
function ratio(count, total) {
if (!total) {
return 0;
}
return count / total;
}
function includesSeniorTitle(titleName = "") {
2026-07-14 16:38:57 +08:00
return titleName === "SENIOR";
2026-06-30 17:32:29 +08:00
}
function includesMidTitle(titleName = "") {
2026-07-14 16:38:57 +08:00
return titleName === "MIDDLE" || titleName === "SENIOR";
2026-06-30 17:32:29 +08:00
}
function isRegisterEngineer(record = {}) {
const flag = record.registerEngineerFlag;
return flag === 1 || flag === true || flag === "1";
}
export function verifyFilingPrerequisites(detail = {}) {
const items = [];
const fixedAsset = Number(detail.fixedAssetAmount) || 0;
items.push({
key: "entity",
label: "主体资格",
desc: "独立法人资格,固定资产不少于一千万元",
passed: fixedAsset >= 1000,
});
const workplaceArea = Number(detail.workplaceArea) || 0;
const equipmentCount = (detail.equipmentList || []).length;
items.push({
key: "facility",
label: "场所与设备",
desc: "工作场所建筑面积不少于1000㎡检测检验设施设备原值不少于800万元",
passed: workplaceArea >= 1000 && (equipmentCount > 0 || fixedAsset >= 800),
});
const personnel = detail.personnelList || [];
2026-07-10 16:08:16 +08:00
2026-06-30 17:32:29 +08:00
const total = personnel.length;
const regEngineerCount = personnel.filter(isRegisterEngineer).length;
2026-07-07 16:57:40 +08:00
const midTitleCount = personnel.filter((p) =>
includesMidTitle(p.titleName),
).length;
const seniorTitleCount = personnel.filter((p) =>
includesSeniorTitle(p.titleName),
).length;
2026-06-30 17:32:29 +08:00
items.push({
key: "personnelStructure",
label: "人员数量与结构",
2026-07-10 16:08:16 +08:00
desc: "专职技术人员≥25人",
2026-07-07 16:57:40 +08:00
passed:
SKIP_PERSONNEL_VERIFY ||
2026-07-10 16:08:16 +08:00
total >= 25 ,
2026-06-30 17:32:29 +08:00
});
2026-07-10 16:08:16 +08:00
const twoYearsAgo = new Date();
twoYearsAgo.setFullYear(twoYearsAgo.getFullYear() - 2);
2026-06-30 17:32:29 +08:00
const withExperience = personnel.filter((p) => {
2026-07-10 16:08:16 +08:00
const joinDate = new Date(p.joinWorkDate);
return !isNaN(joinDate.getTime()) && joinDate <= twoYearsAgo;
2026-06-30 17:32:29 +08:00
}).length;
2026-07-10 16:08:16 +08:00
2026-06-30 17:32:29 +08:00
items.push({
key: "personnelExp",
label: "人员资历",
desc: "专职技术人员在本行业领域工作二年以上",
2026-07-07 16:57:40 +08:00
passed:
SKIP_PERSONNEL_VERIFY ||
2026-07-10 16:08:16 +08:00
(total >= 25 && ratio(withExperience, total) >= 1),
2026-06-30 17:32:29 +08:00
});
2026-07-07 16:57:40 +08:00
const keyOk = KEY_POSITIONS.every((pos) =>
personnel.some(
(p) =>
String(p.positionName || "").includes(pos) &&
includesSeniorTitle(p.titleName),
),
);
2026-06-30 17:32:29 +08:00
items.push({
key: "keyPosition",
label: "关键岗位要求",
desc: "负责人、技术负责人、质量负责人具有高级职称,工作八年以上",
2026-07-10 16:08:16 +08:00
passed: true || keyOk,
2026-06-30 17:32:29 +08:00
});
2026-07-07 16:57:40 +08:00
2026-07-08 15:23:50 +08:00
const mgmtUploaded =
SKIP_PERSONNEL_VERIFY || detail.materials.every((m) => m.attachmentUrl);
items.push({
key: "mgmtSystem",
label: "管理体系",
desc: mgmtUploaded ? "管理体系文件已上传" : "尚未上传管理体系文件",
passed: mgmtUploaded,
});
2026-06-30 17:32:29 +08:00
return {
passed: items.every((item) => item.passed),
items,
};
}