隐患详情重新设计,检查计划重新设计成做题排查式

This commit is contained in:
王利强
2026-06-21 16:30:12 +08:00
parent 1fe87ec438
commit cc94d3e3e9
256 changed files with 12542 additions and 5956 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
import { buildAttachmentItem } from '@/utils/upload.js';
export const LEVEL_OPTIONS = [
{ id: 2, title: '一般隐患' },
{ id: 3, title: '重大隐患' }
];
export const SOURCE_OPTIONS = [
{ id: 1, title: '部门检查' },
{ id: 2, title: '督导检查' },
{ id: 3, title: '企业自查' },
{ id: 4, title: '行业互查' }
];
export const AI_LEVEL_MAP = {
轻微: 0,
轻微隐患: 0,
一般: 0,
一般隐患: 0,
重大: 1,
重大隐患: 1
};
export function createEmptyHazardPayload() {
return {
formData: {
title: '',
level: 0,
source: 0,
description: '',
tagIndex: 0,
tagId: null,
regulationId: null,
regulationName: ''
},
address: '',
lng: 0,
lat: 0,
areaId: '',
areaName: '',
fileList: []
};
}
export function buildHiddenDangerParams(payload, extra = {}) {
const { formData, address, lng, lat, areaId, fileList } = payload;
const selectedTag = payload.tagOptions?.[formData.tagIndex];
const tagId = formData.tagId ?? (selectedTag ? selectedTag.id : null);
return {
title: formData.title,
level: LEVEL_OPTIONS[formData.level]?.id || 2,
lng: lng || 0,
lat: lat || 0,
address: address || '',
areaId: areaId || null,
description: formData.description || '',
source: SOURCE_OPTIONS[formData.source]?.title || '',
tagId,
attachments: (fileList || [])
.filter((f) => f.status === 'success')
.map((file) => buildAttachmentItem(file)),
regulationId: formData.regulationId || null,
...extra
};
}
export function hasValidHazardPayload(payload) {
if (!payload) return false;
const { formData, fileList } = payload;
return !!(formData?.title && fileList?.length > 0);
}

View File

@@ -0,0 +1 @@
export * from './hazardForm.js';