feat: streamline occupancy check-in and imports
This commit is contained in:
@@ -16,7 +16,6 @@ export interface OccupancyImportRow {
|
||||
stayType?: string;
|
||||
emergencyContact?: string;
|
||||
emergencyPhone?: string;
|
||||
organization?: string;
|
||||
supervisor?: string;
|
||||
notes?: string;
|
||||
}
|
||||
@@ -37,7 +36,6 @@ export const OCCUPANCY_IMPORT_COLUMNS = [
|
||||
{ header: '入住类型', key: 'stayType', width: 10 },
|
||||
{ header: '紧急联系人', key: 'emergencyContact', width: 15 },
|
||||
{ header: '紧急联系人电话', key: 'emergencyPhone', width: 18 },
|
||||
{ header: '所属机构', key: 'organization', width: 18 },
|
||||
{ header: '负责人/班主任', key: 'supervisor', width: 15 },
|
||||
{ header: '备注', key: 'notes', width: 20 },
|
||||
] as const;
|
||||
@@ -58,7 +56,6 @@ const HEADER_ALIASES: Record<keyof OccupancyImportRow, string[]> = {
|
||||
stayType: ['入住类型', '住宿类型'],
|
||||
emergencyContact: ['紧急联系人'],
|
||||
emergencyPhone: ['紧急联系人电话', '紧急联系电话'],
|
||||
organization: ['所属机构', '机构'],
|
||||
supervisor: ['负责人/班主任', '负责人', '班主任'],
|
||||
notes: ['备注'],
|
||||
};
|
||||
@@ -137,7 +134,6 @@ export function parseOccupancyImportWorksheet(ws: ExcelJS.Worksheet): OccupancyI
|
||||
stayType: normalizeStayType(cellText(getCell(row, 'stayType'))),
|
||||
emergencyContact: cellText(getCell(row, 'emergencyContact')) || undefined,
|
||||
emergencyPhone: cellText(getCell(row, 'emergencyPhone')) || undefined,
|
||||
organization: cellText(getCell(row, 'organization')) || undefined,
|
||||
supervisor: cellText(getCell(row, 'supervisor')) || undefined,
|
||||
notes: cellText(getCell(row, 'notes')) || undefined,
|
||||
});
|
||||
@@ -152,7 +148,10 @@ export function createOccupancyImportTemplateWorkbook(): ExcelJS.Workbook {
|
||||
ws.getRow(1).font = { bold: true };
|
||||
ws.getRow(1).fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFE0E0E0' } };
|
||||
ws.views = [{ state: 'frozen', ySplit: 1 }];
|
||||
ws.autoFilter = { from: 'A1', to: 'R1' };
|
||||
ws.autoFilter = {
|
||||
from: 'A1',
|
||||
to: `${ws.getColumn(OCCUPANCY_IMPORT_COLUMNS.length).letter}1`,
|
||||
};
|
||||
|
||||
ws.addRow({
|
||||
roomNumber: '4-102',
|
||||
@@ -170,7 +169,6 @@ export function createOccupancyImportTemplateWorkbook(): ExcelJS.Workbook {
|
||||
stayType: '短租',
|
||||
emergencyContact: '张父',
|
||||
emergencyPhone: '13900000000',
|
||||
organization: '',
|
||||
supervisor: '',
|
||||
notes: '',
|
||||
});
|
||||
@@ -190,7 +188,6 @@ export function createOccupancyImportTemplateWorkbook(): ExcelJS.Workbook {
|
||||
stayType: '长租',
|
||||
emergencyContact: '',
|
||||
emergencyPhone: '',
|
||||
organization: 'XXX教育科技',
|
||||
supervisor: '王老师',
|
||||
notes: '示例数据,导入前请删除',
|
||||
});
|
||||
@@ -208,15 +205,16 @@ export function createOccupancyImportTemplateWorkbook(): ExcelJS.Workbook {
|
||||
helpWs.getColumn(1).width = 90;
|
||||
const instructions = [
|
||||
'【入住名单导入说明】',
|
||||
'1. 宿舍号、姓名、入住时间为必填项;床位号建议填写,柜子号可选。',
|
||||
'1. 宿舍号、姓名、手机号、入住时间为必填项;床位号建议填写,柜子号可选。',
|
||||
'2. 填写床位号或柜子号后,系统会在对应宿舍中匹配;不存在时自动创建,已被占用时该行导入失败。',
|
||||
'3. 宿舍不存在时会自动创建;宿舍号可智能解析楼栋、楼层和房间类型,楼栋列可用于补充楼栋名称。',
|
||||
'4. 同一宿舍号的连续多行可以合并或留空,系统会继承上一行宿舍号。',
|
||||
'5. 入住类型可填“短租”或“长租”;计费起始日不填时默认等于入住时间。',
|
||||
'6. 已存在的学生按姓名匹配,并自动补充其缺失的基础资料。',
|
||||
'6. 系统按手机号关联已有学生,入住记录的所属机构自动取学生档案;未找到时会新建学生。',
|
||||
'7. 已有在住记录的学生会自动跳过,不会重复入住。',
|
||||
'8. 填写离宿时间的记录会作为历史入住导入,床位和柜子不会被标记为占用。',
|
||||
'9. 模板中的两行示例数据仅用于说明,正式导入前请删除或替换。',
|
||||
'9. 押金不在表格中逐行填写;请在上传前使用页面上的“导入时自动收押金”和金额设置,历史入住不会自动收取,已有已缴押金不会重复创建。',
|
||||
'10. 模板中的两行示例数据仅用于说明,正式导入前请删除或替换。',
|
||||
];
|
||||
instructions.forEach((instruction) => helpWs.addRow([instruction]));
|
||||
helpWs.getRow(1).font = { bold: true, size: 14 };
|
||||
|
||||
Reference in New Issue
Block a user